Interseção do DFA no espaço subquadrático?


25

A interseção de dois (mínimo) DFAs com n estados pode ser calculada usando O (n 2 ) tempo e espaço. Isso é ideal em geral, uma vez que o DFA resultante (mínimo) pode ter n 2 estados. No entanto, se o DFA mínimo resultante tiver estados z, onde z = O (n), ele pode ser calculado no espaço n 2-eps , para alguns eps constantes> 0? Eu estaria interessado em tal resultado, mesmo no caso especial em que os DFAs de entrada são acíclicos.


3
Um ... se dois DFAs de estado n são acíclicos, então cada um simplesmente aceita um conjunto finito de palavras de comprimento no máximo n, caso em que sua interseção é apenas a interseção dos dois gráficos de transição rotulados, que terão n estados e pode ser calculado no tempo e espaço linear. Ou eu estou esquecendo de alguma coisa?
Joshua Grochow

4
Sim, os DFAs acíclicos aceitam apenas um conjunto finito de palavras. Mas há exemplos de DFAs acíclicos cuja interseção tem tamanho n ^ 2. Por exemplo, pense em um DFA que aceite cadeias no formato AABC (onde ABC são cadeias de comprimento k) e em um que aceite cadeias no formato ABCC.
Rasmus Pagh 17/08/10

1
retagging: cs.cc é uma designação arxiv, portanto, as tags fornecidas não precisam do prefixo cs.cc.
Suresh Venkat

Respostas:


15

A resposta é sim, sem qualquer requisito sobre o tamanho do autômato. Pode ser calculado no espaço O(log2n) mesmo para k DFAs onde k é uma constante.

Seja ( i [ k ] ) sejam k DFAs. Mostra-se que, dado Um 1 , ... , A k , calcular o mínimo DFA reconhecendo L ( A 1 ) L ( A k ) pode ser feito em óAi=(Qi,Σi,δi,zi,Fi)i[k])kA1,,AkL(A1)L(Ak) espaço. Primeiro, provamos alguns resultados técnicos.O(log2n)

Definição 1 : Let ser dois estados depois q r sse w Σ * , q . w F R . w Fq,rqrwΣq.wFr.wF

Agora consideramos o autômato dado pela construção clássica do produto cartesiano. Vamos q = ( q 1 , ... , q k ) e r = ( r 1 , ... , r k ) ser estados de Uma .Aq=(q1,,qk)r=(r1,,rk)A

Lema 1 : Decidindo se está em NL.qr

Prova (esboço): Mostramos que o teste de desigualdade está em NL e usamos NL = coNL. Adivinhe uma palavra (uma letra de cada vez) tal que q . w é um estado final e r . w não é. Isso pode ser alcançado computando q i . w , r i . w no espaço de log para i [ k ] e usando o fato de q ser final iff q iF iwΣq.wr.wqi.w,ri.wi[k]q . Pode ser demonstrado que qqiFii[k] implica a existência de um w de tamanho poli.qrw

Lema 2 : Decidir se é (in) acessível está em NL.q

Prova (esboço): Estimativa (poli-size) caminhos de a q i ( i [ k ] ).ziqii[k]

Definição 2 : Considere os estados de em ordem lexicográfica. Defina s ( 1 ) como sendo o primeiro estado acessível es ( i ) o primeiro estado acessível após s ( i - 1 ) que não é equivalente a nenhum estado anterior. Definimos c ( q ) como o único i tal que q s ( i ) .As(1)s(i)s(i1)c(q)iqs(i)

