THREE-HEAD PROBABILISTIC FINITE AUTOMATA. VERSUS MULTI-HEAD DETERMINISTIC ONES. Some languages can be recognized by multi-head finite.
COMPLEXITY OF PROBABILISTIC VERSUS DETERMINISTIC AUTOMATA R~si~
Freivalds
Institute of Mathematics and Computer Science The University of Latvia Raina bulv~ris 29 Riga, Latvia i.
The
paper
probabilistic
contains automata
INTRODUCTION
several over
results
showing
deterministic
advantages
ones.
The
of
advantages
always are of one kind, namely, the complexity of probabilistic automata turns out to be considerably smaller. The paper contains both
new
results
and
results
already
published
in
the
USSR
(though, hardly these results are known outside the USSR). The economy of computer resources etc.)
is
studied
probabilistic
and applications is
the
in
this
paper,
and deterministic
(computation time, memory, comparing
machines.
computation
Both
by
from theoretical
aspect the most interesting part of the problem
possibility
of
such
an
economy
in
computation
of
explicitly defined natural functions with probability as close to 1
as
possible.
problem was probabilistic probability computation explicitly
Nevertheless
the most
until
recently
survey
part
of is
the
correct
rather
defined
result
is
artificial,
specific
theorem
consists
on
languages
power
of two
high 2)
of
parts.
but for
but
The
first
in
asserts
that
under consideration
of
the
the paper according
first
parts
of
only
machines
The second part shows that no deterministic
proofs
of of by
this the
by a probabilistic machine
to the methods
theorems.
of
non-isolated
language
do this. We organize
concept
1/2
machine. the
is recognizible
the
for
part
the
i) when the
recognition
exceeding
probabilistic
of
The power
machines was proved only in two cases:
cut-points, i.e. with probability unboundedly small numbers. Every
this
hard and the least explored.
The
proofs
second parts use various techniques with no unifying idea.
can
used in of
the
566
The
types
of
automata
and
well-known in the literature.
machines
used
in
Precise definitions
the
paper
are
can be found in
[Hen 77]. 2. A L E M M A F O R J O I N I N G C O U N T E R S
When designing efficient probabilistic computational
devices
as a procedure lemma
that
probabilistic
the
algorithms
can
involving large number of counters,
of the counters a
sometimes
algorithms
depends can
be
on the input word. used
to
justify
for simple
be presented
and the number
This section contains
the
correctness
of
the
algorithm.
Let N denote the set of all non-negative
integers,
Z denote
the set of all integers and X denote an arbitrary set. Let
n~N.
Let
Xx{l,2,...,n}~Z.
P be
a function
We call
the pair
and
F be
a
of functions
X~{0,1}
dispersive
function
if for all x~X the following holds: i) P ( x ) = l ~
(¥u,v~{l,2,...,n})
2) P(x)=0 9 (Vu,v6{l,2, .... n})
(F(x,u)=F(x,v)), (u~v ~ (F(x,u)~F(x,v)).
Let n~N, k(x) be a function X ~ N, and for every i~{1,2,..., k(x)} a dispersive 2,...,n}
~
Z).
pair of functions
We
denote
the
(Pi : X ~ {0,i};
family
F i : X×{I,
{FI,F2,...,Fn}
by
consider the following random value SF(X ). For arbitrary ..,k(x)}
a
random
equiprobably independent
in
number
Yi
{l,2,...,n}
is
taken
which
and
every
Yi
is is
F.
We
i~{i,2,.
distributed statistically
from all the other yj. Then
k(x) SF(X) = Z Fi(x'Yi)i=l LEMMA 2.1.
For arbitrary x~X, if k ~ Pi (x)=l then there i=l
zeZ such that SF(X)=Z with probability there
is
not
a
single
z
such
that
I, and if the
'i=i
probability
is a
i(x)=0 then of
SF(X)=Z
would exceed i/n. PROOF.
The
assertion
we
Pi(x)=0.
Then
first
assume the
assertion
that
for
values
is evident.
some
x,
To prove
i~{l,2,...,k(x)}
the
second
it
holds
{Fi(x,l),Fi(x,2),...,Fi(x,n)}
are
567
k(x) pairwise
distinct.
Fi(x,Yi)
The
total
= ~
Fj (x,yj)
includes
j=l from all the rest of yj. Hence the
and Yi is independent
total SF(X ) can equal
SF(X )
z for no more than one of the n possible
values Yi"
3.
THREE-HEAD VERSUS
Some
languages
automata.
For these
complexity arbitrary
k>0
MULTI-HEAD
can
be
It was
there
is
2-head
a
finite
the minimum
number
which
automaton
In
multi-head
in FREIVALDS
language
automaton.
ONES
by
can
with
this
Section
finite
of heads (1979)
be
is a
that
for
recognized
probability
arbitrary c>0 but which is not recognizable k-head
AUTOMATA
DETERMINISTIC
proved
finite
FINITE
recognized
languages
measure.
probabilistic
PROBABILISTIC
l-c
by fot
by any deterministic another
advantage
of
probabilistic multi-head finite automata is proved. A language is described
which
can
be
recognized
by
a
probabilistic
3-head
finite automaton but no deterministic multi-head finite automaton can recognize this specific language. On the
other
probabilistic
then
finite
the
I risk
to conjecture
that
2-head
of a
automaton do not suffice for such an advantage: I. If a language is recognized by a probabilistic
CONJECTURE
2-head
hand,
automaton
language
is
with
probability
recognized
by
a
l-c
for
arbitrary
deterministic
c>0
multi-head
finite automaton as well. We describe
a language
W.
To describe
it we
introduce
types of blocks A(b), B(m,k), C(m,k), D(n,i), Eb(i,k ). A(b):
0b2021102210231...I0 k-i
B(m,k):
0m20 m
k-i I0 m
2 b-I
20
k-i I...i0 m
2b
k-i 20 m
; k 20 m ;
m times C(m,k):
0X3B(m,l)3D(m,3)3...3B(m,k-l)4B(m,k); D(n,i):
0il0il...10i20 i n times
Eb(i,k):
C(l,k)4D(ik,i)4C(2,k)4D(2k,i)4...
the
568
...4c(2b-l,k)4D((2b-l)k,i)5c(2b,k)5D((2b)k,i); codeb(il,i2,...,ib,Jb,.-.,j2,Jl):
A(b)7Eb(il,l)6Eb(i2,2)6...
..-6Eb(ib_l,b-l)7Eb(ib,b)7Eb(Jb,b)6Eb(Jb_l,b-l)6--. ---6Eb(J2,2)7Eb(Jl,l);
W' = {xlx~{0,1,2,3,4,5,6,7}
& (3 ba2,il,i2,...,ib,Jb,...,j2,Jl
)
(x=codeb(il,i2,---,ib,Jb,.--,j2,Jl)} W = {x]x~{0,1,2,3,4,5,6,7}
& (3 ba2,il,i2,...,ib)
(x=codeb(il,i 2 .... ,ib,ib,...,i2,il)} THEOREM
I.
(I)
For
arbitrary
c>0
there
3-head finite automaton which recognizes every word in W with probability with
probability
l-c.
(2)
No
is
a probabilistic
the language W accepting
1 and rejecting deterministic
carry word in W
multi-head
finite
automaton can recognize W. PROOF. and
(I) Let b 0 be the least value of b for which b/2bi/e.
The
started by the head h I going through the subword A(b)
and deciding
whether
or not bzb 0. Note
computation
is
0 b of the block
that
it suffices
to
read only the first b0+l letters of the subword. The processing
of the input word is different
for large and
small values of b. If b is small, represented
i.e.
b/2bae
as a concatenation
then
the
input word x~W can be 1 1 1 it Zl0 Iz20 2z30 3z4..z10 ,
of words
where t is a constant, Zl,Z2,...,z t are fixed words in {0,1,2,3, 4,5,6,7} and these words begin with letters differing from 0. Additionally,
there is a binary relation R b completely
the parameter
b such that
defined by
(i,j)R b ~ li=l j-
Two heads h I and h 2 suffice to process the word for small values of b. The leading head h I does all the reading from the tape. to
The head h 2 reads nothing.
simulate
distance
a
between
residue modulo automaton. The
counter.
The
the heads this
correctness
factor of
It position
content multiplied kept
of
on the tape is used counter
to a constant
in the
Zl,Z2,...,z z
the
is
internal checked
equals factor
the plus
memory
of
by
finite
the
the
569
automaton
while
reading
the
input.
The
checking
of
all
the
equalities li=l j where it is needed is done in a probabilistic way
by
using
the
counter.
We
define
the
following
family
of
dispersive pairs of functions. i, if l.=l. 1 3 0, if i.~i. l 3 Fij(x,y ) = Y(li-lj).
Pi~(x)3" " =
The
pair
(Pij,Fij)
F={Fij}(i,j)~Rb.
is
in
the
The probabilistic
family
iff
automaton
(i,j)~R b.
for every
Let
(i,j)ER b
produces a random number Yij~{l,2,...,d} being independent of all the other random numbers and adds Fij(x,Yij ) to the counter. The input word is accepted iff at the end the counter is empty. The correctness of the algorithm follows from Lemma i. If b is large, i.e. b/2b
S
and
y
(c k for
We c o n s t r u c t
n) k.
n.
Then
which
the
a new word
should
be
S O contains
at
abovementioned
z from the g i v e n
x and y, t a k i n g the head of the w o r d x (up to the t h i r d symbol and the tail of the w o r d y is
not
in
W
but
the
(from the t h i r d
automaton
symbol
accepts
it
7)
7). The w o r d along
z
with
y.
strengthen
the
Contradiction. Modifying assertion 3-counter
(i)
the in
automaton
language Theorem
W,
it
4.1
by a 2-counter
is p o s s i b l e replacing one,
to the
keeping
probabilistic
(2) u n t o u c h e d
at
579
the
same
time.
We
present
here
only
the
essence
of
the
improvement. For the new language the blocks A(b), B(m,k), C(m,k), D(n,i) are defined precisely as for W. Eb(i,k)
: C(l,k)5D(Ik, i)5C(2,k)4D(2k,i)4... ...4c(2b-l,k)4D((2b-l)k,i)5c(2b,k)5D((2b)k,i);
Fb(i,k)
: c(2b,k)5D((2b)k,i)5c(2b-l,k)4D((2b-l)k,i)4... ...4C(2,k)4D(2k,i)5C(l,k)5D(ik,i);
codeb(il,i2,...,i2b,J2b,...,j2,Jl) : A(b)7Eb(il,l)6Fb(i2,2)6 Eb(i3,3)6Fb(i4,4)6..-6Eb(i2b_l,2b-l)7Fb(i2b,2b)7 Eb(J2b,2b)6Fb(J2b_I,2b-I)6-.-6Eb(J4,4)6F6(J3,3) 6 Eb(J2,2)7Fb(JI,I)V={x / x~{0,1,2,3,4,5,6,7}
& (3b>2,il,i2,...,i2b)
(x=codeb(il,i 2, .... i2b,i2b .... ,i2,il)}. THEOREM 4.2.
(i) For arbitrary c>0 there is a probabilistic
1-way 2-counter automaton which recognizes the language V in real time accepting every word in V with probability 1 and rejecting every word in V with probability l-c. (2) No deterministic 1-way multi-counter automaton can recognize V in real time.
5. O T H E R A P P L I C A T I O N S
OF L E M M A 2.1.
Lemma 2.1 is a useful tool that allows us to use multiple random choices provided they are statistically independent.
Some
more profound results on probabilistic algorithms are proved as well which are a bit outside our topic. We note here two results of this kind. Undecidability of the emptiness problem for languages recognizable by probabilistic 2-head 1-way finite automata was proved by the author in 1980 (English version see in [Fre 83]). INPUT:
an
infinite
sequence
of probabilistic
2-tape
1-way
finite automata all of which recognize the same language L; the automata accept every pair of words in L with probability
1 and
580
reject
every
pair
in
L
with
probabilistic
2/3,
3/4,
4/5,...,
respectively. L is empty.
PROPERTY:
It is known that a projection deterministic tapes
is
a
multihead regular
nondeterministic latter
case
enumerable
1-way
of a language recognized by a
finite
language.
A
automaton
similar
to
result
one
holds
automata but not for probabilistic
the
projection,
language
of
course,
as a projection
is
of
its
also
for
ones.
a
In the
recursively
of a recursive
language.
It
turns out that one can say no more. 5.1. Given arbitrary recursively enumerable
THEOREM
L
of
strings
triples first
in
a
of words tape,
2)
finite
alphabet,
such that: given
there
is
a
i) L is the projection
arbitrary
c>0,
there
is
language
language
K
of
of K to the
a
probabilistic
3-tape 1-way finite automaton which accepts every triple of words in K with probability with probability
1 and rejects
every triple of strings
in
l-c.
Only for recursive languages L it may be possible to replace the language
K of triples
of words
by a language
K' of pairs
of
words. 6. P R O B A B I L I S T I C
The
methods
considered
probabilistic machines for 1-way machines. needed
to
whether
compare
or
not
RECOGNITION
above
OF P A L I N D R O M E S
could
prove
advantages
over their deterministic counterparts
Now we consider a new method. two
objects
they
are
(strings,
identical.
Suppose,
matrices, Instead
of only
it is
polynomials)
of
full
scale
comparison we propose to consider a large set of simple functions defined compute really
on
these
its value identical
functions
should
nonidentical
objects,
to
on the two
pick given
then the obtained be
one
objects. values
chosen
to
ensure
most
of
these
objects
function
at
If the
random
and
objects
are
coincide.
that
for
The
every
functions
set of pair
expose
of
their
distinctness. The author proved his first theorem by this method in 1975. It was
known
deterministic
[Bar
65]
1-head
that
palindromes
off-line
const n 2. It turned out
cannot
Turing machines
be
recognized
in less
[Fre 75] that probabilistic
time
machines
by
than can
581
have less running time
(see Theorem 6.1 below). This theorem and
the proof have been published in several modifications [Fre 77],
(see also
[Fre 83]). For the sake of brevity, we include only a
brief
sketch of proof here.
bound
for
seems
never
probabilistic having
On the other hand,
Turing
been
machines
published
the
([Fre
in
first
75],
English.
lower
{Fre
Hence
79])
it
is
included here in full detail (Theorem 6.2 below). THEOREM 1-head
6.1.
For
off-line
arbitrary
Turing
~>0,
machine
there
is
recognizing
a
probabilistic
palindromes
with
probability l-c in const n log n time. SKETCH OF PROOF. are
interpreted
as
The input word x itself and its reversion
binary
notations
of
numbers
compared modulo a small random prime number. string m~{0,1} d, d=[log 2 c obtained
from
x,y.
They
For this,
are
a random
Ixl] where c is an absolute constant
theory-of-numbers
considerations.
If
the
string
turns out to represent a prime number m, it is tested whether xmy (mod m)
holds.
The
result
probabilistic machine.
of
this
test
is
the
output
of
the
If m is not a prime number, a new string m
is generated, and so on. The proof of the estimate of the running time
and the probability
of the correct
result
involve
Qebi~ev
theorem on density of prime numbers. THEOREM 6.2. Turing machine l-c
in
Let ~0
such
that
t(x)>c, lx].log21x I for infinitely many words x. PROOF.
Let
assume that input word. We
~'
modify
machine
~
the machine always ~"
at
recognize
starts
to first
~'
get marks
on
an
the
~'
keeping precise records
leftmost
additional
the
leftmost
nonempty symbols of the input word. Then of
palindromes.
•
symbol
property. and
the
We
can
of
the
The
new
rightmost
simulates the work
of where the most
extreme ever
visited squares of the tape are. When the simulation ends because • '
has produced the result,
the new machine ends
its work by
walking through all the used part of the tape in a special state q(0)
or
q(1)"
respectively.
increased at most by O(Ixl) important
property:
every
reconstruct the result. machine ~ only.
This
way,
the
running
time
has
but the machine has acquired a new
nonempty
crossing
sequence
allows
to
It suffices to prove the Theorem for the
582 We call a palindrome special if its length equals
0 modulo
3, and the central third part consists of zeros only. The set of squares on the tape corresponding to this central third part is called the central zone. Let n be on arbitrary integer. We consider the work of on the
special
palindromes
of
length
3n.
The
set
of
all these
special palindromes is denoted by S nLet
~
recognize palindromes with probability l-c in time
t(x). We define the function ~(n) such that n (~(n)-l)
O(log2n ). We consider
the
Theorem,
admissible
it
suffices
sequences
corresponding to the given machine
•
palindromes to
of
show
that
instructions
and the given input word
x. All possible admissible sequences of instructions of • x~S
of
on
can be divided into two subsets: n a) "good", i.e. producing the result 1 in no more than n ~(n)
steps, b) "bad", i.e. all the other possible sequences. Note that there can be only finitely many "good" sequences, while infinitely many "bad" ones are possible. Knowing the program of the machine and the probabilities the random number generator type),
of
(which is equiprobable and Bernoulli
it is casy to compute the probability of each admissible
sequence
of
instructions.
sequences for every x~S
n
The
total
probability
of
the
"good"
exceeds l-c.
Consider
)i; p "ng "good" sequence
n ¢(n) pp
> > t=l
X(p,i,t)
(6.2.1)
i~central zone
where pp is the probability of the sequence p of instructions of on the given X~Sn, and
583
X(p,i,t) =
I i, if, when performing the t-th instruction in the sequence p, the head crosses the point i; 0, if otherwise.
On the one hand, the innermost sum does not exceed hence the total (6.2.1) does not exceed n ~(n). hand, all sums in (6.2.1) are finite. Hence
i, and
On the
other
n ~(n) ,
PP
X(p,i,t)
,
i~central being zone "good" sequence
3-6=/4 Hence r
o!
E1 - ~I
r
+
.
E2 - E2
r
+ "'" +
w!
E s - Es
The S-tuple E(x) = (E l, ~2'
"''' Es)
> 3-6c/4
(6.2.3)
586
of
the
leftside
crossing
sequences
rl,r2,...,r 3 of x in its checkpoint can be understood in an s-dimensional unit cube. The inequality (6.2.3)
as a point shows that
the points
probabilities
corresponding
of
to distinct
the
special
palindromes
from S
n
should be distant in the metrics -)
-)
e
p(~(x'),E(x")) Around
=
arbitrary
special palindrome
.
.
E2 - E2
t
+ "'" +
(~,E~,--.,~)
from S n we circumscribe +
corresponding
a
O
E2 - E2
(6.2.3)
.
Es - Es
a body
O
E1 - E1 from
+
point
O
It follows
K
~I - ~I
+ "'" +
~s - Es
that these bodies
< I-2c/4
•
do not intersect.
The
volume of every such body equals
S!
All
they
are
situated
in
an
S-dimensional
cube
with
the
side
length 1 + 2 ~ i-2c
Hence,
= ~ 3-2c
the number of the distinct
special
does not exceed S ( ~ )
(S!)
O(s log2s ) =
s
2
2s
Hence O(s
log2s )
2n < 2
On the other hand, S < 20(~(n)) Hence 0 [og~o~2nl < 20(~(n)) and ~(n) > O(log2n )
palindromes
in S
n
587
7. B O O L E A N
M.O.Rabin probabilistic
[Rab
of this process. The
most
automata
This property way
automaton
if p(x)>l
rejects
define
~
(a version
essential
what
recognizes
a
The automaton
of
the
p(x).
property
meaningfulness
being
does
isolated.
it
mean
language
~
We say that
when L
accepts
definition:
by
a
with
arbitrary H
accepts
if p(x)>A),
and
x, if otherwise.
For dubious
practical because
experiment
purposes
it may
between
be
such
hard
given
radius)
p(x)--~7
.
(7.2.3), we have 2t_u
2vl
i
It follows
large
that
[i-
Taking into account
Hence for
1
v
7 >~--
(7.2.5)
from (7.2.1) that f2 v 1 -
Taking into account
2v
0,
Turing
there
machine
is
which
a
log
n-space
accepts
every
1 and rejects every string in S with
l-c.
(2) Every deterministic 1-way Turing uses at least const, n space. PROOF.
Machine
recognizing
(i) The head of string w is its initial
fragment
S
up
to the symbol 5. The tail of w is the rest of the string. The probabilistic
machine performs the following
ii actions
to recognize whether or not the given string w is in S: i) it checks whether the projection of the head of w to the subalphabet
{0,1,2} is a string of the form bin(l)
2
bin(2)
2
...
2 bin(2kl)
for an integer kl; 2) it checks whether the projection of the tail of w to the subalphabet
{0,1,2} is a string of the form
bin(1) for an integer k2;
2
bin(2)
2
...
2 bin(2k2)
3) it checks whether kl=k2; 4) it counts the number k 3 of the substrings bin(l), • .., bin(k3) inserted;
in the
head
of w where
no
symbol
from
bin(2),
{3,4}
are
5) it checks whether kl=k3; 6) it counts the number k 4 of the substrings bin(l), bin(2), ..., bin(k4) inserted;
in the tail
of w where
no symbols
from
{3,4}
are
598
7) it checks whether k2=k4; 8) using
generator
of random numbers
it generates
in {0,1} cl where c is the constant
from Lemma
lenght
string
for
of bin(2k3).
primality.
generated, 9)
The
If
m
generated
is
not
prime,
tested for primality,
it
regards
the
subalphabet
{3,4}
as
(00,
there
machine
is
a
loglogn-space
which
accepts
every
string in S with probability 1 and rejects every string in S with probability
l-c.
(2)
Every
deterministic
1-way
Turing
machine
recognizing S uses at least const, logn space. PROOF
is
similar
to
the
proof
of
Theorem
8.1.
The
main
additional idea in the proof of (i) is to perform all the needed (probabilistic)
comparisons
whether
the
substrings
bin(i)
correspond one to another in the fragment ... 6
z(join(bin(i-l),bin(i)))
independently,
6 z(join(bin(i),bin(i+l)))
6 ...
i.e. by using another choice of a random modulo.
If the given string is in S then all the many comparisons end in positive with probability i. If there is at least one discrepancy then the comparisons end in negative with probability l-c. It is possible to extend Theorems 8.1 and 8.2 for "natural" space complexities
f(n) between log n and loglogn.
hand,
used
the
nonregular
method languages
above
does
recognizable
machines in o(loglogn)
not
permit
On the other to
by probabilistic
construct
1-way Turing
time. Now we proceed to prove Theorem 8.3
which shows that if a language L is recognized by probabilistic 1-way Turing machine in o(loglogn)
space then L is regular.
result may seem trivial since Trakhtenbrot 74]
have
proved
probabilistic than
theorems
showing
Turing machines
exponentially,
and
it
that
increase is
known
language L is recognized by a deterministic in o(logn)
space then L is regular.
is
complicate
more
constructible
since
no
by deterministic
[Gi
determinization
of
space complexity from
[SHL
65]
no more
that
if
a
1-way Turing machine
Unfortunately, function
The
[Tra 74] and Gill
the situation
o(logn)
1-way Turing machines.
is
space
Hence
the
argument by Trakhtenbrot and Gill is not applicable. Our proof is nonconstructive.
We
do
not
present
an
algorithm
for
determinization of probabilistic 1-way Turing machines. Theorem recognizable
8.2 in
Turing machine.
gave o(log
an log
example n)
space
of by
a
nonregular
a probabilistic
language one-way
600
On the other hand, one-way
Turing
as proved in [SHL 65],
machine
can
o(log n) space. R.Freivalds
recognize
no deterministic
nonregular
languages
in
[Fre 831] proved that recognition of a
language in o(log log n) space by a probabilistic
one-way Turing
machine with probability 2/3 implies regularity of the language. A modification
of
this
theorem
says
that
regularity
of
a
language is implied as well its recognition with any probability p>1/2
by
exceeds
a
probabilistic
a space bound
one-way
S(n)=o(log
Turing
machine
log n) whatever
which
never
random options
are taken by the probabilistic Turing machine. It
was
problem,
formulated
to
explicitly
eliminate
the
pz2/3 or space bound S(n)=o(log In spite hard.
of many
We
solve
n-similar
pairs
attempts, it
only
of words
in
[Fre
abovementioned log n)
this [KF
by
as
an
open
(either
for all random options).
problem
90]
831]
restriction
turned
out
considering
and proving the crucial
to be very
a
notion
Lemma
of
2 which,
we believe, may be of some interest itself. It is interesting to note that for two-way machines there is no minimal nontrivial probabilistic
and
space complexity
deterministic
from this
complexity.
nonregular
language
Theorem which
such that capabilities
machines
9.1 below
can
be
differ shows
recognized
only
that by
remind the reduction theorem by M.O.Rabin
We
be a language.
there
is
a
probabilistic
two-way finite automata with arbitrary probability be a finite set, and L~X
of
starting
1-~ (c>0). [Rab 63]. Let X
The words w', w"~X
are
called equivalent with respect to the language L if
(vw~x) (w'w~L) ~ By
weight
(L)
we
denote
(w"w~L).
the
number
of
the
classes
of
equivalence with respect to the language L (language L is regular if weight (L)0) then
of L~X
automaton with k states with probability
i/2+~
rsim(L,X~n)~(l+i/~) k-l. Below we prove the crucial technical lemma. LEMMA 8 . 3 . If infinetely many n
a
language
L~X
is
nonregular
then
for
~n rsim(L,X )z[(n+3)/2J. Rather many textbooks on automata and formal language theory contain the following definition. , Let X be a finite set and L~X be a language. The words , w',w"~X are called equivalent with respect to L if (Vw~X)(w'w~L~w"w~L). We denote relation
this
equivalence. The ~n rreach(L,X ) and language L. For
arbitrary
n-indistinguishable
and
equivalence
by w' w"(L).
For
every
n~N the
(L) divides X ~n into a certain number of classes of the number
of
called
the
n~N
the
these rank
classes of
words
is
denoted
n-reachability w',w"~X*
are
of
by the
called
with respect to L if
(Vw~xSn)(w'w~L~w"weL). This property is denoted by w' w"(L,X-g(n)).
Cn
(i.e.
in
a
period
configuration
ending
in a
(q",u",l")
For arbitrary triple (q",u",l")~C n we denote by Pn(X,(q',u',l'),(q",u",l"))
607
the probability
of the
associated
period
ending
head on the input tape, and in this moment •
in moving
the
finding itself in
the configuration (q",u",l"). Now
we
consider
the
associated
period
for
arbitrary
configuration (q',u',l')~C n where the head on the input tape observes #. In this case we associate a period of work of • until one of the events take place: i) the input word is accepted or rejected; 2) • enters a configuration (q",u",l") where [u"l>g(n ). We denote by pn(#,(q',u',l'),infinity) the probability of the associated period lasting infinitely long time. By pn(#,(q',u',l'),full) we denote the probability of the associated period ending in a triple (q",u",l") where Iu"i>g(n). By Pn(#,(q',u',l'),qaccept), Pn(#,(q',u',l'),qreject) we denote the probabilities of the acceptation and respectively, at the end of the associated period. Additionally
for
arbitrary
z~Xu{#}
rejection,
we
define
Pn(Z,qaccept,St°p)=Pn(Z,qreject,Stop)=l, pn(z,infinity,infinity)=pn(Z,full,full)=Pn(Z,stop,stop)=l Let n be arbitrary positive integer. Consider finite probabilistic one-way automaton ~n in alphabet Xu{#} with the set of states Sn=Cnu{infinity,full,qaccept,qreject,Stop}, the initial state (ql,A,l) where A is the empty symbol qaccept is the only accepting state. The automaton ~n works as follows. When Rn in the state s'~S n reads from the input an arbitrary symbol z6Xu{#}, the automaton H moves to the state s"~S with the n n probability pn(Z,S',S"). It is easy to see that the automaton n accepts arbitrary word w#, where w~X ~n, with probability h .
n,w"
Every word not of the form w#, where w~X , is rejected by Sn" Since
the
automaton
~n
(wEx~nnL) ~ hn,wZl/2+~, 0
the
{0nl n} can be recognized by a probabilistic
probability
l-c.
Had the recognizability of this
and
even
[LLS
78].
nonregular 2-FA with
language been
proved by the method of invariants, we would have also a nondeterministic 2-FA recognizing {0nl n} but nondeterministic 2-FA recognize only regular languages. The same reason causes a positive probability of error for strings
in the complement
of
the language. THEOREM 9.1. For arbitrary 8>0 there is a probabilistic 2-way finite automaton recognizing the language A={0nl n} with probability l-c. PROOF. Let c(c) and d(c) be large natural numbers such that
d(~:)
2c(e )
d(e)
1+2 c Let
the
input
string
x
be
of
the
form
0nl m.
The
automaton
processes alternately the block of zeros and the block of ones. One processing of a block is a series of options when c(c) random symbols 0 or 1 are produced per every letter in the block. We call the processing to be positive if all the results are I, and
609
negative
otherwise.
If the
length
of the block
is n,
then
the
probability of a positive processing of it is 2 -n c(c). We interpret a processing of an ordered pair of blocks as a competition. the
other
A competition where one processing
is
negative,
is
interpreted
as
a
is positive
win
of
the
and
block
processed positively. To recognize until the total
the
language the automaton
number of wins
helds
reaches d(c).
the two blocks have at least one win each,
competitions
If at this moment
then x is accepted,
otherwise it is rejected. If the competitions are held unrestrictedly, then one of the blocks wins with probability
i. If n~m then the probability
of
the win by the shortest block relates to the probability of the win by the longest block at least as 2c(e):l. Our choice of c(c) and d(c) ensures that the probability of error does not exceed c both in the case n--m and in the case n~m. Now we consider a more complicate language being the Kleene star of the language {0nln}. n n n n A~={0 11 10 21 2...0nkl nk j k=0,1,2,...; nl,...,nk=l,2,... }
THEOREM
9.2.
For
arbitrary
2-way finite automaton probability l-c.
PROOF. obstacle.
The
basic
The algorithm
c>0
there
recognizing
difficulty
the
a
probabilistic
language
arises
in the proof
is
from
of Theorem
the
A*
with
following
9.1 yields
the
right answer with a guaranteed probability 1 neither for strings in
A
nor
therefore
for
strings
recognition
probability
does
whether the probability.
not
string
in
A.
The
number k can be large, and n n fragment 0 ili with a high fixed
of each suffice
to
obtain
is
A
or
in
Let ~ be a real number such that
not
(0