cs3102 theory of
play

CS3102 Theory of Computation - PowerPoint PPT Presentation

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 arent


  1. 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}

  2. 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

  3. 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

  4. Non-Computable Problems 4

  5. 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

  6. 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

  7. ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น 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

  8. 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

  9. 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

  10. Showing ๐ฝ๐‘‚๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น is not computable โ€ข Use _____ to build _____. 10

  11. ๐ฝ๐‘‚๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น Reduction ๐ฝ๐‘‚๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐ถ ๐ต Is L โ„ณ ๐‘ฅ Is L โ„ณ ๐‘ฅ infinite? finite? Assume ๐‘ โˆž computes ๐ฝ๐‘‚๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐‘ ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น computes ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น Reduction 11

  12. ๐ฝ๐‘‚๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น Reduction ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐ฝ๐‘‚๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐ถ ๐ต Is L โ„ณ ๐‘ฅ finite? Is L โ„ณ ๐‘ฅ infinite? Assume ๐‘ ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น computes ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐‘ โˆž computes ๐ฝ๐‘‚๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น Reduction 12

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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

  20. 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

  21. 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

  22. 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

  23. 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

  24. 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