"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
x# // length of x
Definition
〈( x# = (0 ←' x\1 → (1 + (x '∪ x/b>\1)#))) )〉
The definition is recursive:
If the first component does not exist (which happens with an open expression), the length of the expression is zero.
Otherwise, the result is one plus the length of the same expression without the first element.
Justification
The length of an expression is a very frequent operation, so it is useful to have it previously defined.
Examples
a# // ev. 1 (an atom is a sequence of length 1)
{a b c}# // ev. 3
(a b c)# // ev. 3
(a+b+c)# // ev. 5
(123)# // ev. 3
123# // ev. 3
( 123 )# # // ev. 1
(−123)# // ev. 2
( 1…10 )# // ev. 10
(x/y)# // ev. 3
(a (b c)) // ev. 2
(x=3)# // ev. 3
(a b c)# // ev. 0 (expression is open)
Conceptual recursion
The expression (x#)# is the length of the length of x. Examples:
(x = (a b c))
x# // ev. 3
(x#)# // ev. 1 (the length of 3)
((x#)#)# // ev. 1 (length of 1)
(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
()# = 0) // empty sequence length is zero
{}# = 0) // empty set length is zero
(θ# = #) // length cannot be applied to null expression