CS3102 Theory of Computation www.cs.virginia.edu/~njb2b/cstheory/s2020 Warm up: How might we try to show that this language is not computable: ๐ฝ๐๐๐๐๐๐ข๐ = ๐ฅ ๐ โณ ๐ฅ is infinite}
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. ๐ ๐๐๐ ) 2
Proving Other Problems are Uncomputable โข Reduction โ Convert some problem into a known uncomputable one (using only computable steps) โ Show how you can use a solution to one problem to help you to solve another 3
Non-Computable Problems 4
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 5
Example: ๐บ๐ฝ๐๐ฝ๐๐น โข ๐บ๐ฝ๐๐ฝ๐๐น ๐ฅ = 1 if ๐ โณ ๐ฅ is finite is infinite 0 if ๐ โณ ๐ฅ โข To show ๐บ๐ฝ๐๐ฝ๐๐น is uncomputable โ Show how to use a TM for ๐บ๐ฝ๐๐ฝ๐๐น to solve ๐ผ๐ต๐๐ โข ๐บ๐ฝ๐๐ฝ๐๐น โฅ ๐ผ๐ต๐๐ โข ๐ผ๐ต๐๐ reduces to ๐บ๐ฝ๐๐ฝ๐๐น 6
๐บ๐ฝ๐๐ฝ๐๐น Reduction Problem we think is impossible Problem know is impossible ๐บ๐ฝ๐๐ฝ๐๐น ๐ผ๐ต๐๐ ๐ถ ๐ต Build (but donโt run) ๐ ๐ฅ๐ฆ Is L โณ ๐ฅ finite? Does โณ(๐ฅ) halt on input ๐ฆ ? Assume Give ๐ ๐ฅ๐ฆ as input to ๐ ๐๐๐๐๐ข๐ computes ๐บ๐ฝ๐๐ฝ๐๐น ๐ ๐ผ๐ต๐๐ computes ๐ผ๐ต๐๐ ๐ ๐๐๐๐๐ข๐ answer opposite Reduction 7
Whatโs the Language of ๐ ๐ฅ๐ฆ ? โข If โณ(๐ฅ)(๐ฆ) halts: Build this machine: ๐ ๐ฅ๐ฆ : โ ๐ ๐ฅ๐ฆ always returns 1 1) run โณ(๐ฅ)(๐ฆ) โ ๐ ๐ ๐ฅ๐ฆ = ฮฃ โ (all strings) 2) return 1 โ ๐ ๐ ๐ฅ๐ฆ is infinite โข If โณ(๐ฅ)(๐ฆ) doesnโt halt: โ ๐ ๐ฅ๐ฆ gets โstuckโ in step 1 and never returns โ ๐ ๐ ๐ฅ๐ฆ = โ โ ๐ ๐ ๐ฅ๐ฆ = 0 8
Using ๐บ๐ฝ๐๐ฝ๐๐น to build ๐ผ๐ต๐๐ Assume we have ๐ ๐บ๐ฝ๐๐ฝ๐๐น ๐ต ๐ฎ๐ฑ๐ถ๐ฑ๐ผ๐ญ which computes ๐บ๐ฝ๐๐ฝ๐๐น : ๐ โณ ๐ฅ is/isnโt ๐ฅ Is L โณ ๐ฅ finite? finite We could then build ๐ ๐ผ๐ต๐๐ which computes ๐ผ๐ต๐๐ like this: ๐ต ๐ฐ๐ฉ๐ด๐ผ Does โณ ๐ฅ ๐ฆ halt? ๐ฅ โณ ๐ฅ 1 ! = 1 ๐ต ๐ฎ๐ฑ๐ถ๐ฑ๐ผ๐ญ Build this machine: ๐ ๐ฅ๐ฆ : Is L ๐ ๐ฅ๐ฆ finite? 1) run โณ(๐ฅ)(๐ฆ) ๐ฆ 2) return 1 9
Showing ๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น is not computable โข Use _____ to build _____. 10
๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น Reduction ๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น ๐บ๐ฝ๐๐ฝ๐๐น ๐ถ ๐ต Is L โณ ๐ฅ Is L โณ ๐ฅ infinite? finite? Assume ๐ โ computes ๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น ๐ ๐บ๐ฝ๐๐ฝ๐๐น computes ๐บ๐ฝ๐๐ฝ๐๐น Reduction 11
๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น Reduction ๐บ๐ฝ๐๐ฝ๐๐น ๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น ๐ถ ๐ต Is L โณ ๐ฅ finite? Is L โณ ๐ฅ infinite? Assume ๐ ๐บ๐ฝ๐๐ฝ๐๐น computes ๐บ๐ฝ๐๐ฝ๐๐น ๐ โ computes ๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น Reduction 12
Using ๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น to build ๐บ๐ฝ๐๐ฝ๐๐น Assume we have ๐ โ which ๐ต โ computes ๐ฝ๐๐บ๐ฝ๐๐ฝ๐๐น : ๐ โณ ๐ฅ is/isnโt ๐ฅ Is L โณ ๐ฅ infinite? infinite We could then build ๐ ๐บ๐ฝ๐๐ฝ๐๐น which computes ๐บ๐ฝ๐๐ฝ๐๐น like this: ๐ต ๐ฎ๐ฑ๐ถ๐ฑ๐ผ๐ญ Is L โณ ๐ฅ finite? ๐ฅ ๐ต โ ๐ โณ ๐ฅ Is L โณ ๐ฅ infinite? is/isnโt finite ๐ฆ 13
Language ๐๐๐๐๐๐ โข ๐๐๐๐๐๐ = ๐ฅ ๐ โณ ๐ฅ is not regular} โข We will show this is not computable by using ๐๐๐๐๐๐ to compute ๐ผ๐ต๐๐ โข Idea: given an input for ๐ผ๐ต๐๐ , ๐ฅ and ๐ฆ , build a machine ๐ ๐ฅ๐ฆ such that ๐(๐ ๐ฅ๐ฆ ) is regular if and only if โณ(๐ฅ)(๐ฆ) runs forever. 14
Building ๐ ๐ฅ๐ฆ Build this machine: ๐ ๐ฅ๐ฆ (๐ง): 1) run โณ(๐ฅ)(๐ฆ) โข If โณ(๐ฅ)(๐ฆ) halts: 2) return ๐๐๐(๐ง) โ ๐ ๐ฅ๐ฆ returns 1 if ๐๐๐ ๐ง = 1 โ ๐ ๐ ๐ฅ๐ฆ = ๐๐๐(๐ง) , which is not regular โข If โณ(๐ฅ)(๐ฆ) doesnโt halt: โ ๐ ๐ฅ๐ฆ gets โstuckโ in step 2 and never returns 1 โ ๐ ๐ ๐ฅ๐ฆ = โ , which is regular 15
Using ๐๐๐๐๐๐ to build ๐ผ๐ต๐๐ Assume we have ๐ ๐๐ which ๐ต ๐ถ๐บ computes ๐๐๐๐๐๐ : ๐ โณ ๐ฅ is/isnโt ๐ฅ Is L โณ ๐ฅ non- non-regular regular? We could then build ๐ ๐ผ๐ต๐๐ which computes ๐ผ๐ต๐๐ like this: ๐ต ๐ฐ๐ฉ๐ด๐ผ Does โณ ๐ฅ ๐ฆ halt? ๐ฅ โณ(๐ฅ)(๐ฆ) ๐ต ๐ถ๐บ Build this machine: ๐ ๐ฅ๐ฆ (๐ง): does/doesnโt Is L ๐ ๐ฅ๐ฆ non- 1) run โณ(๐ฅ)(๐ฆ) ๐ฆ halt regular? 2) return ๐๐๐(๐ง) 16
Language ๐๐๐๐๐๐ข๐ก101 โข ๐๐๐๐๐๐ข๐ก101 = ๐ฅ โณ ๐ฅ 101 = 0} โข We will show this is not computable by using ๐๐๐๐๐๐ข๐ก101 to compute ๐ผ๐ต๐๐ โข Idea: given an input for ๐ผ๐ต๐๐ , ๐ฅ and ๐ฆ , build a machine ๐ ๐ฅ๐ฆ such that 101 โ ๐(๐ ๐ฅ๐ฆ ) if and only if โณ(๐ฅ)(๐ฆ) runs forever. 17
Building ๐ ๐ฅ๐ฆ Build this machine: ๐ ๐ฅ๐ฆ (๐ง): 1) run โณ(๐ฅ)(๐ฆ) โข If โณ(๐ฅ)(๐ฆ) halts: 2) return ๐ง == 101 โ ๐ ๐ฅ๐ฆ returns 1 if ๐ง == 101 โ ๐ ๐ ๐ฅ๐ฆ = {101} , so it does not reject 101 โข If โณ(๐ฅ)(๐ฆ) doesnโt halt: โ ๐ ๐ฅ๐ฆ gets โstuckโ in step 2 and never returns 1 โ ๐ ๐ ๐ฅ๐ฆ = โ , so it does reject 101 18
Using ๐๐๐๐๐๐ข๐ก101 to build ๐ผ๐ต๐๐ Assume we have ๐ ๐101 ๐ต ๐บ๐๐๐ which computes ๐๐๐๐๐๐ : โณ(๐ฅ) does/doesnโt ๐ฅ Does โณ(๐ฅ) reject reject 101 101? We could then build ๐ ๐ผ๐ต๐๐ which computes ๐ผ๐ต๐๐ like this: ๐ต ๐ฐ๐ฉ๐ด๐ผ Does โณ ๐ฅ ๐ฆ halt? ๐ฅ โณ(๐ฅ)(๐ฆ) ๐ต ๐บ๐๐๐ Build this machine: ๐ ๐ฅ๐ฆ (๐ง): does/doesnโt Does โณ(๐ฅ) reject 1) run โณ(๐ฅ)(๐ฆ) ๐ฆ halt 101? 2) return ๐ง == 101 19
Sematic Property โข Turing machines ๐, ๐โฒ are Functionally Equivalent if โ๐ฆ โ ฮฃ โ , ๐ ๐ฆ == ๐ ๐ฆ โฒ โ i.e. they compute the same function/language โข A Semantic Property of a Turing machine is one that depends only on the input/output behavior of the machine โ Formally, if ๐ is semantic, then for machine ๐, ๐โฒ that are functionally equivalent, ๐ ๐ == ๐ ๐ โฒ โ If ๐, ๐โฒ have the same input/output behavior, and ๐ is a semantic property, then either bother ๐ and ๐โฒ have property ๐ , or neither of them do. 20
Examples โข These properties are Semantic: โ Is the language of this machine finite? โ Is the language of this machine Regular? โ Does this machine reject 101? โ Does this machine return 1001 for input 001? โ Does this machine only ever return odd numbers? โ Is the language of this machine computable? โข These properties are not Semantic: โ Does this machine ever overwrite cell 204 of its tape? โ Does this machine use more than 3102 cells of its tape on input 101? โ Does this machine take at least 2020 transitions for input ๐ ? โ Does this machine ever overwrite the ๐ผ symbol? 21
Riceโs Theorem โข For any Semantic property ๐ of Turing Machines, either: โ Every Turing machine has property ๐ ๐ is โtrivialโ โ No Turing machines have property ๐ โ ๐ is uncomputable โข In other words: โ If ๐ is semantic, and computable, then one of these two machines computes it: Return 1 Return 0 22
Proof of Riceโs Theorem Let ๐ be a semantic property of a Turing machine โข Assume ๐ โ (a machine whose language is โ ) has property ๐ (otherwise โข substitute ยฌ๐ , then answer opposite) Let ๐ ๐บ๐ต๐๐๐น be a machine that doesnโt have property ๐ โข โข Idea: โ If โณ(๐ฅ)(๐ฆ) halts, ๐ ๐ ๐ฅ๐ฆ = ๐ ๐ ๐บ๐ต๐๐๐น โ If โณ(๐ฅ)(๐ฆ) doesnโt halt, ๐ ๐ ๐ฅ๐ฆ = L ๐ โ = โ โ ๐(๐ ๐ฅ๐ฆ ) has property ๐ if and only if โณ ๐ฅ ๐ฆ runs forever Build this machine: ๐ ๐ฅ๐ฆ (๐ง): 1) run โณ(๐ฅ)(๐ฆ) 2) return ๐ ๐บ๐๐๐ก๐ (๐ง) 23
Using ๐ to build ๐ผ๐ต๐๐ Assume we have ๐ ๐ which ๐ต ๐ธ computes ๐ : โณ(๐ฅ) does/doesnโt ๐ฅ Does โณ(๐ฅ) have have property ๐ property ๐ ? We could then build ๐ ๐ผ๐ต๐๐ which computes ๐ผ๐ต๐๐ like this: ๐ต ๐ฐ๐ฉ๐ด๐ผ Does โณ ๐ฅ ๐ฆ halt? ๐ฅ โณ(๐ฅ) ๐ต ๐ธ Build this machine: ๐ ๐ฅ๐ฆ (๐ง): does/doesnโt Does โณ(๐ฅ) have 1) run โณ(๐ฅ)(๐ฆ) ๐ฆ have property ๐ property ๐ ? 2) return ๐ ๐บ๐๐๐ก๐ (๐ง) 24
Recommend
More recommend