theiory 1.docx
-
Upload
bhatiaharryjassi -
Category
Documents
-
view
214 -
download
0
Transcript of theiory 1.docx
-
7/28/2019 theiory 1.docx
1/17
-
7/28/2019 theiory 1.docx
2/17
Example 4.2.1 Let P be the program in Figure4.2.1.
doy := ?
or
if x y thenreject
write yreadx
until x = 0ifeofthen accept
Figure 4.2.1A program.
Assume the set of natural numbers for the domain of the variables of the program, with 0 as an
initial value.
Figure4.2.2(a)
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1 -
7/28/2019 theiory 1.docx
3/17
Figure
4.2.2(a) A schema of a Turing transducer M that simulates the program of Figure4.2.1. (b)A transition diagram for M. (The asterisk * stands for the current symbol under thecorresponding head.)
shows the schema of a Turing transducer M that simulates P. The first auxiliary work tape of M
is used for recording the values ofx. The second is used for recording the values ofy, and thethird is used for recording the values of predicates (0 for false and 1 for true).
Figure4.2.2(b) gives the transition diagram of M. Each of the components of M starts and endseach subcomputation with each of the heads of the auxiliary work tapes positioned at theleftmost, nonblank symbol of the corresponding tape.
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1 -
7/28/2019 theiory 1.docx
4/17
-
7/28/2019 theiory 1.docx
5/17
for j := 1 to m dobegin
uj := B Bvj := B B
endw :=do
/* Check for acceptance conditions. */if F(state) thenbegin
write wifeofthen acceptreject
end/* Determine the transition rule
(state, a, b1, . . . , bm, next_ state, d0, c1, d1, . . . cm, dm, )to be used in the next simulated move.
*/a := top (v); b1 := top (v1); . . . ; bm := top (vm)(next_ state, d0, c1, d1, . . . , cm, dm, ) := (state, a, b1, . . . , bm)
/* Record the changes in the input head position. */case
d0 = -1: a := top (u); pop (u); push (v, a)d0 = +1: push (u, a); pop (v)
end/* Record the changes in the auxiliary work tapes and in their
correspondinghead positions.
*/for j = 1 to m do
casedj = -1: pop (vj); push (vj, cj); bj := top (uj);
pop (uj); push (vj, bj)
dj = 0: pop (vj); push (vj, cj)dj = +1: push (uj, cj); pop (vj)end
/* Record the output and modify the state. */w := append (w, )state := next_ state
until false
Figure 4.2.3A table-driven program for simulating Turing transducers.
The program simulates the Turing transducer in a manner like that of a finite-memory programin Section 2.2 simulating a finite-state transducer. It is also similar to a recursive finite-domain
program in Section 3.2 simulating a pushdown transducer. The main difference is in therecording of the content of the tapes.
The variables of the program are assumed to have the domain of natural numbers. Intuitively,however, we consider the variables as having the domain Q ({, $} )* * * {-1, 0,+1}.
-
7/28/2019 theiory 1.docx
6/17
For each of the nonoutput tapes of M the program has a pair of "pushdown" variables. Onepushdown variable is used for holding the sequence of characters on the tape to the left of thecorresponding head (at the given order). The other is used for holding the sequence of characterson the tape from the corresponding head position to its right (in reverse order). The pair of
pushdown variables u and v is used for the input tape. The pairui and vi is used for the ith
auxiliary work tape. The variable w is used for recording the output, and the variable state isused for recording the state.
Example 4.2.2 The program records the configuration (aabq3aab$, q3aab, aab) in thefollowing manner (see Figure4.2.4(a)).
Figure 4.2.4Configurations of a Turing transducer.
state= q3
u= aab
v= $baa
u1= B B
v1= B Bbaa
w= aab
Similarly, the program records the configuration (aabaq3ab$, aq3ab, aab) in the followingmanner (see Figure4.2.4(b)).
state= q3
u= aaba
v= $ba
u1= B Ba
v1= B Bba
w= aab
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4 -
7/28/2019 theiory 1.docx
7/17
-
7/28/2019 theiory 1.docx
8/17
F(state) is assumed to be a table lookup function specifying whetherstate holds an accepting
state. (next_ state, d0, c1, d1, . . . , cm, dm, ) := (state, a, b1, . . . , bm) is assumed to be acode segment as shown in Figure4.2.5(b) for deterministic Turing transducers, and a codesegment as shown in Figure4.2.5(c) for nondeterministic Turing transducers. state, c1, . . . , cm,
d0, . . . , dm, , tran are assumed to be table lookup functions specifying the desired
information.
Example 4.2.3 For the deterministic Turing transducer M1, whose transition diagram is givenin Figure4.1.6, the following equalities hold.
state(q0, a, B, B) = q1
c1(q0, a, B, B) = B
c2(q0, a, B, B) = B
(q0, a, B, B) =
d0(q0, a, B, B) = + 1d1(q0, a, B, B) = 0
d2(q0, a, B, B) = 0
state(q2, a, c, B) = q2
c1(q2, a, c, B) = a
c2(q2, a, c, B) = B
(q2, a, c, B) =
d0(q2, a, c, B) = - 1
d1(q2, a, c, B) = - 1
d2(q2, a, c, B) = 0
For the nondeterministic Turing transducer M2, whose transition diagram is given inFigure4.1.3, the following equalities hold.
tran(q0, a, B, q1, +1, a, +1, a) = true
tran(q0, b, B, q1, +1, b, +1, b) = true
tran(q0, $, B, q4, 0, B, 0, ) = true
tran(q0, a, b, q2, 0, B, +1, ) = false
For M1 and M2 the equalities F(q4) = true, and F(q0) = F(q1) = F(q2) = F(q3) = false hold.
The program represents each of the symbols in Q {, $, -1, 0, +1} by a distinctnumber between 0 and k - 1, where k denotes the cardinality of Q {, $, -1, 0, +1}. Inparticular, the blank symbol B is assumed to correspond to 0. The variables are assumed to hold
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5 -
7/28/2019 theiory 1.docx
9/17
natural numbers that are interpreted as the strings corresponding to the representations of thenumbers in base k.
top (var) returns the remainder ofvar divided by k. push (var, ch) assigns to var the value var
k + ch. pop (var) assigns to var the integer value ofvar divided by k. empty (var) provides
the value true ifvar = 0, and provides the value false otherwise. input_ symbol (char) isassumed to provide the value true ifchar holds a symbol from , and provides false otherwise.
append (var, ) returns k var + if 0, and returns the value ofvar if = 0.
Example 4.2.4 Let M be the deterministic Turing transducer whose transition diagram is givenin Figure4.1.6. For such an M the set Q {, $, -1, 0, +1} is equal to {B, a, b, c, , $, -1, 0, +1, q0, q1, q2, q3, q4} and has cardinality k = 14. Under the given order for the elements ofthe set Q {, $, -1, 0, +1}, the empty string , as well as any string B B of blanksymbols, is represented by 0. a is represented by 1, and b is represented by 2. On the other hand,the input string abbab is represented by the natural number
44312 = (((1 14 + 2) 14 + 2) 14 + 1) 14 + 2
= 1 14 + 2 14 + 2 14 + 1 14 + 2 14 .
An obvious distinction between programs and Turing transducers is in the primitiveness anduniformity of the descriptions of the latter. These characteristics contribute to the importance ofTuring transducers in the study of computation.
[next][prev][prev-tail][front][up]
[next][prev][prev-tail][tail][up]
4.2 Programs and Turing Transducers
From Programs to Turing TransducersFrom Turing Transducers to Programs
The definition of a program relies on the notion of computability of functions and predicates. Inthe cases of finite-memory programs and recursive finite-domain programs, the computability ofthe program's functions and predicates is implied by the finiteness of the domains of thevariables. On the other hand, for the general class of programs the issue of the computability of
the functions and predicates needs to be resolved explicitly.
From Programs to Turing Transducers
By Church's thesis a program's functions and predicates can be assumed to be computable bydeterministic Turing transducers. Consequently, a similar assumption can be used when showingthat programs can be simulated by Turing transducers.
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#tailtheory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#tailtheory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#tailtheory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk.html#Q2-50002-9http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk.html#Q2-50002-9http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q1-50002-10http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q1-50002-10http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q1-50002-11http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q1-50002-11http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q2-50002-10http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q2-50002-10http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q2-50002-10http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q1-50002-11http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q1-50002-10http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk.html#Q2-50002-9http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#tailtheory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6 -
7/28/2019 theiory 1.docx
10/17
-
7/28/2019 theiory 1.docx
11/17
Figure
4.2.2
(a) A schema of a Turing transducer M that simulates the program of Figure4.2.1. (b)A transition diagram for M. (The asterisk * stands for the current symbol under thecorresponding head.)
shows the schema of a Turing transducer M that simulates P. The first auxiliary work tape of M
is used for recording the values ofx. The second is used for recording the values ofy, and thethird is used for recording the values of predicates (0 for false and 1 for true).
Figure4.2.2(b) gives the transition diagram of M. Each of the components of M starts and endseach subcomputation with each of the heads of the auxiliary work tapes positioned at theleftmost, nonblank symbol of the corresponding tape.
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10003r4.2.2http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-10002r4.2.1 -
7/28/2019 theiory 1.docx
12/17
The component "Initiate the variables" records the value 0 in the first and second auxiliary worktapes.
The component "do or " nondeterministically chooses to proceed either to the component "y
:= ?" or to "ifx ythen."
In state q2 the component "y := ?" erases the value recorded in the second auxiliary work tape for
y. Then the component enters state q3 where it records a new value fory, which is foundnondeterministically.
The component "ifx ythen" locates in state q4 the rightmost digits in x and y. In state q5 the
component moves backward across the digits ofx and y and determines whether thecorresponding digits are equal. If so, the component stores the value 0 in the third auxiliary worktape. Otherwise, the component stores the value 1. In state q6 the component locates the leftmost
digits ofx and y, and depending on the value stored on the third auxiliary work tape transfers the
control either to the component "reject" or to "writey."
The component "writey" outputs the symbol # in state q8, and the value ofy in state q9. Then it
returns to the leftmost symbol ofy.
The component "readx" verifies in state q11 that the input has a value to be read and reads it in
state q12. Then in state q13 the component locates the leftmost digit ofx.
The component "untilx = 0" checks whetherx is 0 in state q14. If so, the component stores 1 inthe third auxiliary work tape. Otherwise, the component stores 0. In state q15 the component
locates the leftmost digit ofx, and then, depending on the value stored on the third auxiliarywork tape, either moves to the component "do or " or to "ifeofthen accept."
The component "ifeofthen accept" moves from state q16 to the accepting state q17 if and only ifthe end of the input is reached.
From Turing Transducers to Programs
As a result of the previous discussion, we see that there is an algorithm that translates any givenprogram to an equivalent Turing transducer. Conversely, there is also an algorithm that, for anygiven Turing transducer M = , provides an equivalent program.
The program can be table-driven and of the form shown in Figure4.2.3.
/* Record the initial configuration (uqv, u1qv1, . . . , umqvm, w)of M (see Figure4.1.4).*/state := q0u := v := get(input)
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q2-50002-11http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q2-50002-11http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11001r4.2.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11001r4.2.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11001r4.2.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4002r4.1.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4002r4.1.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4002r4.1.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11001r4.2.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#Q2-50002-11 -
7/28/2019 theiory 1.docx
13/17
for j := 1 to m dobegin
uj := B Bvj := B B
endw :=do
/* Check for acceptance conditions. */if F(state) thenbegin
write wifeofthen acceptreject
end/* Determine the transition rule
(state, a, b1, . . . , bm, next_ state, d0, c1, d1, . . . cm, dm, )to be used in the next simulated move.
*/a := top (v); b1 := top (v1); . . . ; bm := top (vm)(next_ state, d0, c1, d1, . . . , cm, dm, ) := (state, a, b1, . . . , bm)
/* Record the changes in the input head position. */case
d0 = -1: a := top (u); pop (u); push (v, a)d0 = +1: push (u, a); pop (v)
end/* Record the changes in the auxiliary work tapes and in their
correspondinghead positions.
*/for j = 1 to m do
casedj = -1: pop (vj); push (vj, cj); bj := top (uj);
pop (uj); push (vj, bj)
dj = 0: pop (vj); push (vj, cj)dj = +1: push (uj, cj); pop (vj)end
/* Record the output and modify the state. */w := append (w, )state := next_ state
until false
Figure 4.2.3A table-driven program for simulating Turing transducers.
The program simulates the Turing transducer in a manner like that of a finite-memory programin Section 2.2 simulating a finite-state transducer. It is also similar to a recursive finite-domain
program in Section 3.2 simulating a pushdown transducer. The main difference is in therecording of the content of the tapes.
The variables of the program are assumed to have the domain of natural numbers. Intuitively,however, we consider the variables as having the domain Q ({, $} )* * * {-1, 0,+1}.
-
7/28/2019 theiory 1.docx
14/17
For each of the nonoutput tapes of M the program has a pair of "pushdown" variables. Onepushdown variable is used for holding the sequence of characters on the tape to the left of thecorresponding head (at the given order). The other is used for holding the sequence of characterson the tape from the corresponding head position to its right (in reverse order). The pair of
pushdown variables u and v is used for the input tape. The pairui and vi is used for the ith
auxiliary work tape. The variable w is used for recording the output, and the variable state isused for recording the state.
Example 4.2.2 The program records the configuration (aabq3aab$, q3aab, aab) in thefollowing manner (see Figure4.2.4(a)).
Figure 4.2.4Configurations of a Turing transducer.
state= q3
u= aab
v= $baa
u1= B B
v1= B Bbaa
w= aab
Similarly, the program records the configuration (aabaq3ab$, aq3ab, aab) in the followingmanner (see Figure4.2.4(b)).
state= q3
u= aaba
v= $ba
u1= B Ba
v1= B Bba
w= aab
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11003r4.2.4 -
7/28/2019 theiory 1.docx
15/17
-
7/28/2019 theiory 1.docx
16/17
F(state) is assumed to be a table lookup function specifying whetherstate holds an accepting
state. (next_ state, d0, c1, d1, . . . , cm, dm, ) := (state, a, b1, . . . , bm) is assumed to be acode segment as shown in Figure4.2.5(b) for deterministic Turing transducers, and a codesegment as shown in Figure4.2.5(c) for nondeterministic Turing transducers. state, c1, . . . , cm,
d0, . . . , dm, , tran are assumed to be table lookup functions specifying the desired
information.
Example 4.2.3 For the deterministic Turing transducer M1, whose transition diagram is givenin Figure4.1.6, the following equalities hold.
state(q0, a, B, B) = q1
c1(q0, a, B, B) = B
c2(q0, a, B, B) = B
(q0, a, B, B) =
d0(q0, a, B, B) = + 1d1(q0, a, B, B) = 0
d2(q0, a, B, B) = 0
state(q2, a, c, B) = q2
c1(q2, a, c, B) = a
c2(q2, a, c, B) = B
(q2, a, c, B) =
d0(q2, a, c, B) = - 1
d1(q2, a, c, B) = - 1
d2(q2, a, c, B) = 0
For the nondeterministic Turing transducer M2, whose transition diagram is given inFigure4.1.3, the following equalities hold.
tran(q0, a, B, q1, +1, a, +1, a) = true
tran(q0, b, B, q1, +1, b, +1, b) = true
tran(q0, $, B, q4, 0, B, 0, ) = true
tran(q0, a, b, q2, 0, B, +1, ) = false
For M1 and M2 the equalities F(q4) = true, and F(q0) = F(q1) = F(q2) = F(q3) = false hold.
The program represents each of the symbols in Q {, $, -1, 0, +1} by a distinctnumber between 0 and k - 1, where k denotes the cardinality of Q {, $, -1, 0, +1}. Inparticular, the blank symbol B is assumed to correspond to 0. The variables are assumed to hold
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-3025r4.1.3http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.html#50002-11004r4.2.5 -
7/28/2019 theiory 1.docx
17/17
natural numbers that are interpreted as the strings corresponding to the representations of thenumbers in base k.
top (var) returns the remainder ofvar divided by k. push (var, ch) assigns to var the value var
k + ch. pop (var) assigns to var the integer value ofvar divided by k. empty (var) provides
the value true ifvar = 0, and provides the value false otherwise. input_ symbol (char) isassumed to provide the value true ifchar holds a symbol from , and provides false otherwise.
append (var, ) returns k var + if 0, and returns the value ofvar if = 0.
Example 4.2.4 Let M be the deterministic Turing transducer whose transition diagram is givenin Figure4.1.6. For such an M the set Q {, $, -1, 0, +1} is equal to {B, a, b, c, , $, -1, 0, +1, q0, q1, q2, q3, q4} and has cardinality k = 14. Under the given order for the elements ofthe set Q {, $, -1, 0, +1}, the empty string , as well as any string B B of blanksymbols, is represented by 0. a is represented by 1, and b is represented by 2. On the other hand,the input string abbab is represented by the natural number
44312 = (((1 14 + 2) 14 + 2) 14 + 1) 14 + 2
= 1 14 + 2 14 + 2 14 + 1 14 + 2 14 .
An obvious distinction between programs and Turing transducers is in the primitiveness anduniformity of the descriptions of the latter. These characteristics contribute to the importance ofTuring transducers in the study of computation.
[next][prev][prev-tail][front][up]
http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6http://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-four.html#theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse2.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#tailtheory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse3.htmlhttp://www.cse.ohio-state.edu/~gurari/theory-bk/theory-bk-fourse1.html#50001-4007r4.1.6