Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals.

Similar presentations


Presentation on theme: "1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals."— Presentation transcript:

1 1 The Chomsky Hierarchy

2 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals

3 3 Example unrestricted grammar:

4 4 A language is recursively enumerable if and only if is generated by an unrestricted grammar Theorem:

5 5 Context-Sensitive Grammars: and: Productions String of variables and terminals String of variables and terminals

6 6 The language is context-sensitive:

7 7 A language is context sensistive if and only if is accepted by a Linear-Bounded automaton Theorem:

8 8 There is a language which is context-sensitive but not recursive Observation:

9 9 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free Regular The Chomsky Hierarchy

10 10 Decidability

11 11 Consider problems with answer YES or NO Examples: Does Machine have three states ? Is string a binary number? Does DFA accept any input?

12 12 A problem is decidable if some Turing machine Solves (decides) the problem Decidable problems: Does Machine have three states ? Is string a binary number? Does DFA accept any input?

13 13 Turing Machine Input problem instance YES NO The Turing machine that solves a problem answers YES or NO for each instance

14 14 The machine that decides a problem: If the answer is YES then halts in a yes state If the answer is NO then halts in a no state These states may not be final states

15 15 YES NO Turing Machine that decides a problem YES and NO states are halting states

16 16 Difference between Recursive Languages and Decidable problems The YES states may not be final states For decidable problems:

17 17 Some problems are undecidable: There is no Turing Machine that solves all instances of the problem

18 18 A simple undecidable problem: The membership problem

19 19 The Membership Problem Input:Turing Machine String Question: Does accept ?

20 20 Theorem: The membership problem is undecidable Proof:Assume for contradiction that the membership problem is decidable

21 21 There exists a Turing Machine that solves the membership problem YES accepts NO rejects

22 22 Let be a recursively enumerable language Let be the Turing Machine that accepts We will prove that is also recursive: we will describe a Turing machine that accepts and halts on any input

23 23 accepts ? NO YES accept Turing Machine that accepts and halts on any input reject

24 24 Therefore,is recursive But there are recursively enumerable languages which are not recursive Contradiction!!!! Since is chosen arbitrarily, we have proven that every recursively enumerable language is also recursive

25 25 Therefore, the membership problem is undecidable END OF PROOF

26 26 A famous undecidable problem: The halting problem

27 27 The Halting Problem Input:Turing Machine String Question: Does halt on ?

28 28 Theorem: The halting problem is undecidable Proof:Assume for contradiction that the halting problem is decidable

29 29 There exists Turing Machine that solves the halting problem YEShalts on doesn’t halt on NO

30 30 Input: initial tape contents Encoding of String YES NO Construction of

31 31 Construct machine : If returns YES then loop forever If returns NO then halt

32 32 NO Loop forever YES

33 33 Construct machine : Input: If halts on input Then loop forever Else halt (machine )

34 34 copy

35 35 Run machine with input itself: Input: If halts on input Then loop forever Else halt (machine )

36 36 on input If halts then loops forever If doesn’t halt then it halts : NONSENSE !!!!!

37 37 Therefore, we have contradiction The halting problem is undecidable END OF PROOF

38 38 Another proof of the same theorem: If the halting problem was decidable then every recursively enumerable language would be recursive

39 39 Theorem: The halting problem is undecidable Proof:Assume for contradiction that the halting problem is decidable

40 40 There exists Turing Machine that solves the halting problem YEShalts on doesn’t halt on NO

41 41 Let be a recursively enumerable language Let be the Turing Machine that accepts We will prove that is also recursive: we will describe a Turing machine that accepts and halts on any input

42 42 halts on ? YES NO Run with input reject accept reject Turing Machine that accepts and halts on any input Halts on final state Halts on non-final state

43 43 Thereforeis recursive But there are recursively enumerable languages which are not recursive Contradiction!!!! Since is chosen arbitrarily, we have proven that every recursively enumerable language is also recursive

44 44 Therefore, the halting problem is undecidable END OF PROOF


Download ppt "1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals."

Similar presentations


Ads by Google