Title: Formal Definition
1Formal Definition
Definition. A Turing machine is a 5-tuple (S, ?,
?, s, H), where
- S is a set of states
- ? is an alphabet It must contain ? and ?. It
cannot contain ? or ? - s ? S is the initial state
- H ? S is the set of halting states
2Formal Definition (II)
- ? is a collection of transitions defined by the
function - ? maps ((S-H) ? ?) into (S ? (? ? (?, ?))
- such that
- For any q ? S H, then for some p ? S
- 1.1 ?(q, ?) (p,?), or
- 1.2 ?(q, ?) (p, ?)
- There cannot be any p, q ? S and a ? ? ? such
that ?(p, a) (q, ?)
Very simple definition but very useful precisely
because of its simplicity!
3The Eraser TM
Construct a Turing machine that receives as input
a substring of as and replace each a for a blank
space, ?
4Another Example
-
- ((s, ?),(s,?)),
- ((s,a),(q, ?)),
- ((q, ?),(s, ?)),
- ((s, ?),(h, ?)),
- ((q,a),(q,a)),
- ((q, ?), (q, a))
5The Turing Machines M1 and M0
The Turing Machine M1
6The Turing Machine Mx
7Configuration for Previous Machines
Configuration
Machine
Explanation
Finite automata
Pushdown automata
8Configuration for Turing Machines
Configuration
9Configuration for Turing Machines (2)
Instead of writing (q,h,LS,RS), we write
(q,LShRS)
If q ? H, then (q,LShRS) is called a halting
configuration
Examples
- Initial configuration with 3 as for the eraser
TM
(s,e?aaa?)
- Final configuration starting with (s,e?aaa?)
(s,?????)
- Final configuration of M1with (s,?a?ab)
(s,?1?ab)
10Computation in Turing Machines
A configuration C1 (q1,LS1h1RS1) yields a
configuration C2 (q2,LS2h2RS2) in one step,
written C1 C2, if
?
- There is a transition ((q1, h1),(q2,A)) in ?
- C2 is obtained after applying ((q, h1),(q2,A)) to
C1
(there are 3 cases for A a in ?, ?, or ?)
11Example of Computation
(s,e?aaa?) yields (h,e?????) written (s,e?aaa?)
(h,e?????)
?
12Example of Computation (2)
Consider the following Turing machine
((s, ?),(h, ?))
((s,a),(q,b)) ((s,b),(q,a))
((q,a),(s,?)) ((q,b),(s,?))
((q, ?),(q, ?)) ((s, ?),(s,?))
((q, ?),(s,?))
- Trace the machine when starting with
configuration (s,?abbabba)
- Describe what this machine does
13Another Turing Machine
The (ab) Turing Machine
a
b
?
a
b
a
b
?
a
a
14Homework
- Please provide a secret nickname so we can post
your grades on the courses web site - 4.1 a), b)
- 4.2
- Construct a Turing machine that reads the
character in the current cell and copies it into
the contiguous cell immediately to the right of
the current one (if the character in the current
cell is ?, the machine does not terminate). For
example if the starting configuration is (s,
?abaa), then the halting configuration is (h,
?abba), where h is a halting state - Construct the Turing machine that recognizes
(ab) (See Slide 13)