undecidability and rice s theorem
play

Undecidability and Rices Theorem Lecture 25, April 27 CS 374, - PowerPoint PPT Presentation

Undecidability and Rices Theorem Lecture 25, April 27 CS 374, Spring 2017 . R. E. . UNDECIDABLE . . RECURSIVE . . EXP . . . NP . . P Recap: Universal TM U We saw a TM U such that L u = L ( U ) = { <M> # w | M accepts w


  1. Undecidability and Rice’s Theorem Lecture 25, April 27 CS 374, Spring 2017

  2. . R. E. . UNDECIDABLE . . RECURSIVE . . EXP . . . NP . . P

  3. Recap: Universal TM U We saw a TM U such that L u = L ( U ) = { <M> # w | M accepts w } Thus, U is a stored-program computer. It reads a program <M> and executes it on data w L u is r.e.

  4. Recap: Universal TM U L u = { <M> # w | M accepts w } is r.e. We proved the following: Theorem: L u is undecidable (i.e, not recursive) No “algorithm” for L u

  5. . R. E. . UNDECIDABLE . L u . RECURSIVE . . EXP . . . NP . . P

  6. Polytime Reductions X ≤ p Y “X reduces to Y in polytime” X-solver (polytime) YES I Y I x Y-solver REDUCTION (poly time) (poly time) NO If Y can be decided in poly time, then X can be decided in poly time If X can’t be decided in poly time, then Y can’t be decided in poly time

  7. Polytime Reductions X ≤ Y “X reduces to Y in polytime” X-solver (polytime) YES I Y I x Y-solver REDUCTION (poly time) (poly time) NO If Y can be decided in poly time, then X can be decided in poly time If X can’t be decided in poly time, then Y can’t be decided in poly time

  8. Reduction X ≤ Y “X reduces to Y” X-solver YES I Y I x Y-solver REDUCTION NO If Y can be decided, then X can be decided. If X can’t be decided, then Y can’t be decided

  9. Using Reductions • Once we have some seed problems such as L d and L u we can use reductions to prove that more problems are undecidable

  10. Halting Problem • Does given M halt when run on blank input ? • L halt = {< M > | M halts when run on blank input} • Show L halt is undecidable by showing L u ≤ L halt L u -decider YES L halt REDUCTION decider NO What are input and output of the reduction?

  11. A different version of HALT L halt = { <M>#w | M halts on w } Easier to show that this version of L halt is undecidable by showing L u ≤ L halt Why?

  12. L u ≤ L halt L u -decider YES L halt < M > # w < M’ > REDUCTION decider NO Need: M’ halts on blank input iff M ( w ) accepts TM M’ const M const w run M ( w ) and halt if it accepts The REDUCTION doesn’t run M on w . It produces code for M’ !

  13. Example Suppose we have the code for a program isprime() and we want • to check if it accepts the number 13 The reduction creates new program to give to decider for L halt : • note that the reduction only creates the code, does not run any program itself. main() { If (isprime(13)) then QUIT else LOOP FOREVER } boolean isprime(int i) { … }

  14. L u ≤ L halt L u -decider YES L halt < M > # w < M’ > REDUCTION decider NO Need: M’ halts on blank input iff M ( w ) accepts TM M’ const M const w run M ( w ) and halt if it accepts Correctness: L u -decider say “yes” iff M’ halts on blank input iff M ( w ) accepts iff < M ># w is in L u

  15. More reductions about languages • We’ll show other languages involving program behavior are undecidable: • L 374 = {<M> | L(M) = {0 374 } } • L ≠ Ø = {<M> | L(M) is nonempty} • L pal = {<M> | L(M) = palindromes} • many many others

  16. L 374 = {< M > | L ( M ) = {0 374 } } is undecidable • Given a TM M , telling whether it accepts only the string 0 374 is not possible • Proved by showing L u ≤ L 374 M ’: constants: M, w < M’ > = < M > # w REDUCTION: BUILD M’ instance of L 374 instance of L u On input x, 0. if x ≠ 0 374 , reject x What is L ( M’ ) ? 1. if x = 0 374 , then • If M ( w ) accepts, L ( M’ ) = {0 374 } run M ( w ) • If M ( w ) doesn’t L ( M’ ) = Ø accept x iff M ( w ) ever accepts w Q: How does the reduction know whether or not M ( w ) accepts ? A: It doesn’t have to. It just builds (code for) M’.

  17. If there is a decider M 374 to tell if a TM accepts the language {0 374 }... Decider for L u < M >#w < M’ > YES: REDUCTION: BUILD M’ M 374 L ( M’ ) = {0 374 } iff M accepts w M ’: constants: M, w L ( M’ ) = {0 374 } iff On input x, NO: M ( w ) accepts 0. if x ≠ 0 374 , reject x L ( M’ ) = Ø ≠ {0 374 } 1. if x = 0 374 , then iff M doesn’t accept w 2. run M ( w ) accept x iff M ( w ) ever accepts w Since L u is not decidable, M 374 doesn’t exist, and L 374 is undecidable

  18. Example Suppose we have the code for a program isprime() and we want • to check if it accepts the number 13 The reduction creates new program to give to decider for L 374 : • note that the reduction only creates the code, does not run any program itself. main() { read input x if (x ≠ 0 374 ) reject If (isprime(13)) then accept } boolean isprime(int i) { … }

  19. L 374 = {< M > | L ( M ) = {0 374 } } is undecidable • What about L accepts-374 = {< M > | M accepts 0 374 } • Is this easier? – in fact, yes, since L 374 isn’t even r.e., but L accepts-374 is – but no, L accepts-374 is not decidable either • The same reduction works: – If M ( w ) accepts, L ( M’ ) = {0 374 }, so M’ accepts 0 374 – If M ( w ) doesn’t, L ( M’ ) = Ø, so M’ doesn’t accept 0 374 • More generally, telling whether or not a machine accepts any fixed string is undecidable

  20. L ≠ Ø = {< M > | L ( M ) is nonempty} is undecidable • Given a TM M , telling whether it accepts any string is undecidable • Proved by showing L u ≤ L ≠ Ø M ’: constants: M, w < M’ > = < M > # w REDUCTION: BUILD M’ instance of L ≠ Ø instance of L u On input x, x We want M’ to satisfy: Run M ( w ) Accept x if M ( w ) • If M ( w ) accepts, L ( M’ ) ≠ Ø accepts = Ø • If M ( w ) doesn’t L ( M’ ) If M ( w ) accepts, L ( M’ ) = Σ * hence ≠ Ø What is L(M’)? If M ( w ) doesn’t, L ( M’ ) = Ø

  21. If there is a decider M ≠ Ø to tell if a TM accepts a nonempty language... Decider for L u < M >#w < M’ > YES: REDUCTION: BUILD M’ M ≠Ø L ( M’ ) ≠ Ø iff M accepts w M ’: constants: M, w On input x, NO: x Run M ( w ) L ( M’ ) = Ø Accept x if M ( w ) iff M doesn’t accept w accepts Since L u is not decidable, M ≠ Ø doesn’t exist, and L ≠ Ø is undecidable

  22. L pal = {< M > | L ( M ) = palindromes} is undecidable • Given a TM M , telling whether it accepts the set of palindromes is undecidable • Proved by showing L u ≤ L pal M ’: constants: M, w < M’ > = < M > # w REDUCTION: BUILD M’ instance of L pal instance of L u On input x, x We want M’ to satisfy: Run M ( w ) Accept x if = {palindromes} • If M ( w ) accepts, L ( M’ ) M ( w ) accepts and ≠ {palindromes} • If M ( w ) doesn’t L ( M’ ) x is a palindrome

  23. If there is a decider M pal to tell if a TM accepts the set of palindromes Decider for L u < M >#w < M’ > YES: REDUCTION: BUILD M’ M pal L ( M’ ) = {palindromes} iff M accepts w M ’: constants: M, w On input x, NO: x Run M ( w ) L ( M’ ) = Ø ≠ {palindromes} Accept x if iff M doesn’t accept w M ( w ) accepts and x is a palindrome Since L u is not decidable, M pal doesn’t exist, and L pal is undecidable

  24. Lots of undecidable problems about languages accepted by programs • Given M , is L ( M ) = {palindromes}? • Given M , is L ( M ) ≠ Ø? • Given M , is L ( M ) = {0 374 } ? • Given M, does L ( M ) contain 0 374 ? • Given M , is L ( M ) = {0 p | p is prime}? • Given M , does L ( M ) contain any prime? • Given M , does L ( M ) contain any word? • Given M , does L ( M ) meet these formal specs? • Given M , does L ( M ) = Σ * ?

  25. Rice’s Theorem • Q: What can we decide about the languages accepted by programs? A: NOTHING ! except “trivial” things

  26. Properties of r.e. languages • A Property of r.e. languages is a predicate P of r.e. languages. i.e., P : { L | L is r.e.} à {true, false} Important: we are only interested in r.e languages • Examples: • P ( L ) = “ L contains 0 374 ” • P ( L ) = “ L contains at least 5 strings” • P ( L ) = “ L is empty” • P ( L ) = “ L = {0 n 1 n | n ≥ 0}”

  27. Properties of r.e. languages • A Property of r.e. languages is a predicate P of r.e. languages. i.e., P : { L | L is r.e.} à {true, false} L = L(M) for some TM iff L is r.e by definition. • We will thus think of a Property of r.e. languages as a set { <M> | L ( M ) satisfies predicate P } • Note that each property P is thus a set of strings L(P) = { <M> | L ( M ) satisfies predicate P } • Question: For which P is L(P) decidable?

  28. Trivial Properties • A property is trivial if either all r.e. languages satisfy it, or no r.e. languages satisfy it. • { <M> | L ( M ) is r.e}.... why is this “trivial” ? – EVERY language accepted by an M is r.e. by def’n • { <M> | L ( M ) is not r.e}.... why is this “trivial” ? • { <M>| L ( M ) = Ø or L ( M ) ≠Ø}.... why “trivial”? • Clearly, trivial properties are decidable • Because if P is trivial then L(P) = Ø or L(P) = Σ*

  29. Rice’s Theorem Every nontrivial property of r.e. languages is undecidable So, there is virtually nothing we can decide about behavior (language accepted) by programs Example: auto-graders don’t exist (if submissions are allowed to run an arbitrary (but finite) amount of time).

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