# Fall 2006Costas Busch - RPI1 Decidable Languages.

## Presentation on theme: "Fall 2006Costas Busch - RPI1 Decidable Languages."— Presentation transcript:

Fall 2006Costas Busch - RPI1 Decidable Languages

Fall 2006Costas Busch - RPI2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also known as: Turing-Recognizable or Recursively-enumerable languages

Fall 2006Costas Busch - RPI3 For any string : halts in an accept state halts in a non-accept state or loops forever

Fall 2006Costas Busch - RPI4 Definition: A language is decidable if there is a Turing machine (decider) which accepts and halts on every input string Also known as recursive languages

Fall 2006Costas Busch - RPI5 For any string : halts in an accept state halts in a non-accept state Every decidable language is Turing-Acceptable

Fall 2006Costas Busch - RPI6 Sometimes, it is convenient to have Turing machines with single accept and reject states These are the only halting states That result to possible halting configurations

Fall 2006Costas Busch - RPI7 We can convert any Turing machine to have single accept and reject states Old machine New machine Multiple accept states For each tape symbol One accept state

Fall 2006Costas Busch - RPI8 For all tape symbols not used for read in the other transitions of Old machine New machine Multiple reject states One reject state Do the following for each possible halting state: For each

Fall 2006Costas Busch - RPI9 Input string Accept Reject Decider for Decision On Halt: For a decidable language : For each input string, the computation halts in the accept or reject state

Fall 2006Costas Busch - RPI10 Input string Turing Machine for For a Turing-Acceptable language : It is possible that for some input string the machine enters an infinite loop

Fall 2006Costas Busch - RPI11 Is number prime? Corresponding language: Problem: We will show it is decidable

Fall 2006Costas Busch - RPI12 On input number : Divide with all possible numbers between and If any of them divides Then reject Else accept Decider for :

Fall 2006Costas Busch - RPI13 (Input string) is prime? Decider for PRIMES Input number YES NO the decider for the language solves the corresponding problem (Accept) (Reject)

Fall 2006Costas Busch - RPI14 Theorem: If a language is decidable, then its complement is decidable too Proof: Build a Turing machine that accepts and halts on every input string ( is decider for )

Fall 2006Costas Busch - RPI15 Transform accept state to reject and vice-versa

Fall 2006Costas Busch - RPI16 Accepts and halts on every input string 1. Let be the decider for If accepts then reject If rejects then accept Turing Machine On each input string do: 2. Run with input string END OF PROOF

Fall 2006Costas Busch - RPI17 Undecidable Languages An undecidable language has no decider: There is a language which is Turing-Acceptable and undecidable We will show that: each Turing machine that accepts does not halt on some input string

Fall 2006Costas Busch - RPI18 We will prove that there is a language : is not Turing-acceptable (not accepted by any Turing Machine) is Turing-acceptable Therefore, is undecidable the complement of a decidable language is decidable

Fall 2006Costas Busch - RPI19 Decidable Turing-Acceptable Non Turing-Acceptable

Fall 2006Costas Busch - RPI20 A Language which is not Turing Acceptable

Fall 2006Costas Busch - RPI21 Consider alphabet Strings of :

Fall 2006Costas Busch - RPI22 Consider Turing Machines that accept languages over alphabet They are countable: (There is an enumerator that generates them)

Fall 2006Costas Busch - RPI23 Each machine accepts some language over Note that it is possible to have Since, a language could be accepted by more than one Turing machine for

Fall 2006Costas Busch - RPI24 Example language accepted by Binary representation

Fall 2006Costas Busch - RPI25 Example of binary representations

Fall 2006Costas Busch - RPI26 Consider the language consists of the 1’s in the diagonal

Fall 2006Costas Busch - RPI27

Fall 2006Costas Busch - RPI28 Consider the language consists of the 0’s in the diagonal

Fall 2006Costas Busch - RPI29

Fall 2006Costas Busch - RPI30 Proof: is Turing-Acceptable Assume for contradiction that There must exist some machine that accepts : Theorem: Language is not Turing-Acceptable

Fall 2006Costas Busch - RPI31 Question:

Fall 2006Costas Busch - RPI32 Answer:

Fall 2006Costas Busch - RPI33 Question:

Fall 2006Costas Busch - RPI34 Answer:

