• No results found

Undecidable Problems for CFGs

N/A
N/A
Protected

Academic year: 2021

Share "Undecidable Problems for CFGs"

Copied!
21
0
0

Loading.... (view fulltext now)

Full text

(1)

Undecidable Problems for CFGs

CSCI 3130 Formal Languages and Automata Theory

Siu On CHAN Fall 2019

(2)

Decidable vs undecidable

Decidable Undecidable

DFAD accepts w TMM accepts w CFGG generates w TMM halts on w DFAsD and D0accept same

inputs

TMM accepts some input TM M and M0 accept the

same inputs CFGG generates all inputs?

(3)
(4)

Configurations

Aconfigurationconsists of current state, head position, and tape contents

Configuration (abbreviation)

q1 a b a  … abq1a

q1 a/bR qacc

(5)
(6)

Computation histories as strings

IfM halts on w, thecomputation historyof (M, w) is the sequence of configurationsC1, . . . ,CkthatM goes through on input w

q0ab%ab xq2b%ab ... xx%xxq1 xx%xqaccx #q0ab%ab | {z } C1 #xq1b%ab | {z } C2 #…#xx%xqaccx | {z } Ck #

The computation history can be written as a string h over alphabet Γ ∪ Q ∪ {#}

accepting history: M accepts w ⇔ qaccappears inh

(7)

Undecidable problems for CFGs

ALLCFG= {hGi | G is a CFG that generates all strings}

The language ALLCFGis undecidable

We will argue that

If ALLCFGcan be decided, so canATM

(8)

Undecidable problems for CFGs

Proof by contradiction

Suppose some Turing machineA decides ALLCFG A

hGi accept ifG generates all strings reject otherwise

We want to construct a Turing machineS that decides ATM

Convert toG A hM, wi accept if M rejects or loops onw reject ifM accepts w hGi S

(9)

Undecidable problems for CFGs

Convert to G

hM, wi hGi

Gfails to generatesome string m

M accepts w ThealphabetofG will be Γ ∪ Q ∪ {#}

G will generate all stringsexcept

(10)

Undecidablility via computation histories

P candidate compu-tation historyh of (M, w) accept everything except acceptingh #q0ab%ab#xq1b%ab#…#xx%xqaccx# ⇒ Reject

P = on input h (try to spot amistakeinh) • Ifh isnotof the form #w1#w2#…#wk#,accept

• Ifw16=q0w or wkdoesnotcontainqacc,accept

• If two consecutive blockswi#wi+1donotfollow from the transitions ofM,accept

(11)

Computation is local

q0 q1 qacc q2 q3 q4 q5 q6 q7 a/xR b/x%/%RR x/xR /L a/aR b/bR %/%R x/xR a/aR b/bR %/%R x/xR a/xL b/xL a/aL b/bL x/xL %/%L a/aL b/bL x/xR q0ab%ab aq2b%ab abq2%ab ab%q3ab abq2%xb ... xx%xxq1 xx%xqaccx

(12)

Legal and illegal transitions windows

legal windows illegal windows

(13)

Implementing

P

If two consecutive blockswi#wi+1donot

follow from the transitions ofM,accept

#xb%q3ab

#xbq5%xb

For every position ofwi:

Remember offset from # inwion stack Remember first row of window in state After reaching the next #:

Pop offset from # from stack as you consume input Remember second row of window in state

(14)

The computation history method

ALLCFG= {hGi | G is a CFG that generates all strings}

If ALLCFGcan be decided, so canATM

Convert to G

hM, wi hGi

G accepts all stringsexcept

accepting computation history of (M, w)

(15)

Post Correspondence Problem

Input: A fixed set of tiles, each containing a pair of strings bab cc c ab a ab baa a a baba bab ε

Given an infinite supply of tiles from a particular set, can you match top and bottom?

(16)

Undecidability of PCP

PCP = {hTi |

T is a collection of tiles that contains a top-bottom match} Next lecture we will show (using computation history method)

(17)

Ambiguity of CFGs

AMB = {hGi | G is an ambiguous CFG} The language AMB is undecidable

We will argue that

(18)

Ambiguity of CFGs

T (collection of tiles) 7−→ G (CFG) IfT can be matched, then G is ambiguous IfT cannot be matched, then G is unambiguous

(19)
(20)

Ambiguity of CFGs

Each sequence of tiles gives a pair of derivations

bab cc c ab c ab 1 2 2

S ⇒ T ⇒ babT1 ⇒ babcT21 ⇒ babcc221 S ⇒ B ⇒ ccB1 ⇒ ccabB21 ⇒ ccabab221 If the tilesmatch, these two derive the same string

(21)

Ambiguity of CFGs

T (collection of tiles) 7−→ G (CFG) IfT can be matched, then G is ambiguous 3

IfT cannot be matched, then G is unambiguous 3

References

Related documents

Types are called collective nouns worksheet is determined by collection as a formula is just select goal seek dialog box button on general.. biology, which

None of reference is invalid, drug information to opioids under the references from a group of the technologies we cannot show you already on our pdr.. Just some electronic access

***Gathering Prayer Mary Maren Bjork Timeless God, on this day we remember all the saints of our lives.. Some have gone before; some are sitting right next to us in

Recent work suggests that learning-related emotions (LREs) play a crucial role in performance especially in the first year of university, a period of transition for

•  One mole of molecules or formula units contains Avogadro s number times the number of atoms or ions of each element in the compound... Stoichiometry

No partial immu- nity to the disease will have been built up by previous exposure and recovery from less deadly forms of malaria, such as happens with men in the

 Using symmetric algorithms for payment card data invites

During the duration of this decree, the CCCF warden shall report to CCA’s ethics compliance office all complaints of a serious violation of CCA’s sexual harassment or