CS3102 Theory of Computation www.cs.virginia.edu/~njb2b/cstheory/s2020 Warm up: Recall: โข ๐ต๐ท๐ท๐น๐๐๐ ๐ฅ, ๐ฆ = 1 if ๐ฅ (as a TM description, call it โณ ๐ฅ ) accepts ๐ฆ , 0 otherwise Why would ๐ต๐ท๐ท๐น๐๐๐ be a useful function to implement?
Last Time โข An uncomputable problem โ ๐ต๐ท๐ท๐น๐๐๐ ๐ฅ, ๐ฆ = 1 if ๐ฅ (as a TM description, call it โณ ๐ฅ ) accepts ๐ฆ , 0 otherwise โ First attempt to solve: โข Try running โณ(๐ฅ) , see what happens โ Challenge: โณ(๐ฅ) could not accept for two reasons โข โณ ๐ฅ halts and returns 0 โข โณ ๐ฅ runs forever (how long do we wait to see?) 2
Proving ๐ต๐ท๐ท๐น๐๐๐ is uncomputable โข Proof by contradiction: โ Assume (toward contradiction) that there is an always- halting Turing machine to compute ๐ต๐ท๐ท๐น๐๐๐ โ Show that we could use that Turing machine to build an impossible Turing machine โข Whatโs the impossible machine? โ ๐๐๐๐๐๐๐๐๐๐ข = The set of all Turing machine descriptions that donโt accept themselves โ ๐ฆ โ ๐๐๐๐๐๐๐๐๐๐ข if and only if โณ ๐ฆ ๐ฆ = 0 3
Using ๐ต๐ท๐ท๐น๐๐๐ to build ๐๐๐๐๐๐๐๐๐๐ข Assume we have ๐ ๐๐๐ ๐ฅ ๐ต ๐๐ ๐ which computes ๐ต๐ท๐ท๐น๐๐๐ : Does โณ ๐ฅ ๐ฆ = 1? โณ ๐ฅ ๐ฆ == 1? ๐ฆ We could then build ๐ ๐ก๐ which computes ๐๐๐๐๐๐๐๐๐๐ข like this: ๐ต ๐๐ Does โณ ๐ฅ ๐ฅ = 0? ๐ต ๐๐ ๐ ๐ฅ โณ ๐ฅ 1 == 0? Does โณ ๐ฅ ๐ฆ = 1? 4
Can ๐ ๐๐ exist? Let ๐ฅ ๐๐ be the description of ๐ ๐๐ โข โ โณ ๐ฅ ๐๐ = ๐ ๐๐ What should be ๐ ๐๐ ๐ฅ ๐๐ ? โข โ If ๐ ๐๐ ๐ฅ ๐๐ = 1 : โข Since ๐ ๐๐ computes ๐๐๐๐๐๐๐๐๐๐ข we conclude that ๐ฅ ๐๐ is rejected by whatever machine it describes. โข Since ๐ฅ ๐๐ describes ๐ ๐๐ , it must have been that ๐ ๐๐ ๐ฅ ๐๐ = 0 โ If ๐ ๐๐ ๐ฅ ๐๐ = 0 : โข Since ๐ ๐๐ computes ๐๐๐๐๐๐๐๐๐๐ข we conclude that ๐ฅ ๐๐ is accepted by whatever machine it describes. โข Since ๐ฅ ๐ก๐ describes ๐ ๐๐ , it must have been that ๐ ๐๐ ๐ฅ ๐๐ = 1 โ Thereโs no answer that makes sense! Conclusion: ๐ ๐๐ canโt be an always -halting Turing machine, so ๐ ๐๐๐ โข canโt exist 5
How to show things arenโt computable 1. Ask โcan I have an always -halting Turing machine ๐ ๐ for language/function/problem ๐ ?โ 2. Show that, if ๐ ๐ exists, it can be used to make an impossible machine ๐ ๐๐๐ How do we know a machine is impossible? Option 1: It contradicts itself (e.g. ๐ ๐๐ ) Option 2: Someone has done this before (e.g. ๐ ๐๐๐ ) 6
Proving Other Problems are Uncomputable โข Reduction โ Convert some problem into a known uncomputable one (using only computable steps) 7
Proof by Reduction Shows how two different problems relate to each other
Reduction Proofs Opening a Lighting a door fire ๐ถ ๐ต reduces to Alcohol, wood, Keg cannon matches ๐ ๐ battering ram can be used to make that can solve B that can solve A ๐ฉ is not a harder problem than ๐ช ๐ฉ โค ๐ช The name โreducesโ is confusing: it is in the opposite direction of the making
Proof of Impossibility by Reduction 1. X isnโt possible ๐ (e.g., X = some way to open the door) 2. Assume Y is possible ๐ ( Y = some way to light a fire) ๐ ๐ 3. Show how to use Y to perform X . 4. X isnโt possible, but Y could be used to perform X conclusion: Y must not be possible either
Proof of Impossibility by Reduction 1. Take ๐ that does not exist. ๐ e.g., ๐ = Some TM that computes ๐ต๐ท๐ท๐น๐๐๐ 2. Assume ๐ exists. ๐ ๐ = Some TM that computes ๐ถ ๐ 3. Show how to use ๐ to perform ๐ . ๐ 4. ๐ doesnโt exist, but ๐ could be used to make ๐ conclusion: ๐ must not exist either, so ๐ถ is โข impossible
MacGyverโs Reduction Problem we think is impossible Problem know is impossible Lighting a fire Opening a door ๐ถ ๐ต Aim duct at door, insert keg If Solution for ๐ฉ Solution for ๐ช Keg cannon battering ram Alcohol, wood, matches Put fire under the Keg Reduction 12
Converse? ๐ฉ reduces to ๐ช ๐ ๐ can be used to make that can solve ๐ช that can solve ๐ฉ ๐ฉ is not harder to solve than ๐ช (Lighting a fire) (opening a door) ๐ฉ โค ๐ช Does this mean ๐ช is equally as hard as ๐ฉ ? ๐ฉ = ๐ช No! Solving ๐ is only one way to solve ๐ There may be an easier way
Common Reduction Traps โข Be careful: the direction matters a great deal โ Using a solver for ๐ถ to solve ๐ต shows ๐ต is not harder than ๐ถ ๐ต ๐ถ ___ Reduces to ___ โข The transformation must use only things you can do : โ Otherwise it may be that ๐ถ exists, but some other step doesnโt ! โ Example: โข A witch/wizard could open the door by waving a wand and casting a magic spell โข MacGyver canโt do magic, and is in a room that cannot be opened โข Can we conclude that MacGyver canโt wave a wand?
What โCan Doโ Means โข Tools used in a reduction are limited by what you are proving โข Undecidability: โ You are proving something about all TMs: โ The transformation โcan doโ things a terminating TM โcan doโ Spoiler alert! โข Complexity: โ You are proving something about time required: โ The time it takes to do the transformation is limited
Example โข ๐ผ๐ต๐๐ ๐ฅ, ๐ฆ = 1 if โณ ๐ฅ ๐ฆ halts ๐ฆ runs forever 0 if โณ ๐ฅ โ Does the machine halt on this input? โข To show ๐ผ๐ต๐๐ is uncomputable: โ Show how to use a TM for ๐ผ๐ต๐๐ to solve an uncomputable problem โข Show ๐ผ๐ต๐๐ โฅ ๐ต๐ท๐ท๐น๐๐๐ โข Show ๐ต๐ท๐ท๐น๐๐๐ reduces to ๐ผ๐ต๐๐ 16
๐ผ๐ต๐๐ Reduction Problem we think is impossible Problem know is impossible ๐ผ๐ต๐๐ ๐ต๐ท๐ท๐น๐๐๐ ๐ถ Does โณ(๐ฅ) ๐ต Does โณ(๐ฅ) halt on input ๐ฆ ? accept ๐ฆ ? Assume ๐ โ๐๐๐ข computes ๐ผ๐ต๐๐ ๐ ๐๐๐ computes ๐ต๐ท๐ท๐น๐๐ Reduction 17
Using ๐ผ๐ต๐๐ to build ๐ต๐ท๐ท๐น๐๐๐ Assume we have ๐ ๐ผ๐ต๐๐ ๐ฅ ๐ต ๐ฐ๐ฉ๐ด๐ผ which computes ๐ผ๐ต๐๐ : โณ ๐ฅ ๐ฆ Does โณ ๐ฅ ๐ฆ halt? does/doesnโt halt ๐ฆ We could then build ๐ ๐๐๐ which computes ๐ต๐ท๐ท๐น๐๐๐ like this: ๐ต ๐๐ ๐ Does โณ ๐ฅ ๐ฅ = 1? If it halts: Return โณ(๐ฅ) ๐ฅ ๐ต ๐ฐ๐ฉ๐ด๐ผ โณ ๐ฅ 1 == 1 Does โณ ๐ฅ ๐ฆ halt? ๐ฆ If it doesnโt halt: Return 0 18
๐ผ๐ต๐๐ Reduction Problem we think is impossible Problem know is impossible ๐ผ๐ต๐๐ ๐ต๐ท๐ท๐น๐๐๐ ๐ถ Does โณ(๐ฅ) ๐ต Give ๐ฅ, ๐ฆ as inputs to ๐ผ๐ต๐๐ Does โณ(๐ฅ) halt on input ๐ฆ ? accept ๐ฆ ? Assume If โณ ๐ฅ ๐ฆ halts, return โณ ๐ฅ ๐ฆ ๐ โ๐๐๐ข computes ๐ผ๐ต๐๐ ๐ ๐๐๐ computes ๐ต๐ท๐ท๐น๐๐ Else return 0 Reduction 19
Conclusion โข ๐ต๐ท๐ท๐น๐๐๐ is not computable โข If ๐ผ๐ต๐๐ was computable, an implementation could be used to compute ๐ต๐ท๐ท๐น๐๐๐ โข So it must be that ๐ผ๐ต๐๐ is not computable 20
Example: ๐บ๐ฝ๐๐ฝ๐๐น โข ๐บ๐ฝ๐๐ฝ๐๐น ๐ฅ = 1 if ๐ โณ ๐ฅ is finite is infinite 0 if ๐ โณ ๐ฅ โข To show ๐บ๐ฝ๐๐ฝ๐๐น is uncomputable โ Show how to use a TM for ๐บ๐ฝ๐๐ฝ๐๐น to solve ๐ผ๐ต๐๐ โข ๐บ๐ฝ๐๐ฝ๐๐น โฅ ๐ผ๐ต๐๐ โข ๐ผ๐ต๐๐ reduces to ๐บ๐ฝ๐๐ฝ๐๐น 21
๐บ๐ฝ๐๐ฝ๐๐น Reduction Problem we think is impossible Problem know is impossible ๐บ๐ฝ๐๐ฝ๐๐น ๐ผ๐ต๐๐ ๐ถ ๐ต Is L โณ ๐ฅ finite? Does โณ(๐ฅ) halt on input ๐ฆ ? Assume ๐ ๐๐๐๐๐ข๐ computes ๐บ๐ฝ๐๐ฝ๐๐น ๐ ๐ผ๐ต๐๐ computes ๐ผ๐ต๐๐ Reduction 22
Using ๐ผ๐ต๐๐ to build ๐ต๐ท๐ท๐น๐๐๐ Assume we have ๐ ๐บ๐ฝ๐๐ฝ๐๐น ๐ต ๐ฎ๐ฑ๐ถ๐ฑ๐ผ๐ญ which computes ๐บ๐ฝ๐๐ฝ๐๐น : ๐ โณ ๐ฅ is/isnโt ๐ฅ Is L โณ ๐ฅ finite? We could then build ๐ ๐ผ๐ต๐๐ finite which computes ๐ผ๐ต๐๐ like this: ๐ต ๐ฐ๐ฉ๐ด๐ผ Does โณ ๐ฅ ๐ฅ = 1? ๐ฅ โณ ๐ฅ 1 == 1 ๐ต ๐ฎ๐ฑ๐ถ๐ฑ๐ผ๐ญ Build this machine: ๐ ๐ฅ๐ฆ : Is L ๐ ๐ฅ๐ฆ finite? 1) run โณ(๐ฅ)(๐ฆ) ๐ฆ 2) return 1 23
Whatโs the Language of ๐ ๐ฅ๐ฆ ? โข If โณ(๐ฅ)(๐ฆ) halts: Build this machine: ๐ ๐ฅ๐ฆ : โ ๐ ๐ฅ๐ฆ always returns 1 1) run โณ(๐ฅ)(๐ฆ) โ ๐ ๐ ๐ฅ๐ฆ = ฮฃ โ 2) return 1 โ ๐ ๐ ๐ฅ๐ฆ is infinite โข If โณ(๐ฅ)(๐ฆ) doesnโt halt: โ ๐ ๐ฅ๐ฆ gets โstuckโ in step 1 and never returns โ ๐ ๐ ๐ฅ๐ฆ = โ โ ๐ ๐ ๐ฅ๐ฆ = 0 24
Recommend
More recommend