MENTAL
 Main Menu
 Language
 Primitives
 Substitution (Actual and Potential)


Substitution (Actual and Potential)
 SUBSTITUTION
(Actual and Potential)

"The method by which mathematics obtains its equations is the method of substitution" (Wittgenstein, Tractatus 6.24).

"We call any reality that substitutes for, imitates, or reflects another reality a representation" (Wittgenstein).

"To name is to have individuality" (Nikolai Luzin).



Current Substitution

Semantics

Replace an expression x by the expression y, so that, from this point on, the occurrences of < code>x are automatically replaced by y, i.e., x is evaluated as y.


Syntax

(x = y) // replace x with y


Justification

Substitution is the way to specify the change or modification of expressions over time.


Examples
  1. (x = "abc")
    (u x x x v) // ev. (u "abc" "abc" v)

  2. (x = 5)
    (x = x+1) // ev. x=6

  3. ("ab" = "abcd")
    (u "ab" "ab" "ab" v) // ev. (u "abcd" "abcd" v)

  4. (33 = table)
    (1 2 33) // ev. (1 2 table)

  5. (3 = table)
    33 // ev. (table table)

  6. (u = ⟨(x and x+y)⟩)
    (u u+1) // ev. (⟨(x and x+y)⟩ ⟨(x and x+y)⟩+1)

  7. ( ⟨(x and x+y)⟩ = 6 )
    ⟨(x and x+y)⟩*2 // ev. 12

  8. (x+y = 12)
    (a x+y b x+y) // ev. (a 12 b 12)

Remarks
Hierarchical substitutions

Substitution specifications can be hierarchical, that is, left and right expressions can themselves be substitution specifications. Examples:
  1. (x = (y = 7)) // on the right-hand side
    (1 x 2) // ev. (1 y=7 2)

  2. ((x = 5) = 3) // on the left side
    (x=5 x=5 3) // ev. (3 3 3)

  3. ((x = 3) = (y = 7)) // on both sides
    (x=3 1 2 3) // ev. (y=7 1 2 3)

Restoring an expression

To restore an expression to its self-evaluation state, to which a substitution has been previously defined by (x = y), it can be done by (x° = x°). Example:

(x = 33) // define substitution
x // x evaluates to 33
(x° = x°) // restore the self-evaluation of x
x // x self-evaluates


Imaginary expressions

When the left expression of a substitution specification is a compound expression, we have imaginary expressions. The most paradigmatic example is the imaginary unit i, defined as (i^2 = −1). Another example is the definition of infinitesimal (ε^2 = 0). [see MENTAL Language - Expressions - Imaginary Expressions]. Examples:
  1. (i^2 = −1)
    (i^2 23) // ev. (−1 23)

  2. (ε*ε = 0)
    (ε^2 13) // ev. (0 13)

  3. (x+y+z = a*b)
    (x+y+z 1 2 3) // ev. (a*b 1 2 3)

Relative substitution

Is an x=y substitution specification that applies exclusively to a z expression. Its form is z/(x=y).

If the substitution can be applied, the substitution expression disappears (the substitution expression is said to "resolve"). If it cannot be applied, the substitution expression self-evaluates and remains in the result. Examples:
  1. (u = (x y x z))
    u/(x = ab) // ev. (ab y ab z)

  2. (u = (x b y))
    u/(x=ab)/(b=4) // ev. (ab b y)/(b=4) ev. (a4 4 y)
    In this case two relative substitutions are applied in succession.

  3. (u = (x b y))
    u/((x=ab) (b=4)) // ev. (a4 4 y)
    This example is equivalent to the previous one.

  4. (u = (x b y))
    u/((b=4) (x=ab)) // ev. (ab b y)
    This is the same case as above, but applying the substitutions in reverse order. The result is different.

  5. (u = (x y))
    u/(z=2) // ev. (x y)/(z=2)
    In this case substitution cannot be applied.

  6. (u = (x y))
    u/(x=1 z=2) // ev. (1 y)/(z=2)
    In this case the first substitution is solved, but not the second.

  7. (u = (x b y))
    u/{x=ab b=4} // ev. (ab 4 y)
    In this case the two substitutions are applied simultaneously.

Expression elimination

The expression (x = θ) specific replace x by the null expression, i.e., eliminate x. Elimination is thus a particular case of substitution. Examples:
  1. (u = (x y x x z))
    (x = θ)
    u // ev. (θ y θ z) ev. yz

  2. (u = (x y x x z))
    (x=θ y=θ)
    u // ev. z

  3. (u = (x and z))
    u/(v=θ) // ev. (x and z)/(v=θ)

Types of expressions and substitution

The expression (x = α) is useful for example to define types of expressions. For example, if we have the concrete sequence

z=(x a x)

and we make x=α, then z evaluates to (α a α), i.e., z is then a type of expression: a sequence of three components whose second component is a.


Axioms
  1. ⟨(x = x)⟩

    Unless otherwise indicated (by a substitution specification), every expression is self-evaluating, i.e., it substitutes itself.

  2. ⟨( (x = y) → (y = z) → (x = z) )⟩ // transitivity

    Example:

    ((a = b) (b = c)) // implies (a = c)
    a // ev. c
    b // ev. c
    c // ev. c (self-evaluates)

  3. ⟨( x/(u=v)/(v=w) ≡ x/(< b>u=v v=w) ≡ x/(u=w) )⟩

