← RGPV CS-501 Theory of Computation May 2023 Solved Paper
Question
Construct a DFA over {a,b} accepting strings with at least one a.
Asked in: CS-501 | May 2023 | 2(a)(ii)
Answer
q0 records that no a has occurred; q1 records that an a has occurred. Once q1 is reached it remains accepting. Examples: ba and abb are accepted; ε and bb are rejected.
The initial state is q0. Accepting states: q1. Every state has exactly one outgoing transition for each input symbol, so the machine is deterministic and complete.
| State | a | b |
|---|---|---|
| q0 | q1 | q0 |
| q1 | q1 | q1 |
Process the input from left to right and accept only if the final state is accepting. The state meanings establish the invariant after every prefix, proving correctness by induction on input length.

Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion