1 / 21

Decidability

Decidability. A decision problem is a problem for which the answer is either "yes" or "no". A decidable problem is a decision problem that has a solution algorithm. A semidecidable problem is a decision problem for which there is a decision procedure

alodie
Download Presentation

Decidability

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Decidability • A decision problem is a problem for which the answer is either "yes" or "no". • A decidable problem is a decision problem that has a solution algorithm. • A semidecidable problem is a decision problem for which there is a decision procedure • that correctly answers "yes" if the answer is "yes", • and never answers "yes" if the answer is "no".

  2. Decidability and semidecidability • Decidable problems correspond to recursive languages; semidecidable problems correspond to r.e. languages. • since we’re assuming algorithms halt on all input • All decidable problems are semidecidable • so all recursive languages are r.e. • Semidecidable problems needn't be decidable • there may be no decision procedure that halts on all inputs

  3. The universal problem • The universal problem asks whether M accepts w, given a TM M and string w • here w is a string over {0,1}, which is also M's input alphabet • We've seen this problem to be semidecidable • so Lu = {<M,w> | M accepts w} is an r.e.language, if encoded as described above • The universal problem is undecidable • so undecidable problems exist!!!!!

  4. Undecidable problems • To show that undecidable problems exist, it’s easiest to look at a special case of the universal problem • Just as we can number TMs, we can also number strings over {0,1} • One mapping between i and wi converts i to binary and ignores the leading digit • every bit string arises in this way from some i • Now we can ask whether Mi accepts wi

  5. A non-r.e. language • If it were decidable whether M accepts w, it would be decidable whether Mi accepts wi • And it would be decidable, given i, whether Mi fails to accept wi • given i, we could construct Mi and wi • and then decide whether Mi accepts wi • So let Ld = { wi | Mi doesn't accept wi} • Ld (the diagonal language) can’t even be r.e. • the intuition is that of Linz's Figure 11.2, p. 280

  6. Showing that Ld is not r.e. • To be r.e., Ld must be accepted by some TM Mk. • We may ask whether Mk accepts wk • If so, then wk is in not in Ld, by its definition • but by definition of Mk, wk is in Ld • If not, then wk is in Ld, by its definition. • but by definition of Mk, wk is not in Ld • These contradictions show that no such Mk exists, and thus that Ld is not r.e.

  7. Recursive and r.e. languages • If L is recursive, then so is L' • since the algorithm for deciding L will also decide L' if we complement its output • If L and L' are both r.e., then both are recursive, since • both L and L' have TMs M and M’ • given an input x, we may run both TMs on x • one will halt and return "yes" • if M halts, we answer "yes" for L and "no" for L' • if M’ halts, we answer "yes" for L' and "no" for L

  8. Examples of recursive and r.e. languages • Ld is not r.e., so it's not recursive. • Ld' is r.e. • Mu may be modified to accept it • Ld' is not recursive • if it were, then Ld would be • Lu is r.e. but not recursive. • if it were recursive, then Ld' would be

  9. Recursive and r.e. languages, conclusions • Not all languages are r.e. • Ld is not r.e. • The recursive languages are a proper subset of the r.e. languages • Lu is r.e. but not recursive • The CFLs are a proper subset of the recursive language • recall that {anbncn} is recursive but not a CFL

  10. Properties of r.e. languages • Our final and rather astonishing result deals with properties of the r.e. languages. • For each a property P (e.g., being finite), we consider the question of whether a given r.e., language L has property P • We assume that L is represented by a TM M • Rice's theorem states that there is a decision algorithm for this question only when the answer is always "yes" or always "no"

  11. Rice's theorem, restated • That is, for any property P we know that one of three cases holds: • P is true for any r.e. language • P is true for no r.e. language • P is true for some but not all r.e. languages • We know that in cases 1 and 2 there are trivial solution algorithms • We call such properties trivial properties. • Rice's theorem states that there are no solution algorithms for case 3

  12. The halting problem • The proof of Rice's theorem is not difficult • But it may be instructive to consider a similar argument first • For a given TM M and input x, we may ask whether it halts on all input • This is the halting problem

  13. Undecidability of the halting problem • To show undecidability, we may use the language of algorithms instead of TMs. • We'll suppose there’s an algorithm A for deciding the halting problem. • We'll then use A to construct an algorithm for deciding membership in Lu. • Since no such algorithm can exist, this contradiction shows that A cannot exist either

  14. The algorithm for Lu • The algorithm U for Lu would take its input <M,x> and feed M and x to A. • If A returned “no”, then so would U • correctly, since if M can’t accept x unless it halts • If A returned “yes”, then U would return the result of simulating M on x • correctly, since the simulation halts. • Since U always halts and always determines whether M accepts w, it’s an algorithm for membership in Lu.

  15. Proof of Rice's Theorem • Consider a nontrivial property P. • We first assume that the empty language {} does not have property P. • Since P is nontrivial, there's a (nonempty) r.e. language L that does have P • And since L is r.e., L is accepted by a TM ML

  16. Rice's Theorem: a claim • The proof of Rice's theorem is by contradiction. • We’ll show that if there's a TM MP for deciding P, then Lu is recursive. • The proof depends on the following claim: • Claim: there's an algorithm for constructing TMs from pairs (M,w). The resulting TM M‘ • accepts L when M accepts w, and • accepts {} otherwise.

  17. Proof of the claim • M' can be constructed to work as follows: • note: M' has its own input x, rather than M or w • Given M and w, simulate M on w. • If M doesn’t accept w, then M' doesn’t accept its input x. • If M accepts w, then M' simulates ML on x. • This M' behaves properly • if M does not accept w, M' accepts {} • otherwise M' accepts L.

  18. Conclusion • So we may get a halting TM for Lu by taking (M,w), building M', and feeding M' to MP. • MP answers "yes" if and only if M accepts w. • Finally, the construction above works if {} does have property P • if an extra step is added to complement the output of MP (which does halt on all inputs) • Since no such halting TM exists, the proof is complete, and no nontrivial property of the r.e. languages is decidable

  19. The Chomsky hierarchy • Each of the following classes of languages is properly contained in the succeeding class: • regular languages • deterministic context-free languages • context-free languages • context-sensitive languages • recursive languages • recursively enumerable languages

  20. Grammars and the Chomsky hierarchy • Every regular language can be generated by a grammar of a more restrictive form than a CFG. • Every context-sensitive language can be generated by a grammar of a more general form than a CFG. • Every r.e. language can be generated by a grammar of a more general form than a CFG.

  21. Decidability of CFG problems • Given CFGs G1 and G2, it’s undecidable whether • G1 is ambiguous • L(G1) is S* for any S • L(G1) = L(G2) • L(G1) is a subset of L(G2) • L(G1) ∩ L(G2) = {}

More Related