Is a way to find a single solution for multiple regular expressions?

19 Views Asked by At

I have a type of problem that is modeled by non-deterministic finite automata. For my problem, I need to find an input that goes through every unique combination of the non-deterministic split of the state machine. You could think of this problem as a set of finite state machines that need to all be solved by the same input. Example: In this image, treat $q_0$ and $q_{10}$ as starting states for two different machines find the solution for both machines

An answer for this pair of machines is $u, s, r, d, a, b, b, b$

Is there an algorithm that can find an answer like this?

1

There are 1 best solutions below

0
On

First of all, your example is wrong, since if you start in $q_0$, you arrive in $q_9$ on the input $usrdabbb$. You could take $usrdabbbb$ instead.

Now, to answer your question, consider a finite family of finite deterministic automata $({\cal A}_i)_{i \in I}$, with ${\cal A} = (Q_i, A, \cdot_i, q_i, F_i)$ and let $L_i$ be the language accepted by ${\cal A}_i$. Your question amounts to find the intersection $L = \bigcap_{i \in I} L_i$. This language $L$ is accepted by the product of the automata ${\cal A}_i$, which is the deterministic finite automaton $$ {\cal A} = (Q, A, \cdot, q, F) $$ where the set of states is $Q = \prod_{i \in I} Q_i$, the cartesian product of the sets $Q_i$, the initial state is $q = (q_i)_{i \in I}$, the set of final states is $F = \prod_{i \in I} F_i$ and the transition function is given by $(p_i)_{i\in I} \cdot a = (p_i \cdot_i a)_{i \in I}$. Using standard algorithms, you can now obtain a regular expression for $L$ which will give you all the solutions to your problem.