COMP-330 Theory of Computation Fall 2012 -- Prof. Claude Crépeau Lec. 14 : Turing Machines 1
COMP 330 Fall 2012: Lectures Schedule 1. Introduction 1.5. Some basic mathematics 2. Deterministic finite automata +Closure properties, 3. Nondeterministic finite automata 4. Determinization+Kleene s theorem 5-6. Regular Expressions, GNFA and Regular Languages 6-7. The pumping lemma 8. Minimization+Myhill-Nerode theorem 9. Context-free languages 10. Pushdown automata 11. Equivalence between CFG & PDA 12. The pumping lemma for CFLs 13. MIDTERM 14. Turing Machines 15. The Church-Turing Thesis 16. Introduction to computability 17. Models of computation Basic computability theory 18. Reducibility, undecidability and Rice s theorem 19. Undecidable problems about CFGs 20. Post Correspondence Problem 21. Validity of FOL is RE / Gödel s and Tarski s thms 22. Universality / The recursion theorem 23. Degrees of undecidability 24. Introduction to complexity 25. Introduction to Quantum Computing/Complexity 26. Review of course material 2
All languages Computability Theory Languages we can describe Decidable Languages Context-free Languages Regular NON-Regular Languages via Pumping Lemma Languages NON-Regular Languages via Reductions 3
All languages Computability Theory Languages we can describe Decidable Languages Context-free Languages Regular Languages NON-CFLs via Pumping Lemma NON-CFLs via Reductions 4
All languages Computability Theory Decidable Languages Languages. we can describe Context-free Languages Regular Languages NON-decidable via Diagonalization NON-decidable via Reductions 5
Turing MACHINES Alan Turing 6
M 1 7
M 1 q1 10010101 8
M 1 1 q2 10010101 9
M 1 0 q3 10010101 10
M 1 1 q2 10110101 read and write! moves Right and Left! 11
M 1 0 q3 10110101 12
Turing Machines 13
TM Example 14
15
15
15
15
15
15
Definition of PDA States Input Alphabet Tape Alphabet Transition function Start state Accept state Reject state 16
Definition of PDA States q 1 q 2 q 3 Input Alphabet Tape Alphabet Transition function Start state Accept state Reject state 16
Definition of PDA States q 1 q 2 q 3 Input Alphabet a,b,c Tape Alphabet Transition function Start state Accept state Reject state 16
Definition of PDA States q 1 q 2 q 3 Input Alphabet Tape Alphabet a,b,c a,b,c,a,b,c,_ Transition function Start state Accept state Reject state 16
Definition of PDA States q1 q2 q3 a,b,c Tape Alphabet a,b,c,a,b,c,_ Input Alphabet Transition function b c,d q1 q2 Start state Accept state Reject state 16
Definition of PDA q2 q 3 q1 L or R States output head input symbol move Input Alphabet a,b,c symbol b c,d Tape Alphabet a,b,c,a,b,c,_ Transition function q1 b c,d Start state q1 Accept state q2 q2 Reject state 16
Definition of PDA States q1 q2 q3 a,b,c Tape Alphabet a,b,c,a,b,c,_ Input Alphabet Transition function b c,d q1 q2 Start state Accept state Reject state 16
Definition of PDA States q2 q1 q3 a,b,c Tape Alphabet a,b,c,a,b,c,_ Input Alphabet Transition function Start state q1 b c,d q1 q2 Accept state Reject state 16
Definition of PDA States q2 q1 q3 a,b,c Tape Alphabet a,b,c,a,b,c,_ Input Alphabet Transition function Start state q1 b c,d q1 q2 Accept state qacc Reject state 16
Definition of PDA States q2 q1 q3 a,b,c Tape Alphabet a,b,c,a,b,c,_ Input Alphabet Transition function Start state q1 b c,d q1 q2 Accept state qacc Reject state qrej 16
TM definition 17
18
TM Configuration 19
TM Computation 20
TM definition For all a,b,c Γ, u,v Γ*, qi,qi Q Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition ua qi bv For all a,b,c Γ, u,v Γ*, qi,qi Q Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l yields (L) Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r u qj acv Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition For all a,b,c Γ, u,v Γ*, qi,qi Q Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition ua qi bv For all a,b,c Γ, u,v Γ*, qi,qi Q Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l yields (R) Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r uac qj v Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition For all a,b,c Γ, u,v Γ*, qi,qi Q Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition For all a,b,c Γ, u,v Γ*, qi,qi Q qi bv Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l yields (L) Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r qj cv Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition For all a,b,c Γ, u,v Γ*, qi,qi Q Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition For all a,b,c Γ, u,v Γ*, qi,qi Q qi bv Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l yields (R) Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r c qj v Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM definition For all a,b,c Γ, u,v Γ*, qi,qi Q Config. ua qi bv yields config. u qj acv if δ(qi,b) = qj,c,l Config. ua qi bv yields config. uac qj v if δ(qi,b) = qj,c,r Special cases: Config. q i bv yields qj cv if δ(qi,b) = qj,c,l Config. qi bv yields c qj v if δ(qi,b) = qj,c,r 21
TM Computation Start configuration: q0 w (w = input string) Accepting configuration: state = qaccept Rejecting configuration: state = qreject 22
TM Computation Turing Machine M accepts input w if there exists configurations C 0, C1,..., Cm such that C0 is a start configuration Ci yields Ci+1 for 0 i<m Cm is an accepting configuration. The collection of strings that M accepts is the language of M or the language recongnized by M, denoted L(M). 23
TM Computation 24
TM Computation A TM decides a language if it recognizes it and halts (reaches an accepting or rejecting states) on all input strings. 24
TM Computation A TM decides a language if it recognizes it and halts (reaches an accepting or rejecting states) on all input strings. 24
TM Computation A TM decides a language if it recognizes it and halts (reaches an accepting or rejecting states) on all input strings. 1 Often named Recursively-Enumerable in the litterature. 2 Often named Recursive in the litterature. 24
TM Examples 25
TM Examples 26
TM Examples 27
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
TM Examples 29
30
TM Examples 31
TM Examples 32
TM Examples 33
More Turing MACHINES Multitape Turing Machines Non-Deterministic Turing Machines Enumerator Turing Machines Everything else... 34
Multitape TM 35
Multitape TM 36
Multitape TM 36
Multitape TM 37
Multitape TM 38
Non-deterministic TM 39
Non-deterministic TM 40
Non-deterministic TM 41
Non-deterministic TM 41
Non-deterministic TM 41
Enumerator TM 42
Enumerator TM 43
Enumerator TM 44
Enumerator TM 45
Enumerator TM 45
Enumerator TM 45
Everything Else Alonzo Church Stephen Kleene J. Barkley Rosser 46
Everything Else Lambda-calculus Alonzo Church Stephen Kleene J. Barkley Rosser 46
Everything Else Lambda-calculus Alonzo Church Recursive Functions Stephen Kleene J. Barkley Rosser 46
Everything Else Lambda-calculus Alonzo Church Recursive Functions Programming languages: Stephen Kleene J. Barkley Rosser 46
Everything Else Lambda-calculus Alonzo Church Recursive Functions Programming languages: FORTRAN, PASCAL, C, JAVA,... Stephen Kleene J. Barkley Rosser 46
Everything Else Lambda-calculus Alonzo Church Recursive Functions Programming languages: FORTRAN, PASCAL, C, JAVA,... Stephen Kleene LISP, SCHEME,... J. Barkley Rosser 46
Church-Turing Thesis Alonzo Church Alan Turing 47
Church-Turing Thesis 48
Paris, 1900 David Hilbert 49
Paris, 1900 David Hilbert Speaking on 8 August 1900, at the Paris 2 nd International Congress of Mathematicians, at La Sorbonne, German mathematician David Hilbert presented ten problems in mathematics. 49
Paris, 1900 David Hilbert Speaking on 8 August 1900, at the Paris 2 nd International Congress of Mathematicians, at La Sorbonne, German mathematician David Hilbert presented ten problems in mathematics. The problems were all unsolved at the time, and several of them turned out to be very influential for 20 th century mathematics. 49
Hilbert s 10 th problem Let P be a polynomial in several variables: P(x,y,z)=24x 2 y 3 +17x+5y+25 Is there a set of integers for x,y,z such that P(x,y,z)=0? This problem is undecidable... but is Turing-Recognizable... Needed a formal model of computing to prove impossibility. Yuri Matiyasevich 50
Single variable Poly 51
Single variable Poly 51
Format & Notations Represent objects as strings O 1, O 2,..., O k is the string representing objects O 1, O 2,..., O k Many encodings are possible. Implicitly, at begining of an algorithm, check that input is in the correct format, otherwise reject. 52
Format & Notations 53
Format & Notations 54
COMP-330 Theory of Computation Fall 2012 -- Prof. Claude Crépeau Lec. 14 : Turing Machines & Church-Turing Thesis 55