MENTAL
 Main Menu
 Language
 Primitives
 Execution (Start and End)


Execution (Start and End)
 EXECUTION
(Start and End)

"Activity is the essence of substance in general" (Leibniz).

"Reality is a totality of active meaning" (David Bohm).

"Reality is a process constructed by events, not by substances" (Alfred North Whitehead).



Semantics

Execution of an expression is a type of result-oriented evaluation. If the expression to be executed is constructive, the execution of an expression x is the same as the normal evaluation (which has no explicit operator), but combined with the opposite operation ("end of execution"), you have two additional possibilities:
  1. The evaluation process of x can be interrupted (for example, when a certain condition occurs).

  2. An expression is assigned as a result of the evaluation process of x. If not specified, it assumes the evaluation of the expression x.
If the expression to be executed is descriptive, its evaluation is forced, if possible, that is, if the result is finite. If it is not finite, the descriptive expression is kept.


Syntax
Justification

Execution applies to algorithms and to processes in general, tending to obtain a result.


Examples with constructive expressions
  1. Gets the largest number of the components of a numerical sequence s.

    ⟨( major(s) = ( ( r = s/b>)
    [ i=[1…s#]
    ((s\i > r) → (r = s\i)) ]
    ¡r )! )⟩

    major(−1 7 12 5) // ev. 12
    major(123) // ev. 3 (sequence of 3 components)
    greater( 123 ) // ev. 123 (sequence of one component)
    major(2.5 7.2 6.1) // ev. 7.2


  2. Sum of the natural numbers until it is as close (equal to or less than) a certain number n.

    ⟨( sum(n) = ( k=0
    [ m=[1...]
    (k = k+m)
    ( k>n → ¡(k−m)) ] ) )⟩

    (sum(25))! // ev. 21 (1+2+3+4+5+6)


    In this case, the start of execution symbol is placed in the call.

  3. (a=3 b=4 ¡(a+b))! // ev. 12

  4. ⟨( f(x y) = (¡(x+y) ←' x>y → ¡(x+y))) )! )⟩

    f(3 4) // ev. 7
    f(4 3) // ev. 12


    In this case, the symbols relating to execution would not be necessary, since there is only one condition. Therefore, this function is equivalent to

    ⟨( f(x/b> y) = ((x+y) ←' x>y → (x+y)) ) )⟩

  5. ⟨( (minimo(n1 n2) = ((m=n1n1n2) →' m=n2)) ¡m))! )⟩

    This function is equivalent to:

    ⟨( (min(n1 n2) = (n1n1n2) →' n2) )⟩

Examples with descriptive expressions
  1. ( 1...4 )! // ev. ( 1 2 3 4)

  2. (a=3 b=4)
    (x =: a+b)
    x // rep. a+b
    x! // ev. 7


  3. ( 1... )! // is self-evaluating because the expression is infinite: (1 2 3 4 ...)

  4. (ab★4)! // ev. ( ab ab ab ab ab )

  5. (ab★)! // it is self-evaluating because the expression is infinite: (ab ab ab ab ...)

  6. ([a [u v] b])! // ev. (a u b a v b)

Remarks

Axioms
  1. ⟨( (x/b>¡)! = x )⟩

  2. ⟨( (x°)! = x )⟩

  3. ⟨( (x¡ ← z →' &y)! = (xz →' y) )⟩

  4. (¡! = θ )

  5. ⟨( (x° = x) → (x! = x) )⟩
    If x is self-evaluating, then the expression x! is equal to x