cs3102 theory of
play

CS3102 Theory of Computation - PowerPoint PPT Presentation

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


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

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

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

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

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

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

  7. Proving Other Problems are Uncomputable โ€ข Reduction โ€“ Convert some problem into a known uncomputable one (using only computable steps) 7

  8. Proof by Reduction Shows how two different problems relate to each other

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

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

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

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

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

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

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

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

  17. ๐ผ๐ต๐‘€๐‘ˆ Reduction Problem we think is impossible Problem know is impossible ๐ผ๐ต๐‘€๐‘ˆ ๐ต๐ท๐ท๐น๐‘„๐‘ˆ๐‘‡ ๐ถ Does โ„ณ(๐‘ฅ) ๐ต Does โ„ณ(๐‘ฅ) halt on input ๐‘ฆ ? accept ๐‘ฆ ? Assume ๐‘ โ„Ž๐‘๐‘š๐‘ข computes ๐ผ๐ต๐‘€๐‘ˆ ๐‘ ๐‘๐‘‘๐‘‘ computes ๐ต๐ท๐ท๐น๐‘„๐‘ˆ Reduction 17

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

  19. ๐ผ๐ต๐‘€๐‘ˆ 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

  20. Conclusion โ€ข ๐ต๐ท๐ท๐น๐‘„๐‘ˆ๐‘‡ is not computable โ€ข If ๐ผ๐ต๐‘€๐‘ˆ was computable, an implementation could be used to compute ๐ต๐ท๐ท๐น๐‘„๐‘ˆ๐‘‡ โ€ข So it must be that ๐ผ๐ต๐‘€๐‘ˆ is not computable 20

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

  22. ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น Reduction Problem we think is impossible Problem know is impossible ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐ผ๐ต๐‘€๐‘ˆ ๐ถ ๐ต Is L โ„ณ ๐‘ฅ finite? Does โ„ณ(๐‘ฅ) halt on input ๐‘ฆ ? Assume ๐‘ ๐‘”๐‘—๐‘œ๐‘—๐‘ข๐‘“ computes ๐บ๐ฝ๐‘‚๐ฝ๐‘ˆ๐น ๐‘ ๐ผ๐ต๐‘€๐‘ˆ computes ๐ผ๐ต๐‘€๐‘ˆ Reduction 22

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

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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend