# Turing Machines S Motogna LFTC Alan Turing Enigma

• Slides: 12

Turing Machines S. Motogna - LFTC

Alan Turing • Enigma (criptography) • Turing test • Turing machine (1937) S. Motogna - LFTC

Turing Machine • Mathematical model for computation • Abstract machine • Can simulate any algorithm S. Motogna - LFTC

Turing Machine • Input band (infinite) • Reading head • Control Unit: states • Transitions / moves S. Motogna - LFTC

Turing machine – definition 7 -tuple M = (Q, �� , b, �� , q 0, F) where: • Q – finite set of states • �� - alphabet (finite set of band symbols) • b ∈ �� - blank (symbol) • �� ⊆ �� {b} – input alphabet • �� : (QF) x �� →Q x �� x {L, R} –transition function • q 0 ∈Q – initial state • F ⊆Q – set of final states S. Motogna - LFTC L = left R = right

Example – palindrome over {0, 1} • 001100, 00100, 101101 a. s. o. accepted • 00110, 1011 a. s. o. not accepted 001100 S. Motogna - LFTC

Example – palindrome over {0, 1} 0 1 b q 0 (p 1, b, R) (p 2, b, R) (qf, b, R) p 1 (p 1, 0, R) (p 1, 1, R) (q 1, b, L) p 2 (p 2, 0, R) (p 2, 1, R) (q 2, b, L) q 1 (qr, b, L) q 2 qr (qr, 0, L) Delete 0 in left side; search 0 in right side Delete 1 in left side; search 1 in right side On right is 0 or 1? Shift right (qf, b, R) (qr, b, L) (qf, b, R) (qr, 1, L) (q 0, b, R) qf q 1 and q 2 – process 0 and 1 on the right qf –final state S. Motogna - LFTC

0110 0 1 1 0 1 1 1 1 1 1 . . . S. Motogna - LFTC

(q 0, 0110) |- (p 1, 110 b) |- (q 1, 110) |- (qr, 11) |- (qr, b 11) |- (q 0, 11) |-. . . S. Motogna - LFTC 0 1 b q 0 (p 1, b, R) (p 2, b, R) (qf, b, R) p 1 (p 1, 0, R) (p 1, 1, R) (q 1, b, L) p 2 (p 2, 0, R) (p 2, 1, R) (q 2, b, L) q 1 (qr, b, L) q 2 qr qf (qr, 0, L) (qf, b, R) (qr, b, L) (qf, b, R) (qr, 1, L) (q 0, b, R)

https: //turingmachinesimulator. com S. Motogna - LFTC

Consultations • 23. 01. 2020, 13. 00 – 14. 00 – campus – L 342 • 28. 01. 2020, 10. 00 - 11. 00 – Central Building, room 230, 2 nd floor • 04. 02. 2020, 10. 00 - 11. 00 – Central Building, room 230, 2 nd floor S. Motogna - LFTC

Exam I. 4 multiple choices questions (0, 5 p each) II. Theory part a) Definition (0, 5 p) b) Algorithm (1 p) c) Implementation – data structure (0, 5) III. Applicative – exercises + problems (similar to course and seminar) a) b) c) d) RG => FA, reg exp => FA a. s. o (1 p) Parser: desc. recursive, LL(1), LR(0), SLR (2 p) Regex (0, 5 p) * (difficult): PDA, attribute grammars, grammar, intermediary code, syntax oriented translation (1, 5 p) S. Motogna - LFTC