Download presentation
Presentation is loading. Please wait.
Published byKerry Page Modified over 8 years ago
1
1 Turing Machines
2
2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
3
3 Regular Languages Context-Free Languages Languages accepted by Turing Machines
4
4 A Turing Machine...... Tape Read-Write head Control Unit
5
5 The Tape...... Read-Write head No boundaries -- infinite length The head moves Left or Right
6
6...... Read-Write head The head at each time step: 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right
7
7...... Example: Time 0...... Time 1 1. Reads 2. Writes 3. Moves Left
8
8...... Time 1...... Time 2 1. Reads 2. Writes 3. Moves Right
9
9 The Input String...... Blank symbol head Head starts at the leftmost position of the input string Input string
10
10 States & Transitions Read Write Move Left Move Right
11
11 Example:...... Time 1 current state
12
12...... Time 1...... Time 2
13
13...... Time 1...... Time 2 Example:
14
14...... Time 1...... Time 2 Example:
15
15 Determinism Allowed Not Allowed No epsilon transitions allowed Turing Machines are deterministic
16
16 Partial Transition Function...... Example: No transition for input symbol Allowed:
17
17 Halting The machine halts if there are no possible transitions to follow
18
18 Example:...... No possible transition HALT!!!
19
19 Final States Allowed Not Allowed Final states have no outgoing transitions In a final state the machine halts
20
20 Acceptance Accept Input If machine halts in a final state Reject Input If machine halts in a non-final state or If machine enters an infinite loop
21
21 Turing Machine Example A Turing machine that accepts language a *
22
22 Time 0
23
23 Time 1
24
24 Time 2
25
25 Time 3
26
26 Time 4 Halt & Accept
27
27 Rejection Example Time 0
28
28 Time 1 No possible Transition Halt & Reject
29
29 Infinite Loop Example Another Turing machine for language a * and is this one correct???
30
30 Time 0
31
31 Time 1
32
32 Time 2
33
33 Time 2 Time 3 Time 4 Time 5... Infinite Loop
34
34 Because of the infinite loop: The final state cannot be reached The machine never halts The input is not accepted
35
35 Another Turing Machine Example Turing machine for the language
36
36 Time 0
37
37 Time 1
38
38 Time 2
39
39 Time 3
40
40 Time 4
41
41 Time 5
42
42 Time 6
43
43 Time 7
44
44 Time 8
45
45 Time 9
46
46 Time 10
47
47 Time 11
48
48 Time 12
49
49 Halt & Accept Time 13
50
50 If we modify the machine for the language we can easily construct a machine for the language Observation:
51
51 Formal Definitions for Turing Machines
52
52 Transition Function
53
53 Transition Function
54
54 Turing Machine: States Input alphabet Tape alphabet Transition function Initial state blank Final states
55
55 Configuration Instantaneous description:
56
56 Time 4Time 5 A Move: aybqxxaybq 02
57
57 Time 4Time 5 bqxxyybqxxaybqxxaybq 1102 Time 6Time 7
58
58 bqxxyybqxxaybqxxaybq 1102 bqxxyxaybq 12 Equivalent notation:
59
59 Initial configuration: Input string
60
60 The Accepted Language For any Turing Machine }:{)( 210 xqxwqwML f Initial stateFinal state
61
61 Standard Turing Machine Deterministic Infinite tape in both directions Tape is the input/output file The machine we described is the standard:
62
62 Implementation-level descriptions {w|w contains an equal number of 0s and 1s}
63
63 Implementation-level descriptions {w|w contains an equal number of 0s and 1s} On input string w:
64
64 Implementation-level descriptions {w|w contains an equal number of 0s and 1s} On input string w: 1)Scan the tape & mark the 1st 0 which is unmarked. If none is found, go to #4. Otherwise, move the head back to the front of the tape.
65
65 Implementation-level descriptions {w|w contains an equal number of 0s and 1s} On input string w: 1)Scan the tape & mark the 1st 0 which is unmarked. If none is found, go to #4. Otherwise, move the head back to the front of the tape. 2)Scan the tape & mark the 1st 1 which is unmarked. If none is found, reject.
66
66 Implementation-level descriptions {w|w contains an equal number of 0s and 1s} On input string w: 1)Scan the tape & mark the 1st 0 which is unmarked. If none is found, go to #4. Otherwise, move the head back to the front of the tape. 2)Scan the tape & mark the 1st 1 which is unmarked. If none is found, reject. 3)Move the head back to the front of the tape & go to #1.
67
67 Implementation-level descriptions {w|w contains an equal number of 0s and 1s} On input string w: 1)Scan the tape & mark the 1st 0 which is unmarked. If none is found, go to #4. Otherwise, move the head back to the front of the tape. 2)Scan the tape & mark the 1st 1 which is unmarked. If none is found, reject. 3)Move the head back to the front of the tape & go to #1. 4)Move the head back to the front of the tape. Scan the tape to see if any unmarked 1s remain. If none are found, accept; otherwise, reject.
68
68 Try this one: {w|w contains twice as many 0s as 1s} On input string w: 1)Scan the tape &... (Hint, you can “mark” and “double mark”.)
69
69 Try this one: {w|w = a n b n, n 0} On input string w: 1)Scan the tape &...
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.