1 introduction to computability theory lecture12: reductions prof. amos israeli

63
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Post on 19-Dec-2015

222 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

1

Introduction to Computability Theory

Lecture12: ReductionsProf. Amos Israeli

Page 2: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The rest of the course deals with an important tool in Computability and Complexity theories, namely: Reductions.

The reduction technique enables us to use the undecidability of to prove many other languages undecidable.

Introduction

2

TMA

Page 3: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

A reduction always involves two computational problems. Generally speaking, the idea is to show that a solution for some problem A induces a solution for problem B. If we know that B does not have a solution, we may deduce that A is also insolvable. In this case we say that B is reducible to A.

Introduction

3

Page 4: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

In the context of undecidability: If we want to prove that a certain language L is undecidable. We assume by way of contradiction that L is decidable, and show that a decider for L, can be used to devise a decider for . Since is undecidable, so is the language L.

Introduction

4

TMATMA

Page 5: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Using a decider for L to construct a decider for , is called reducing L to .

Note: Once we prove that a certain language L is undecidable, we can prove that some other language, say L’ , is undecidable, by reducing L’ to L.

Introduction

5

TMA TMA

Page 6: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

1. We know that A is undecidable.

2. We want to prove B is undecidable.

3. We assume that B is decidable and use this assumption to prove that A is decidable.

4. We conclude that B is undecidable.

Note: The reduction is from A to B.

Schematic of a Reduction

6

Page 7: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

1. We know that A is undecidable. The only undecidable language we know, so far, is whose undecidability was proven directly. (In the discussion you also proved directly that is undecidable). So we pick to play the role of A.

2. We want to prove B is undecidable.

Demonstration

7

TMHALT

TMA

TMA

Page 8: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

2. We want to prove B is undecidable. We pick to play the role of B that is: We want to prove that is undecidable.

3. We assume that B is decidable and use this assumption to prove that A is decidable.

Demonstration

8

TMHALT

TMHALT

Page 9: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

3. We assume that B is decidable and use this assumption to prove that A is decidable.In the following slides we assume (towards a contradiction) that is decidable and use this assumption to prove that is decidable.

4. We conclude that B is undecidable.

Demonstration

9

TMA

TMHALT

Page 10: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Consider

Theorem

is undecidable.

Proof

By reducing to .

The “Real” Halting Problem

10

wMwMHALTTM on haltsTM that a is ,

TMHALT

TMATMHALT

Page 11: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Assume by way of contradiction that is decidable.

Recall that a decidable set has a decider R: A TM that halts on every input and either accepts or rejects, but never loops!.

We will use the assumed decider of to devise a decider for .

Discussion

11

TMHALT

TMHALT

TMA

Page 12: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Recall the definition of :

Why is it impossible to decide ?

Because as long as M runs, we cannot determine whether it will eventually halt.

Well, now we can, using the decider R for .

Discussion

12

TMA

TMA

wMwMATM acceptsTM that a is ,

TMHALT

Page 13: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Assume by way of contradiction that is decidable and let R be a TM deciding it. In the next slide we present TM S that uses R as a subroutine and decides . Since is undecidable this constitutes a contradiction, so R does not exist.

Proof

13

TMHALT

TMA TMA

Page 14: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

S=“On input where M is a TM:

1. Run R on input until it halts.

2. If R rejects, (i.e. M loops on w ) - reject.

(At this stage we know that R accepts, and we conclude that M halts on input w.)

3. Simulate M on w until it halts.

4. If M accepts - accept, otherwise - reject. “

Proof (cont.)

14

wM ,

wM ,

Page 15: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

In the discussion, you saw how Diagonalization can be used to prove that is not decidable.

We can use this result to prove by reduction that is not decidable.

Another Example

15

TMA

TMHALT

Page 16: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Note: Since we already know that both and are undecidable, this new proof does not add any new information. We bring it here only for the the sake of demonstration.

Another Example

16

TMA

TMHALT

Page 17: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

1. We know that A is undecidable. Now we pick to play the role of A.

2. We want to prove B is undecidable. We pick to play the role of B, that is: We want to prove that is undecidable.

3. We assume that B is decidable and use this assumption to prove that A is decidable.

Demonstration

17

TMHALT

TMA

TMA

Page 18: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

3. We assume that B is decidable and use this assumption to prove that A is decidable.In the following slides we assume that is decidable and use this assumption to prove that is decidable.

4. We conclude that B is undecidable.

Demonstration

18

TMA

TMHALT

Page 19: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Let R be a decider for . Given an input for , R can be run with this input :If R accepts, it means that .This means that M accepts on input w. In particular, M stops on input w. Therefore, a decider for must accept too.wM ,

Discussion

19

wM ,

TMHALT

TMA

TMAwM ,

Page 20: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

If however R rejects on input , a decider for cannot safely reject: M may be halting on w to reject it. So if M rejects w, a decider for must accept .

Discussion

20

TMHALT

wM ,

wM ,

TMHALT

Page 21: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

