Escolar Documentos
Profissional Documentos
Cultura Documentos
|
!
The four types of automata, TM, LBA, PDA, and FA (either deterministic or nondeterministic) are typical models for
computation that have been extensively investigated in the area of theory of computation. Many variations of these automata have
been introduced, including automata with variations on the number of tapes or stacks, tape dimensions, number of heads, head
mobility, etc. This chapter introduces some of these interesting variations and discusses their computational capability.
By @ @
we are concerned only with a computational model¶s capacity to show us a final result, with no
regard to the amount of space or time used. If two models have the same computational capability, we say they are
.
Simulation is a popular technique for showing that two computational models are equivalent. If we can show that one model can
simulate the other and vice versa, then they are equivalent. We will see a couple of application examples of this technique.
|
!
The automata that we have introduced produce (implicitly) a simple output ³yes´
by entering an accepting state if the input string belongs to its language. Attaching
an output port to the finite state control we can extend this limited output capacity so
that for the given input string they produce an output string of finite length (see
Figure (a) below for an FA). We call such automata @.
Depending on the time of output, there are two variations. The one produces an
output while taking a transition, and the other after the transition (i.e., on the next
state). In particular for FA, the former models are called Mealy automata, and the
latter Moore automata. (See the figure (b) and (c), where 0 is an output symbol.)
0
--a-- a
a/0
output 0
port
||
! V
The TM with one-dimensional tape and one read/write head can be extended
to multi-track, multi-tape, or multi-dimensional tape TM. We will see that
these variations are equivalent to the standard TM. In other words, if one of
these variations recognizes a language L, we can build a standard TM that
recognizes L, and vice versa.
a b a a b a b a a b
b c
p r
|
V
The figures below illustrate that by encoding k symbols that can appear in a
column of k-track tape, we can transform a k-track tape TM M to the standard
1-track TM M¶ that recognizes the same language.
Conversely, for a given 1-track TM, it is trivial to construct a k-track TM that
recognizes the same language. Hence, 1-track TM¶s and multi-track TM¶s are
"# .
a b a a b a a b
Î
b c Encoding
[a, B] = a
M r M¶
r [b, B] = b
[a, b] = Î
([a, B], [a, b], R) q (a, Î, R) q
[b, c] =
.
p . p
|
V
V V
A multi-tape TM has some constant k 2 1 auxiliary tapes in addition to the input tape.
Each tape head can move independent of others. Given a (k+1)-tape TM M, we can
build a (k+1)-track TM M¶ which simulates M as follows. Put the k+1 tracks of M¶ in
correspondence with the k+1 tapes of M as illustrated below. Use a check mark for
each track to indicate the position of its corresponding tape head. To simulate the next
move of M, M¶ scans its tape and collects the k+1 check marked symbols, applies the
transition function of M and then updates its tape accordingly.
Given a multi-track TM, it is trivial to construct a multi-tape TM that recognizes the
same language. It follows that both TM models are equivalent. Since multi-track TM¶s
are equivalent to standard TM¶s, multi-tape TM¶s are equivalent to standard TM¶s.
a b b a
Input tape aâ b b a
V
câ d
auxiliary tapes
a bâ
c d
V
a b
|
V
V
We can extend the tape dimension of the standard TM to a multi-dimension one. A
two-dimensional (2D) tape TM is illustrated below. The finite state control, with a
read/write head under it, can move up, down, to the right or to the left. This model is
widely used for pattern analysis and searching.
We can show that the tape¶s dimension does not affect computational capability. For
example, given a standard TM M, it is trivial to build a 2D-tape TM M¶, which, given
the input string on one of its tape rows, simply simulates M step by step.
Conversely, given a 2D-tape TM M, constructing a standard TM M¶ that simulates M
is a little bit tricky. TM M¶, with the 2D input mapped on its one-dimensional tape raw
by raw with a boundary mark, must keep track of the current position of M. Here we
present a rough sketch of an idea.
a b a
finite state control b b a
with 4-way read/ a
write head.
|
V
Given a 2D pattern, we first transform it into the smallest rectangle by filling the
blank cells around the boundary with a special symbol (# in the figure below). (We
need this rectangular form for the convenience of keeping track of the current
position of M when it moves up or down.)
Then we make copies of the rectangular pattern row by row and concatenate
them into a one-dimensional string by inserting a boundary marker ($ in the
figure). Finally we put this one-dimensional string onto the standard TM tape with
a check mark on every symbol appearing in the column where M is positioned.
Now, we let M¶ simulate M step by step. The simulation needs tedious house-
keeping operations, especially when M moves up, down, or off the pattern. We
leave these challenging details for the reader.
a b a
â â â
finite state b b # a b a $ b b # $ b a #
control b a #
with 4-way
read/write
head. M¶
M
|
We can extend the LBA model with multi-track, multi-tape, and multi-dimensional
tape LBA¶s as we did for the TM. In these extensions, we restrict the additional tape
space available to the size of the input. Recall that the tape space of the standard LBA
is restricted to the length of the input. So, for the two-tape LBA, the machine cannot
use auxiliary tape longer than the input size. We can show that these LBA variations
are all equivalent to the standard LBA.
Break Time
A ten year old boy was failing math. His parents tried everything from tutors to hypnosis, but to no avail. Finally,
at the insistence of a family friend, they decided to enroll their son in a private Catholic school. After the first day,
the boy's parents were surprised when he walked in after school with a stern, focused and very determined
expression on his face, and went right past them straight to his room, where he quietly closed the door.
For nearly two hours he toiled away in his room - with math books strewn about his desk and the surrounding
floor. He emerged long enough to eat, and after quickly cleaning his plate, went straight back to his room, closed
the door, and worked feverishly at his studies until bedtime. This pattern continued ceaselessly until it was time for
the first quarter report card. (To be continued on next slide)
|
!
The PDA model also has many variations, such as two-way (input head), multi-stack,
finite-turn, and empty stack. A finite-turn PDA can have a constant number of turns
from pushing operations to popping and vice versa during the computation. An empty
stack PDA accepts the input string by empty stack (instead of being in an accepting
state) together with the condition of reading up to the last input symbol.
Contrary to the TM case, these variations of the standard PDA show different
computational capability, and in general it is not easy to prove the difference.
Break Time
The boy walked in with his report card -- unopened -- laid it on the dinner table and went straight to his room.
Cautiously, his mother opened it, and to her amazement, she saw a bright red "A" under the subject of MATH.
Overjoyed, she and her husband rushed into their son's room, thrilled at his remarkable progress.
"Was it the nuns that did it?", the father asked. The boy only shook his head and said, "No."
"Was it the one-on-one tutoring? The peer-mentoring?"
"No."
"The textbooks? The teachers? The curriculum?"
"Nope," said the son. "On that first day, when I walked in the front
door and saw that guy they nailed to the 'plus sign,' I just knew they meant business!"
- Denise -
|
The 1-way head of PDA can be extended to 2-way with the same two accepting
conditions. This two-way mobility gives more computational power. For example,
we can easily construct a 2-way PDA M that recognizes our familiar context-
sensitive language {aibici | i > 0 }.
To accept this language, M scans the input twice. During the first scan M reads
up to the first c and checks if the prefix before c is aibi, for some i > 0. If this part
is successful, M moves back to the left till it sees the last a. Then scanning right,
M makes sure that there is the postfix bici. (We leave the details for the reader.) In
Chapter 12 we will prove that this language is not a context-free and that no
standard PDA can recognize it.
aa . . . abb . . . bcc . . . c
Z0 stack
|
2-way read/write
Stack 1 Z0
(a) TM
Stack 2 Z0baa . . .babba
|
The 2-stack PDA can do this by pushing the whole input into one of its stacks and
then transferring it to the other stack. Notice that since the input has no end marker, to
shift the whole input string into one of the stacks, the PDA needs a nondeterministic
move to guess the last symbol of the input.
During the simulation we can always let the symbol read by the TM appear at one
of the stack tops (stack 2 in figure (b) below) by popping a symbol from a stack and
pushing it onto the other stack. Using this trick, it is easy to simulate the TM step by
step. (The details are left to the reader.)
00b . . . aab
00b . . . aab
1-way read only
2-way read/write
Z000 Stack 1
(a) TM
Z0baa . . .b Stack 2
0
!
Recall that for a PDA to accept the input string, it must satisfy two conditions:
(1) the whole input must be read and (2) the machine must be in an accepting state.
Substituting the empty stack for condition (2), we get a PDA accepting by empty stack.
Here, by empty stack we mean the stack completely emptied by popping out the bottom
of the stack symbol Z0. No computational move is possible with empty stack.
We can show that the standard PDA and the PDA accepting by empty stack are
computationally equivalent. Let Ma be a standard PDA and Me be a PDA accepting by
empty stack. Given an Me, we can construct an Ma which recognizes the language
L(Me). We simply change every transition of Me that pops Z0 to a transition that enters
an accepting state without empting the stack, as the following figure show.
($%&'º) ($%&'%&)
(a) Me (b) Ma
|
Now suppose that we are given a standard PDA Ma, and assume that Ma does not
pop the bottom of stack symbol Z0. Otherwise, if Ma has a transition, for example
(p, a, Z0)= (q, º), we introduce a new stack symbol, say A0, and let the machine
rewrite Z0 with A0, instead of popping (see the figure below). Such modification
does not affect the language accepted by Ma. Notice that Ma does not empty the
stack, because no transition is defined with A0 at the stack top.
($%&'º ($%&'& )
(º$%&'º (º$%&'& )
"& "&
start start
|
With Ma, which does not pop the bottom of the stack symbol Z0, we construct an Me
to recognize L(Ma) as follows. Introduce a new state, say qe, and add a transition to this
state from every accepting state of Ma without reading the input. Then let it dump the
stack contents in state qe. (In the figure below, ; denotes any stack symbol including
Z0.)
(º$;'º
(º$;'º "
(º$;'º
(a) Ma (b) Me
|
We learned that substituting the condition of empty-stack for the condition of being
in an accepting state does not affect the language accepted by the PDA, i.e., the classes
of languages accepted by both models are the same. In the proof, we paid no attention
to the types (deterministic or nondeterministic) of PDA Ma and Me. If the given Me is
DPDA (or NPDA), then obviously the PDA Ma that we have constructed is also DPDA
(or, respectively, NPDA). But it does not work the other way around. Here is an
example.
It is easy to construct a standard DPDA which recognizes the language is a+ (see
figure (a) below). If we transform this standard DPDA to a DPDA accepting by empty
stack, we get an NPDA Me as shown in figure (b) below. Actually, it is impossible to
construct a DPDA that recognizes this language with empty stack. So we can say that
the standard DPDA is more powerful than the DPDA accepting by empty stack.
( a, Z0/Z0 ) ( a, Z0/Z0 )
a b a b b
|
2D tape
a b a (read-only)
b a
Finite state control b a
|
V
We can add extra read-only heads to the standard FA model. Initially all the
heads are assumed to be reading the leftmost input symbol. The head mobility is
usually restricted to one-way, and we may (or may not) allow the heads to sense
the presence of the others on the same cell.
A multi-head FA model is more powerful than the standard FA. We can constrict a
2-head FA that recognizes {aibi | i > 0 }, which is a non-regular context-free
language. (In Chapter 12 we will prove that this language is not regular.) (The
details for the construction are left for the reader.)
a a a b b b
.....
..... .....
/0.5
0/0.5
|
||
! Construct the state transition graph of a DPDA which recognizes each of the following languages 0
!.
(a) L1 = {aibj*| i > j > 0 } (b) L2 = {aibj | i > j > 0 } (c) L3 = { aibkci | i, k > 0 }
! Construct the transition graph of a 2-head 1-way DFA which recognizes the language L below and briefly describe how
it works. The two heads can move independently to the left, right or stay, after reading the input. When you construct a 2-
head 1-way DFA, use the notation shown in the figure below. (In Chapter 12 we will prove that it is impossible for any
standard FA to recognize L.)
L = { aibi | i > 0 }
( a, b ), (a, a )
q
p
t
In state t, head 2 does not read, and if head
s 1 reads a, then the 2-head DFA enters state s.
(a, º )
|
! Construct the state transition graph of a 2-D DTM, which draws a figure 8 with character 8¶s (see figure (b)) with as few
states as possible. When the work is complete your DTM should be in an accepting state.
(a) (b)
|