Recursively Enumerable and R I L Recursive Languages

Recursively Enumerable and R I L Recursive Languages

Department of Computer & Information Sciences Recursive Languages Pakistan Institute of Engineering and Applied Sciences Definition: A recursive language L is a formal language for which there exists a TM that will halt and accept an input string in L, and Recursively Enumerable halt and reject, otherwise. and RiRecursive Languages ElExample: The decision problem of determining whether a natural number is a perfect square (represented by using the string an) is decidable. Based on slides by Costas Busch [http://csc.lsu.edu/~busch] Umar Faiz http://www.pieas.edu.pk/umarfaiz/cis317 1 2 Recursive Languages Recursively Enumerable Languages Let L be a recursive language and M the Turing Machine Definition: that accepts it A language is recursively enumerable if some Turing For string : w machine accepts it If w ∈ L then M halts in a final state Let L be a recursively enumerable language and M the Tur ing Mac hine that accepts it If w ∉ L then M halts in a non-final state For string : w If w ∈ L then M halts in a final state If w ∉ L then M halts in a non-final state and loops forever Costas Busch - RPI 3 Costas Busch - RPI 4 Non Recursively Enumerable Context-Free Languages We will prove: Technical Note: Type-1 languages explicitly Type-0 Languages 1. There is a specific language which is not recursively exclude the null string. All other language (Recursively Enum.) enumerable (not accepted by any Turing Machine) families permit the null Recursive string as a member. Languages (The Venn diagram is in slight error because 2. There is a specific language which is recursively of this technicality.) enumerable bu t not recursive Type-1 (Context-sensitive) Languages Type-2 (Context-free) Languages Linear (Context-free) Type-3 Languages (Regular) Languages Costas Busch - RPI 5 6 1 Non Recursively Enumerable Recursively Enumerable A Language which is not Recursively Enumerable Recursive 7 Costas Busch - RPI 8 Non Recursively Enumerable Non Recursively Enumerable • We want to find a language that is Non Recursively Enumerable Consider alphabet {a} • This language is not accepted by any Turing Machine Strings: a, aa, aaa, aaaa, K 1 2 3 4 a a a a L Consider Turing Machines that accept languages over alphabet {a} They are countable: M1, M 2, M3, M 4, K Costas Busch - RPI 9 Costas Busch - RPI 10 Non Recursively Enumerable Non Recursively Enumerable 1 2 3 4 Example language accepted by Mi a a a a L L(Mi ) = {aa,aaaa,aaaaaa} 2 4 6 L(M1) 0 110 L L(Mi ) = {a ,a ,a } 1010 Alternative representation L(M2) L 1 2 3 4 5 6 7 a a a a a a a L L(M3) 0111 L L(Mi ) 0 1110 0 0 L L(M4) 010 0 L Costas Busch - RPI 11 Costas Busch - RPI 12 2 Non Recursively Enumerable Non Recursively Enumerable 1 2 3 4 Consider the language a a a a L i i L(M1) 0 110 L L = {a : a ∈ L(Mi )} L(M2) 1 0 0 1 L L(M3) 0111 L L(M4) 010 0 L L consists from the 1’s in the diagonal 3 4 L = {a ,a ,K} Costas Busch - RPI 13 Costas Busch - RPI 14 Non Recursively Enumerable Non Recursively Enumerable Consider the language L 1 2 3 4 a a a a L L(M1) 0 110 L i i L = {a : a ∈ L(Mi )} L(M2) 1010 L i i L(M ) L = {a : a ∉ L(Mi )} 3 0111 L L(M4) 010 0 L L consists of the 0’s in the diagonal 1 2 L = {a ,a ,K} Costas Busch - RPI 15 Costas Busch - RPI 16 Non Recursively Enumerable Non Recursively Enumerable Theorem: Proof: – Language L is not recursively enumerable Assume for contradiction that L is recursively enumerable There must exist some machine M k that accepts L L(M k ) = L Costas Busch - RPI 17 Costas Busch - RPI 18 3 1 2 3 4 1 2 3 4 a a a a L a a a a L L(M1) 0 110 L L(M1) 0 110 L L(M2) 1 0 0 1 L L(M2) 1 0 0 1 L L(M3) 0 1 1 1 L L(M3) 0 1 1 1 L L(M4) 010 0 L L(M4) 010 0 L 1 a ∈ L(Mk ) Answer: M ≠ M Question: M k = M1? k 1 1 Costas Busch - RPI 19 Costas Busch - RPIa ∉ L(M1) 20 1 2 3 4 1 2 3 4 a a a a L a a a a L L(M1) 0 110 L L(M1) 0 110 L L(M2) 1 0 0 1 L L(M2) 1 0 0 1 L L(M3) 0 1 1 1 L L(M3) 0 1 1 1 L L(M4) 010 0 L L(M4) 010 0 L 2 a ∈ L(Mk ) Answer: M ≠ M Question: Mk = M2 ? k 2 2 Costas Busch - RPI 21 Costas Busch - RPIa ∉ L(M2) 22 1 2 3 4 1 2 3 4 a a a a L a a a a L L(M1) 0 110 L L(M1) 0 110 L L(M2) 1 0 0 1 L L(M2) 1 0 0 1 L L(M3) 0 1 1 1 L L(M3) 0 1 1 1 L L(M4) 010 0 L L(M4) 010 0 L 3 a ∉ L(Mk ) Answer: M ≠ M Question: Mk =M 3 ? k 3 3 Costas Busch - RPI 23 Costas Busch - RPIa ∈ L(M3) 24 4 Non Recursively Enumerable Non Recursively Enumerable Therefore, the machine M k cannot exist. Therefore, the language L is not recursively enumerable Similarly: M k ≠ Mi for any i Observation: Because either: There is no algorithm that describes L (otherwise would be accepte d by some Turi ng Machi ne) ai ∈ L(M ) ai ∉ L(M ) k or k i i a ∉ L(Mi ) a ∈ L(Mi ) Costas Busch - RPI 25 Costas Busch - RPI 26 Non Recursively Enumerable L Recursively Enumerable A Language which is Recursively Enumerable and not Recursive Recursive 27 Costas Busch - RPI 28 We want to find a language which We will prove that the language i i Is recursively But not L = {a : a ∈ L(Mi )} enumerable recursive Is recursively enumerable but not recursive There is a Turing The machine Machine that accepts doesn’t halt the language on some input Costas Busch - RPI 29 Costas Busch - RPI 30 5 1 2 3 4 a a a a L Theorem: i i L(M1) 0 110 L The language L = { a : a ∈ L ( M i )} is recursively enumerable Proof: L(M2) 1010 L We will give a Turing Machine that accepts L L(M3) 0111 L L(M4) 010 0 L 3 4 L = {a ,a ,K} Costas Busch - RPI 31 Costas Busch - RPI 32 Turing Machine that accepts L For any input string w Observation: i Recursively enumerable Compute i , for which w = a i i L = {a : a ∈ L(Mi )} Find Turing machine Mi (using an enumeration procedure for Turing Machines) Not recursively enumerable i Simulate M on input a i i i L = {a : a ∉ L(Mi )} If M accepts, then accept w i (Thus, also not recursive) End of Proof Costas Busch - RPI 33 Costas Busch - RPI 34 Theorem: Proof: Assume for contradiction that L is recursive i i The language L = {a : a ∈ L(Mi )} is not recursive Then L is recursive: Ta ke the Turing Mach ine M that accepts L M halts on any input: If M accepts then reject If M rejects then accept Costas Busch - RPI 35 Costas Busch - RPI 36 6 Non Recursively Enumerable Therefore: L L is recursive Recursively Enumerable But we know: L L is not recursively enumerable thus, not recursive Recursive CONTRADICTION!!!! Therefore, L is not recursive Costas Busch - RPI 37 38 We will prove: (weak result) If a language is recursive then there is an enumeration procedure for it Turing acceptable languages and Enumeration Procedures (strong result) A language is recursively enumerable if and only if there is an enumeration procedure for it Costas Busch - RPI 39 Costas Busch - RPI 40 Proof: Theorem: If a language L is recursive then there is an Enumeration Machine enumeration procedure for it ~ M M Enumerates all Accepts L strings of input alphabet Costas Busch - RPI 41 Costas Busch - RPI 42 7 ~ Enumeration procedure If the alphabet is { a , b } then M can enumerate strings as follows: a Repeat: b ~ aa M generates a string w ab M checks if w∈ L ba YES: print w to output bb aaa NO: ignore w aab ...... End of Proof Costas Busch - RPI 43 Costas Busch - RPI 44 Example: L = {b,ab,bb,aaa,....} Theorem: ~ Enumeration If language L is recursively enumerable then M L(M ) Output there is an enumeration procedure for it a b b b aa ab ab ab ba bb bb bb aaa aaa aaa aab ...... ...... ...... Costas Busch - RPI 45 Costas Busch - RPI 46 ~ If the alphabet is { a , b } then M can enumerate Proof: strings as follows: Enumeration Machine a b ~ M M aa ab ba bb aaa Enumerates all Accepts L aab strings of input alphabet Costas Busch - RPI 47 Costas Busch - RPI 48 8 NAIVE APPROACH BETTER APPROACH Enumeration procedure ~ M Generates first string w ~ 1 Repeat: M generates a string w M executes first step on w1 M checks if w∈ L YES: prin t w to output ~ M Generates second string w2 NO: ignore w Problem: If w∉ L M executes first step on w2 machine M may loop forever second step on w1 Costas Busch - RPI 49 Costas Busch - RPI 50 ~ w M Generates third string 3 w1 w2 w3 w4 L M executes first step on w3 1 11 1 second step on w2 Step in 22 third step on w 22 1 string 33 3 3 And so on...........

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us