DFA A
First language · L(A)Advanced: import / export DFA A JSON ⌄
Copy this JSON to save a definition. To import edits, click Apply JSON.
Compare deterministic finite automata, understand the algorithm, and discover the shortest string that proves they differ.
Build your DFAs visually: add states, connect them, and compare their languages.
Copy this JSON to save a definition. To import edits, click Apply JSON.
Copy this JSON to save a definition. To import edits, click Apply JSON.
BFS explores pairs of states and checks whether their accepting status differs.
Every product state represents where both DFAs end up after reading the same string. If a reachable pair disagrees on acceptance, that string distinguishes the languages. BFS explores by increasing string length, so the first disagreement gives a shortest counterexample. If every reachable pair agrees, the languages are equivalent.
Follow one input through both DFAs. Testing one string does not prove language equivalence.
Start at the initial states, then read one symbol at a time.
A deterministic finite automaton is a machine with one unambiguous next step for every input symbol.
A DFA is (Q, Σ, δ, q₀, F): a finite nonempty set of states, an alphabet, a transition function, one start state, and a set of accepting states.
For every state and every symbol in Σ, there must be exactly one outgoing transition. Several symbols can share one arrow. Loops are allowed. Missing transitions are unfinished work; two destinations for the same symbol break determinism.
Read the whole string, one symbol at a time. Accept only if the final state is accepting (a double circle). Passing through an accepting state halfway through is not enough. Zero, some, or all states may be accepting.
ε has length zero: the machine reads nothing and stays at its start state. It accepts ε exactly when that start state is accepting. A DFA has no ε-transitions. The ∅ symbol means an empty set, not the empty string.
The simulator answers “does this machine accept this particular string?” Compare answers “do these machines accept the same language?” BFS checks reachable pairs of states, and a disagreement produces a shortest counterexample.
A regular expression describes a regular language; a DFA recognizes one. They have the same expressive power. Converting a DFA to regex is a separate algorithm (for example, state elimination), and the expression may be long. This simulator follows transitions; it does not generate a regex.