O lema 3 : pode ser calculado em O ( logs(i) .O(log2n)

Prova (esboço): A definição 2 produz um algoritmo. Usamos contadores para percorrer os estados. Seja j 0 e q o estado atual. Em cada estado, usamos o lema 2 para verificar se q está acessível. Se for, fazemos um loop em todos os estados anteriores e verificamos se algum deles é equivalente a q . Se não houver, incrementamos j e produzimos q se j = i . Caso contrário, armazenamos q como sendo s ( j ) e continuamos. Como armazenamos apenas um número constante de contadores e nossos testes podem ser realizados em NLkj0qqqjqj=iqs(j) , isso completa a prova.NLDSPACE(log2n)

O corolário 1 : pode ser calculado no espaço O ( log 2 n ) .c(q)O(log2n)

Teorema : Minimizar pode ser feito no espaço O ( log 2 n ) .AO(log2n)

Prova (esboço): Seja seja o maior i tal que s ( i ) seja definido (isto é, o número de classes de ). Damos um algoritmo que produz um autômato A = ( Q , Σ , δ , z , F ) onde1m|Q0||Q1|is(i)A=(Q,Σ,δ,z,F)

  • ;Q={s(i):i[m]}
  • ;F={qQ:qiFii[k]}
  • onde q = ( z 0 , , z k ) .z=s(c(q))q=(z0,,zk)

We now show how to compute δ. For every i[m],aΣ, compute qs(i).a and output the transition (s(i),a,s(c(q))). By lemma 3 and corollary 1, this algorithm runs in O(log2n) space. It can be checked that A is minimal and L(A)=L(A).


3
Nice algorithm! Here is a slightly different way to look at this algorithm. Its core is that the state minimization of any given DFA can be done in polynomial time and O(log2n) space. After that, it is easy to construct some DFA representing the intersection in the logarithmic space (hence in polynomial time and O(log2n) space), and we can compose two functions computable in polynomial time and O(log2n) space (in a similar way to composing two logarithmic-space reductions), yielding the whole algorithm in polynomial time and O(log2n) space.
Tsuyoshi Ito

2
I just saw this answer... I don't see why the algorithm runs in polytime and O(log2n) space simultaneously. Yes, NLPDSPACE[log2n], but it is not known if NLTISP[nO(1),log2n] -- that is, we can get an algorithm running in polytime, and we can get another algorithm running in O(log2n) space, but I do not know how to solve NL problems in polytime and O(log2n) space with a single algorithm.
Ryan Williams

You are right, I don't know how either. I posted this a long time ago, so I'm not sure why I wrote it this way, but perhaps I meant "polynomial time or O(log² n)". I will edit it because it is misleading. Thank you!
Michael Blondin

14

Dick Lipton and colleagues recently worked on this problem, and Lipton blogged about it here:

http://rjlipton.wordpress.com/2009/08/17/on-the-intersection-of-finite-automata/

It appears that doing better than O(n^2) is open even for the very-special case of determining if the DFA intersection defines the empty language.
The paper gives complexity consequences that would result from a much-improved algorithm handling not just 2 DFAs in the intersection, but larger numbers as well.


1
and what about lower bounds?
Marcos Villagra

1
Just to clarify the questions: I'm happy to spend O(n^2) time (or maybe even n^O(1) time) to improve the space bound.
Rasmus Pagh

13

If you're given k DFAs (k is part of the input) and wish to know if their intersection is empty, this problem is PSPACE-complete in general:

Dexter Kozen: Lower Bounds for Natural Proof Systems FOCS 1977: 254-266

Perhaps if you carefully study this proof (and similar constructions by Lipton and his co-authors), you might find some sort of space lower bound even for fixed k.


Thanks for this pointer. I'm guessing that this could possibly lead to an n^Omega(1) space lower bound on the additional space needed, apart from the input. But could it possibly lead to a super-linear space lower bound?
Rasmus Pagh

1
@user124864 Given k DFA's with n states each, the product automaton will have nk states. Now, there are two tricks you can do to reduce its size. The first is that you just consider the reachable component of the product graph. Second, you could minimize the product DFA. At the end of the day, figuring out what language is recognized by this product automaton is hard.
Michael Wehar

1
@user124864 Even just trying to determine if the product DFA recognizes a non-empty language is hard. This is the intersection non-emptiness problem. By hard, I mean that it is XNL complete in a strong sense.
Michael Wehar

1
@user124864 If you can solve it in less than nk time, then we get faster algorithms for PSPACE complete problems. It is not solvable in o(1)klog(n) non-deterministic binary space. It's not known if we can solve it in less than k2log2(n) deterministic binary space. It's not known if we can solve it in simultaneous deterministic polynomial time and f(k)log2(n) binary space for any function f (doing so would improve Savitch's theorem).
Michael Wehar

1
@user124864 Note: we have both of the following. (1) Beating nk time deterministically implies faster deterministic algorithms for PSPACE complete problems and (2) beating nk time non-deterministically implies faster non-deterministic algorithms for PSPACE complete problems.
Michael Wehar

7

Given two automata A, B accepting finite languages (acyclic automata), the state complexity of L(A)L(B) is in Θ(|A||B|) (1). This result also holds for unary DFAs (not necessarily acyclic) (2). However, you seem to be talking about the space required to compute the intersection of two automata. I don't see how the classic construction using the Cartesian product uses O(n2) space. All you need is a constant number of counters of logarithmic size. When you compute the transition function for the new state (q,r) you only have to scan the input without looking to any previously generated data.

Perhaps you want to output the minimal automaton? If this is the case, then I have no clue whether it can be achieved. The state complexity of the intersection for finite languages doesn't seem encouraging. However, unary DFAs have the same state complexity and I think it can be achieved with such automata. By using results from (2), you can get the exact size of the automaton recognizing the intersection. This size is described by the length of the tail and the cycle, thus the transition function can be easily computed with very few space since the structure is entirely described by those two sizes. Then, all you have to do is to generate the set of final states. Let n be the number of states in the resulting automaton, then for all 1in, state i is a final state iff ai is accepted by both A and B. This test can be carried with few space.


1
Yes, I am interested in the minimal automaton, or at least an automaton of similar size. Thanks for the pointers to unary DFAs. However, this does not seem to help much for the general case.
Rasmus Pagh
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.