NFA for strings starting with a or bb
This epsilon-NFA illustrates a language with alternative prefixes. It reads the first symbol at q0. An a moves to qa, while a b moves to q1, which needs a second b to reach qb. The two successful branches then merge into qf by epsilon, where the machine can consume any remaining symbols. The epsilon transitions mean the required prefix itself is enough for acceptance; no extra input is needed before qf. The drawing shows that acceptance depends on the beginning of the input rather than its end. Prefix languages are common in token recognition, command parsing and protocol dispatch, where the first few symbols choose a valid form.
Open it in the AI editor with a prompt pre-filled — keep what works, change what doesn't.
Scenario
Prefix alternatives
Key decisions
- Branching prefix: q0 separates the a and bb alternatives.
- Successful merge: qa and qb lead to one accepting continuation.
- Suffix loop: qf accepts arbitrary remaining input after a valid prefix.
When to reuse this
Use a branch-and-merge automaton for a language defined by several allowed starting patterns.
Frequently asked questions
What prefixes does the machine recognize?
Why is there a separate q1 state?
Can the branches share one final state?
Tweak it with chat, export PNG/SVG, or fork it for your own use case.