DFA to Regular Expression via State Elimination (State Elimination Technique)
This section teaches the state elimination method to convert a DFA to a regular expression (regex). The core idea is to transform the DFA into an equivalent GNFA-like graph with regex-labeled edges, add a fresh start and accept state, then repeatedly eliminate intermediate states by updating edge labels using the rule:
where state is being eliminated.
To ground the method, we apply it to the given DFA with states and alphabet :
- Start state: (indicated by , meaning is accepting and is the start in the diagram; see note below)
- Accepting state: (marked by )
- Transitions:
- From : on go to , on go to
- From : on go to , on go to
- From : on go to , on go to
- From : on go to , on go to
Important: The table formatting you provided is ambiguous (it shows both “” and a separate row labeled “s”, but both appear in the first column). In the solution below, I treat the DFA as the conventional interpretation consistent with the transitions shown in each row label:
- Row : and (from the row you labeled “”)
- Row : and
- Row : and
- Row (last row) should be state ? But it shows and .
Because of this clash, the result can’t be guaranteed unique from the text alone. I proceed with the most coherent mapping consistent with the four transition rows as:
- Start:
- Accept:
- Transitions:
If you intended a different mapping, the elimination steps are still the same; only the initial edge labels change.
Key terms you’ll see:
- GNFA
- State elimination
- [Kleene star]{def="Operation meaning zero or more repetitions of regex "}
- [Union]{def="Regex choice operator; matches strings matched by either regex"}
DFA to Regular Expression (State Elimination / GNFA) — Tutorial
State Elimination Procedure for DFA → Regular Expression
- 1Step 1
Treat each DFA transition as a GNFA edge labeled by the regex ''. If multiple edges exist from to , union their labels. Add explicit ε where needed later.
- 2Step 2
Add new start with an edge labeled by ε. Add new accept and for every DFA accept state , add labeled by ε.
- 3Step 3
If there is no edge , treat the label as ∅ (matches nothing).
- 4Step 4
For every pair among remaining states (excluding ), update: . Then delete all edges into/out of .
- 5Step 5
The resulting label is the regex for the language accepted by the DFA.
1) Encode the given DFA as a regex-labeled transition system
We use states with start and accept (per the marker).
The DFA transitions (as interpreted from your table) are:
- From : on go to , on go to
- From : on go to , on go to
- From : on go to , on go to
- From : on go to , on go to
Now build GNFA edges labeled with single symbols:
- gives edge label on
- gives edge label on
- ,
- (self-loop),
- ,
Add:
- fresh start with
- fresh accept with
So we will compute the regex .
type="tip" title="Regex-edge update rule (memorize this)" content="When eliminating state , every path contributes ; then you union it with the existing . Self-loops become stars."
Elimination Roadmap
Insert $S$ and $F$
Add GNFA scaffoldingStart via labeled ε; accept via labeled ε."
Remove $q$
Eliminate 1st intermediate stateUpdate edges through using ."
Remove $r$
Eliminate 2nd intermediate stateAccount for ’s self-loop via ."
Remove $s$
Eliminate 3rd intermediate stateFinally connect directly to through remaining states."
Extract $R_{S→F}$
Read resultThe remaining single edge label is the regex."
Perform the State Eliminations (compute the regex)
- 1Step 1
We eliminate states in the order , then , then (keeping because is the accept gateway to ).
- 2Step 2
Compute necessary edge updates through . Current notable edges: , , . There is no transition, so and (since is ε). Then paths are: contributes so add . Concretely, because is and is . Also contributes so .
- 3Step 3
State has a self-loop on : , and . With eliminated, we will have induced edges from to and/or via . The crucial part is from the self-loop. Edges through used by the update formula become: for any , add . In particular, exists, and existed; after eliminating , gets a contribution via with label . Therefore (concise: ).
- 4Step 4
After eliminating and , we connect the fresh start to via . Since , the final regex is the label on which equals concatenated with (because is ε): .
- 5Step 5
From the induced updates above, the dominant accepting routes are those ending in from . These correspond to: (i) direct giving regex , and (ii) giving regex . Taking the union yields:
Final regular expression
Under the interpretation of the DFA consistent with the labeled rows/entries shown, the equivalent regular expression is:
where:
- matches exactly the string of length consisting of two zeros.
- matches strings starting with , then any number of zeros, then at the end (i.e., for ).
Key terms:
- Regular expression
- [Kleene star]{def="Operator matching zero or more repetitions of R"}
- [Union]{def="Regex choice operator "}
- [Elimination rule]{def="Update when removing j"}
Common pitfalls with DFA→Regex state elimination
Knowledge Check
In state elimination, which update rule is used when eliminating a state ?