1 decidability continued. 2 undecidable problems halting problem: does machine halt on input ?...

40
1 Decidability continued

Post on 21-Dec-2015

237 views

Category:

Documents


0 download

TRANSCRIPT

1

Decidability

continued

2

Undecidable Problems

Halting Problem:

M wDoes machine halt on input ?

State-entry Problem:

Mw

Does machine enter state halt on input ?

q

3

Blank-tape halting problem:

MDoes machine halt when startingon blank tape?

Membership problem:

Is a string member of a recursively enumerable language ? L

w

4

Uncomputable Functions

A function is uncomputable if it cannotbe computed for all the domain

Domain Valuesregion

f

5

Function : )(nf

)(nfmaximum number of moves untilany Turing machine with stateshalts when started with the blank tape

n

6

Theorem:

Function is uncomputable)(nf

Proof:

If was computable thenthe blank-tape halting problem would be decidable

)(nf

7

Algorithm for blank-tape halting problem

Input: machine M

1. Count states of : M m

2. Compute )(mf

3. Simulate for steps starting with empty tape

M )(mf

If halts then return YES otherwise return NO

M

8

Rice’s Theorem

9

Non-trivial property of recursively enumerable languages:

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

10

Some non-trivial properties of recursively enumerable languages:

• is emptyL

L• is finite

L• contains two different strings of the same length

11

Rice’s Theorem:

Any non-trivial property of a recursively enumerable languageis undecidable

12

Theorem:

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

Proof:

We will reduce the membership problemto this problem

13

Membership problem:

Inputs: machine and string M w

Question: ?)(MLw

14

Construct machine : wM

When enters a final state, compare input with w

M

}{)()( wMLML w

Observations:

)(MLw if and only if is empty)( wML

15

Algorithm for membership problem:

Inputs: machine and string M w

1. Construct wM

2. Determine if is empty )( wML

Yes: then )(MLw

No: then )(MLw

16

construct

wM

Check if)( wML

is empty

yes

no

M

w

no

yes

Membership machine

17

Theorem:

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

Proof:

We will reduce the halting problemto this problem

18

Halting problem:

Inputs: machine and string M w

Question: does halt on input ?M w

19

Construct machine : wM

When enters a halt state, accept any input

M

Initially, simulates on input M w

(virtual input)

20

Observations:

M halts on if and only if is infinite

w

)( wML

If is finite then )( wML )( wML

21

Algorithm for halting problem:

Inputs: machine and string M w

1. Construct wM

2. Determine if is finite )( wML

Yes: then doesn’t halt on

No: then halts on

M w

M w

22

construct

wM

Check if)( wML

is finite

yes

no

M

w

no

yes

Machine for halting problem

23

Theorem:

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

Proof:

We will reduce the halting problemto this problem

24

Halting problem:

Inputs: machine and string M w

Question: does halt on input ?M w

25

Construct machine : wM

When enters a halt state, accept symbols or

M

Initially, simulates on input M w

a b

(virtual input)

26

Observation:

M halts on if and only if accepts and

w

)( wML a b

(strings of equal length)

27

Algorithm for halting problem:

Inputs: machine and string M w

1. Construct wM

2. Determine if accepts strings of equal length

)( wML

Yes: then halts on

No: then doesn’t halt on

M w

M w

28

construct

wM

Check if)( wML

Has equallengthstrings

yes

no

M

w

yes

no

Machine for halting problem

29

The Post Correspondence Problem

30

Some undecidable problems forcontext-free languages:

• Is context-free grammar ambiguous?G

• Is ? )()( 21 GLGL

31

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

The Post Correspondence Problem

32

The Post Correspondence Problem

Input: Two sequences of strings

nwwwA ,,, 21

nvvvB ,,, 21

33

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

kjikji vvvwww

PC-solution

34

Example:11100 111

001 111 11

1w 2w 3w

1v 2v 3v

:A

:B

PC-solution: 3,1,2 312312 vvvwww

11100111

35

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

36

The Modified Post Correspondence Problem

Inputs: nwwwA ,,, 21

nvvvB ,,, 21

MPC-solution: kji ,,,,1

kjikji vvvvwwww 11

37

Example:11 100111

001111 11

1w 2w 3w

1v 2v 3v

:A

:B

MPC-solution: 2,3,1 321231 vvvwww

11100111

38

We will show that:

The Modified Post Correspondence Problem is undecidable

In other words: There is not MPC-solution for any pair ),( BA

39

Proof Technique:

We will reduce the membership problemto theMPC problem

40

Membership problem:

Does Turing machine accept string M w

Equivalent Problem:

Does unrestricted Grammar generate string ?

Gw