How can we use our decider for ?The answer here is more difficult. The new decider should first modify the input TM, M, so the modified TM, , accepts, whenever TM M halts.

Since M is a part of the input, the modification must be a part of the computation.

Discussion

21

TMA

1M

Page 22: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Faithful to our principal “ If it ain’t broken don’t

fix it”, the modified TM keeps M as a subroutine, and the idea is quite simple:Let and be the accepting and rejecting states of TM M, respectively. In the modified TM, , and are kept as ordinary states.

Discussion

22

acceptq

1M

rejectq

acceptq rejectq

Page 23: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

We continue the modification of M by adding a new accepting sate . Then we add two new transitions: A transition from to , and another transition from to .

This completes the description of . It is not hard to verify that accepts iff M halts.

acceptnq

Discussion

23

acceptq

rejectq

acceptnq

acceptnq

1M

1M

Page 24: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Discussion

24

acceptnq

1M

acceptq

rejectq

M

Page 25: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The final description of a decider S for is:

S=“On input where M is a TM:

1. Modify M as described to get .

2. Run R, the decider of with input .

3. If R accepts - accept, otherwise - reject. ”

Discussion

25

TMHALT

TMA

1M

wM ,1

wM ,

Page 26: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

It should be noted that modifying TM M to get , is part of TM S, the new decider for , and can be carried out by it.

It is not hard to see that S decides . Since

is undecidable, we conclude that is undecidable too.

Discussion

26

1M

TMHALT

TMHALT

TMHALTTMA

Page 27: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

We continue to demonstrate reductions by showing that the language , defined by

is undecidable.

Theorem

is undecidable.

The TM Emptiness Problem

27

M AndTM a is LMMETM

TME

TME

Page 28: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The proof is by reduction from :

1. We know that is undecidable.

2. We want to prove is undecidable.

3. We assume toward a contradiction that is decidable and devise a decider for .

4. We conclude that is undecidable.

Proof Outline

28

TME

TMA

TMA

TMATME

TME

Page 29: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Assume by way of contradiction that is decidable and let R be a TM deciding it. In the next slides we devise TM S that uses R as a subroutine and decides .

Proof

29

TME

TMA

Page 30: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Given an instance for , , we may try to run R on this instance. If R accepts, we know that . In particular, M does not accept w so a decider for must reject .

Proof

30

TMA

ML

wM ,

wM ,

TMA

Page 31: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

What happens if R rejects? The only conclusion we can draw is that . What we need to know though is whether .

In order to use our decider R for , we once again modify the input machine M to obtain TM :

Proof

31

ML

MLw

TME

1M

Page 32: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

We start with a TM satisfying .

Description of___

32

1M

MLML 1

1Macceptq

rejectq

M

startq

acceptnq

rejectnq

startnq

Page 33: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

wM

wMwML

rejects if

accepts if 1

Now we add a filter to divert all inputs but w.

Description of___

33

1M

wx

wx

1Macceptq

rejectq

M

startq

acceptnq

rejectnq

startnq

wx filter

no

yes

Page 34: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

TM has a filter that rejects all inputs excepts w, so the only input reaching M, is w.

Therefore, satisfies:

wM

wMwML

rejects if

accepts if 1

Proof

34

1M

1M

Page 35: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Here is a formal description of :

“On input x :

1. If - reject . 2. If - run M on w and accept if M accepts. ”

Note: M accepts w if and only if .

Proof

35

wx 1M

wx

1ML

1M

Page 36: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

S=“On input where M is a TM:

1. Compute an encoding of TM . 2. Run R on input .

3. If R rejects - accept, otherwise - reject.

Proof

37

wM ,

1M 1M

1M

Page 37: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Recall that R is a decider for . If R rejects the modified machine , , hence by the specification of , , and a decider for must accept .If however R accepts, it means that , hence , and S must reject . QED

Proof

38

1M

TME

1ML

MLw1M

TMA

1ML

wM ,

MLw wM ,

Page 38: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

We continue to demonstrate reductions by showing that the language :

is undecidable.

Theorem

is undecidable.

_______ is undecidable

39

TMREGULAR

TMREGULAR

TMREGULAR

RegularIS M AndTM a is LMMREGULARTM

Page 39: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The proof is by reduction from :

1. We know that is undecidable.

2. We want to prove is undecidable.

3. We assume that is decidable and devise a decider for .

4. We conclude that is undecidable.

Proof Outline

40

TMA

TMA

TMA

TMREGULAR

TMREGULAR

TMREGULAR

Page 40: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Consider an instance of ATM . Once again, the

idea is to transform TM M to another TM, , such that is regular if and only if .

Once we have such a machine we can run a decider for with as input, and accept , if the decider accepts.

Proof

41

TMAwM ,

wM ,

2M 2ML

TMREGULAR 2M

wM ,

Page 41: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Here the idea is to devise a TM that satisfy:

.

Description of___

42

2M

wMn

wMML

nn rejects if 0|10

accepts if *

2

Page 42: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

TM M2 is obtained as follows:

1. Start with M.

2. Add a filter in front of M such that for every input x:

