Top Banner
Fall 2006 Costas Busch - RPI 1 Reductions
89

Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Apr 01, 2015

Download

Documents

Kylee Oswald
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 1

Reductions

Page 2: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 2

Problem is reduced to problemX Y

If we can solve problem then we can solve problemX

Y

Page 3: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 3

Language is reduced tolanguage

There is a computable function (reduction) such that:f

BwfAw )(

A

B

Definition: A B

w )(wf

Page 4: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 4

Computable function : f

which for any string computes )(wfwThere is a deterministic Turing machineM

Recall:

Page 5: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 5

If: a: Language is reduced to b: Language is decidableThen: is decidable

Theorem:

Proof:

A BB

A

Basic idea:Build the decider for using the decider for

A

B

Page 6: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 6

Decider for B

Decider for A

compute

)(wf

)(wfw

accept

reject

accept

reject

(halt)

(halt)(halt)

(halt)

Inputstring

BwfAw )(

END OF PROOF

Reduction YES YES

NO NO

Page 7: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 7

Example:

}languages same the accept that

DFAs are and :,{ 2121 MMMMEQUALDFA

} language empty the

accepts that DFA a is :{

MMEMPTYDFA

is reduced to:

Page 8: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 8

Turing Machinefor reduction

DFADFA EMPTYMEQUALMM 21,

f21,MM M

MMf

21,

DFA

We only need to construct:

Page 9: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 9

21,MM M

MMf

21,

Let be the language of DFA Let be the language of DFA

1L

2L1M

2M

)()()( 2121 LLLLML

construct DFA by combining and so that:

M

DFA

1M 2M

Turing Machinefor reduction f

Page 10: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 10

)(21 MLLL

)()()( 2121 LLLLML

DFADFA EMPTYMEQUALMM 21,

Page 11: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 11

Decider

Decider for

compute M

Inputstring

DFAEQUAL

21,MM 21,MMf DFAEMPTY

YESYES

NONO

Reduction

Page 12: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 12

If: a: Language is reduced to b: Language is undecidableThen: is undecidable

Theorem (version 1):

A B

BA

(this is the negation of the previous theorem)

Proof:

Using the decider for build the decider forA

BSuppose is decidable B

Contradiction!

Page 13: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 13

Decider for B

Decider for A

compute

)(wf

)(wfw

accept

reject

accept

reject

(halt)

(halt)(halt)

(halt)

Inputstring

BwfAw )(

Reduction

END OF PROOF

If is decidable then we can build:B

CONTRADICTION!

YES YES

NO NO

Page 14: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 14

Observation:

In order to prove that some language is undecidablewe only need to reduce a known undecidable language to

B

BA

Page 15: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 15

State-entry problem

Input: M•Turing Machine•State q

Question: Does M

•Stringw

enter state qwhile processing input string ?w

Corresponding language:

} string input on state enters

that machine Turing a is :,,{

wq

MqwMSTATE TM

Page 16: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 16

Theorem:

(state-entry problem is unsolvable)

Proof: Reduce (halting problem) to (state-entry problem)

TMSTATE is undecidable

TMHALT

TMSTATE

Page 17: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 17

Decider for

YES

NO

wM,

state-entry problem decider

TMSTATEDeciderCompute

Reduction

wMf ,

wqM ,,ˆ

TMHALT

YES

NO

Given the reduction,if is decidable,then is decidable

TMSTATE

TMHALT

A contradiction!sinceis undecidable

Halting Problem Decider

TMHALT

Page 18: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 18

wM,Compute

Reduction

wMf ,wqM ,,ˆ

We only need to build the reduction:

TMHALTwM , TMSTATEqwM ,,ˆ

wMf ,

So that:

Page 19: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 19

Mqhalting

states

specialhalt state

Rxx ,

Construct from :M̂ M

A transition for every unused tape symbol of x

iq

iq

Page 20: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 20

M̂ halts on state qM halts

Mqhalting

states

specialhalt state

iq

Page 21: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 21

M̂ halts on state on inputq

M halts on input w

w

Therefore:

Equivalently:

END OF PROOF

TMHALTwM , TMSTATEqwM ,,ˆ

Page 22: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 22

Blank-tape halting problem

Input: MTuring Machine

Question: Does M halt when started with

a blank tape?

Corresponding language:

}tape blank on started when halts

