# Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.

## Presentation on theme: "Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages."— Presentation transcript:

Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages

Fall 2004COMP 3352 Definition: A language is recursively enumerable if some Turing machine accepts it

Fall 2004COMP 3353 For string : Let be a recursively enumerable language and the Turing Machine that accepts it ifthen halts in a final state ifthen halts in a non-final state or loops forever

Fall 2004COMP 3354 Definition: A language is recursive if some Turing machine accepts it and halts on any input string In other words: A language is recursive if there is a membership algorithm for it

Fall 2004COMP 3355 For string : Let be a recursive language and the Turing Machine that accepts it ifthen halts in a final state ifthen halts in a non-final state

Fall 2004COMP 3356 We will prove: 1. There is a specific language which is not recursively enumerable (not accepted by any Turing Machine) 2. There is a specific language which is recursively enumerable but not recursive

Fall 2004COMP 3357 Recursive Recursively Enumerable Non Recursively Enumerable

Fall 2004COMP 3358 A Language which is not Recursively Enumerable

Fall 2004COMP 3359 We want to find a language that is not Recursively Enumerable This language is not accepted by any Turing Machine

Fall 2004COMP 33510 Consider alphabet Strings:

Fall 2004COMP 33511 Consider Turing Machines that accept languages over alphabet They are countable:

Fall 2004COMP 33512 Example language accepted by Alternative representation

Fall 2004COMP 33513

Fall 2004COMP 33514 Consider the language consists from the 1’s in the diagonal

Fall 2004COMP 33515

Fall 2004COMP 33516 Consider the language consists of the 0’s in the diagonal

Fall 2004COMP 33517

Fall 2004COMP 33518 Theorem: Language is not recursively enumerable

Fall 2004COMP 33519 Proof: is recursively enumerable Assume for contradiction that There must exist some machine that accepts

Fall 2004COMP 33520 Question:

Fall 2004COMP 33522 Question:

Fall 2004COMP 33524 Question:

Fall 2004COMP 33526 Similarly: for any Because either: or

Fall 2004COMP 33527 Therefore, the machine cannot exist Therefore, the language is not recursively enumerable End of Proof

Fall 2004COMP 33528 Observation: There is no algorithm that describes (otherwise would be accepted by some Turing Machine)

Fall 2004COMP 33529 Recursive Recursively Enumerable Non Recursively Enumerable

Fall 2004COMP 33530 A Language which is Recursively Enumerable and not Recursive

Fall 2004COMP 33531 We want to find a language which There is a Turing Machine that accepts the language The machine doesn’t halt on some input Is recursively enumerable But not recursive

Fall 2004COMP 33532 We will prove that the language Is recursively enumerable but not recursive

Fall 2004COMP 33533

Fall 2004COMP 33534 The language Theorem: is recursively enumerable

Fall 2004COMP 33535 Proof: We will give a Turing Machine that accepts

Fall 2004COMP 33536 Turing Machine that accepts For any input string Compute, for which Find Turing machine (using an enumeration procedure for Turing Machines) Simulate on input If accepts, then accept End of Proof

Fall 2004COMP 33537 Observation: Recursively enumerable Not recursively enumerable (Thus, also not recursive)

Fall 2004COMP 33538 Theorem: The language is not recursive

Fall 2004COMP 33539 Proof: Assume for contradiction that is recursive Then is recursive: Take the Turing Machine that accepts halts on any input: If accepts then reject If rejects then accept

Fall 2004COMP 33540 Therefore: is recursive But we know: is not recursively enumerable thus, not recursive CONTRADICTION!!!!

Fall 2004COMP 33541 Therefore, is not recursive End of Proof

Fall 2004COMP 33542 Recursive Recursively Enumerable Non Recursively Enumerable

Fall 2004COMP 33543 Turing acceptable languages and Enumeration Procedures

Fall 2004COMP 33544 We will prove: If a language is recursive then there is an enumeration procedure for it A language is recursively enumerable if and only if there is an enumeration procedure for it (weak result) (strong result)

Fall 2004COMP 33545 Theorem: if a language is recursive then there is an enumeration procedure for it

Fall 2004COMP 33546 Proof: Enumeration Machine Accepts Enumerates all strings of input alphabet

Fall 2004COMP 33547 If the alphabet is then can enumerate strings as follows:

Fall 2004COMP 33548 Enumeration procedure Repeat: generates a string checks if YES: print to output NO: ignore End of Proof

Fall 2004COMP 33549 Example: Enumeration Output

Fall 2004COMP 33550 Theorem: if language is recursively enumerable then there is an enumeration procedure for it

Fall 2004COMP 33551 Proof: Enumeration Machine Accepts Enumerates all strings of input alphabet

Fall 2004COMP 33552 If the alphabet is then can enumerate strings as follows:

Fall 2004COMP 33553 Enumeration procedure Repeat:generates a string checks if YES: print to output NO: ignore NAIVE APPROACH Problem: If machine may loop forever

Fall 2004COMP 33554 executes first step on BETTER APPROACH Generates second string executes first step on second step on Generates first string

Fall 2004COMP 33555 Generates third string executes first step on second step on third step on And so on............

Fall 2004COMP 33556 1 Step in string 111 22 22 3333

Fall 2004COMP 33557 If for any string machine halts in a final state then it prints on the output End of Proof

Fall 2004COMP 33558 Theorem: If for language there is an enumeration procedure then is recursively enumerable

Fall 2004COMP 33559 Proof: Input Tape Enumerator for Compare Machine that accepts

Fall 2004COMP 33560 Turing machine that accepts Repeat: Using the enumerator, generate the next string of For input string Compare generated string with If same, accept and exit loop End of Proof

Fall 2004COMP 33561 We have proven: A language is recursively enumerable if and only if there is an enumeration procedure for it