MENTAL
 Main Menu
 Language
 Expressions
 Virtual Expressions


Virtual Expressions
 VIRTUAL
EXPRESSIONS

"Science may place limits on knowledge, but it should not place limits on the imagination" (Bertrand Russell).

"Our minds, or our consciousness, appear at the border between the real and the imaginal" (Fred Alan Wolf).



Concept of Virtual Expression

Definition

A virtual expression is an expression that refers to other already existing expressions (called base expressions) and automatically changes when the base expressions change.


Remarks
Examples of non-parameterized virtual expressions.
  1. Transposed matrix

    We have the following matrix (sequence of sequences of the same length):

    ( x = ((a b c) (d e f)) ) // matrix of 2 rows and 3 columns

    This expression is equivalent to:

    ( (x1 = a) (x2 = b) (x3 = c)
    (x\2\1 = d) (x\2\2 = e) (x\2\3 = f) )


    We want to obtain the xt view of x below, which corresponds to the transposed matrix of x:

    ( xt = ((a d) (b e) (c f)) ) // matrix of 3 rows and 2 columns

    The transposed matrix is:

    ⟨( xt = ((x\1\1 x\2\1) (x\1\2 x\2\2) (x\1\3 x\2\3)) )⟩

    xt // ev. ((a b) (b e) (c f))


    This expression is generic, so it is valid at all times, so that if, for example, we make a change in x, then we automatically have the new value of xt:

    (x/1 = (1 2 3))
    x // ev. (( 1 2 3) (d e f) )
    xt // ev. ((1 d) (2 e) (3 f)) )


  2. Union of two sets

    We have the following two sets:

      (u = {a b c})
      (v = {d e f})

    We want the expression union to correspond at all times to the union of both sets, regardless of their values. This is simply achieved by the generic expression.

      ⟨( union = {u↓ v↓} )⟩

    Initially,
    union // ev. {a b c d e f}

    If we make the change

      (u = {1 2 3})

    then we automatically have the new value of union:

    union // ev. {1 2 3 d e f} )

  3. Selection of elements of a sequence

    We have the following numerical sequence:

    (s = (45 34 6 12 85 23 72 51})

    We want sel1 to be, at all times, the sequence with the elements of s less than or equal to 50 and sel2 those greater than this amount.

      ⟨( sel1 = x⇓(≤50) )⟩
      ⟨( sel2 = x⇓(>50) )⟩

    Initially,

    sel1 // ev. (45 34 6 12 23)
    sel2 // ev. (85 72 51)


    If we make the change (s\6 = 99), then we automatically have the new values of sel1 and sel2:

    sel1 // ev. (45 34 6 12).
    sel2 // ev. (85 72 51 99).

Examples of parameterized virtual expressions
  1. Transposed matrix of any x matrix:

    In general, transposed matrix of x:

    ⟨( t(x) = ((nf = x#) // number of rows of x.
    (nc = (x#)#) // number of columns of x
    (v = ( ( ( 0★nf)★nc ))
    v/&⟨( v = x )) )⟩ ¡v )⟩


    ( x = (abc def) )
    t(x) // ev. (ad be cf)


  2. Union of any two sets x and y:

    ⟨( union(x y) = {xy↓} )⟩ // general definition

    ( u = {a b c} )
    ( v = {d e f} )
    union(u v) // ev. {a b c d e f}


    ⟨( unionuv = union(u v) )⟩ // definition for two specific sets.
    ( u = {1 2 3} ) // modification of set u
    unionuv // ev. {1 2 3 d e f} (new union of u and v).


  3. Selection, respectively, of elements less than or equal to and greater than n in any sequence s:

    ⟨( sel1(s n) = (s⇓(≤n) )⟩
    ⟨( sel2(s n) = (s⇓(>n) )⟩

    (s = (45 34 6 12 85 23 72 51})


    ⟨( s1 = sel1(s 50) )⟩
    ⟨( s2 = sel2(s 50) )⟩
    s1 // ev. (45 34 6 12 23}
    s2 // ev. (85 72 51)

    (s/6 = 99) // change s
    s1 // ev. (45 34 6 12} // s1 switches automatically
    s2 // ev. (85 99 99 72 52} // s2 automatically changes

Other Types of Virtual Expressions

Higher order virtual expressions

Virtual expressions can be defined from virtual expressions, parameterized or not.

Examples:
  1. In the example of the union of two sets, the sum of the elements is defined from the union:

    ⟨( union(x y) = {xy↓} )⟩
    ⟨( sum(x y) = +⊣( (union(x y))↓ )↓ ) )⟩


    (u = {1 2 3})
    (v = {11 12 13})
    union(u v) // ev. {1 2 3 11 12 13}
    sum(u v)) // ev. 42

    ⟨( suv = sum(union(u v)) )⟩
    suv // ev. 42
    (u = {−1 −2 −3}) // we shift u
    suv // ev. 30 // new value of the sum


  2. In the example of selecting elements of a sequence, elements of selected elements are selected.

    ⟨( sel1(x n) = (x⇓(≤n) )⟩ // order 1 selection.

    ⟨( sel2(x n) = (sel1(x n))⇓(>n) )⟩ // order selection 2


    ( s = (45 34 6 12 85 23 72 51} )

    Less than or equal to 50:
    sel1(s 50) // ev. (45 34 6 12 23}

    And greater than 30:
    sel2(sel1(s 50) 30) // ev. (45 34}

Dynamic virtual expressions

These are virtual expressions that are modified during the execution process. Example:

⟨( sel(x n) = x⇓(≤n) )⟩ // initial definition
(s = (45 34 6 12 85 23 72 51})
sel(s 50) // ev. (45 34 6 12 12 23}
⟨( sel(x n) = x⇓(≥n)+1) )⟩ // selection is redefined.
sel(s 50) // ev. (85 72 51}


The comparison operator could also have been parameterized.