that machin aTuring is :{ eMMBLANKTM

Page 23: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 23

Theorem:

(blank-tape halting problem is unsolvable)

Proof: Reduce (halting problem) to (blank-tape problem)

TMBLANK is undecidable

TMHALT

TMBLANK

Page 24: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 24

Decider for

YES

NO

wM,

blank-tape problem decider

DeciderCompute

Reduction

wMf ,

TMHALT

YES

NO

Given the reduction,If is decidable,then is decidableTMHALT

A contradiction!sinceis undecidable

Halting Problem Decider

TMHALT

TMBLANK

TMBLANK

Page 25: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 25

wM,Compute

Reduction

wMf ,M̂

We only need to build the reduction:

TMHALTwM , TMBLANKM ˆ

wMf ,

So that:

Page 26: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 26

no

yes

Write on tape w

Tape is blank?

Run

with input

Construct from :M̂ wM,

If halts then halt

M

w

M

Page 27: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 27

M̂ halts when started on blank tape

M halts on input

no

yesM

Write on tape w

Tape is blank?

Run

with inputw

w

Page 28: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 28

END OF PROOF

M̂ halts when started on blank tape

M halts on inputw

TMHALTwM , TMBLANKM ˆ

Equivalently:

Page 29: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 29

If: a: Language is reduced to b: Language is undecidableThen: is undecidable

Theorem (version 2):

A B

BA

Proof:

Using the decider for build the decider for A

B

Suppose is decidable B

Contradiction!

Then is decidableB

Page 30: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 30

Suppose is decidableB

Decider for B

s

accept

reject

(halt)

(halt)

Page 31: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 31

Suppose is decidableB

Decider for B

s

accept

reject

(halt)

(halt)

Then is decidableB(we have proven this in previous class)

reject

accept(halt)

(halt)

Decider for BNO YES

YES NO

Page 32: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 32

Decider for B

Decider for A

compute

)(wf

)(wfw

accept

reject

accept

reject

(halt)

(halt)(halt)

(halt)

Inputstring

BwfAw )(

Reduction

If is decidable then we can build:B

CONTRADICTION!

YES YES

NO NO

Page 33: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 33

Decider for B

Decider for A

compute

)(wf

)(wfw

accept

reject accept

reject

(halt)

(halt)(halt)

(halt)

Inputstring

BwfAw )(

Reduction

END OF PROOFCONTRADICTION!

Alternatively:

NO YES

YES NO

Page 34: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 34

Observation:

In order to prove that some language is undecidablewe only need to reduce some known undecidable languagetoor to B

(theorem version 1)

(theorem version 2)

B

AB

Page 35: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 35

Undecidable Problems for Turing Recognizable languages

• is empty?L

L• is regular?

L• has size 2?

Let be a Turing-acceptable language L

All these are undecidable problems

Page 36: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 36

• is empty?L

L• is regular?

L• has size 2?

Let be a Turing-acceptable language L

Page 37: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 37

Empty language problem

Input: MTuring Machine

Question: Is )(ML empty?

Corresponding language:

} language empty the accepts

that machine aTuring is :{

MMEMPTYTM

?)( ML

Page 38: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 38

Theorem:

(empty-language problem is unsolvable)

is undecidable

Proof: Reduce (membership problem) to

(empty language problem)

TMA

TMEMPTY

TMEMPTY

Page 39: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 39

Decider for

YES

NO

wM,

empty problem decider

DeciderCompute

Reduction

wMf ,

M̂YES

NO

Given the reduction,if is decidable,then is decidable

membership problem decider

TMA

TMATMEMPTY

TMEMPTY

A contradiction!sinceis undecidable

TMA

Page 40: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 40

wM,Compute

Reduction

wMf ,M̂

We only need to build the reduction:

TMATwM , TMEMPTYM ˆ

wMf ,

So that:

Page 41: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 41

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

sTape of M̂

input string

accepts ?

troys

Construct from :M̂ wM,

Page 42: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 42

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

s

accepts ?

troys

Tape of M̂

Page 43: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 43

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

s

accepts ?

w

troys

Tape of M̂

Page 44: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 44

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

s

accepts ?

During this phase this area is not touched

working area of

wM

troys

Page 45: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 45

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

s

accepts ?

waltered

Simply check if entered an accept stateM

troys

Page 46: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 46

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

s

accepts ?

Now check input string

troys

Page 47: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 47

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

saccepts ?

The only possible accepted string

troys

t r o y

Page 48: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 48

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

saccepts ?

troys

accepts }{)ˆ( troyMLM w

does notaccept

M w )ˆ(ML

Page 49: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 49

Therefore:

acceptsM w )ˆ(ML

Equivalently:

TMATwM , TMEMPTYM ˆ

END OF PROOF

Page 50: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 50

• is empty?L

L• is regular?

L• has size 2?

Let be a Turing-acceptable language L

Page 51: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 51

Regular language problem

Input: MTuring Machine

Question: Is )(ML a regular language?

Corresponding language:

language} regular a accepts

