AutomataLab
PURE JAVASCRIPTv3.0 · LEARNING STUDIO
THEORY OF COMPUTATION · INTERACTIVE STUDIO

Two automata.
One clear answer.

Compare deterministic finite automata, understand the algorithm, and discover the shortest string that proves they differ.

01 / CONFIGURE

Your automata workspace

Build your DFAs visually: add states, connect them, and compare their languages.

Save both diagrams, including unfinished work and positions.
QUICK EXAMPLES

A

DFA A

First language · L(A)
READY
Advanced: import / export DFA A JSON ⌄

Copy this JSON to save a definition. To import edits, click Apply JSON.

B

DFA B

Second language · L(B)
READY
Advanced: import / export DFA B JSON ⌄

Copy this JSON to save a definition. To import edits, click Apply JSON.

Using sample definitions
02 / ANALYZE

Equivalence analysis

BFS explores pairs of states and checks whether their accepting status differs.

BFS · PRODUCT AUTOMATON

Execution traces

SHORTEST WITNESS

BFS explorer

STEP —
i
Why is this proof correct?

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.

TRY A STRING

Watch your automata read

Follow one input through both DFAs. Testing one string does not prove language equivalence.

Enter symbols directly, without separators. ε means no input; leave the field empty to test it. Maximum 500 symbols.

Start at the initial states, then read one symbol at a time.

UNDERSTAND THE RULES

What makes a DFA?

A deterministic finite automaton is a machine with one unambiguous next step for every input symbol.

Five ingredients

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.

Exactly one next state

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.

When does it accept?

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.

The empty string: ε

ε 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.

Simulation versus equivalence

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.

Where does regex fit?

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.