Fall 2006Costas Busch - RPI35 Question:

Fall 2006Costas Busch - RPI36 Answer:

Fall 2006Costas Busch - RPI37 Similarly: for any Because either: or the machine cannot exist is not Turing-Acceptable End of Proof

Fall 2006Costas Busch - RPI38 Decidable Turing-Acceptable Non Turing-Acceptable

Fall 2006Costas Busch - RPI39 A Language which is Turing-Acceptable and Undecidable

Fall 2006Costas Busch - RPI40 There is a Turing machine that accepts Each machine that accepts doesn’t halt on some input string Is Turing- Acceptable Undecidable We will prove that the language

Fall 2006Costas Busch - RPI41

Fall 2006Costas Busch - RPI42 The languageTheorem: Is Turing-Acceptable Proof: We will give a Turing Machine that accepts

Fall 2006Costas Busch - RPI43 Turing Machine that accepts For any input string Compute, for which Find Turing machine (using the enumerator for Turing Machines) Simulate on input If accepts, then accept End of Proof

Fall 2006Costas Busch - RPI44 Observation: Turing-Acceptable Not Turing-acceptable (Thus, is undecidable)

Fall 2006Costas Busch - RPI45 Decidable Turing-Acceptable Non Turing-Acceptable ?

Fall 2006Costas Busch - RPI46 Theorem: is undecidable Proof: If is decidable Then is decidable Contradiction!!!! However, is not Turing-Acceptable! the complement of a decidable language is decidable

Fall 2006Costas Busch - RPI47 Decidable Turing-Acceptable Not Turing-Acceptable

Fall 2006Costas Busch - RPI48 Turing acceptable languages and Enumerators

Fall 2006Costas Busch - RPI49 We will prove: If a language is decidable then there is an enumerator for it A language is Turing-acceptable if and only if there is an enumerator for it (weak result) (strong result)

Fall 2006Costas Busch - RPI50 Theorem: if a language is decidable then there is an enumerator for it Proof: Let be the decider for Use to build the enumerator for

Fall 2006Costas Busch - RPI51 Example: alphabet is (proper order) Let be an enumerator that prints all strings from input alphabet in proper order

Fall 2006Costas Busch - RPI52 Enumerator for Repeat: 1. generates a string 2. checks if YES: print to output NO: ignore This part terminates, because is decidable

Fall 2006Costas Busch - RPI53 Enumerator for string Give me next string Enumerates all strings of input alphabet Generates all Strings in alphabet If accepts then print to output Tests each string if it is accepted by output All strings of

Fall 2006Costas Busch - RPI54 Example: Enumeration Output reject accept reject END OF PROOF

Fall 2006Costas Busch - RPI55 Theorem: if language is Turing-Acceptable then there is an enumerator for it Proof: Let be the Turing machine that accepts Use to build the enumerator for

Fall 2006Costas Busch - RPI56 Enumerator for Accepts Enumerates all strings of input alphabet in proper order

Fall 2006Costas Busch - RPI57 Enumerator for Repeat:generates a string checks if YES: print to output NO: ignore NAIVE APPROACH Problem:If machine may loop forever

Fall 2006Costas Busch - RPI58 executes first step on BETTER APPROACH Generates second string executes first step on second step on Generates first string

Fall 2006Costas Busch - RPI59 Generates third string executes first step on second step on third step on And so on............

Fall 2006Costas Busch - RPI60 1 Step in computation of string 111 22 22 3333 String: 4444

Fall 2006Costas Busch - RPI61 If for any string machine halts in an accepting state then print on the output End of Proof

Fall 2006Costas Busch - RPI62 Theorem: If for language there is an enumerator then is Turing-Acceptable Proof: Using the enumerator for we will build a Turing machine that accepts

Fall 2006Costas Busch - RPI63 Input Tape Enumerator for Compare Turing Machine that accepts If same, Accept and Halt Give me the next string in the enumeration sequence

Fall 2006Costas Busch - RPI64 Turing machine that accepts Loop: Using the enumerator of, generate the next string of For any input string Compare generated string with If same, accept and exit loop End of Proof

Fall 2006Costas Busch - RPI65 By combining the last two theorems, we have proven: A language is Turing-Acceptable if and only if there is an enumerator for it