• No results found

CS310 : Automata Theory 2019

N/A
N/A
Protected

Academic year: 2022

Share "CS310 : Automata Theory 2019"

Copied!
32
0
0

Loading.... (view fulltext now)

Full text

(1)

CS310 : Automata Theory 2019

Lecture 32: Post’s Correspondance Problem

Instructor: S. Akshay

IITB, India

26-03-2019

(2)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 2

Recap

Turing machines and computability

1. Definition of Turing machines: high level and low-level descriptions 2. Variants of Turing machines

3. Decidable and Turing recognizable languages 4. Church-Turing Hypothesis

5. Undecidability and a proof technique by diagonalization

I A universal TM langLATM ={hM,wi |M is a TM andM acceptsw} 6. Reductions: a powerful way to show undecidability.

7. Rice’s theorem, its proof and its applications.

(3)

Undecidability beyond Turing machines

Are only problems about Turing machines undecidable?

(4)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 3

Undecidability beyond Turing machines

Are only problems about Turing machines undecidable?

I Computers, C-programs, counter machines I Problems on CFLs: Given CFG G, isL(G) = Σ? I Problems on Tiling

I Problems on String Matching

(5)

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim =ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110} 2, 3, 1! I A={0011,11,1101}andB ={101,1,110}

I A={0011,11,1101}andB ={101,011,110} I A={100,0,1}andB ={1,100,0}

Can you write an algorithm for solving this?

(6)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim=ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110} 2, 3, 1! I A={0011,11,1101}andB ={101,1,110}

I A={0011,11,1101}andB ={101,011,110} I A={100,0,1}andB ={1,100,0}

Can you write an algorithm for solving this?

(7)

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim=ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110}

2, 3, 1! I A={0011,11,1101}andB ={101,1,110}

I A={0011,11,1101}andB ={101,011,110} I A={100,0,1}andB ={1,100,0}

Can you write an algorithm for solving this?

(8)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim=ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110} 2, 3, 1!

I A={0011,11,1101}andB ={101,1,110} I A={0011,11,1101}andB ={101,011,110} I A={100,0,1}andB ={1,100,0}

Can you write an algorithm for solving this?

(9)

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim=ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110} 2, 3, 1!

I A={0011,11,1101} andB ={101,1,110}

I A={0011,11,1101}andB ={101,011,110} I A={100,0,1}andB ={1,100,0}

Can you write an algorithm for solving this?

(10)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim=ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110} 2, 3, 1!

I A={0011,11,1101} andB ={101,1,110}

I A={0011,11,1101} andB ={101,011,110}

I A={100,0,1}andB ={1,100,0} Can you write an algorithm for solving this?

(11)

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim=ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110} 2, 3, 1!

I A={0011,11,1101} andB ={101,1,110}

I A={0011,11,1101} andB ={101,011,110}

I A={100,0,1}andB ={1,100,0}

Can you write an algorithm for solving this?

(12)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

A simple programming exercise

A string matching problem

Given two lists A={s1, . . .sn}and B={t1, . . . ,tn}, over the same

alphabet, is there a sequence of combining elements that produces the same string in both lists?

I Does there exist a finite sequence 1≤i1, . . . ,im≤n such that si1. . .sim=ti1. . .tim

Consider the following lists

I A={110,0011,0110}and B={110110,00,110} 2, 3, 1!

I A={0011,11,1101} andB ={101,1,110}

I A={0011,11,1101} andB ={101,011,110}

I A={100,0,1}andB ={1,100,0}

Can you write an algorithm for solving this?

(13)

Post’s correspondance problem

A domino game

Given a collection of dominos:

b ca

,h a

ab i

,hca a

i ,

abc c

I A match is a list of these dominos (with possible repetitions) such that the string formed in top is same as string formed by bottom row. I Does this collection of dominos have a match?

I Same as the string matching exercise!

I Called Post’s Correspondance Problem or PCP. Theorem

The Post’s correspondance problem is undecidable!

(14)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 5

Post’s correspondance problem

A domino game

Given a collection of dominos:

b ca

,h a

ab i

,hca a

i ,

abc c

I A match is a list of these dominos (with possible repetitions) such that the string formed in top is same as string formed by bottom row.

I Does this collection of dominos have a match? I Same as the string matching exercise!

I Called Post’s Correspondance Problem or PCP. Theorem

The Post’s correspondance problem is undecidable!

(15)

Post’s correspondance problem

A domino game

Given a collection of dominos:

b ca

,h a

ab i

,hca a

i ,

abc c

I A match is a list of these dominos (with possible repetitions) such that the string formed in top is same as string formed by bottom row.

I Does this collection of dominos have a match?

I Same as the string matching exercise!

I Called Post’s Correspondance Problem or PCP. Theorem

The Post’s correspondance problem is undecidable!

(16)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 5

Post’s correspondance problem

A domino game

Given a collection of dominos:

b ca

,h a

ab i

,hca a

i ,

abc c

I A match is a list of these dominos (with possible repetitions) such that the string formed in top is same as string formed by bottom row.

I Does this collection of dominos have a match?

I Same as the string matching exercise!

I Called Post’s Correspondance Problem or PCP.

Theorem

The Post’s correspondance problem is undecidable!

(17)

Post’s correspondance problem

A domino game

Given a collection of dominos:

b ca

,h a

ab i

,hca a

i ,

abc c

I A match is a list of these dominos (with possible repetitions) such that the string formed in top is same as string formed by bottom row.

I Does this collection of dominos have a match?

I Same as the string matching exercise!

I Called Post’s Correspondance Problem or PCP.

Theorem

The Post’s correspondance problem is undecidable!

(18)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 6

Post’s correspondance problem

Theorem

The Post’s correspondance problem is undecidable.

Proof Idea:

I Encode TM computation histories!

