DISTRIBUTION
(Normal and Linear)

"Substituting ideas for calculations" (Dirichlet).

"A synthesis is worth ten analyses" (Eugenio d'Ors).

"We only think in signs" (Jacques Derrida).



Normal Distribution in Context

Semantics

The distribution of an open expression within the context or scope of another expression y represents the expression formed by n expressions equal to y, where in the order i has been replaced by xi.


Syntax Bold square brackets indicate the context or scope of the distribution. I indicates the left scope of the expression and D the right scope. I and D may not exist (be null expressions).

A distribution requires two pairs of nested square brackets. The inner ones delimit the expression to be distributed. The outer ones delimit the scope of the distribution.


Informal definition

[I [x1 x2 ... xn] D] =: I x1 D I x2 D ... I xn D

The definition of the distribution is done informally, although illustratively. It is not done formally, because if it could be done, then the operation would be derivative, not primitive.


Justification

The distribution is a descriptive mechanism for simplifying the specification of a series of expressions that have a common part.


Examples
  1. ([(u [a b c] v)]) // rep. ((u a v) (u b v) (u b v) (u c v)) eq. (uav ubv ucv)

  2. ([x+[a b]] y) // rep. (x+a x+b y)

  3. ([(x+[a b] y)]) // rep. ((x+a y) (x+b y))

  4. (x=([(u [a b] v)])) // rep. (x=(((u a v) (u b v))) eq. (x=(uav ubv))

  5. ([x=(u [a b] v)]) // rep. (x=(u a v) x=(u b v))

  6. {[[a b c]+1]} // rep. {a+1 b+1 c+1}

  7. (x = {[[a b c]1]}) // rep. (x = {a1 b1 c1})

  8. ([ab[u v w]]) // rep. (abu abv abw)

  9. ([x/[a b c] ]) // rep. (x/a x/b x/c)

  10. ([x=[1 2 3] ]) // rep. (x=1 x=2 x=3)

  11. ([x>[a b c ]) // rep. (x>a x>b x>c)

  12. ([[x and z]! ]) // rep. (x! y! z!)

  13. ([[x and z]←a]) // rep. (x←a y←a z←a)

  14. ([a+[3 5 7]]) // rep. (a+3 a+5 a+7)

  15. ([a (b [c d]) e]) // rep. (a (a (b c) e a (b d) e)

  16. (x° = [a b c]°) // ev. x=[a b c]
    ([u x v]) // rep. (u a v u b v u c v)


  17. The For-Next loop of the Basic language

    For i = n1 To n2
    x
    Next


    can be expressed as follows:
    ([(i=[n1…n2] x)])

Axioms
  1. When the expression to be distributed has only one component, it is evaluated as the same expression without the two pairs of square brackets.

    ⟨( ([x [y] z]) = (x y z)) ← (y# = 1) )⟩

    ⟨( ([[x]]) = x) ← (x# = 1) )⟩


    Note that the potential substitution has been changed to immediate substitution.

    Examples:

    ([1 2 3 [abc]]) // ev. (1 2 3 abc)

    ([[abc] 1 2 3]) // ev. (abc 2 3 4)

    ([1 2 [abc] 3 4]) // ev. (1 2 abc 3 4)

    ([[abc]]) // ev. abc


  2. When there is no left scope and no right scope, there is no distribution.

    ⟨( [[x]] = x )⟩

    Examples:

    [[abc]] // ev. abc
    ([[a b]]) // ev. (a b)


  3. Empty distribution: [].

    ([] = θ)
    ⟨( ([x [] y]) = (x y) )⟩


    Example:
    ([1 [] 2]) // ev. (1 2)

Common scope distributions

When two distributive expressions share the same scope, you have a common scope distribution. If we have x=(x1 x2 ... xn)↓ and y=(y1 y2 ... yn)↓, an informal definition would be:

[I [x] C [y] D] =: [I x1 C [y] D] ... [I xn C [y] D]

I indicates the left scope of the expression of the two expressions to be distributed, D the right scope and C the central scope between the two expressions. I, C and D may not exist (be null expressions).

Since the evaluation is from left to right, first x is distributed, and on the result y is distributed. The second expression is the most rapidly varying.

This definition is generalizable for any number of expressions to be distributed with a common scope.

Examples:
  1. ([[x y] [a b] ]) // rep. (x a x x b y a y b)

  2. ([[1 2]*[4 5]]) // rep. (1*4 1*5 2*4 2*4 2*5) ev. (4 5 8 10)

  3. (u = [1 2])
    (v = [2 3])
    ([(a+u)*(b+v)]) // rep. ((a+1)*(b+2)*(a+1)*(b+3)*(a+2)*(b+2)*(a+2)*(b+3))

Higher order distributions

A distribution can, in turn, be distributed. In the following example, deferred evaluation has been used to illustrate this mechanism:

(x = [a [b c] d]°) // ev. x=[a [b c] d]

(y = [1 [x 2 x] 3]) // rep. (y = [1 [[a [b c] d] 2 [a [b c] d]] 3])



Linear Distribution in Context

Semantics

The linear distribution of two open expressions inside another open expression (I x C y D)↓ is equal to n open expressions equal to the latter, where in the order expression < code>i has been replaced x by xi and y by yi. I indicates the left scope of the expression of the two expressions to be distributed, D the right scope and C the scope between the two expressions. I, C and D may not exist (be null expressions).


Syntax

[I ⌊x1 x2 ... xn⌋ C ⌊y1 y2 ... yn⌋ D]


Informal definition

[I ⌊x⌋ C ⌊y⌋ D] =: I x1 C y1 D ... I xn C yn D


Justification

The linear distribution is a descriptive mechanism that also makes it possible to simplify the specification of a series of expressions that have a common part.


Remarks
Examples
  1. [(⌊a b⌋ ⌊1 2⌋)]) // rep. ((a 1) (b 2))

  2. ([(⌊a b⌋ x ⌊1 2⌋)]) // rep. ((a x 1) (b x 2))

  3. ([(⌊x and z⌋ = ⌊1 2 3⌋)]) // rep. ((x = 1) (y = 2) (z = 3))

  4. ([(⌊x y⌋ + ⌊a b⌋ + z)]) // rep. ((x+a+z) (y+b+z))

  5. (x = ⌊a b c⌋)
    ([x x]) // rep. (a a a b b c c) eq. aabbcc


  6. (x = ⌊a b c⌋

    (y= [xx])) // rep. (y = aa bb cc)

    (z = [yy]) // rep. (z = aaaa bbbb cccc)


  7. ([a ⌊1 2⌋ b ⌊4 5 6⌋ c]) // rep. (a 1 b 4 a 2 b 5 a b 6)

  8. ([(⌊a b⌋ ⌊c d⌋ ⌊u v⌋ ⌊w x⌋]) // rep. (a c b d u w a c b d u x a c b d v w a c b d v x) eq. acbduwacbduxacbdvwacbdvx

Axioms
  1. When the expression to be distributed has only one component, it is evaluated as the same expression without the two pairs of square brackets.

    ⟨( ([x ⌊y] z]) = (x y z)) ← (y# = 1) )⟩

    ⟨( ([x⌋]) = x) ← (x# = 1) )⟩


    Note that the potential substitution has been changed to immediate substitution.

    Examples:

    ([1 2 3 ⌊abc⌋]) // ev. (1 2 3 abc)

    ([⌊abc⌋ 1 2 3]) // ev. (abc 2 3 4)

    ([1 2 [abc] 3 4]) // ev. (1 2 abc 3 4)

    ([[abc]]) // ev. abc


  2. Empty linear distribution: ⌊⌋.

    (⌊⌋ = θ)
    ⟨( ([x ⌊⌋ y]) = (x y) )⟩


    Example:
    ([1 ⌊⌋ 2]) // ev. (1 2)

Local Distribution

Semantics

Local distribution is an operation in which there is no explicit scope, but implicit scope. The implicit scope is delimited by blanks or parentheses. The local distribution can be normal or linear.


Examples
  1. a[u v w] // rep. au av aw

  2. [u v w]b // rep. ub vb wb

  3. a[u v w]b // rep. aub avb awb
  4. ( a[u v w]b ) // rep. (aub avb awb)

  5. a[1...10] // rep. a1 a2 ... a10

  6. a[1...n] // rep. a1 a2 ... an

  7. {a[u v w]} // rep. {au av aw]

  8. a [u v w] b // self-evaluates

  9. [a b]+[a b] // ev. 2*[a b]

  10. (⌊a b⌋+⌊u v⌋) // rep. (a+u b+v)

  11. (⌊3 4⌋*⌊a b⌋) // rep. (3*a 4*b)

  12. a [u v w] b // self-evaluates