fall 2004comp 3351 undecidable problems for recursively enumerable languages continued…

36
Fall 2004 COMP 335 1 Undecidable problems for Recursively enumerable languages continued…

Upload: delphia-gaines

Post on 19-Dec-2015

236 views

Category:

Documents


2 download

TRANSCRIPT

Fall 2004 COMP 335 1

Undecidable problemsfor

Recursively enumerable languages

continued…

Fall 2004 COMP 335 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

Fall 2004 COMP 335 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

Fall 2004 COMP 335 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 )(

Fall 2004 COMP 335 5

Halting problemdecider

M

w

YES

NO

halts onM w

We will build a decider for the halting problem:

doesn’t halt onM w

Fall 2004 COMP 335 6

YES

NO

M

w

NO

YES

Halting problem decider

wMfinite languageproblemdecider

We want to reduce the halting problem tothe finite language problem

Fall 2004 COMP 335 7

YES

NO

M

w

NO

YES

Halting problem decider

wMfinite languageproblemdecider

We need to convert one problem instanceto the other problem instance

convertinput ?

Fall 2004 COMP 335 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

*

Fall 2004 COMP 335 9

M halts on

)( wML is infinite

if and only if

w

*)( wML

Fall 2004 COMP 335 10

construct

wM

YES

NO

M

w

NO

YES

halting problem decider

finite languageproblemdecider

wM

Fall 2004 COMP 335 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

Fall 2004 COMP 335 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

Fall 2004 COMP 335 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

Fall 2004 COMP 335 14

Halting problemdecider

M

w

YES

NO

halts onM w

We will build a decider for the halting problem:

doesn’t halt onM w

Fall 2004 COMP 335 15

YES

NO

M

w

YES

NO

Halting problem decider

Two-stringsproblemdecider

wM

We want to reduce the halting problem tothe empty language problem

Fall 2004 COMP 335 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 ?

Fall 2004 COMP 335 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

Fall 2004 COMP 335 18

M halts on

wM

if and only if

w

accepts two equal length strings

wM accepts and a b

Fall 2004 COMP 335 19

construct

wM

YES

NO

M

w

YES

NO

Halting problem decider

Two-stringsproblemdecider

wM

Fall 2004 COMP 335 20

Rice’s Theorem

Fall 2004 COMP 335 21

Non-trivial properties of recursively enumerable languages:

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

Definition:

Fall 2004 COMP 335 22

Some non-trivial properties of recursively enumerable languages:

• is emptyL

L• is finite

L• contains two different strings of the same length

Fall 2004 COMP 335 23

Rice’s Theorem:

Any non-trivial property of a recursively enumerable languageis undecidable

Fall 2004 COMP 335 24

The Post Correspondence Problem

Fall 2004 COMP 335 25

Some undecidable problems forcontext-free languages:

• Is context-free grammar ambiguous?G

• Is ? )()( 21 GLGL

21,GG are context-free grammars

Fall 2004 COMP 335 26

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

The Post Correspondence Problem

Fall 2004 COMP 335 27

The Post Correspondence Problem

Input: Two sequences of strings

nwwwA ,,, 21

nvvvB ,,, 21

n

Fall 2004 COMP 335 28

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

kjikji vvvwww PC-solution:

Indices may be repeated or omitted

Fall 2004 COMP 335 29

Example:11100 111

001 111 11

1w 2w 3w

1v 2v 3v

:A

:B

PC-solution: 3,1,2 312312 vvvwww

11100111

Fall 2004 COMP 335 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

Fall 2004 COMP 335 31

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:

Fall 2004 COMP 335 32

Theorem: The PC problem is undecidable

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

Fall 2004 COMP 335 33

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

Fall 2004 COMP 335 34

Theorem:

Proof:

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

21,GG

)()( 21 GLGL

Rdeduce the PC problem to thisproblem

Fall 2004 COMP 335 35

Suppose we have a decider for theempty-intersection problem

Empty-interectionproblemdecider

?)()( 21 GLGL

1G

2G

YES

NO

Context-free grammars

Fall 2004 COMP 335 36

For a context-free grammar ,GTheorem:

it is undecidable to determineif G is ambiguous

Proof: Reduce the PC problem to this problem