I Each transition as a domino!

I Simulate the run using the dominos.

(19)

Post’s correspondance problem

Theorem

The Post’s correspondance problem is undecidable.

Proof Idea:

I Encode TM computation histories!

I Each transition as a domino!

I Simulate the run using the dominos.

(20)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 6

Post’s correspondance problem

Theorem

The Post’s correspondance problem is undecidable.

Proof Idea:

I Encode TM computation histories!

I Each transition as a domino!

I Simulate the run using the dominos.

(21)

Proof of undecidability of PCP:1

Simplifying assumptions

I Assume that the tape of TM is one-way infinite and never attempts to move left off its left-end.

I Ifw =ε, then usetinstead ofw.

I Modify PCP so that match must start with a given domino, say the first one. Call this MPCP.

(22)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Proof of undecidability of PCP:1

Simplifying assumptions

I Assume that the tape of TM is one-way infinite and never attempts to move left off its left-end.

I Ifw =ε, then usetinstead ofw.

I Modify PCP so that match must start with a given domino, say the first one. Call this MPCP.

(23)

Proof of undecidability of PCP:1

Simplifying assumptions

I Assume that the tape of TM is one-way infinite and never attempts to move left off its left-end.

I Ifw =ε, then usetinstead ofw.

I Modify PCP so that match must start with a given domino, say the first one. Call this MPCP.

(24)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Proof of undecidability of PCP:2

We define a reductionfromATM to (M)PCP. Let an instance ofATM be I M = (Q,Σ,Γ, δ,q0,qacc,qrej)

I w =w1, . . .wn.

We build instanceP0 of MPCP in several steps: Step 1: fix first domino in P0

#

#q0w1· · ·wn#

Because we are reducing to MPCP, the match must start with this domino!How do we proceed?

(25)

Proof of undecidability of PCP:2

We define a reductionfromATM to (M)PCP. Let an instance ofATM be I M = (Q,Σ,Γ, δ,q0,qacc,qrej)

I w =w1, . . .wn.

We build instance P0 of MPCP in several steps:

Step 1: fix first domino in P0

#

#q0w1· · ·wn#

Because we are reducing to MPCP, the match must start with this domino!How do we proceed?

(26)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Proof of undecidability of PCP:2

We define a reductionfromATM to (M)PCP. Let an instance ofATM be I M = (Q,Σ,Γ, δ,q0,qacc,qrej)

I w =w1, . . .wn.

We build instance P0 of MPCP in several steps:

Step 1: fix first domino in P0

#

#q0w1· · ·wn#

Because we are reducing to MPCP, the match must start with this domino!How do we proceed?

(27)

Proof of undecidability of PCP:2

We define a reductionfromATM to (M)PCP. Let an instance ofATM be I M = (Q,Σ,Γ, δ,q0,qacc,qrej)

I w =w1, . . .wn.

We build instance P0 of MPCP in several steps:

Step 1: fix first domino in P0

#

#q0w1· · ·wn#

Because we are reducing to MPCP, the match must start with this domino!

How do we proceed?

(28)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Proof of undecidability of PCP:2

We define a reductionfromATM to (M)PCP. Let an instance ofATM be I M = (Q,Σ,Γ, δ,q0,qacc,qrej)

I w =w1, . . .wn.

We build instance P0 of MPCP in several steps:

Step 1: fix first domino in P0

#

#q0w1· · ·wn#

Because we are reducing to MPCP, the match must start with this domino!How do we proceed?

(29)

Proof of undecidability of PCP:3

Step 2: encode transitions of TM into dominos!

For everya,b,c ∈Γ and everyq,q0 ∈Q,q 6=qrej, I if δ(q,a) = (q0,b,R) then add domino toP0:

qa bq0

I if δ(q,a) = (q0,b,L) then add domino toP0:

cqa q0cb

I add all dominos (i.e, for all a∈Γ∪ {#}) toP0: ha

a i

(30)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 9

Proof of undecidability of PCP:3

Step 2: encode transitions of TM into dominos!

For every a,b,c ∈Γ and everyq,q0∈Q,q 6=qrej, I if δ(q,a) = (q0,b,R) then add domino toP0:

qa bq0

I if δ(q,a) = (q0,b,L) then add domino toP0:

cqa q0cb

I add all dominos (i.e, for all a∈Γ∪ {#}) toP0: ha

a i

(31)

Proof of undecidability of PCP:3

Step 2: encode transitions of TM into dominos!

For every a,b,c ∈Γ and everyq,q0∈Q,q 6=qrej, I if δ(q,a) = (q0,b,R) then add domino toP0:

qa bq0

I if δ(q,a) = (q0,b,L) then add domino to P0:

cqa q0cb

I add all dominos (i.e, for all a∈Γ∪ {#}) toP0: ha

a i

(32)

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 9

Proof of undecidability of PCP:3

Step 2: encode transitions of TM into dominos!

For every a,b,c ∈Γ and everyq,q0∈Q,q 6=qrej, I if δ(q,a) = (q0,b,R) then add domino toP0:

qa bq0

I if δ(q,a) = (q0,b,L) then add domino to P0:

cqa q0cb

I add all dominos (i.e, for alla∈Γ∪ {#}) toP0: ha

a i

References

Related documents

If L is the language accepted of P by empty stack , there exists PDA P 0 such that its language accepted by final state is L..

I Text processing: Given input as English alphabet, output can be capitalized words. I Translation: Given input in English, output can be

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 10.. CFGs

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2.. Topic 8.1

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2..

I Assume that the tape of TM is one-way infinite and never attempts to move left off its left-end.. I Modify PCP so that match must start with a given domino, say the

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2.. Topic 13.1

We can club the rules for a nonterminal together and separate right hand sides using “|”. Example 21.1