Terminal and non-terminal expressions

An expression is terminal if no substitution expression has been defined for it, or it is defined but the right-hand side of the substitution expression is equal to the left-hand side.

An expression is non-terminal if a substitution expression exists for it and the right expression is different from the left.

To find out if an expression x is terminal or not, just compare x with and see if they are the same:

("x is a terminal expression" ← (x° = x) →' "x is a non-terminal expression.")

Example:

(a = 1) // a is non-terminal, 1 is terminal (self-evaluates)

(b° = b°) // b is terminal
(c = 3*4) // c is non-terminal, 3 and 4 are terminal (self-evaluating)


Variables

A particular case of substitution specification is when the left expression is a name.

This case corresponds to that of variables in traditional programming languages, but here the generic substitution operation is interpreted as "naming" an expression (the one on the right-hand side of the substitution expression) and not as "assigning" a value to a memory location represented by the name.

This is the so-called "nominal interpretation". The operation "naming" is a mechanism that allows us, in a convenient way, to refer to something that can be simple or complex. The name is a kind of key that allows us to access or a fragment of information. It is a psychological mechanism widely used because of the economy of specification it implies.

In a dynamic environment, the same name may refer at a certain point in time to one expression and later to a different expression.


Generic substitution expressions

Generic substitution expressions can be parameterized or not.

Examples of non-parameterized generic substitution expressions:
  1. ⟨(x = a*b)⟩
    (a = 2)
    (b = 3)
    x // ev. 6
    (b = 4)
    x // ev. 8

  2. ⟨(a+b = c)⟩
    (c = 6)
    (1 a+b 2) // ev. (1 6 2)
    (c = 7)
    (1 a+b 2) // ev. (1 7 2)
Examples of generic parameterized substitution expressions:
  1. ⟨(f(x y) = x+y)⟩
    f(3 4) // ev. 7

  2. ⟨((x a) = b)⟩
    (u a) // ev. b
    (v a) // ev. b

Potential Substitution

Semantics

Potential substitution is a type of substitution that has the following characteristics:
Syntax

(x =: y) // x represents y


Justification

The potential substitution is justified because there are situations where an immediate evaluation of x is not desirable, such as:
Examples
  1. (a =: b)
    a // is self-evaluating, but represents b

    b // ev. a (b evaluates as its representative: a)

  2. (a+a =: 3+3) // ev. (2*a =: 6)
    (2*a + 5) // ev. 11

  3. (a =: 1+2+3+4) // ev. (a =: 10)
    a // a is self-evaluating, but represents 10

  4. (a = b)
    (a =: u) // ev. (b =: u)
    b // rep. u

  5. (x =: a+b) // x represents a+b
    (a=3 b=2)
    a+b // ev. 5
    x // self-evaluates, but represents a+b = 3+2 = 5
    (a=6 b=8)
    x // is self-evaluating, and still represents a+b = 6+8 = 14

  6. (a=3 b=2)
    (x =: a+b) // x represents a+b = 3+2 = 5
    x // is self-evaluating, but represents 5

  7. ((a =: b) (b =: c))
    a // self-evaluates
    b // ev. a
    c // ev. a

  8. (x+y+z =: a)
    a // ev. x+y+z

  9. (∞ =: ∞+1) // definition of the infinite numberable (recursive expression)

  10. (a =: (1 8 9 56 43)
    a // self-evaluates
    (a\3 a\5) //ev. (9 43)
Examples combining the two types of substitutions:
  1. ((a =: b) (b = c))
    a // ev. a
    b // ev. c
    c // ev. c

  2. ((a = b) (b =: c))
    a // ev. b
    b // ev. b but represents c
    c // ev. b

  3. (tres = 3) // tres evaluates to 3
    (three three three three) // ev. 333
    tres*11 // ev. 33
    (tres =: 3) // tres represents 3
    (three three) // self evaluates and represents 33

Remarks
Axioms
  1. ⟨(x =: x)⟩

    Unless otherwise indicated (by a substitution specification), every expression represents itself.

  2. ⟨(x =: y)→(x =: y)→(x =: z)⟩ // transitivity

Initial Substitution

Semantics

An initial substitution is a substitution specification that appears when initially loading code into abstract space, but whose expression disappears at code evaluation time. It specifies an initial value of an expression. It applies to both types of substitutions (actual and potential).


Syntax

(x := y) // initial current substitution

(x :=: y) // initial potential substitution


Examples of initial substitutions
  1. (Φ := 1.618033988)
    (area ratio)

  2. (N := ( 0... ))
    (sequence of natural numbers: (0 1 2 3 4 ...))

  3. (∞ :=: ∞+1)
    (definition of numerable infinity by a recursive expression)

Equality and inequality

It is possible to ask whether an expression x is equal to another y if the condition of x=y is satisfied, i.e. if x is replaced by y.

z←(x=y) (here x=y is not a substitution, but a condition of equality).

The expression (x =' y) or (xy) can be used as a condition. It is defined as follows:

⟨( (z ← (x =' y)) =: (z ←' (x = y))) )⟩

For example,

(a ←(x =' y)) represents (a ←' (x = y))

These two forms of condition also apply to potential substitution.

The expression (x ≠ y) can also be used as a description. For example,

(a ≠ b) (it is established that a is different from b)