MENTAL
 Main Menu
 Language
 Derivatives
 Length


Length
 LENGTH

"In abstract space there are only two dimensions: length and depth" (the author).



Semantics

The length (or breadth) of an expression x is equal to its number of components, where x is a sequence or a set. If the expression is open, the length is zero.


Syntax
Definition

⟨( x# = (0 ←' x\1 → (1 + (x '∪ x/b>\1)#))) )⟩

The definition is recursive:
Justification

The length of an expression is a very frequent operation, so it is useful to have it previously defined.


Examples
Conceptual recursion

The expression (x#)# is the length of the length of x. Examples:
  1. (x = (a b c))
    x# // ev. 3
    (x#)# // ev. 1 (the length of 3)
    ((x#)#)# // ev. 1 (length of 1)


  2. (x = ( 1…10 ))
    x# // ev. 10
    (x#)# // ev. 2 (the length of 10)
    ((x#)#)# // ev. 1 (length of 2)
It would not really be necessary to specify nested parentheses because there is implicit left-hand associativity: x### eq. ((x#)#)#


Properties
  1. ()# = 0) // empty sequence length is zero

  2. {}# = 0) // empty set length is zero

  3. (θ# = #) // length cannot be applied to null expression

  4. ((α°)# = 1) // length refers to symbol

  5. ((Ω°)# = 1) // length refers to symbol

  6. ⟨( (x= x) ← (x# = 1) )⟩ // length expression 1 (atom)