that machine aTuring is :{ MMREGULARTM

Page 52: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 52

Theorem:

(regular language problem is unsolvable)

is undecidable

Proof: Reduce (membership problem) to (regular language problem)

TMA

TMREGULAR

TMREGULAR

Page 53: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 53

Decider for

YES

NO

wM,

regular problem decider

DeciderCompute

Reduction

wMf ,

M̂YES

NO

Given the reduction,If is decidable,then is decidable

membership problem decider

TMA

TMA

TMREGULAR

A contradiction!sinceis undecidable

TMATMREGULAR

Page 54: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 54

wM,Compute

Reduction

wMf ,M̂

We only need to build the reduction:

TMATwM , TMREGULARM ˆ

wMf ,

So that:

Page 55: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 55

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If has the form

s

sTape of M̂

input string

accepts ?

nnba

Construct from :M̂ wM,

s

Page 56: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 56

skip inputstring s

write on tape

run

on input

w Mw

M w

yesaccepts ?

accepts }0:{)ˆ( nbaML nnM w

does notaccept

M w )ˆ(ML

then accept

If has the form

s

nnbas

not regular

regular

Page 57: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 57

Therefore:

acceptsM w )ˆ(ML

Equivalently:

TMATwM , TMREGULARM ˆ

END OF PROOF

is not regular

Page 58: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 58

• is empty?L

L• is regular?

L• has size 2?

Let be a Turing-acceptable language L

Page 59: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 59

Does have size 2?

Size2 language problem

Input: MTuring Machine

Question: )(ML

Corresponding language:

strings} two exactly accepts

