Professional Documents
Culture Documents
Goddard 11: 2
The TM’s Tape
control
··· ∆ ∆ 0 0 1 ∆ ∆ ···
Goddard 11: 3
The Program
• writes a symbol,
• moves left or right or stays in place, and
• updates its state.
Goddard 11: 5
Example TM: Strings Containing 101
00R
Goddard 11: 6
Formal Definition
• Q is set of states.
• Σ is input alphabet.
• Γ is tape alphabet (more than Σ).
• q0 is start state, ha the unique halt-and-accept
state, and hr the (seldom drawn) unique halt-
and-reject state.
• δ is the transition function Q × Γ 7→ Q × Γ ×
{L, R, S}.
Goddard 11: 7
Example TM: 0n1n
00R, 11R
0∆R
A B
∆∆L
∆∆S
∆∆R
ha D C
1∆L
00L, 11L
Goddard 11: 9
A
∆ 0 0 1 1 1 ∆
∆ ∆ 0 1 1 1 ∆
..
.
C
∆ ∆ 0 1 1 1 ∆
∆ ∆ 0 1 1 ∆ ∆
..
.
A
∆ ∆ 0 1 1 ∆ ∆
..
.
C
∆ ∆ ∆ 1 1 ∆ ∆
..
.
A
∆ ∆ ∆ 1 ∆ ∆ ∆
Goddard 11: 10
Reject
TMs might not halt
∆∆R
Goddard 11: 11
Example TM: Balanced Brackets
Goddard 11: 12
Example TM: Balanced Brackets
∆∆S
xxL C ha
Goddard 11: 13
Example TM: Palindromes
Goddard 11: 14
Example TM: Even-length Palindromes
00R, 11R
∆∆L
B0 C0
0∆L
0∆R
A D 00L, 11L
∆∆R
1∆R
∆∆S
1∆L
∆∆L
ha B1 C1
00R, 11R
Goddard 11: 15
Informal TM
Goddard 11: 16
Informal TM
Goddard 11: 17
TM Subroutines
Goddard 11: 18
Example Subroutine
Goddard 11: 19
Example Subroutine
Goddard 11: 20
TM for Shifting Right
0∆L, 1∆L
00R
00R q2 ∆0L
q1 q4
11R
∆∆S
11R 00R
∆1L
ha q3
11R
Goddard 11: 21
TMs That Do Not Halt
Goddard 11: 23
Solution to Practice
00R, xxR
1xR
0∆R
11R, yyR
2yL
xxR ∆∆R
Goddard 11: 24
Summary
Goddard 11: 25