Lindenmayer system

Definition

Lindenmayer systems, or L-systems for short, are a variant of general rewriting systems. Like a rewriting system, an L-system is also a languagegenerator, where words are generated by applications of finite numbers of rewriting steps to some initial word given in advance. However, unlike a rewriting system, rewriting occurs inparallel in an L-system. The notion of L-system was introduced by plant biologist Aristid Lindenmayer when he was studying the growth development of red algae.

P is a finite subset of Σ×Σ* such that for every a∈Σ, there is at least one u∈Σ* such that (a,u)∈P.

w is called the start word, or the axiom of G, and elements of P are called productions of the L-system G, and are written a→u instead of (a,u).

As stated above, an L-system is a language generator, where words are generated from the axiom w by repeated applications of productions of P. Let us see how this is done. Define a binary relation⇒ on Σ* as follows: for words u,v∈Σ*,

Then L⁢(G) is called the language generated by the L-system G. An L-language is L⁢(G) for some L-system G.

Examples

1.

Let G=({a},{a→a2},a). In two derivations, we get a⇒a2⇒a2⁢a2=a4. It is easy to see that after n derivations, we get a⇒*a2n, and that L⁢(G)={a2n∣n≥1}. Note that if parallel rewriting is not required then a3 may be derived in three steps: a⇒a2⇒(a2)⁢a=a3.

2.

Let G=({a},{a→a,a→a2},a). Then L⁢(G)={a}+.

3.

Let G=({a},{a→λ,a→a2},a). Then L⁢(G)={a2⁢n∣n≥0}∪{a}.

4.

Let G=({a,b},{a→ab,b→ba},a). Then we get a sequence of words a⇒a⁢b⇒a⁢b⁢b⁢a⇒a⁢b⁢b⁢a⁢b⁢a⁢a⁢b⇒⋯, and L⁢(G) is the set containing words in the sequence. Note the recursive nature of the sequence: if un is the nth word in the sequence, then u1=a and un+1=un⁢h⁢(un), where h is the homomorphism given by h⁢(a)=b and h⁢(b)=a.

5.

L-systems can be used to generate graphs. Usually, symbols in Σ represent instructions on how to construct the graph. For example,

G=({a,b,c},{a→a,b→b,c→cacbbcac},c)

generates the famous Koch curve. If u∈L⁢(G) is derived from c in n steps, then u represents the n-th iteration of the Koch curve. To draw the n-th iteration based on u, we do the following:

(a)

write u=d1⁢⋯⁢dm, where di∈Σ (it is easy to see that m=2n-1).

(b)

at each di, a current position zi, and current direction θi, are given.

if di=c, draw a line segment of unit length from zi-1 to a point P based on θi-1, and set zi=P and θi=θi-1.

A production b→u is said to correspond to a∈Σ if b=a. Both productions in Example 2 correspond to a. A production is said to be a constant production if it has the form a→a. A symbol in Σ is called a constant if the only corresponding production is the constant production. In the last example above, a,b are both constants. a is not a constant in Example 2, even though it has a corresponding constant production.

Properties

Given an L-system G=(Σ,P,w), we can associate a functionfG:Σ→2Σ* as follows: for each a∈Σ, set

fG⁢(a):={u∣a→u∈P}.

Then fG extends to a substitutionsG:Σ*→2Σ*. It is easy to see that sG⁢(w) is just the set of words derivable from w in one step: sG⁢(w)={u∣w⇒u}. In fact,

If an L-system G=(Σ,P,w) contains a constant production for each symbol in Σ, then L⁢(G) is context-free.

3.

Denote the families of regular, context-free, context-sensitive, and L-languages by ℛ,ℱ,𝒮,ℒ, and set 𝒳1=ℛ, 𝒳2=ℱ-ℛ, and 𝒳2=𝒮-ℱ. Then ℒ∩𝒳i and ℒ¯∩𝒳i are non-empty for i=1,2,3. Here, ℒ¯ is the complement of ℒ in 2Σ*, the family of all languages over Σ.

Subsystems

An L-system is said to be deterministic if every symbol in Σ has at most one (hence exactly one) production corresponding to it. A deterministic L-system is also called a DL-system. Examples 1,4,5 above are DL-systems. For a DL-system, the associated substitution is a homomorphism, which means that for each n≥0, the set sGn⁢(w) is a singleton, so we get a unique sequence of words w0,w1,…, such that wn⇒wn+1. If |wn|<|wn+1| for some n, then the word sequence is infinite. In particular, if wn is a prefix of wn+1 for all large enough n, and the lengths of the words have the property that |wn|=|wn+1| implies |wm|<|wm+1| for some m>n, then the DL-system defines a unique infinite word (by taking the union of all finite words). In Example 4 above, the infinite word we obtain is the famous Thue-Morse sequence (an infinite word is an infinite sequence).

An L-system is said to be propagating if no productions are of the form a→λ. A propagating L-system is also called a PL-system. All examples above, except 3, are propagating. A DPL-system is a deterministic propagating L-system. In a DPL-system, the lengths of the words in the corresponding sequence are non-decreasing, and one may classify DPL-systems by how fast these lengths grow.

Variations

There are also ways one can extend the generative capacity of an L-system by generalizing some or all of the criteria defining an L-system. Below are some:

1.

Create a partition of Σ=N∪T, the set N of non-terminals and the set T of terminals, so that only terminal words are allowed in L⁢(G). Such a system is called an EL-system. Formally, an EL-system is a 4-tuple

H=(N,T,P,w)

such that GH=(N∪T,P,w) is an L-system, and L⁢(H)=L⁢(GH)∩T*.

2.

Notice that the productions in an L-system are context-free in the sense that during a rewriting step, the rewriting of a symbol does not depend on the “context” of the symbol (its neighboring symbols). This is the reason why an L-system is also known as a 0L-system. We can generalize an 0L-system by permitting context-sensitivity in the productions. If the rewriting of a symbol depends both on its left and right neighboring symbols, the resulting system is called a 2L-system. On the other hand, a 1L-system is a system such that dependency is one-sided.

Formally, a 2L-system is a quadruple

(Σ,P,w,⊔).

Both Σ and w are defined as in an L-system. ⊔ is a symbol not in Σ, denoting a blank space. P is a subset of Σ1×Σ×Σ1×Σ*, where Σ1=Σ∪{⊔}, such that for every (a,b,c)∈Σ1×Σ×Σ1, there is a u∈Σ* such that (a,b,c,u)∈P. Elements of P are called productions, and are written a⁢b⁢c→u instead of (a,b,c,u). Rewriting works as follows: the binary relation ⇒ on Σ* called a rewriting step, is given by u⇒v iff either u=v, or u=a1⁢⋯⁢an and v=v1⁢⋯⁢vn, such that

(a)

⊔a1⁢a2→v1,

(b)

ai-1⁢ai⁢ai+1→vi where i=2,⋯,n-1, and

(c)

an-1⁢an⊔→vn.

If n=2, then productions of the second form above do not apply. If n=1, then ⊔a1⊔→v1 are the only productions.

A 1L-system is then a 2L-system such that either, a⁢b⁢c→u for some c∈Σ1 implies a⁢b⁢d→u for all d∈Σ1, or c⁢a⁢b→u for some c∈Σ1 implies d⁢a⁢b→u for all d∈Σ1.

It is easy to see that an L-system is a 2L-system such that if a⁢b⁢c→u for some a,c∈Σ1, then d⁢b⁢e→u for all d,e∈Σ1.

3.

Allow the possibility that not all of the symbols may be rewritten. This means that u⇒v iff either u=v, or u=a1⁢⋯⁢an and v=v1⁢⋯⁢vn, and either ai=vi or ai→vi∈P.

4.

Allow more than one axiom. In other words, the single axiom word w is replaced by a set W of axioms.