that machine aTuring is :{2 MMSIZE TM

?2|)(| ML

(accepts exactly two strings?)

Page 60: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 60

Theorem:

(regular language problem is unsolvable)

is undecidable

Proof: Reduce (membership problem) to (size 2 language problem)

TMA

TMSIZE 2

TMSIZE 2

Page 61: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 61

Decider for

YES

NO

wM,

size2 problem decider

DeciderCompute

Reduction

wMf ,

M̂YES

NO

Given the reduction,If is decidable,then is decidable

membership problem decider

TMA

TMA

A contradiction!sinceis undecidable

TMA

TMSIZE 2

TMSIZE 2

Page 62: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 62

wM,Compute

Reduction

wMf ,M̂

We only need to build the reduction:

TMATwM , TMSIZEM 2ˆ

wMf ,

So that:

Page 63: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 63

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

sTape of M̂

input string

accepts ?

Construct from :M̂ wM,

},{ albanytroys

Page 64: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 64

skip inputstring s

write on tape

run

on input

w Mw

M w

yesaccepts ?

accepts },{)ˆ( albanytroyML M w

does notaccept

M w )ˆ(ML

2 strings

0 strings

then accept

If

s

},{ albanytroys

Page 65: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 65

Therefore:

acceptsM w )ˆ(ML

Equivalently:

TMATwM , TMSIZEM 2ˆ

END OF PROOF

has size 2

Page 66: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 66

RICE’s Theorem

• is empty?L

L• is regular?

L• has size 2?

Undecidable problems:

This can be generalized to all non-trivialproperties of Turing-acceptable languages

Page 67: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 67

Non-trivial property:

A property possessed by some Turing-acceptable languages but not all

: is empty?LExample:

L

}{troyL YES

NO

},{ albanytroyL NO

P

1P

Page 68: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 68

: is regular?

More examples of non-trivial properties:

L

}0:{ nbaL nn

YES

NO

L2P

}0:{ naL nYES

: has size 2?L3PL

}{troyL },{ albanytroyL

NO

YES

NO

Page 69: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 69

Trivial property:

A property possessed by ALL Turing-acceptable languages

P

: has size at least 0?LExamples: 4PTrue for all languages

: is accepted by some Turing machine?

L5P

True for allTuring-acceptable languages

Page 70: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 70

We can describe a property as the setof languages that possess the property

P

: is empty?LExample:

L

}{troyL YES

NO

},{ albanytroyL NO

P

}{P

If language has property then PL PL

Page 71: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 71

: has size 1?LP

}{a

},{ a

NO

NO

YES

Example: Suppose alphabet is }{a

}{aa},{ aa

}{aaa}{},{ aaa

}},{},{},{},{},{{ aaaaaaaaaaP

},,{ aaaNO },,{ aaaaaaaaa

Page 72: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 72

Non-trivial property problem

Does have the non-trivial property ?

Input: MTuring Machine

Question: )(ML

Corresponding language:

})( is, that , property

trivial-non the has )( that such

machine aTuring is :{

PMLP

ML

MMPROPERTYTM

?)( PML P

Page 73: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 73

Rice’s Theorem: TMPROPERTY is undecidable

(the non-trivial property problem is unsolvable)

Proof: Reduce (membership problem)

to

TMA

TMPROPERTY TMPROPERTYor

Page 74: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 74

We examine two cases:

Case 1:

Case 2:

P

P

Examples: : is empty?)(MLP

: is regular?)(MLP

: has size 2?)(MLPExample:

Page 75: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 75

Let be the Turing machine thataccepts

Case 1: P

Since is non-trivial, there is a Turing-acceptable languagesuch that:

PX

PX

XM

X

Page 76: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 76

Reduce (membership problem) to

TMA

TMPROPERTY

Page 77: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 77

Decider for

YES

NO

wM,

Non-trivial property problem decider

DeciderCompute

Reduction

wMf ,

M̂YES

NO

Given the reduction,if is decidable,then is decidable

membership problem decider

TMA

TMA

A contradiction!sinceis undecidable

TMA

TMPROPERTY

TMPROPERTY

Page 78: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 78

wM,Compute

Reduction

wMf ,M̂

We only need to build the reduction:

TMATwM , TMPROPERTYM ˆ

wMf ,

So that:

Page 79: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 79

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

sTape of M̂

input string

accepts ?

Construct from :M̂ wM,

Xs

Page 80: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 80

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

saccepts ?

Xs

For this phase we can run machinethat accepts , with input string

XMX s

Page 81: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 81

skip inputstring s

write on tape

run

on input

w Mw

M w

yesaccepts ?

accepts XML )ˆ(M w

does notaccept

M w )ˆ(ML

P

P

then accept

If

s

Xs

Page 82: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 82

Therefore:

acceptsM w PML )ˆ(

Equivalently:

TMATwM , TMPROPERTYM ˆ

Page 83: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 83

Let be the Turing machine thataccepts

Case 2: P

Since is non-trivial, there is a Turing-acceptable languagesuch that:

PX

PX

XM

X

Page 84: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 84

Reduce (membership problem) to

TMA

TMPROPERTY

Page 85: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 85

Decider for

YES

NO

wM,

Non-trivial property problem decider

DeciderCompute

Reduction

wMf ,

M̂YES

NO

Given the reduction,if is decidable,then is decidable

membership problem decider

TMA

TMA

A contradiction!sinceis undecidable

TMA

TMPROPERTY

TMPROPERTY

Page 86: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 86

wM,Compute

Reduction

wMf ,M̂

We only need to build the reduction:

TMATwM , TMPROPERTYM ˆ

wMf ,

So that:

Page 87: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 87

skip inputstring s

write on tape

run

on input

w Mw

M w

yes

then accept

If

s

sTape of M̂

input string

accepts ?

Construct from :M̂ wM,

Xs

Page 88: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 88

skip inputstring s

write on tape

run

on input

w Mw

M w

yesaccepts ?

accepts XML )ˆ(M w

does notaccept

M w )ˆ(ML

P

P

then accept

If

s

Xs

Page 89: Fall 2006Costas Busch - RPI1 Reductions. Fall 2006Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.

Fall 2006 Costas Busch - RPI 89

Therefore:

acceptsM w PML )ˆ(

Equivalently:

TMATwM , TMPROPERTYM ˆ

END OF PROOF