m-multiple context-free grammars
The Pumping Lemma for Well-Nested Multiple Context-Free Languages
N=
!N
Seki et al. 1991
(r )
G = (N, !,P,S)
r !m
S !N (1) B(t1,…, tr ) :! B1(x1,1,…, x1,r ),…,Bn (x n,1,…, x n,r ).
ranked alphabet head
subgoal ( ri )
1
n
subgoal
• B !N ,B !N • t …t !(" # X ) • Each x occurs at most once in t …t (r )
i
Makoto Kanazawa National Institute of Informatics Tokyo, Japan
1
$
r
1
i,j
r
# !L(G ) = { w !" "P ! S(w ) } 1
3
X is the set of variables appearing in the right-hand side. Use logic programming terminology.
Multiple context-free grammars am
S
A am
bn
cm
An infinite hierarchy
dn
m
B b
cm
n
d
3 2 1
n
yield = tuple of strings
MCFL = ! m-MCFL m!1
CFL
derivation tree
S(x1y1x 2 y 2 ) :! A(x1, x 2 ),B(y1, y 2 ). A(" , " ). A(ax1,cx 2 ) :! A(x1, x 2 ).
B(! , ! ). B(by1,dy 2 ) :" B(y1, y 2 ).
n n !{ a1 …a2m+1"n ! 0 } "(m +1)-MCFL # m-MCFL 2
MCFGs have the same kind of derivation tree as CFGs, but the object produced by a derivation tree is a tuple of strings, rather than a string. A nonterminal is like a predicate on strings. A rule is a Horn clause.
4
MCFGs were introduced in the context of comp. ling., but natural. Each level of the hierarchy is equivalently defined by various other formalisms, e.g., HR and yT_{fc}(REG). Containment in LOGCFL, Parikh image semilinear.
Difficulty with pumping
The pumping lemma for MCFL
•
z = u0 v1 u1 v2 u2 . . . uk−1 vk uk v1 v2 . . . vk "= !
u0 v1i u1 v2i u2 . . . uk−1 vki uk ∈ L
(v1 x1 v2 , v3 x2 v4 )
2-MCFG:
A string z!L is k-pumpable in L if
even pump
A
for every i ≥ 0
A
• Theorem (Seki et al. 1991). If L is an infinite m-MCFL,
(x1 , x2 ) (v1 v1 x1 v2 v2 , v3 v3 x2 v4 v4 )
then there is a string z!L that is 2m-pumpable.
• Myth (Radzinski 1991, Groenink 1997, Kracht 2003). If L is
“pump”
an m-MCFL, all but finitely many strings z!L are 2mpumpable.
All but finitely many derivation trees contain a pump.
“universal pumping lemma” Chinese number names (Radzinski) crossed dependencies + coordination (Groenink)
(x1 , x2 ) 5
Seki et al.’s result is existential. The Myth was appealed to in their attempts to show that these constructions go beyond the power of MCFGs. Michaelis & Kracht (1997) showed the set of Chinese number names is not semilinear.
“pump” Call such a pump an “even” pump because the components of an input tuple are evenly
7
distributed among the components of the output tuple. Not all pumps are even.
Pumping
Difficulty with pumping v1 xv2
CFG:
2-MCFG:
A
A
A
(v1 x1 v2 x2 v3 , v4 )
uneven pump
A
x
(x1 , x2 ) (v1 v1 x1 v2 x2 v3 v2 v4 v3 , v4 )
v1 v1 xv2 v2
“pump”
“pump”
All but finitely many derivation trees contain a pump.
All but finitely many derivation trees contain a pump. x
“pump” Let’s see why it’s not easy to prove the pumping lemma for MCFL.
(x1 , x2 ) 6
“pump”
8
Example
Well-nested MCFGs
π1 : S(x1 x2 ) :− A(x1 , x2 ). π2 : A(ax1 bx2 c, d) :− A(x1 , x2 ). π3 : A(", "). ¬4-pumpable
2-pumpable
S(!) π1
S(abcd) π1
S(aabcbdcd) π1
S(aaabcbdcbdcd) π1
A(!, !) π3
A(abc, d) π2
A(aabcbdc, d) π2
A(aaabcbdcbdc, d) π2
A(!, !) π3
A(abc, d) π2
A(aabcbdc, d) π2
A(!, !) π3
A(abc, d) π2
a
i−1
i−1
abc(bdc)
d
A(!, !) π3
!
S(x1y1x 2 y 2 ) :! A(x1, x 2 ),B(y1, y 2 ).
!
S(x1y1y 2 x 2 ) :! A(x1, x 2 ),B(y1, y 2 ).
!
C(x1y1, y 2 z1, z2 x 2 z3 ) :! A(x1, x 2 ),B(y1, y 2 ),C(z1, z2 , z3 ).
!
C(z1x1, x 2 z2 , y1y 2 z3 ) :! A(x1, x 2 ),B(y1, y 2 ),C(z1, z2 , z3 ). Cf. Kuhlmann 2007
¬(All but finitely many derivation trees contain an even pump) 9
11
A concrete example of a grammar that gives rise to uneven pumps. It almost seems as if aabcbdcd is 2-pumpable by accident.
Well-nested MCFGs
The universal pumping lemma
•
An MCFG rule B(t1 , . . . , tr ) :− B1 (x1,1 , . . . , x1,r1 ), . . . , Bn (xn,1 , . . . , xn,rn ).
is well-nested iff for every i, i’, j, j’, k, k’ (i!i’), it holds that
• remains open for m-MCFGs • holds for the subclass consisting of well-
t1 . . . tr !∈ (Σ ∪ X)∗ xi,j (Σ ∪ X)∗ xi % ,j % (Σ ∪ X)∗ xi,k (Σ ∪ X ∗ )xi % ,k % (Σ ∪ X)∗
•
nested m-MCFGs
The well-nested (m-)MCFGs are the same as coupledcontext-free grammars (Hotz & Pitsch 1995) (of rank m).
10
12
Coupled-context-free grammars take a top-down view of rules as rewriting instructions.
Well-nested vs. general MCFGs
•
•
MCFL vs. MCFLwn
Universal recognition problem (Kaji et al. 1992, Satta 1992, Hotz & Pitsch 1995) m-MCFGwn
P-complete
m-MCFG
NP-complete (m"2)
Theorem (new). Well-nested (m-)MCFGs are equivalent to non-duplicating macro grammars (Fischer 1968) (of rank m!1).
•
Theorem (Seki and Kato 2008). For all m"2, m-MCFLwn!m-MCFL.
•
Theorem (Staudacher 1993, Michaelis 2005). MCFLwn!MCFL. { w1 …w n zn w n zn!1 …z1w1z0w1R …w nR" !
n "!,w i "{a,b} + , zn …z0 "D[,]* } "MCFL ! MCFL wn Dyck language over [,]
13
15
There’s just one example in the literature that purportedly shows the inclusion to be strict.
The pumping lemma for m-MCFGwn
m-MCFL vs. m-MCFLwn
If G is a w.n. m-MCFG (m!2), { T | T is a derivation tree of G without even pumps }
Weir 1989 RESP = { a1i a2i b1j b2j a3i a4i b3j b4j"i, j ! 0 } 2 ! RESP2 !2-MCFL " 2-MCFL wn Seki et al. 1991
may not be finite. But there is a w.n. (m-1)-MCFG generating
i i j j RESP = { a1i a2i b1j b2j …a2m!1 a2m b2m!1 b2m "i, j " 0 } m ! RESPm !m-MCFL " m-MCFL wn for m # 2
{ yield(T) | T is a derivation tree of G without even m-pumps }. (v1 x1 v2 , . . . , v2m−1 xm v2m )
Seki and Kato 2008
even m-pump
RESPm !2m-MCFL wn (x1 , . . . , xm ) 14
16
If the derivation tree contains an even m-pump, the string is 2m-pumpable. Otherwise, the string is in the language of some w.n. (m-1)-MCFG, and therefore is 2(m-1)pumpable. Proof by induction on m.
The pumping lemma for PDA
Proof of the theorem
stack height
w.n. m-MCFG with no even m-pumps |Q|
2
q1
q2
q1
u0
no m-proper rules
q2
v1
u1
v2
u3
total m-degree = 0
time
¬(All but finitely many accepting computations reach 2 stack height |Q| )
w.n. (m!1)-MCFG
{ w | w has an accepting computation that doesn’t 2 reach stack height |Q| } is regular. 17
19
The proof generalizes to linear indexed grammars (CL_2) and to CL_k.
m-proper rules
Proof of the pumping lemma
• Lemma.
Let G be a w.n. m-MCFG, and let D be the set of derivation trees of G without even m-pumps. There is a w.n. m-MCFG G’ without even m-pumps that generates { yield(T) | T ! D }.
π : B(t1 , . . . , tr ) :− B1 (x1,1 , . . . , x1,r1 ), . . . , Bn (xn,1 , . . . , xn,rn ). π is m-proper on the i-th subgoal if
ri = r = m, tj ∈ (Σ ∪ X)∗ xi,j (Σ ∪ X)∗
nonterminal relabeling
for j = 1, . . . , m.
Any even m-pump has the form (v1 x1 v2 , . . . , v2m−1 xm v2m )
D π1
derivation trees of G’
derivation trees of G
.. .
• Lemma. Any w.n. m-MCFG G without even m-pumps has
π1 , . . . , πk m-proper
πk
an equivalent w.n. (m!1)-MCFG.
(x1 , . . . , xm ) 18
h is extended to h: T_P -> T_P’. G’ is well-nested if G is. Implies yield(T) = yield(h(T))
20
Elimination of m-proper rules Lemma. Any (w.n.) m-MCFG without even m-pumps has an equivalent (w.n.) m-MCFG that has no mproper rules. π1 : π2 : π3 : π4 :
S(x1 x2 ) :− B(x1 , x2 ). B(ax1 b, cx2 d) :− A(x1 , x2 ). A(ax1 bx2 c, d) :− A(x1 , x2 ). A(", ").
w.n. m-MCFG with no even m-pumps unfolding
no m-proper rules
m-proper rule
total m-degree = 0
unfolding π1 : π2 ◦ π3 : π2 ◦ π4 : π3 : π4 :
S(x1 x2 ) :− B(x1 , x2 ). B(aax1 bx2 c1 b, cdd) :− A(x1 , x2 ). B(ab, cd). A(ax1 bx2 c, d) :− A(x1 , x2 ). A(", ").
w.n. (m!1)-MCFG
21
Unfolding
23
Reduction of m-degrees π : B(t1 , . . . , tr ) :− B1 (x1,1 , . . . , x1,r1 ), . . . , Bn (xn,1 , . . . , xn,rn ).
π : B(t1 , . . . , tr ) :− C(y1 , . . . , ys ), Γ π " : C(u1 , . . . , us ) :− ∆
The m-degree of π =
!
unfolding at the first subgoal
"
π ◦1 π : B(t1 , . . . , tr )[yi : = ui ] :− ∆, Γ π : B(t1 , . . . , tr ) :− B1 (x1,1 , . . . , x1,r1 ), . . . , Bn (xn,1 , . . . , xn,rn ). Lemma.
P ! = (P − {π}) ∪ { π ◦i π ! | the head nonterminal of π ! is Bi } is equivalent to P.
0 |{ i | ri = m }|
if r != m, if r = m.
Lemma. If π : B(t1 , . . . , tm ) :− C(y1 , . . . , ym ), Γ is well-nested and not m-proper, then π can be replaced with ! ) :− D(z1 , . . . , zp ), Γ1 π1 : B(t1! , . . . , tm π2 : D(u1 , . . . , up ) :− C(y1 , . . . , ym ), Γ2 where D is a new nonterminal of arity p<m and Γ = Γ1 , Γ2 , m-degree(" ) < m-degree(") m-degree(" ) = 0 π = π1 ◦1 π2 . 1
2
22
The operation of unfolding is familiar from logic programming.
24
Reduction of m-degrees
Elimination of nonterminals of arity m
π : B(x1,1 y1 x2,1 , x2,2 y2 ay3 b, cx1,2 d) :− C(y1 , y2 , y3 ), A1 (x1,1 , x1,2 ), A2 (x2,1 , x2,2 ). π : B(t1 , . . . , tr ) :− C(y1 , . . . , ym ), Γ. π " : C(u1 , . . . , um ) :− ∆.
π1 : B(x1,1 z1 , z2 b, cx1,2 d) :− D(z1 , z2 ), A1 (x1,1 , x1,2 ). π2 : D(y1 x2,1 , x2,2 y2 ay3 ) :− C(y1 , y2 , y3 ), A2 (x2,1 , x2,2 ).
π ◦1 π " : B(t1 , . . . , tr )[yi := ui ] :− ∆, Γ.
π : B(x1,1 ax1,2 y1 x2,1 , bx2,2 c, y2 y3 dx1,2 ) :− C(y1 , y2 , y3 ), A1 (x1,1 , x1,2 ), A2 (x2,1 , x2,2 ). π1 : B(z1 x2,1 , bx2,2 c, z2 ) :− D(z1 , z2 ), A2 (x2,1 , x2,2 ). π2 : D(x1,1 ax1,2 y1 , y2 y3 dx1,2 ) :− C(y1 , y2 , y3 ), A1 (x1,1 , x1,2 ). 25
The 3-degree of # is 1.
27
$ contains no arity-m nonterminal.
D has arity < 3 because # is not 3-proper. The converse of unfolding. Well-nestedness is crucial here.
w.n. m-MCFG with no even m-pumps
w.n. m-MCFG with no even m-pumps
unfolding
unfolding
no m-proper rules
no m-proper rules unfolding!1
unfolding!1
total m-degree = 0
total m-degree = 0 unfolding
w.n. (m!1)-MCFG
w.n. (m!1)-MCFG
26
28
Conclusion
• Theorem.
If L is a well-nested m-MCFL, all but finitely many z!L are 2m-pumpable.
z = u0 v1 u1 v2 u2 . . . u2m−1 v2m u2m v1 v2 . . . vk "= !
i u0 v1i u1 v2i u2 . . . u2m−1 v2m u2m ∈ L
for every i ≥ 0
29
Conclusion
• Theorem.
If L is a 2-MCFL, all but finitely many z!L are
4-pumpable.
• Open question.
Does every m-MCFG without even mpumps have an equivalent (m!1)-MCFG?
30