costas busch - rpi1 undecidable problems for recursively enumerable languages continued…

84
Costas Busch - RPI 1 Undecidable problems for Recursively enumerable languages continued…

Post on 19-Dec-2015

236 views

Category:

Documents


0 download

TRANSCRIPT

Costas Busch - RPI 1

Undecidable problemsfor

Recursively enumerable languages

continued…

Costas Busch - RPI 2

• is empty?L

L• is finite?

L• contains two different strings of the same length?

Take a recursively enumerable language L

Decision problems:

All these problems are undecidable

Costas Busch - RPI 3

Theorem:

For a recursively enumerable language Lit is undecidable to determine whether is finite L

Proof:

We will reduce the halting problemto this problem

Costas Busch - RPI 4

finite languageproblemdecider

M

YES

NO

Suppose we have a decider for the finite language problem:

Let be the TM with M

)(ML

)(ML

finite

not finite

LML )(

Costas Busch - RPI 5

Halting problemdecider

M

w

YES

NO

halts onM w

We will build a decider for the halting problem:

doesn’t halt onM w

Costas Busch - RPI 6

YES

NO

M

w

NO

YES

Halting problem decider

wMfinite languageproblemdecider

We want to reduce the halting problem tothe finite language problem

Costas Busch - RPI 7

YES

NO

M

w

NO

YES

Halting problem decider

wMfinite languageproblemdecider

We need to convert one problem instanceto the other problem instance

convertinput ?

Costas Busch - RPI 8

Construct machine : wM

If enters a halt state, accept ( inifinite language)

M

Initially, simulates on input M w

Otherwise, reject ( finite language)

On arbitrary input strings

s

s

*

Costas Busch - RPI 9

M halts on

)( wML is infinite

if and only if

w

*)( wML

Costas Busch - RPI 10

construct

wM

YES

NO

M

w

NO

YES

halting problem decider

finite languageproblemdecider

wM

Costas Busch - RPI 11

• is empty?L

L• is finite?

L• contains two different strings of the same length?

Take a recursively enumerable language L

Decision problems:

All these problems are undecidable

Costas Busch - RPI 12

Theorem:

For a recursively enumerable language Lit is undecidable to determine whether contains two different strings of same length

L

Proof:We will reduce the halting problemto this problem

Costas Busch - RPI 13

Two-stringsproblemdecider

M

YES

NO

Suppose we have the deciderfor the two-strings problem:

Let be the TM withM

)(ML

)(ML

contains

Doesn’t contain

LML )(

two equal length strings

Costas Busch - RPI 14

Halting problemdecider

M

w

YES

NO

halts onM w

We will build a decider for the halting problem:

doesn’t halt onM w

Costas Busch - RPI 15

YES

NO

M

w

YES

NO

Halting problem decider

Two-stringsproblemdecider

wM

We want to reduce the halting problem tothe empty language problem

Costas Busch - RPI 16

YES

NO

M

w

YES

NO

Halting problem decider

Two-stringsproblemdecider

wM

We need to convert one problem instanceto the other problem instance

convertinputs ?

Costas Busch - RPI 17

Construct machine : wM

When enters a halt state, accept if or

M

Initially, simulate on input M w

as bs (two equal length strings )

On arbitrary input strings

},{)( baML w

Otherwise, reject ( )s )( wML

Costas Busch - RPI 18

M halts on

wM

if and only if

w

accepts two equal length strings

wM accepts and a b

Costas Busch - RPI 19

construct

wM

YES

NO

M

w

YES

NO

Halting problem decider

Two-stringsproblemdecider

wM

Costas Busch - RPI 20

Rice’s Theorem

Costas Busch - RPI 21

Non-trivial properties of recursively enumerable languages:

any property possessed by some (not all)recursively enumerable languages

Definition:

Costas Busch - RPI 22

Some non-trivial properties of recursively enumerable languages:

• is emptyL

L• is finite

L• contains two different strings of the same length

Costas Busch - RPI 23

Rice’s Theorem:

Any non-trivial property of a recursively enumerable languageis undecidable

Costas Busch - RPI 24

The Post Correspondence Problem

Costas Busch - RPI 25

Some undecidable problems forcontext-free languages:

• Is context-free grammar ambiguous?G

• Is ? )()( 21 GLGL

21,GG are context-free grammars

Costas Busch - RPI 26

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

The Post Correspondence Problem

Costas Busch - RPI 27

The Post Correspondence Problem

Input: Two sequences of strings

nwwwA ,,, 21

nvvvB ,,, 21

n

Costas Busch - RPI 28

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

kjikji vvvwww PC-solution:

Indeces may be repeated or ommited

Costas Busch - RPI 29

Example:11100 111

001 111 11

1w 2w 3w

1v 2v 3v

:A

:B

PC-solution: 3,1,2 312312 vvvwww

11100111

Costas Busch - RPI 30

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

Costas Busch - RPI 31

The Modified Post Correspondence Problem

Inputs: nwwwA ,,, 21

nvvvB ,,, 21

MPC-solution: kji ,,,,1

kjikji vvvvwwww 11

Costas Busch - RPI 32

Example:11 100111

001111 11

1w 2w 3w

1v 2v 3v

:A

:B

MPC-solution: 2,3,1 231231 vvvwww

11100111

Costas Busch - RPI 33

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:

Costas Busch - RPI 34

Theorem: The MPC problem is undecidable

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

Costas Busch - RPI 35

Membership problem

Input: recursive language string

Lw

Question: ?Lw

Undecidable

Costas Busch - RPI 36

Membership problem

Input: unrestricted grammar string

Gw

Question: ?)(GLw

Undecidable

Costas Busch - RPI 37

Suppose we have a decider for the MPC problem

MPC solution?

YES

NO

String Sequences

MPC problemdecider

A

B

Costas Busch - RPI 38

We will build a decider for the membership problem

YES

NO

Membershipproblemdecider

G

w

?)(GLw

Costas Busch - RPI 39

MPC problemdecider

Membership problem decider

G

w

The reduction of the membership problemto the MPC problem:

A

B

yes yes

no no

Costas Busch - RPI 40

MPC problemdecider

Membership problem decider

G

w

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

A

B

yes yes

no no

convert inputs ?

Costas Busch - RPI 41

A

FS

B

FF : special symbol

aa For every symbol

Grammar G

S : start variable

a

V V For every variable V

Costas Busch - RPI 42

A

y

B

x

wEE

Grammar G

For every production

yx

E : special symbol

string w

Costas Busch - RPI 43

Example:

Grammar : G

aacAC

CBb

BbbaABbS

|

String aaacw

Costas Busch - RPI 44

A B

FS F:1w :1v

a a

b b

c c

A

B

CS

A

B

CS

:2w

:8w

:2v

:8v

Costas Busch - RPI 45

A B

E aaacE:9w :9v

aABb S

Bbb S

C Bbaac

AC

:14w

:14v

Costas Busch - RPI 46

)(GLaaac

aaacaACaABbS

Grammar : G

aacAC

CBb

BbbaABbS

|

Costas Busch - RPI 47

bBAaSF

A

B

1w

aABbS

10w

1v 10v

Costas Busch - RPI 48

CAabBAaSF

A

B

1w

aACaABbS

10w

1v 10v

14w 2w 5w 12w

14v 2v 5v 12v

Costas Busch - RPI 49

EcaaaCAabBAaSF

A

B

1w

aaacaACaABbS

10w

1v 10v

14w 2w 5w 12w

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

14w 2w 13w 9w

Costas Busch - RPI 50

),( BA has an MPC-solution

)(GLw

if and only if

Costas Busch - RPI 51

MPC problemdecider

Membership problem decider

G

w

ConstructBA,

A

B

yes yes

no no

Costas Busch - RPI 52

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

END OF PROOF

Costas Busch - RPI 53

Theorem: The PC problem is undecidable

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

Costas Busch - RPI 54

Suppose we have a decider for the PC problem

PC solution?

YES

NO

String Sequences

PC problemdecider

C

D

Costas Busch - RPI 55

We will build a decider for the MPC problem

MPC solution?

YES

NO

String Sequences

MPC problemdecider

A

B

Costas Busch - RPI 56

PC problemdecider

MPC problem decider

The reduction of the MPC problemto the PC problem:

A

B

yes yes

no no

C

D

Costas Busch - RPI 57

PC problemdecider

MPC problem decider

A

B

yes yes

no no

C

D

convertinputs ?

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

Costas Busch - RPI 58

: input to the MPC problemBA,

nwwwA ,,, 21

nvvvB ,,, 21

Costas Busch - RPI 59

We construct new sequences DC,

nwwwA ,,, 21

nvvvB ,,, 21

110 ,,,, nn wwwwC

110 ,,,, nn vvvvD

Costas Busch - RPI 60

abcadwi

***** dacbawi

A

C

We insert a special symbol between any two symbols

Costas Busch - RPI 61

abcadvi

dacbavi *****

B

D

Costas Busch - RPI 62

1nw

C

Special Cases

10 *ww

*1nv

D

10 vv

Costas Busch - RPI 63

DC,

BA,

has a PC solution

has an MPC solution

if and only if

Costas Busch - RPI 64

PC-solution 1010 nknk vwvwww

MPC-solution kk vvww 11

Costas Busch - RPI 65

PC problemdecider

MPC problem decider

A

B

yes yes

no no

C

D

Construct

DC,

Costas Busch - RPI 66

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

END OF PROOF

Costas Busch - RPI 67

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

Costas Busch - RPI 68

Theorem:

Proof:

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

21,GG

)()( 21 GLGL

Rdeduce the PC problem to thisproblem

Costas Busch - RPI 69

Suppose we have a decider for theempty-intersection problem

Empty-interectionproblemdecider

?)()( 21 GLGL

1G

2G

YES

NO

Context-free grammars

Costas Busch - RPI 70

We will build a decider for the PC problem

PC solution?

YES

NO

String Sequences

PC problemdecider

A

B

Costas Busch - RPI 71

PC problem decider

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

A

B

yes yes

no no

Empty-interectionproblemdecider

AG

BG

Costas Busch - RPI 72

PC problem decider

A

B

no yes

yes no

Empty-interectionproblemdecider

AG

BG

convertinputs ?

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

Costas Busch - RPI 73

: input to the PC problemBA,

nwwwA ,,, 21

nvvvB ,,, 21

Costas Busch - RPI 74

nwwwA ,,, 21

nvvvB ,,, 21

Introduce new unique symbols:

naaa ,,, 21

Costas Busch - RPI 75

nwwwA ,,, 21

naaa ,,, 21

}:{ ijkkjiA aaawwwssL

Context-free grammar :

iiiAiA awaSwS |AG

Costas Busch - RPI 76

nvvvB ,,, 21

naaa ,,, 21

}:{ ijkkjiB aaavvvssL

Context-free grammar :

iiiBiB avaSvS |BG

Costas Busch - RPI 77

)()( BA GLGL

if and only if

),( BA has a PC solution

Costas Busch - RPI 78

ijkkji aaavvvs ijkkji aaawwws

naaa ,,, 21 Because are unique

)()( 21 GLGL

There is a PC solution:

ijkkji aaawwws

Costas Busch - RPI 79

PC problem decider

A

B

no yes

yes no

Empty-interectionproblemdecider

AG

BG

ConstructContext-FreeGrammars

Costas Busch - RPI 80

Since PC is undecidable,the empty-intersection problem is undecidable

END OF PROOF

Costas Busch - RPI 81

For a context-free grammar ,GTheorem:

it is undecidable to determineif G is ambiguous

Proof: Reduce the PC problem to this problem

Costas Busch - RPI 82

PC problem decider

A

B

no yes

yes no

Ambiguous-grammarproblemdecider

GConstructContext-FreeGrammar

Costas Busch - RPI 83

AS start variable of AG

BS start variable of BG

S start variable of G

BA SSS |

Costas Busch - RPI 84

if and only if

G is ambiguous

)()( BA GLGL

if and only if

),( BA has a PC solution