Title: COSC 3340: Introduction to Theory of Computation
1COSC 3340 Introduction to Theory of Computation
- University of Houston
- Dr. Verma
- Lecture 17
2Definitions
- A configuration is a snapshot of the machine
written uqv. - Configuration C1 yields configuration C2 if the
Turing machine can legally go from C1 to C2 in a
single step. - Suppose a, b, and c in ?, u and v in ? and
states qi and qj. Then, uaqibv and uqjacv are two
configurations. - uaqibv yields uqjacv if ?(qi, b) (qj, c, L).
- handles the case where the TM moves leftward.
- For a rightward move, uaqibv yields uacqjv if
?(qi, b) (qj,c,R).
3Special Cases
- Special Cases occur when the head is at one of
the ends of the configurations. - For the left-hand end, the configurations qibv
yields qjcv if the transition is left moving, and
it yields cqjv for the right moving transition. - For the right-hand end, the configuration uaqi is
equivalent to uaqi? because we assume that blanks
follow the part of the tape represented in the
configuration. Thus we can handle this case as
before, with the head no longer at the right hand
end.
4More Definitions
- The start configuration of M on input w is the
configuration q0w, which indicates that the
machine is in the start state q0 with its head at
the leftmost position on the tape - In an accepting configuration the state of the
configuration is qaccept - In a rejecting configuration the state of the
configurations is qreject - Accepting and rejecting configurations are
halting configurations and accordingly do not
yield further configurations
5More Definitions
- A TM M accepts input w if a sequence of
configurations C1,C2,,Ck exists where - C1 is the start configuration of M on input w,
- Each Ci yields Ci1, and
- Ck is an accepting configuration.
- The collection of strings that M accepts is the
language of M, denoted L(M).
6More Definitions
- - Turing-recognizable/acceptable
- TM M accepts/recognizes language L if L w M
accepts w. Note 3 outcomes possible, either TM
accepts, rejects, or loops. - Turing-decidable TM M decides L if
- (i) w ? L, M writes a Yes on tape and halts
- (ii) w ? L, M writes a No on tape and halts.
- Every decidable language is Turing-recognizable
but certain Turing-recognizable language are not
decidable.
7Example of TM for 0n1n2n n gt 0
- English description of how the machine works
- Look for 0s
- If 0 found, change it to x and move right, else
reject - Scan past 0s and ys until you reach 1
- If 1 found, change it to y and move right, else
reject. - Scan past 1s and zs until you reach 2
- If 2 found, change it to z and move left, else
reject. - Move left scanning past 0s, ys, zs and 1s
- If x found move right
- If 0 found, loop back to step 2.
- If 0 not found, scan past ys and zs and accept.
Head is on the left or start of the string.
x, y and z are just variables to keep track of
equality
8Example of TM for 0n1n2n n gt 0 contd.
In this case we are starting from the right or at
the end of a given string on the tape. Table will
be very similar if we start from the left.
State Symbol Next state action
q0 0 (q1, x, R)
q0 1 halt/reject
q0 2 halt/reject
q0 x halt/reject
q0 y (q4, y, R)
q0 z halt/reject
9Example of TM for 0n1n2n n gt 0 contd.
Head is on the left or start of the string.
State Symbol Next state action
q1 0 (q1, 0, R)
q1 1 (q2, y, R)
q1 2 halt/reject
q1 x halt/reject
q1 y (q1, y, R)
q1 z halt/reject
10Example of TM for 0n1n2n n gt 0 contd.
Head is on the left or start of the string.
State Symbol Next state action
q2 0 halt/reject
q2 1 (q2, 1, R)
q2 2 (q2, z, R)
q2 x halt/reject
q2 y halt/reject
q2 z (q2, z, R)
11Example of TM for 0n1n2n n gt 0 contd.
Head is on the left or start of the string.
State Symbol Next state action
q3 0 (q3, 0, L)
q3 1 (q3, 1, L)
q3 2 halt/reject
q3 x (q0, x, R)
q3 y (q3, y, L)
q3 z (q3, z, L)
12Example of TM for 0n1n2n n gt 0 contd.
Head is on the left or start of the string.
State Symbol Next state action
q4 0 halt/reject
q4 1 halt/reject
q4 2 halt/reject
q4 x halt/reject
q4 y (q4, y, L)
q4 z (q4, z, L)
q4 ? (q5, y, L)
13Example of TM for 0n1n2n n gt 0 contd.
State Symbol Next state action
q5 0 halt/reject
q5 1 halt/reject
q5 2 halt/reject
q5 x halt/reject
q5 y halt/reject
q5 z halt/reject
q5 ? halt/reject
14Example of TM for 0n1n2n n gt 0 contd.
15JFLAP SIMULATION
16JFLAP SIMULATION
17JFLAP SIMULATION
18JFLAP SIMULATION
19JFLAP SIMULATION
20JFLAP SIMULATION
21JFLAP SIMULATION
22JFLAP SIMULATION
23JFLAP SIMULATION
24JFLAP SIMULATION
25JFLAP SIMULATION
26JFLAP SIMULATION
27JFLAP SIMULATION
28JFLAP SIMULATION
29JFLAP SIMULATION
30JFLAP SIMULATION
31JFLAP SIMULATION
32JFLAP SIMULATION
33JFLAP SIMULATION
34JFLAP SIMULATION
35JFLAP SIMULATION
36JFLAP SIMULATION
37JFLAP SIMULATION
38JFLAP SIMULATION
39JFLAP SIMULATION
40Different way of making 0n1n2n n gt 0