1 / 15

Formal Languages Wrap-up

Formal Languages Wrap-up. Recursively Enumerable Languages. A language is recursively enumerable if there is a Turing Machine that accepts it. This allows the TM to go into an infinite loop if the string is not in the language. Recursive Languages.

yonah
Télécharger la présentation

Formal Languages Wrap-up

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. Formal Languages Wrap-up

  2. Recursively Enumerable Languages • A language is recursively enumerable if there is a Turing Machine that accepts it. • This allows the TM to go into an infinite loop if the string is not in the language.

  3. Recursive Languages • A language is Recursive if there is a TM that accepts the language and it halts on every string in Σ+. • That is, a recursive language has to have a membership algorithm.

  4. Recursively Enumerable, contd • Not all languages are recursively enumerable. • Some languages are recursively enumerable but not recursive. • Unrestricted grammars produce recursively enumerable languages. These statements are proven, yet examples are hard to come by...

  5. Context-Sensitive Grammars • All productions are of the form x -> y, where x and y are elements of (VUT)+ and |x| <= |y| Example: S -> ABCAB -> aaabC -> DFDF -> cccab

  6. Context-Sensitive Languages • CSL example: anbncn • Automata for CSLs are linear-bounded automata: TM’s where only the area of tape used by the input is allowed as storage. • All CSL’s are recursive, but not all recursive languages are context-sensitive.

  7. Chomsky’s Hierarchy Recursively Enumerable Recursive Context-Sensitive Non-det Context-Free Det Context-Free Regular

  8. So can anything be computed?No! • Computability – the study of which problems can and which cannot be solved by a Turing Machine.

  9. The Halting Problem • Given an algorithm decide will it halt? • Assume it can be done: Halt(M,w) = yes if algorithm (TM) M halts on input w, and no if it doesn’t. That is: • Halt(M,w) = yes if M(w) halts, else no. • Create new algorithm:Strange(String s): if Halt(s,s)= “no” then return yes else while(true){ }

  10. Halting Problem Strange(String s): if Halt(s,s)= “no” then return yes else while(true){ } So, for any program P, if P(P) halts then Strange(P) doesn’t halt. if P(P) doesn’t halt then Strange(P) does halt. But that means: if Strange(Strange) halts then Strange(Strange) doesn’t halt. if Strange(Strange) doesn’t halt then Strange(Strange) does halt. Contradiction!

  11. Computability • So, not all problems can be solved with a computer. • The Halting Problem is said to be “undecidable”. • DO NOT confuse this with an NP-complete problem! Remember, problems in NP are solvable by non-deterministic TMs and therefore also solvable by TMs, just not necessarily in polynomial time.

  12. Reducing one problem to another... • The state-entry problem: Given a TM and string w, tell whether or not a given state q is ever entered when processing w. • Is it decidable? Why or why not?

  13. Other Undecidable Problems • Given a TM M, letter a, and string w, determine if the letter a ever gets written when processing M(w). • Determine if two TMs are equal • Determine if a CFG is ambiguous • Given 2 CFGs, G1 and G2, determine if L(G1)  L(G2) = {}

  14. Rice’s Theorem • Any non-trivial property of a recursively enumerable language is undecidable. • Particularly, the following are undecidable. • For language G, is L(G) = {}? • For language G, is string w in L(G)? • Is TM M finite? • Does TM M accept 2 different strings of the same length?

  15. The moral of the story... • Researchers first find the properties of the problem before trying to solve it. • Know beforehand the possibilities of the best answer, or even that an answer is possible. • Often leads to a definition of assumptions or concessions to make the problem solvable in a more practical way.

More Related