56 Regular Grammars and Regular Expressions
Symbols of K are mainly used to distinguish places where the substitution
must take place, and they are usually not relevant. For instance, if t is a tree
on the alphabet F ∪ {2} and L be a language of trees on the alphabet F, then
the trees of t{2 ← L} don’t contain the symbol 2.
The substitution operation generalizes to languages in a straightforward way.
When L, L
1
, . . . , L
n
are languages of T (F ∪ K) and 2
1
, . . . , 2
n
are elements of
K, we define L{2
1
← L
1
, . . . , 2
n
← L
n
} to be the set
S
t∈L
{ t{2
1
← L
1
, . . . , 2
n
←
L
n
}}.
Now, we can define the concatenation op er ation for tree languages. Given L
and M two languages of T
F∪K
, and 2 be an element of K, the concatenation
of M to L through 2, denoted by L .
2
M, is the set of trees obtained by
substituting the occurrence of 2 in trees of L by trees of M , i.e. L .
2
M =
S
t∈L
{t{2←M }}.
To define the closure of a language, we must define the sequence of successive
iterations. Given L a language of T (F ∪K) and 2 an element of K, the s equence
L
n,2
is defined by the equalities.
• L
0, 2
= {2}
• L
n+1, 2
= L
n, 2
∪ L .
2
L
n, 2
The closure L
∗,2
of L is the union of all L
n, 2
for non-negative n, i.e., L
∗,2
=
∪
n≥0
L
n,2
. From the definition, one gets that {2} ⊆ L
∗,2
for any L.
Example 2.2.2. Let F = {0, nil, s(), cons(, )}, let L = {0, cons(0, 2)} and
M = {nil, cons(s(0), 2)}, then
L .
2
M = {0, cons(0, nil), cons(0, cons(s(0), 2))}
L
∗,2
= {2}∪
{0, cons(0, 2)}∪
{0, cons(0, 2), cons(0, cons(0, 2))} ∪ . . .
We prove now that the substitution and concatenation operations yield reg-
ular languages when they are applied to regular languages.
Proposition 2.2.3. Let L be a regular tree language on F ∪K, let L
1
, . . . , L
n
be
regular tree languages on F ∪ K, let 2
1
, . . . , 2
n
∈ K, then L{2
1
←L
1
, . . . , 2
n
←
L
n
} is a regular tree language.
Proof. Since L is regular, there exists some normalized regular tree grammar
G = (S, N, F ∪ K, R) such that L = L(G), and for each i = 1, . . . , n there
exists a normalized grammar G
i
= (S
i
, N
i
, F ∪ K, R
i
) such that L
i
= L(G
i
).
We can assume that the sets of non-terminals are pairwise disjoint. The idea
of the proof is to construct a grammar G
′
which starts by generating trees like
G but replaces the generation of a symbol 2
i
by the generation of a tree of
L
i
via a branching towards the axiom of G
i
. More precisely, we show that
L{2
1
←L
1
, . . . , 2
n
←L
n
} = L(G
′
) where G
′
= (S, N
′
, F ∪ K, R
′
) such that
• N
′
= N ∪ N
1
∪ . . . ∪ N
n
,
• R
′
contains the rules of R
i
and the rules of R but the rules A → 2
i
which
are replaced by the rules A → S
i
, where S
i
is the axiom of L
i
.
TATA — November 18, 2008 —