• No se han encontrado resultados

Segunda parte: el lugar y el no-lugar

obsolescencia y despoblamiento de la ciudad

2.2. Segunda parte: el lugar y el no-lugar

Theorem 10.4.1 The following problem is undecidable: given two context-free gram- marsGi= (Ni, Ti, Pi, Si) fori= 1,2, to decide whether or notL(G1)∩L(G2) =∅.

Proof. This is shown by reduction from the PCP. Assume given a set of pairs

(u1, v1),(u2, v2), . . . ,(un, vn) in Σ∗×Σ∗. Assuming disjointness of all the involved sym-

bols and alphabets4, we construct from this the two grammars, with N

1={S1, E}, N2={S2, F}, T1=T2= Σ∪ {1,2, . . . , n,∆}and production sets

P1={S1::= 1Eu1| 2Eu2 | . . . |nEun} ∪ {E::= ∆|1Eu1 |2Eu2| . . . |nEun}

P2={S2::= 1F v1 |2F v2 | . . . |nF vn} ∪ {F::= ∆|1F v1| 2F v2 | . . . |nF vn}

ClearlyS1generates all strings of formim. . . i2i1∆ui1ui2. . . , uim, andS2generates all of

form im. . . i2i1∆vi1vi2. . . , vim. Thus L(G1)∩L(G2)6=∅ if and only if there there exists an index sequencei1, . . . , im such that ui1ui2. . . , uim=vi1vi2. . . , vim. If it were possible

to decide emptiness ofL(G1)∩L(G2) we could also decide the PCP, and so the halting problem for two-counter machines. But this, as we know, is undecidable. 2 Theorem 10.4.2 The following problem CFAMB is undecidable: given a context-free grammarG= (N, T, P, S), to decide whether or notGis ambiguous5.

Proof. This is shown by reduction from the PCP. Given a set of correspondence pairs (u1, v1), . . . ,(un, vn) over alphabet Σ, construct from this the grammar G= (N,Σ, P, S),

withN={S, S1, E, S2, F} and production setP as follows S ::= S1|S2

S1 ::= 1Eu1 |2Eu2 | . . . |nEun

E ::= ∆|1Eu1 |2Eu2| . . . |nEun

S2 ::= 1F v1 |2F v2 | . . . |nF vn

F ::= ∆|1F v1 |2F v2| . . . |nF vn

ClearlyS1, S2derive just the same strings they did inG1andG2. ThusL(G1)∩L(G2)6=∅ if and only if the same string can be derived from both S1 and S2. But this is true

4This can be ensured by renaming if necessary. 5See Appendix A for the definition if unfamiliar.

if and only if G is ambiguous (all derivations are necessarily left-most since at most one nonterminal is involved). As a consequence, decidability of ambiguity would imply decidability of context-free interesection, in conflict with the preceding theorem. 2 Lemma 10.4.3 Given a sequence of strings U = (u1, u2, . . . , un) over alphabet Σ, the

following set is generated by some context-free grammar GU = (NU, T, PU, SU) where

T={1,2, . . . , n,∆} ∪Σ:

{im. . . i2i1∆u|u=6 ui1ui2. . . uim}

Theorem 10.4.4 The following problem CFALL is undecidable: given a context-free grammarG= (N, T, P, S), to decide whetherL(G) =T∗.

Proof. Again we begin with the PCP. Given a sequence of pairs (u1, v1), . . . ,(un, vn) over

alphabet Σ, construct from this three context-free grammars 1. GU as by the preceding lemma withU = (u1, u2, . . . , un)

2. GV as by the preceding lemma with V = (v1, v2, . . . , vn).

3. G0 withL(G0) ={x∈T∗ |xis not of the formim. . . i2i1∆uj1uj2. . . ujk}

It is easy (and an exercise) to see thatG0 exists, and in fact can be a regular grammar. It is also easy to construct from these a single context-free grammarG= (N, T, P, S) with L(G) =L(GU)∪L(GV)∪L(G0).

Claim: L(G)6=T∗ if and only if the PCP has a solution. To see this, sup-

pose x∈T∗ but x /∈L(G) =L(GU)∪L(GV)∪L(G0). Then x∈T∗\L(G0) implies x has the form x=im. . . i2i1∆uj1uj2. . . ujk. Further, x∈T

\L(G

U) implies x=

im. . . i2i1∆ui1ui2. . . uim, and x∈T∗\L(GV) impliesx=im. . . i2i1∆vi1vi2. . . vim. Thus

ui1ui2. . . uim =vi1vi2. . . vim, so the PCP has a solution. Similarly, if the PCP has an

index sequencei1, . . . , im as solution, then

x=im. . . i2i1∆vi1vi2. . . vim∈/L(G)

ThusL(G)6=T∗ if and only if the PCP has a solution, which is undecidable. 2

Exercises

10.2 Does the PCP with pairs (10,101),(10,011),(011,11),(101,011) have a solution?

2

10.3 Prove that the following problem is decidable: given a sequence of pairs (u1, v1), (u2, v2), . . . , (uk, vk) of nonempty strings over a finite alphabet Σ, the problem is to

determine whether or not there exist two index sequences i1, . . . , im and j1, . . . , jn such

that

ui1ui2. . . uim=vj1vj2. . . vjn

Hint: the sets of left and right sides can be described by regular expressions. 2 10.4 *Complete the proof of Theorem 10.3.2 by showing thatP has a rooted solution if and only ifP0 has an unrestricted solution. Prove both the “if” and the “only if” parts.

2

10.5 Prove Lemma 10.4.3: construct the required context-free grammarGU. 2

10.6 Complete the proof of Theorem 10.4.4 (for example by showing that the set involved

is recognizable by a finite automaton). 2

10.7 Prove that it is undecidable, given two context-free grammarsG, G0, to determine

whetherL(G)⊆L(G0). 2

References

Post’s correspondence problem was first formulated and shown unsolvable in [144]. Context-free ambiguity and some related problems were proven undecidable in [7]. The book by Lewis and Papadimitriou, and the one by Rozenberg and Salomaa, contain a broad selection of natural undecidable problems [108, 156].

Other Aspects of Computability The-