Top Banner
Fall 2006 Costas Busch - RPI 1 The Post Correspondence Problem
59

Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Jan 15, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 1

The Post Correspondence Problem

Page 2: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 2

Some undecidable problems forcontext-free languages:

• Is context-free grammar ambiguous?G

• Is ? )()( 21 GLGL

21,GG are context-free grammars

Page 3: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 3

We need a tool to prove that the previousproblems for context-free languagesare undecidable:

The Post Correspondence Problem

Page 4: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 4

The Post Correspondence Problem

Input: Two sets of strings

nwwwA ,,, 21

nvvvB ,,, 21

n

Page 5: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 5

There is a Post Correspondence Solutionif there is a sequence such that:kji ,,,

kjikji vvvwww PC-solution:

Indices may be repeated or omitted

Page 6: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 6

Example:11100 111

001 111 11

1w 2w 3w

1v 2v 3v

:A

:B

PC-solution: 3,1,2 312312 vvvwww

11100111

Page 7: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 7

Example:00100 1000

0 11 011

1w 2w 3w

1v 2v 3v

:A

:B

There is no solution

Because total length of strings from is smaller than total length of strings from

BA

Page 8: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 8

The Modified Post Correspondence Problem

Inputs: nwwwA ,,, 21

nvvvB ,,, 21

MPC-solution: kji ,,,,1

kjikji vvvvwwww 11

Page 9: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 9

Example:11 100111

001111 11

1w 2w 3w

1v 2v 3v

:A

:B

MPC-solution: 2,3,1 231231 vvvwww

11100111

Page 10: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 10

1. The MPC problem is undecidable

2. The PC problem is undecidable

(by reducing MPC to PC)

(by reducing the membership to MPC)

We will show:

Page 11: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 11

Theorem: The MPC problem is undecidable

Proof: We will reduce the membership problem to the MPC problem

Page 12: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 12

Membership problem

Input: Turing machine string

Mw

Question: ?)(MLw

Undecidable

Page 13: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 13

Membership problem

Input: unrestricted grammar string

Gw

Question: ?)(GLw

Undecidable

Page 14: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 14

Suppose we have a decider for the MPC problem

MPC solution?

YES

NO

String Sequences

MPC problemdecider

A

B

Page 15: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 15

We will build a decider for the membership problem

YES

NO

Membershipproblemdecider

G

w

?)(GLw

Page 16: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 16

MPC problemdecider

Membership problem decider

G

w

The reduction of the membership problemto the MPC problem:

A

B

yes yes

no no

Page 17: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 17

MPC problemdecider

Membership problem decider

G

w

We need to convert the input instance ofone problem to the other

A

B

yes yes

no noReduction?

Page 18: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 18

Convert grammar and string

Reduction:

G w

to sets of strings and A B

Such that:

generatesG wThere is an MPCsolution for BA,

Page 19: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 19

A

FS

B

FF : special symbol

aa For every symbol

Grammar G

S : start variable

a

V V For every variable V

Page 20: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 20

A

y

B

x

wEE

Grammar G

For every production

yx

E : special symbol

string w

Page 21: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 21

Example:

Grammar : G

aacAC

CBb

BbbaABbS

|

String aaacw

Page 22: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 22

A B

FS F:1w :1v

a a

b b

c c

A

B

CS

A

B

CS

:2w

:8w

:2v

:8v

:3w :3v

Page 23: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 23

A B

E aaacE:9w :9v

aABb S

Bbb S

C Bbaac

AC

:14w

:14v

Page 24: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 24

:)(GLaaac aaacaACaABbS

Grammar : G

aacAC

CBb

BbbaABbS

|

Page 25: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 25

SF

:A

:B

1w

S

1v

aacAC

CBb

BbbaABbS

|

Derivation:

Page 26: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 26

bBAaSF

:A

:B

1w

aABbS

10w

1v 10v

aacAC

CBb

BbbaABbS

|Derivation:

Page 27: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 27

CAabBAaSF

1w

aACaABbS

10w

1v 10v

14w 2w 5w 12w

14v 2v 5v 12v

aacAC

CBb

BbbaABbS

|

:A

:B

Derivation:

Page 28: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 28

EcaaaCAabBAaSF

1w

aaacaACaABbS

10w

1v 10v

14w 2w 5w 12w

14v 2v 5v 12v 14v 2v 13v

14w 2w 13w

aacAC

CBb

BbbaABbS

|

:A

:B

Derivation:

Page 29: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 29

EcaaaCAabBAaSF

1w

aaacaACaABbS

10w

1v 10v

14w 2w 5w 12w

14v 2v 5v 12v 14v 2v 13v 9v

14w 2w 13w 9w

aacAC

CBb

BbbaABbS

|

:A

:B

Derivation:

Page 30: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 30

),( BA has an MPC-solution

)(GLw

if and only if

Page 31: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 31

MPC problemdecider

Membership problem decider

G

w

ConstructBA,

A

B

yes yes

no no

Page 32: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 32

Since the membership problem is undecidable,The MPC problem is undecidable

END OF PROOF

Page 33: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 33

Theorem: The PC problem is undecidable

Proof: We will reduce the MPC problem to the PC problem

Page 34: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 34

Suppose we have a decider for the PC problem

PC solution?

YES

NO

String Sequences

PC problemdecider

C

D

Page 35: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 35

We will build a decider for the MPC problem

MPC solution?

YES

NO

String Sequences

MPC problemdecider

A

B

Page 36: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 36

PC problemdecider

MPC problem decider

The reduction of the MPC problemto the PC problem:

A

B

yes yes

no no

C

D

Page 37: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 37

PC problemdecider

MPC problem decider

A

B

yes yes

no no

C

DReduction?

We need to convert the input instance ofone problem to the other

Page 38: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 38

: input to the MPC problemBA,

nwwwA ,,, 21

nvvvB ,,, 21

11 ,,, nn wwwC

11 ,,, nn vvvD

: input to the PC problemDC ,

Translated to

Page 39: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 39

kiw 21 *** 21 kiw

A C

BD

11 *ww

1nw

*1nv

For each i

iFor each ikiv 21 kiv **** 21

replace

Page 40: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 40

PC-solution

1111 nkinki vwvvwwww

Has to start with These strings

C D

Page 41: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 41

PC-solution

MPC-solution

kiki vvvwww 11

1111 nkinki vwvvwwww C D

A B

Page 42: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 42

DC,

BA,

has a PC solution

has an MPC solution

if and only if

Page 43: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 43

PC problemdecider

MPC problem decider

A

B

yes yes

no no

C

D

Construct

DC,

Page 44: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 44

Since the MPC problem is undecidable,The PC problem is undecidable

END OF PROOF

Page 45: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 45

Some undecidable problems forcontext-free languages:

• Is context-free grammar ambiguous?

G

• Is ? )()( 21 GLGL

21,GG are context-free grammars

We reduce the PC problem to these problems

Page 46: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 46

Theorem:

Proof:

Let be context-free grammars. It is undecidableto determine if

21,GG

)()( 21 GLGL

Reduce the PC problem to thisproblem

(intersection problem)

Page 47: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 47

Suppose we have a decider for theintersection problem

Empty-interectionproblemdecider

?)()( 21 GLGL

1G

2G

YES

NO

Context-free grammars

Page 48: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 48

We will build a decider for the PC problem

PC solution?

YES

NO

String Sequences

PC problemdecider

A

B

Page 49: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 49

PC problem decider

The reduction of the PC problemto the empty-intersection problem:

A

B

no yes

yes no

Intersectionproblemdecider

AG

BG

Page 50: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 50

PC problem decider

A

B

no yes

yes no

AG

BGReduction?

We need to convert the input instance ofone problem to the other

Intersectionproblemdecider

Page 51: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 51

nwwwA ,,, 21 naaa ,,, 21

}:{ ijkkjiA aaawwwssL

Context-free grammar : iiiAiA awaSwS |AG

Introduce new unique symbols:

nvvvB ,,, 21

}:{ ijkkjiB aaavvvssL

Context-free grammar : iiiBiB avaSvS |BG

Page 52: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 52

)()( BA GLGL

if and only if

),( BA has a PC solution

Page 53: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 53

ijkkji aaavvvs ijkkji aaawwws

naaa ,,, 21 Because are unique

)()( 21 GLGL

There is a PC solution:

kjikji vvvwww

Page 54: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 54

PC problem decider

A

B

no yes

yes no

Intersectionproblemdecider

AG

BG

ConstructContext-FreeGrammars

Page 55: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 55

Since PC is undecidable,the Intersection problem is undecidable

END OF PROOF

Page 56: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 56

For a context-free grammar ,GTheorem:

it is undecidable to determineif G is ambiguous

Proof: Reduce the PC problem to this problem

Page 57: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 57

PC problem decider

A

B

no yes

yes no

Ambiguousproblemdecider

GConstructContext-FreeGrammar

Page 58: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 58

AS start variable of AG

BS start variable of BG

S start variable of G

BA SSS |

Page 59: Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.

Fall 2006 Costas Busch - RPI 59

if and only if

G is ambiguous

)()( BA GLGL

if and only if

),( BA has a PC solution