MENTAL
 Main Menu
 Language
 Derivatives
 Repetition


Repetition
 REPETITION

"But what has once been said can always be repeated" (Zeno of Elea).

"Repetition in space is harmony" (Jorge Wagensberg).

"Repetition is the only form of permanence that nature can achieve" (George Santayana).

"Order is repetition of units, Chaos is multiplicity without rhythm" (M.C. Escher).



Finite open-ended repetition

Semantics

Repeat n times an expression x, where n is an integer greater than or equal to zero. The result is an open expression.
Syntax
Definition (recursive)

⟨( xn =: ( (θ ← (n = 0) →'
(x ← (n = 1) →' (x (x☆(n−1))↓))↓ ) )⟩



Justification

Repetition is a simplified way of specifying an expression that is repeated a certain number of times.


Examples
  1. a☆4 // rep. a a a a a a a a a

  2. ( a☆4 ) // rep. ( a a a a a a a ) ev. aaaa

  3. (ab)☆3 // rep. ab ab ab ab

  4. abc☆0 // ev. θ

  5. α☆3 // rep. α α α

  6. (ab↓)☆3 // rep. a b a b a b a b a b

  7. a☆(-3) // self-evaluates

  8. a☆(3.5) // self-evaluate

  9. 3☆xxx // self-evaluates

Remarks
Properties
  1. ⟨( ( (x☆0) = θ )⟩ // by definition.

  2. ⟨( (xn)☆mx☆(n+m) )⟩

    Example: (ab☆2)☆3 // rep. ab ab ab ab ab ab ab ab ab ab ab ab ab eq. ab☆6

  3. ⟨(( (xn xm)↓ = x☆(n+m) )⟩

    Example: (ab☆2 ab☆3) // rep. (ab ab ab ab ab ab ab ab) eq. ( ab☆5 )

  4. ⟨( θ☆n = θ )⟩ // by the definition

  5. ⟨( ({x☆n} = {x}) )⟩

    Example: {ab☆4} // rep. {ab ab ab ab} ev. {ab}

  6. ⟨( ( ( ( xn )# = n )⟩ // by the definition of repeat and length

Infinite open repetition

Semantics

Repeat indefinitely to the left or to the right. The result is an open descriptive expression.


Syntax

x☆ // infinite repetition to the right.

☆x // infinite repeat left



Definition (recursive)

⟨( x☆ =: (x x x☆)↓ )⟩ // infinite repeat to the right.

⟨( ☆x =: (☆x x x)↓ )↓ )⟩ // infinite repeat to the left



Examples
  1. ab☆ // rep. ab ab ab ab ...

  2. ( ab☆ ) // rep. ( ab ab ab ab ... )

  3. ( 1☆ ) // rep. 111111...

  4. ☆123 // rep. ... 123 123 123 123

  5. sentence☆
    Equivalent to repeating statement infinitely many times. This has application in specifying potentially infinite loops, which terminate when a certain condition is met.

Properties
  1. ⟨( ( ( ( x☆ )# = ∞ )⟩ // by definition of infinite repetition and length.

  2. ⟨( ( ( ☆x )# = ∞ )⟩ // id.

Closed repetition

For practical reasons, we further define the repetition that produces a sequence, finite or infinite:


Syntax
Definition
Examples

a★4 // rep. ( a a a a a a ) ev. aaaa
a★ // rep. ( a a a a a a ... )