2.1 If x is of the form 0n1n - accept. 2.2 Send w to M – If M accepts - accept.

Description of___

43

2M

Page 43: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

We start with a TM satisfying .

Description of___

44

2M

MLML 2

2M

M

rejectq

acceptq

startq

acceptnq

rejectnq

startnq

Page 44: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Add a filter to accept all inputs of form .

Description of___

45

1M

nnx 102M

M

rejectq

acceptq

startq

acceptnq

rejectnq

startnq

nn10filter

no

yes

w

nn10

Page 45: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

“On input x :

1. If x has the form , accept . 2. If x does not have this form, run M on w and accept if M accepts w . ”

Note: If M accept w then . If M does not accepts w then .

Proof

46

nn10

2M

0|102 nML nn

*2 ML

Page 46: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Now consider S:

“On input :1. Construct as described using .

2. Run R on .

3. If R accepts (Meaning ) - accept , otherwise ( ) - reject .”

Proof

47

S wM ,

2M wM ,

2M

*2 ML

0|102 nML nn

Page 47: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Consider

Theorem

is undecidable.

TM Equivalence is Undecidable

48

2121, MLMLMMEQTM

TMEQ

Page 48: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The proof is by reduction from . We have to show that if is decidable, so is .The idea is very intuitive: In order to check that a language of TM M is empty, as required by , we will check whether M is equivalent to a TM that rejects all its inputs.

Proof

49

TME

ML

TMEQ TME

TME

Page 49: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

S=“On input , where M is a TM:

1. Run R on input where is a TM that rejects all its inputs.

2. If R accepts – accept, otherwise – reject .

If R decides , S decides . Since is undecidable, so is . QED

Proof

50

M

1, MM 1M

TMEQ TME

TMEQ

TME

Page 50: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Mapping Reductions are the most common reductions in Computer Science. In this lecture we define mapping reductions and demonstrate the way in which they are used.

Mapping Reductions

51

Page 51: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The idea of a mapping reduction is very simple: If the instances (candidate elements) of one language, say A, are mapped to the instances of another language, say B, by a computable mapping M in a way that iff , then a decider for B can be used to devise a decider for A.

Mapping Reductions

52

AI BIM

Page 52: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Let A and B be two languages over . A function is a computable function if there exists a TM M such that for every , if M computes with input w it halts with on its tape.

Computable Functions

53

**: f

*

*w

wf

Page 53: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

1. Let m and n be natural numbers, let be a string encoding both m and n, and let be the string representing their sum. The function ,, is computable.

2. The function is a computable function.

Can you devise TM-s to compute f and g?

Examples of Computable Functions

54

nmnmf ,

rwwg

nm,

nm

Page 54: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

3. Let be an encoding of TM M and let be an encoding of another TM M’ satisfying:1. .2. TM M’ never makes two steps in the same

head direction.The function t defined below is computable:

Examples of Computable Functions

55

M

'MLML

TM any of ecodingnot is if

TM of ecoding an is if '

M

MMMMt

'M

Page 55: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Let A and B be two languages over . A computable function is a mapping reduction from A to B if for every it holds that follows: For each it holds that iff . The function f is called reduction of A to B. The arguments of the reduction are often called instances.

Mapping Reductions

56

**: f

*

AI

*I

BIf

Page 56: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

If there exists a mapping reduction from A to B, We say that A is mapping reducible to B and denote it by .

If language A is mapping reducible to language B, then a solution for B, can be used to derive a solution for A. This fact is made formal in the following theorem:

Mapping Reductions

57

BA m

Page 57: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

If and B is decidable, then A is decidable.

Theorem

58

BA m

Page 58: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

Let M be a decider for B and let f be the reduction from A to B. Consider TM N:

N=“On input w :

1. Compute .

2. Run M on and output whatever M outputs. “

Clearly N accepts iff . QED

Proof

59

wf

wf

Bw

Page 59: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

If and A is undecidable, then B is undecidable.

Corollary

60

BA m

Page 60: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The previous corollary is our main tool for proving undecidability.

Notice that in order to prove B undecidable we reduce from A which is known to be undecidable to B. The reduction direction is often a source of errors.

A similar tool is used in Complexity theory.

Discussion

61

Page 61: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

At the beginning of this lecture we looked at

and proved that it is undecidable.

Now, we prove this theorem once more by demonstrating a mapping reduction from to .

The Halting Problem Revisited

62

wMwMHALTTM on haltsTM that a is ,

TMHALTTMA

Page 62: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

The mapping reduction is presented by TM F :

F=“On input :

1. Construct TM M’ .

M’=“On input x:

1. Run M on x.

2. if M accepts accept.

3. If M rejects, enter a loop. “

2. Output . “

The Halting Problem Revisited

63

wM ,

wM ,'

Page 63: 1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli

What happens if the input does not contain a valid description of a TM?

By the specification of we know that in this case . Therefore in this case TM F should output any string s satisfying .

The Halting Problem Revisited

64

wM ,

TMA

TMAwM ,

TMHALTs