1 Turing Machines
2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
3 Regular Languages Context-Free Languages Languages accepted by Turing Machines
4 A Turing Machine Tape Read-Write head
5 The Tape Read-Write head No boundaries -- infinite length The head moves Left or Right
Read-Write head The head at each transition (time step): 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right
Example: Time Time 1 1. Reads 2. Writes 3. Moves Left
Time Time 2 1. Reads 2. Writes 3. Moves Right
9 The Input String Blank symbol head Head starts at the leftmost position of the input string Input string
10 States & Transitions Read Write Move Left Move Right
11 Example: Time 1 current state
Time Time 2
Time Time 2 Example:
Time Time 2 Example:
15 Partial Transition Function Example: No transition for input symbol Allowed:
16 Halting The machine halts in a state if there is no transition to follow
17 Halting Example 1: No transition from HALT!!!
18 Halting Example 2: No possible transition from and symbol HALT!!!
19 Accepting States Allowed Not Allowed Accepting states have no outgoing transitions The machine halts and accepts
20 Acceptance Accept Input If machine halts in an accept state Reject Input If machine halts in a non-accept state or If machine enters an infinite loop string
21 Turing Machine Example Accepts the language: Input alphabet
22 Time 0
23 Time 1
24 Time 2
25 Time 3
26 Time 4 Halt & Accept
27 Rejection Example Time 0
28 Time 1 No possible Transition Halt & Reject
29 Another Turing Machine Example Turing machine for the language
30 Match a’s with b’s: Repeat: replace leftmost a with x find leftmost b and replace it with y Until there are no more a’s or b’s If there is a remaining a or b reject Basic Idea:
31 Time 0
32 Time 1
33 Time 2
34 Time 3
35 Time 4
36 Time 5
37 Time 6
38 Time 7
39 Time 8
40 Time 9
41 Time 10
42 Time 11
43 Time 12
44 Halt & Accept Time 13
45 If we modify the machine for the language we can easily construct a machine for the language Observation: