languages and finite automataryan/cse4083/busch/class21.pdfreducibility. there are two main...

52
1 Reducibility

Upload: others

Post on 31-Mar-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

1

Reducibility

Page 2: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

There are two main techniques for showing that problems are undecidable:

diagonalization and reduction

2

Page 3: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

We say that a problem A is reduced to a problem B if the decidability of A follows from the decidability of B.

Linz, 6th, page 315

3

Page 4: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

4

Problem is reduced to problemA B

If we can solve problem then

we can solve problem

B

A

B

A

Page 5: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

A is reducible to B if we can use B as a subroutine to solve A.

Use a halting TM for B in the construction of a halting TM which decides problem A.

5

Page 6: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

6

If is undecidable then is undecidable

If is decidable then is decidableB A

A B

Problem is reduced to problemA B

Page 7: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

7

Example: the halting problem

is reduced to

the state-entry problem

So, if the halting problem is undecidable, then the state-entry problem is undecidable.

Page 8: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

8

The state-entry problem

Inputs: M•Turing Machine

•State q

Question: Does M

•String w

enter state q

on input ?w

Page 9: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

9

Theorem:

The state-entry problem is undecidable

Proof: Reduce the halting problem to the

state-entry problem.

Page 10: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

10

Suppose we have an algorithm

(Turing Machine) that solves the

state-entry problem

We will construct an algorithm

that solves the halting problem

Page 11: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

11

Algorithm for

state-entry

problem

M

w

q

YES

NO

entersM q

doesn’t

enterM q

Assume we have the state-entry algorithm:

Page 12: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

12

Algorithm for

Halting problem

M

w

YES

NO

halts onM w

doesn’t

halt onM w

We want to design the halting algorithm:

Page 13: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

13

Modify any machine to construct :M

•Add new state q

•From any halting state add transitions to q

M q

halting statesSingle

halt state

M

M

Page 14: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

14

M halts

M halts on state q

if and only if

Page 15: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

15

machine and string

Algorithm for halting problem:

Inputs: M w

1. Construct machine with state M q

2. Run algorithm for state-entry problem

with inputs: M wq, ,

Page 16: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

16

Generate

M M

w

M

q

w

State-entry

algorithm

Halting problem algorithm

YES

NO

YES

NO

Page 17: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

17

Since the halting problem is undecidable,

it must be that the state-entry problem

is also undecidable

END OF PROOF

We reduced the halting problem

to the state-entry problem

Page 18: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

18

Another example:

the halting problem

is reduced to

the blank-tape halting problem

Page 19: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

19

The blank-tape halting problem

Input: MTuring Machine

Question: Does M halt when started with

a blank tape?

Page 20: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

20

Theorem:

Proof: Reduce the halting problem to the

blank-tape halting problem

The blank-tape halting problem is undecidable

Page 21: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

21

Suppose we have an algorithm

for the blank-tape halting problem

We will construct an algorithm

for the halting problem

Page 22: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

22

Algorithm for

blank-tape

halting problem

M

YES

NO

halts on

blank tape

M

doesn’t halt

on blank tape

M

Assume we have the blank-tape halting algorithm/machine. It looks

like this:

Page 23: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

23

Algorithm for

halting problem

M

w

YES

NO

halts onM w

doesn’t

halt onM w

We want to design a machine that decides

the halting problem. The machine looks

like this:

Page 24: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

24

wMConstruct a new machine

• On blank tape writes w

• Then continues execution like M

wM

M

then write w

step 1 step2

if blank tape execute

with input w

Page 25: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

25

M halts on input string

wM halts when started with blank tape

if and only if

w

Page 26: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

26

Algorithm for halting problem:

1. Construct wM

2. Run algorithm for

blank-tape halting problem

with input

,

wM

machine and stringInputs: M w

Page 27: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

27

Generate

wM

M

w

blank-tape

halting

algorithm

Halting problem algorithm

YES

NOwM

YES

NO

