Below is a straight-from-Thompson (Theorem 3.1) ε–NFA for the regular expression
L = ( a a* a a + b b a* a b )
The machine has exactly one start state (s) and one final state (f).
Every transition label is either a symbol (a or b) or ε.
ε ε
+-----> p1 --a--> p2 --ε--> p3 --ε--> p4 ----ε----> p7 --a--> p8 --ε--> p9 --a--> p10 --ε--> f
| ^ | | ^
| | | +--ε--+ |
| | | \ |
| | | >- p5 --a--> p6 --ε--> p4 -------+
| | | / ^ |
| | | ε-------+ +--ε-----+
| | |
| +--------+
start s |
| ε
| |
| v
| q1 --b--> q2 --ε--> q3 --b--> q4 --ε--> q5
| | ε
| | \
| | >- q7 --a--> q8 --ε--> q5
| | / ^ |
| +--ε--> q6 --+ +--ε-----+
| | |
| v |
| ε----> q9 --a--> q10 --ε--> q11 --b--> q12 --ε--> f
| ^
+-----------------------------------------------------------------------------------------+
(states p• deal with a a* a a branch)
(states q• deal with b b a* a b branch)
Readable state/transition table
| State | a-moves | b-moves | ε-moves | Accept? |
|---|
| s | — | — | p1, q1 | no |
| p1 | p2 | — | — | no |
| p2 | — | — | p3 | no |
| p3 | — | — | p4, p5 | no |
| p4 | — | — | p7 | no |
| p5 | p6 | — | — | no |
| p6 | — | — | p4, p5 | no |
| p7 | p8 | — | — | no |
| p8 | — | — | p9 | no |
| p9 | p10 | — | — | no |
| p10 | — | — | f | no |
| q1 | — | q2 | — | no |
| q2 | — | — | q3 | no |
| q3 | — | q4 | — | no |
| q4 | — | — | q5 | no |
| q5 | — | — | q6, q7 | no |
| q6 | — | — | q9 | no |
| q7 | q8 | — | — | no |
| q8 | — | — | q5, q6 | no |
| q9 | q10 | — | — | no |
| q10 | — | — | q11 | no |
| q11 | — | q12 | — | no |
| q12 | — | — | f | no |
| f | — | — | — | YES |
How it was built (sketch)
- For every symbol (a or b) we made a two-state fragment.
- For R* we used the four-ε-arc “star” gadget.
- For concatenation we hooked the accept of the left part to the start of the right part with ε.
- For union we added a new global start (s) and global final (f) with ε-transitions to the two branch starts and from the two branch accepts to f.
Because the construction is purely mechanical, any equivalent drawing with the same structure of ε-edges and labeled edges earns full credit.