Come suggerito nei commenti alla domanda, cercherò di dare una risposta (purtroppo parziale) alla domanda, almeno nella misura in cui ho capito il problema da solo (questo implica che potresti trovare degli errori e se trovi un modo per spiegare più brevemente o chiaramente uno dei seguenti punti, sentiti libero di modificare la risposta di conseguenza):
In primo luogo, si dovrebbe notare che in realtà non dobbiamo calcolare l'automa universale di una lingua se vogliamo calcolare le fattorizzazioni di una lingua.
Dal documento menzionato nel mio commento ¹, v'è una corrispondenza 1-1 tra fattori sinistra e destra di un linguaggio regolare, cioè, dato un fattore di sinistra della lingua, il corrispondente fattore di destra viene determinato e vice versa univocamente. Più precisamente, abbiamo quanto segue:
Let è una fattorizzazione di L . Quindi
Y = ⋂ x ∈ X x - 1 L , X = ⋂ y ∈ Y L y - 1 ,
ovvero ogni fattore sinistro è un'intersezione dei quozienti giusti e qualsiasi fattore destro è un'intersezione dei quozienti sinistri. Viceversa, ogni intersezione dei quozienti sinistra di L è un fattore diritto di L e ogni intersezione dei quozienti destro di L è un fattore fianco di L .(X,Y)L
Y=⋂x∈Xx−1L,X=⋂y∈YLy−1,
LLLL
Si noti che per un linguaggio regolare, c'è solo un insieme finito di quozienti a destra ea sinistra, e, quindi, o un problema si riduce a calcolare i quozienti a destra ea sinistra di una lingua, e quindi di calcolare la loro chiusura -STABLE, che è, un minimo superset dei quozienti chiusi sotto l'intersezione. Questi sono poi proprio i fattori di destra e di sinistra fattori, e quindi di solito è facile vedere quali coppie sono sottoinsiemi di L .∩L
Esempio
Per illustrare i punti di cui sopra, considera il primo esempio nella domanda (di cui penso anche che non sia corretto nel documento):
Sia . Ora, i quozienti sinistra della L sono insiemi x - 1 L per x ∈ Σ * , cioè quelle parole u in Σ * che può essere preceduto da x , cioè x u ∈ L . Quando è y - 1 L = x - 1 L per x distinto , y ? Questo è il caso se e solo se xL=Σ∗abΣ∗Lx−1Lx∈Σ∗uΣ∗xxu∈Ly−1L=x−1Lx,yxe può essere aumentato alle parole in L con esattamente gli stessi suffissi. Ciò significa che, per dirla in termini più familiari, sono equivalenti a Nerode e i suffissi necessari per aggiungere parole in una classe Nerode sono esattamente i rispettivi quozienti a sinistra.yL
Per , vediamo che le nostre classi di equivalenza Nerode sonoL
- , l'insieme di parole che non contiene a b come fattore e termina con a , N1aba
- , l'insieme di parole che terminano con b e che non contengono a b come fattore, e N2bab
- , l'insieme di parole contenenti a b come fattore, ovvero N 3 = LN3abN3=L
Possono essere aumentati con i seguenti insiemi (ovvero, questi sono i quozienti di sinistra delle parole nelle rispettive classi):
- per x in N 1 è costituito da tutte le parole in L (qualsiasi parola può essere aumentata con una parola contenente una b come fattore e quindi diventa una parola in L ) e b Σ ∗ , ovvero S 1 = L ∪ b Σ ∗S1=x−1LxN1LabLbΣ∗S1=L∪bΣ∗
- S2=x−1L for x in N2 is the language itself, that is, S2=L and
- S3=x−1L for x in N3 is obviously Σ∗. That is, we have found three right factors of L. As S2⊂S1⊂S3, their ∩-stable closure is trivially S1,S2,S3, and those are then precisely the right factors.
Hence, our factorization set FL is of the form (P1,S1),(P2,S2),(P3,S3).
Now, for the left factors Pi, we use the equations of the beginning of this answer:
Pi=⋂x∈SiLx−1
.
For P1, this yields L∪Σ∗a, for P2 we get Σ∗ and for P3, we obtain L. You can see this by inspection (the most popular excuse for being too lazy to state a formal proof) or by explicitly computing the right quotients (which is fairly analogous, although not completely, to computing the left quotients).
Our factorizations are thus given by FL=u,v,w where
- u=(P1,S1)=(Σ∗abΣ∗∪Σ∗a,Σ∗abΣ∗∪bΣ∗)
- v=(P2,S2)=(Σ∗,Σ∗abΣ∗) and
- w=(P3,S3)=(Σ∗abΣ∗,Σ∗)
Summary
To summarize (as you were asking for a simple procedure):
- For computing the factorizations of a language L, first compute the left quotients of L.
- You can do so, in the language of the paper, by constructing a minimal DFA A for L and then for each state q in A (corresponding, as a Nerode-equivalence class, to a left quotient) compute the future of q in A, thus obtaining one left quotient of the language for each state.
- The collection of left quotients obtained in this way yields, in general, a subset SR of the right factors.
- Compute then the ∩-stable closure of SR, which can be done in practice by forming the intersection of any subset of SR and adding any subset obtained in this way to SR.
- The set SR together with all the intersections from the previous step is then the set of right factors of L.
- In order to obtain the left factors, we can compute the right quotients of L.
- These are sets of the form Ly−1, for y∈Σ∗. Now, these are again only finitely many, and for x≠y, we have Ly−1=Lx−1 if and only if for all u∈Σ∗, ux∈L⇔uy∈L, that is they can be prefixed to words in the language with precisely the same set of strings.
- To compute Lx−1, consider those states q in A such that x is contained in the future of q. The union of the pasts of those states constitute one right quotient. Find all these quotients.
- You know you are done when you have found as many left factors as you have right factors.
- Find those pairs of left and right factors X,Y such that X⋅Y⊆L. This is FL.
- The Universal Automaton by Lombardy and Sakarovitch (in Texts in Logic and Games, Vol 2: Logic and Automata: History and Perspectives, 2007)