Page 28: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

28

Since the halting problem is undecidable,

the blank-tape halting problem is

also undecidable

END OF PROOF

We reduced the halting problem

to the blank-tape halting problem

Page 29: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

29

Does machine halt on input ?

Summary of Undecidable Problems

Halting Problem:

M w

Membership problem:

Is a string member of a

recursively enumerable language ?L

w

Does machine accept string ?M w

In other words:

Page 30: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

30

Does machine enter state

on input ?

Does machine halt when starting

on blank tape?

Blank-tape halting problem:

M

State-entry Problem:

M

w

q

Page 31: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

31

Uncomputable Functions

Page 32: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

32

Uncomputable Functions

A function is uncomputable if it cannot

be computed for all of its domain

Domain Values

region

f

Page 33: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

33

An uncomputable function:

)(nf

maximum number of moves until

any Turing machine with states

halts when started with the blank tape

n

Page 34: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

34

Theorem: Function is uncomputable)(nf

Proof:

Then the blank-tape halting problem

is decidable

Assume for contradiction that

is computable)(nf

Page 35: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

35

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

Page 36: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

36

Therefore, the blank-tape halting

problem is decidable

However, the blank-tape halting

problem is undecidable

Contradiction!!!

Page 37: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

37

Therefore, function in uncomputable)(nf

END OF PROOF

Page 38: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

38

Rice’s Theorem

Page 39: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

39

Non-trivial properties of

recursively enumerable languages:

any property possessed by some (not all)

recursively enumerable languages

Definition:

Page 40: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

40

Some non-trivial properties of

recursively enumerable languages:

• is emptyL

L• is finite

L• contains two different strings

of the same length

Page 41: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

41

Rice’s Theorem:

Any non-trivial property of

a recursively enumerable language

is undecidable

Page 42: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

Rice’s Theorem

In exactly the same manner, we can substitute other questions such as “Does L(M) contain any string of length five?” or “Is L(M) regular?” without affecting the argument essentially. These questions, as well as similar questions, are all undecidable. A general result fromalizngthis is known as Rice’s theorem.

42

Page 43: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

Rice’s Theorem

This theorem states that any nontrivial property of a recursively enumerable language is undecidable. The adject“nontrivial” refers to a property possed by some but not all recursively enumerable languages. A precide statement and a proof of Rice’s theory can be found in Hopcroft and Ullman (1979).

Linz, 6th, pages 321-322

43

Page 44: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

A property of the RE languages is simply a set of RE languages. Thus, the property of being context-free is formally the set of all CFL’s. The property of being empty is the set {∅} consisting of only the empty language.

Theorem 9.11: (Rice’s Theorem) Every nontrivial property of the RE languages is undecidable.

Hopcroft, Motwani, Ullman, 3rd, pages 397-39844

Page 45: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

45

We will prove some non-trivial properties

without using Rice’s theorem

Page 46: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

46

Theorem:

For any recursively enumerable language Lit is undecidable to determine whether

is empty L

Proof:

We will reduce the membership problem

to this problem

Page 47: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

47

Algorithm for

empty language

problem

M

YES

NO

Assume we have the empty language algorithm:

Let be the machine that accepts M L

)(ML

)(ML

empty

not empty

LML )(

Page 48: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

48

Algorithm for

membership

problem

M

w

YES

NO

acceptsM w

rejectsM w

We will design the membership algorithm:

Page 49: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

49

First construct machine : wM

When enters a final state,

compare original input string with w

M

Accept if original input is

the same with w

Page 50: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

50

Lw

)( wML is not empty

if and only if

}{)( wML w

Page 51: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

51

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

Page 52: Languages and Finite Automataryan/cse4083/busch/class21.pdfReducibility. There are two main techniques for showing that problems are undecidable: diagonalization and reduction 2

52

construct

wM

Check if

)( wML

is empty

YES

NO

M

w

NO

YES

Membership algorithm

wM

END OF PROOF