Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
Determinism versus Nondeterminismin Two-Way Finite Automata
Recent Results around the Sakoda and Sipser Question
Giovanni Pighizzini
Dipartimento di InformaticaUniversità degli Studi di Milano
NCMA 2012Fribourg, SwitzerlandAugust 23-24, 2012
Outline
Preliminaries
The Question of Sakoda and Sipser
Restricted 2DFAs
The Unary Case
Relationships with L ?= NL
Restricted 2NFAs
Conclusion
Finite State Automata
i n p u t. . .
6 -
Base version:one-way deterministic finite automata (1DFA)
I one-way input tapeI deterministic transitions
Possibile variants allowing:I nondeterministic transitions
one-way nondeterministic finite automata (1NFA)I input head moving forth and back
two-way deterministic finite automata (2DFA)two-way nondeterministic finite automata (2NFA)
I alternationI ...
Two-Way Automata: Technical Details
` i n p u t. . . a6 -
I Input surrounded by the endmarkers ` and aI w ∈ Σ∗ is accepted iff there is a computation
with input tape ` w astarting at the left endmarker ` in the initial statereaching a final state
1DFA, 1NFA, 2DFA, 2NFA
What about the power of these models?
They share the same computational power, namely theycharacterize the class of regular languages, however...
...some of them are more succinct
Example: In = (a + b)∗a(a + b)n−1
I In is accepted by a 1NFA with n + 1 states
q0 q1 q2 q3 qn @@R-a -a, b -a, b -a, b
-
a, b
I The minimum 1DFA accepting In requires 2n statesI We can get a deterministic automaton for In with n + 2 states,
which reverses the input head direction just one timeI Hence In is accepted by
a 1NFA and a 2DFA with approx. the same number of statesa minimum 1DFA exponentially larger
Example: Ln = (a + b)∗a(a + b)n−1a(a + b)∗
q0 q1 q2 q3 qn qf @@R-a -a, b -a, b -a, b -a - a, b - a, b
1NFA: n + 2 states
Example: Ln = (a + b)∗a(a + b)n−1a(a + b)∗
@@Rbbb bba baa aaa-a -a -a
?
b
?b
a -
b
bab aab
?
a?b
a
a
@@
@@I a
-a, b
6b
aba abb
6b
b
6
n = 3
Minimum 1DFA: 2n + 1 states
Example: Ln = (a + b)∗a(a + b)n−1a(a + b)∗
` b b a b a a b a a a a n = 4
while input symbol 6= a do move to the rightmove n squares to the rightif input symbol = a then accept
else move n − 1 cells to the leftrepeat from the first step
Exception: if input symbol =a then reject
2DFA: O(n) states
Costs of the Optimal Simulations Between Automata
1DFA
1NFA 2DFA 2NFA
@@@@@@@R ?
2n O(2n log n) O(2n2)
-? ?
[Rabin&Scott ’59, Shepardson ’59, Meyer&Fischer ’71, . . . ]
Question
How much the possibility of moving the input headforth and back is useful to eliminate the nondeterminism?
Costs of the Optimal Simulations Between Automata
1DFA
1NFA 2DFA 2NFA
@@@@@@@R ?
2n O(2n log n) O(2n2)
-? ?
Problem ([Sakoda&Sipser ’78])Do there exist polynomial simulations of
I 1NFAs by 2DFAsI 2NFAs by 2DFAs ?
Conjecture
These simulationsare not polynomial
Sakoda&Sipser Question: Upper and Lower Bounds
I Exponential upper boundsderiving from the simulations of 1NFAs and 2NFAs by 1DFAs
I Polynomial lower boundsfor the cost c(n) of simulation of 1NFAs by 2DFAs:
c(n) ∈ Ω( n2
log n ) [Berman&Lingas ’77]c(n) ∈ Ω(n2) [Chrobak ’86]
I Complete languages...
Sakoda and Sipser Question
I Very difficult in its general formI Not very encouraging obtained results:
Lower and upper bounds too far(Polynomial vs exponential)
I Hence:Try to attack restricted versions of the problem!
2NFAs vs 2DFAs: Restricted Versions
(i) Restrictions on the resulting machines (2DFAs)I sweeping automata [Sipser ’80]I oblivious automata [Hromkovič&Schnitger ’03]I “few reversal” automata [Kapoutsis ’11]
(ii) Restrictions on the languagesI unary regular languages [GeffertMereghetti&P ’03]
(iii) Restrictions on the starting machines (2NFAs)I outer nondeterministic automata [GuillonGeffert&P ’12]
Sweeping Automata
Definition (Sweeping Automata)
A two-way automaton A is said to be sweeping if and only if
I A is deterministicI the input head of A can change direction only at the
endmarkers
Each computation is a sequence of complete traversals of the input
I Sweeping automata can be exponentially larger than 1NFAs[Sipser ’80]
I However, they can be also exponentially larger than 2DFAs[Berman ’81, Micali ’81]
Oblivious Automata
DefinitionA two-way automaton A is said to be oblivious if and only if
I A is deterministic, andI for each integer n, the “trajectory” of the input head is the
same for all inputs of length n
Each sweeping automaton can be made oblivious with at most aquadratic growth of the number of the states
Oblivious Automata
I Oblivious automata can be exponentially larger than 2NFAs[Hromkovič&Schnitger ’03]
I Oblivious automata can be exponentially smaller thansweeping automata:
Lk = (uv | u, v ∈ a, bk and u 6= v#)∗
Lk is accepted by an oblivious automaton with O(k) states[KutribMalcher&P ’12]
each sweeping automaton for Lk requires at least 2k−1
2 states[Hromkovič&Schnitger ’03]
I Oblivious automata can be exponentially larger than 2DFAsWitness: PAD(Lk) =
⋃a1a2...am∈Lk
$∗a1$∗a2$∗ · · · $∗am$∗
[KutribMalcher&P ’12]
“Few Reversal” Automata [Kapoutsis ’11]
Definition (Few Reversal Automata)
A two-way automaton A makes few reversals if and only if thenumber of reversals on input of length n is o(n)
Model between sweeping automata (O(1) reversals) and 2NFAs
Theorem ([Kapoutsis ’11])
I Few reversal DFAs can be exponentially largerthan few reversal NFAs and, hence, than 2NFAs
I Sweeping automata can be exponentially largerthan few reversal DFAs
I Few reversal DFAs can be exponentially larger than 2DFAs
Hence, this result really extends Sipser’s separation,but does not solve the full problem
Sakoda&Sipser Question
Problem ([Sakoda&Sipser ’78])Do there exist polynomial simulations of
I 1NFAs by 2DFAsI 2NFAs by 2DFAs ?
Another possible restriction:
The unary case #Σ = 1
Optimal Simulation Between Unary Automata
The costs of the optimal simulations between automata aredifferent in the unary and in the general case
2DFA
1DFA 1NFA
2NFA
eΘ(
√n ln n)
6
eΘ(√
n ln n)
@@@
@@@
@@I
eΘ(√
n ln n)
# ?
eΘ(√
n ln n)
6
eΘ(√
n ln n)
!6 n2
?
[Chrobak ’86, Mereghetti&P ’01]
Optimal Simulation Between Unary Automata
The costs of the optimal simulations between automata aredifferent in the unary and in the general case
2DFA
1DFA 1NFA
2NFA
eΘ(
√n ln n)
6
eΘ(√
n ln n)
@@@
@@@
@@I
eΘ(√
n ln n)
# ?
eΘ(√
n ln n)
6
eΘ(√
n ln n)
!6 n2
?
1NFA → 2DFAIn the unary casethis question is solved!(polynomial conversion)
Optimal Simulation Between Unary Automata
The costs of the optimal simulations between automata aredifferent in the unary and in the general case
2DFA
1DFA 1NFA
2NFA
eΘ(
√n ln n)
6
eΘ(√
n ln n)
@@@
@@@
@@I
eΘ(√
n ln n)
# ?
eΘ(√
n ln n)
6
eΘ(√
n ln n)
!6 n2
?
2NFA → 2DFAEven in the unary casethis question is open!
I eΘ(√
n ln n) upper bound(from 2NFA → 1DFA)
I Ω(n2) lower bound(from 1NFA → 2DFA)
A better upper bound eO(ln2 n)
has been proved!
Sakoda&Sipser Question: Current Knowledge
I Upper bounds
unary case
general case
1NFA→ 2DFA 2NFA→ 2DFA
O(n2) eO(ln2 n)
optimal
exponential exponential
Unary case [Chrobak ’86, GeffertMereghetti&P ’03]
I Lower BoundsIn all the cases, the best known lower bound is Ω(n2)[Chrobak ’86]
Unary Case: Quasi Sweeping Automata[GeffertMereghetti&P ’03]
In the study of unary 2NFA, sweeping automata with somerestricted nondeterministic capabilities turn out to be very useful:
DefinitionA 2NFA is quasi sweeping (qsNFA) iff both
I nondeterministic choices and head reversalsare possible only at the endmarkers
Theorem (Quasi Sweeping Simulation)
Each n-state unary 2NFA A can be transformed into a 2NFA M s.t.I M is quasi sweepingI M has at most N ≤ 2n + 2 statesI M and A are “almost equivalent”
(differences are possible only for inputs of length ≤ 5n2)
Quasi Sweeping Simulation: Consequences
Several results using quasi sweeping simulation of unary 2NFAshave been found:
(i) Subexponential simulation of unary 2NFAs by 2DFAsEach unary n-state 2NFA can be simulated by a 2DFAwith eO(ln2 n) states [GeffertMereghetti&P ’03]
(ii) Polynomial complementation of unary 2NFAsInductive counting argument for qsNFAs
[GeffertMereghetti&P ’07](iii) Polynomial simulation of unary 2NFAs by 2DFAs
under the condition L = NL [Geffert&P ’10](iv) Polynomial simulation of unary 2NFAs by unambiguous 2NFAs
(unconditional) [Geffert&P ’10]
We are going to discuss (iii)
Logspace Classes and Graph Accessibility Problem
L: class of languages accepted in logarithmic spaceby deterministic machines
NL: class of languages accepted in logarithmic spaceby nondeterministic machines
ProblemL ?
= NL
Graph Accessibility Problem GAPI Given G = (V ,E ) oriented graph, s, t ∈ VI Decide whether or not G contains a path from s to t
Theorem ([Jones ’75])GAP is complete for NL(under logspace reductions)
⇒ GAP ∈ L iff L = NL
More in general, GAP ∈ C implies C ⊇ NLfor each class C closed under logspace reductions
Polynomial Deterministic Simulation (under L = NL)Outline
I Let A be an n-state unary 2NFAI Reduction from L(A) to GAP
i.e, from each string am we compute a graph G (m) s.t.
am ∈ L(A) ⇐⇒ G (m) ∈ GAP
I Under the hypothesis L = NLthis reduction is used to build a 2DFA equivalent to A,with a number of states polynomial in n
I Actually we do not work directly with A:we use the qsNFA M obtained from Aaccording to the quasi sweeping simulation
The Graph G (m)
` a a a a a. . . a6p q
6-
m︷ ︸︸ ︷
Given the qsNFA M with N states and an input am
the graph G (m) is defined as:I the vertices are the states of MI (p, q) is an edge iff M can traverse the input
from one endmarker in the state pto the opposite endmarker in the state qwithout visiting the endmarkers in the meantime
Thenam ∈ L(M) iff G (m) contains a path from q0 to qF
The existence of the edge (p, q) can be verified by a subroutine,implemented by a finite automaton Ap,q with N states
Deterministic Simulation
-am
GG (m)
- DGAP*
yes
HHHjno
I Suppose L = NLI Let DGAP be a logspace bounded deterministic machine
solving GAPI On input am, compute G (m) and give the resulting graph as
input to DGAP
I This decides whether or not am ∈ L(M)
Deterministic Simulation
-am
GG (m)
- DGAP*
yes
HHHjno
I The graph G (m) has N vertices, the number of states of MI DGAP uses space O(logN)
I M is fixed. Hence N is constant, independent on the input am
The worktape of DGAP can be encoded in a finitecontrol using a number of states polynomial in N
I The graph G (m) can be represented with N2 bits
Representing the graph in a finite control wouldrequire exponentially many states
I To avoid this we compute input bits for DGAP “on fly”
Deterministic Simulation
-am
GG (m)
- DGAP*
yes
HHHjno
We define a unary 2DFA M ′ equivalent to M
I M ′ keeps in its finite control:The input head position of DGAPThe worktape content of DGAPThe finite control of DGAP
I This uses a number of states polynomial in N
Deterministic Simulation
-am
GG (m)
- DGAP*
yes
HHHjno
We define a unary 2DFA M ′ equivalent to MI On input am, M ′ simulates DGAP on input G (m)
I Input bits for DGAP are the entries of G (m) adjacency matrixI Each time DGAP needs an input bit, a subroutine Ap,q is calledI Each Ap,q uses no more than N statesI Considering all possible (p, q), this part uses at most N3 states
Summing Up... (under L = NL)
We described the following simulation:
I M is almost equivalent to the original 2NFA AI Hence, M ′ is almost equivalent to AI Possible differences for input length ≤ 5n2
I They can be fixed in a preliminary scan (5n2 + 2 more states)I The resulting automaton has polynomially many states
A given unary 2NFA n states⇓ Conversion into Normal FormM almost equivalent to A N ≤ 2n + 2 states⇓ Deterministic SimulationM ′ 2DFA equivalent to M poly(N) states
Preliminary scan to accept/reject inputs of length ≤ 5n2⇓
then simulation of M ′ for longer inputsM ′′ 2DFA equivalent to A poly(n) states
Polynomial Deterministic Simulation (under L = NL)
Theorem ([Geffert&P ’10])If L = NL then each n-state unary 2NFA can be simulated by anequivalent 2DFA with poly(n) many states
Hence, proving the Sakoda&Sipser conjecture for unary2NFAs would separate L and NL
What about the converse?
It has been proved under the following uniformity assumption:
The transformation from unary 2NFAs to 2DFAs must becomputable in deterministic logspace [Geffert&P ’10]
Uniformity?
Nonuniform Deterministic Logspace
I L/polyclass of languages accepted by deterministic logspace machineswith a polynomial advice
x - *
yes
HHHjno
α(|x |)
-logspacemachine
ProblemL/poly ⊇ NL ?
Polynomial Deterministic Simulation (under L = NL)
We did not used the uniformity of L !
I L can be replaced by L/poly:
If L/poly ⊇ NL then each n-state unary 2NFA can be simulatedby an equivalent 2DFA with poly(n) many states
I We can prove the converse using GAP:
If the simulation of unary 2NFAs by 2DFAs is polynomial instates then there is a deterministic logspace machine with apolynomial advice which solves GAP
Solving GAP with Two-Way AutomataBinary Encoding: Languages BGAP
I Let n be a fixed integerI GAPn denotes GAP restricted to graphs with vertex set
Vn = 0, . . . , n − 1I The binary encoding of a graph G = (Vn,E )
is the standard encoding of its adjacency matrix, i.e., a string〈G 〉2 = x1x2 · · · xn2 ∈ 0, 1n
2
with xi·n+j+1 = 1 if and only if (i , j) ∈ E
I BGAPn := 〈G 〉2 | G has a path from 0 to n − 1= 〈G 〉2 | G ∈ GAPn
Solving GAP with Two-Way AutomataRecognizing BGAPn
Standard nondeterministic algorithm solving graph accessibility
i ← 0 // input head on the left endmarkerwhile i 6= n − 1 do
guess j 6= i // try the edge (i , j)move to the input cell i · n + j + 1if the input symbol is 0 then reject // (i , j) /∈ Emove the input head to the left endmarkeri ← j
endwhileaccept
I Implementation using O(n3) states
Solving GAP with Two-Way AutomataUnary Encoding: Languages UGAP
I Kn := complete directed graph withvertex set Vn = 0, . . . , n − 1
I With each edge (i , j) we associatea different prime number p(i ,j)
I A subgraph G = (Vn,E ) of Kn isencoded by the string amG , where
mG =∏
(i ,j)∈E
p(i ,j)
2 3 0 1
-
-
6
-
-
6
?
6
?
6
?
11
3
47
37
43 1923 5
29
17
7
41
mG = 3·11·17·37·43= 892551
I Graph Kn(m): ∃ edge (i , j) iff p(i ,j) divides m
I UGAPn := am | Kn(m) has a path from 0 to n − 1
Solving GAP with Two-Way AutomataUnary Encoding: Languages UGAP
I Kn := complete directed graph withvertex set Vn = 0, . . . , n − 1
I With each edge (i , j) we associatea different prime number p(i ,j)
I A subgraph G = (Vn,E ) of Kn isencoded by the string amG , where
mG =∏
(i ,j)∈E
p(i ,j)
2 3 0 1
-
-
6
-
-
6
?
6
?
6
?
11
3
47
37
43
1923 5
29
17
7
41
mG = 3·11·17·37·43= 892551
I Graph Kn(m): ∃ edge (i , j) iff p(i ,j) divides m
I UGAPn := am | Kn(m) has a path from 0 to n − 1
Solving GAP with Two-Way AutomataRecognizing UGAPn
Unary version of the algorithm for BGAPn
i ← 0 // input head on the left endmarkerwhile i 6= n − 1 do
guess j 6= i // try the edge (i , j)scan the input string counting modulo p(i ,j)if reminder 6= 0 then reject // (i , j) /∈ Emove the input head to the left endmarkeri ← j
endwhileaccept
I Implementation using O(n4 log n) states
Solving GAP with Two-Way AutomataOutline of the Construction
-G 〈 〉1
T
amG
z1, . . . , zk
- Bn
B ′n
*yes
HHHjno
I Suppose the conversion of unary 2NFAs into 2DFAs ispolynomial
I Let Bn be a 2DFA with poly(n) states recognizing UGAPn
I Given a graph G = (Vn,E ), compute its unary encoding amG
and give it as input to Bn
I This decides whether or not G ∈ GAP
Solving GAP with Two-Way AutomataOutline of the Construction
-G 〈 〉1
T
amG
z1, . . . , zk
- Bn
B ′n
*yes
HHHjno
I Our goal:a deterministic machineworking in logarithmic spaceusing a polynomial advice
I The input is the graph G (size n2)I Bn is the advice: polynomial size in nI Representing amG would require too much space!
Solving GAP with Two-Way AutomataOutline of the Construction
-G 〈 〉1
TamG
z1, . . . , zk- Bn
B ′n
*yes
HHHjno
Prime encoding:
A list of prime powers z1, . . . , zk factorizing mG
amG is replaced by the prime encoding
Solving GAP with Two-Way AutomataReplacing Unary Encodings by Prime Encodings
-G
〈 〉1
T
amG
z1, . . . , zk-
Bn
B ′n*yes
HHHjno
I mG =∏
(i ,j)∈Ep(i ,j)
I Prime encoding of amG :list of all p(i ,j) associated with the edges of G
I It can be computed by in logarithmic spaceby a deterministic transducer T
I We replace Bn by an “equivalent” 2DFA B ′n:B ′n inputs represent prime encodings of Bn inputs
How to Obtain B ′n?
I s := number of states of Bn
I Bn → Mn
Mn sweeping, O(s) statesin each traversal Mn counts the input length modulo anumber `Mn and Bn almost equivalent (differences for length O(s))
I Mn → B ′npoly(s) many statesB ′n reads the prime encoding of an integer mIf m is “small” then B ′n gives the output according to a finitetableotherwise, B ′n on its input simulates Mn on am
How to Obtain B ′n?Simulation on Long Inputs
` a a a a a. . . a6p q
6r = m mod `-
m︷ ︸︸ ︷
In a sweep:I Mn counts the input length modulo an integer `I The value of ` depends only on the starting state pI The ending state q depends on p and on r = m mod `
B ′n simulates the same sweep on input z1, z2, . . . , zk ,a prime encoding of m:
m mod ` = ((· · · ((z1 mod `) · z2) mod ` · · · ) · zk) mod `
How to Obtain B ′n?Simulation on Long Inputs
` # z1 # zk. . . a6p q
6r = m mod `-
m︷ ︸︸ ︷
In a sweep:I Mn counts the input length modulo an integer `I The value of ` depends only on the starting state pI The ending state q depends on p and on r = m mod `
B ′n simulates the same sweep on input z1, z2, . . . , zk ,a prime encoding of m:
m mod ` = ((· · · ((z1 mod `) · z2) mod ` · · · ) · zk) mod `
Solving GAP with Two-Way AutomataCombining All Together
-G
〈 〉1
T
amG
z1, . . . , zk-
Bn
B ′n*yes
HHHjno
I We replace:The machine which computes mG = 〈G 〉1 by a logspacetransducer T which outputs a prime encoding of mGThe unary 2DFA Bn by an “equivalent” 2DFA B ′n working onprime encodings
I The resulting machine still decides whether G ∈ GAPn
I The symbols of z1, . . . , zk are computed “on fly”,by restarting T each time B ′n needs them
Solving GAP with Two-Way AutomataCombining All Together
-G
〈 〉1
T
amG
z1, . . . , zk-
Bn
B ′n*yes
HHHjno
I B ′n has number of states polyomial in nI T works in space O(log n)
I Hence the resulting machine works in logarithmic space
We did not provided B ′n in a constructive way!
I Its existence follows from the hypothesis that the simulation ofunary 2NFAs by 2DFAs is polynomial
I Hence the resulting machine is nonuniform
B ′n is the advice!
Solving GAP with Two-Way AutomataCombining All Together
-G
〈 〉1
T
amG
z1, . . . , zk-
Bn
B ′n*yes
HHHjno
Since GAP is complete for NL we obtain:
Theorem ([Kapoutsis&P ’12])If each n-state unary 2NFA can be simulated by a 2DFA with apolynomial number of states then L/poly ⊇ NL
Hence
Corollary
L/poly ⊇ NL if and only ifthe state cost of the simulation of unary 2NFAs by 2DFAs is poly
Outer Nondeterministic Automata (ONFAs)
DefinitionA two-way automaton is said to be outer nondeterministic iffnondeterministic choices are allowed only when the input head isscanning the endmarkers
Hence:
I No restrictions on the input alphabetI No restrictions on head reversalsI Deterministic transitions on “real” input symbolsI Nondeterministic choices only at the endmarkers
Outer Nondeterministic Automata (ONFAs)
All the results we obtained for the unary casecan be extended to ONFAs:
[GuillonGeffert&P ’12, Kapoutsis&P ’12]
(i) Subexponential simulation of 2ONFAs by 2DFAs(ii) Polynomial complementation of unary 2ONFAs(iii) Polynomial simulation of 2ONFAs by 2DFAs
if and only if L/poly ⊇ NL(iv) Polynomial simulation of 2ONFAs by unambiguous 2ONFAs
While in the unary case all the proofs rely on the conversionof 2NFAs into quasi sweeping automata,in the case of 2ONFAs we do not have a similar tool!
Final Remarks
I The question of Sakoda and Sipser is very challenging
I In the investigation of restricted versions many interesting andnot artificial models have been considered
I The results obtained for restricted versions of the problem,even if not solving the full problem, are nontrivialand, in many cases, very deep
I Strong connections with open questions in structuralcomplexity
I Many times techniques used in space complexity can beadapted for the investigation of automata and vice versa
Two Further Directions
I The results obtained in the unary case have been extended tothe general case for outer nondeterministic automata
Question
Does it is possible to extend the same results (or some of them) tosome less restricted models of computation?
I Input head reversals are a critical resource that deservesfurther investigation
Theorem ([Kapoutsis&P ’12])Given k > 0, there exists a language L such that each 2DFAaccepting L with less than k head reversals is exponentially largerthan each 2DFA with k reversals
Question
What about the power of head reversals combined withnondeterminism?