- 2068 Bhadra · 3+2+3 marks
Design FSA for strings beginning with baa
Short answer
DFA with states q0 (start), q1, q2, q3 (final), and dead state d. Transitions: b to q1, then a to q2, a to q3; any other input goes to d. q3 loops on a,b. Only prefixes baa accepted.
Design a finite-state automata that accepts only those set of strings over {a, b} which starts with baa. Precisely, only those strings which begin with baa should be accepted and other strings over {a, b} should be rejected. Your design should include the proper definition of the finite-state automata, transition table and the transition diagram.
Definition
A finite-state automaton is a 5-tuple M = (S, I, f, s₀, F): S a finite set of states, I the input alphabet, f : S × I → S the transition function, s₀ ∈ S the start state and F ⊆ S the set of final states. A string is accepted when it drives M from s₀ into a state of F. (For a DFA, f gives exactly one next state.)
Design
The machine checks the first three symbols b, a, a one by one. Any wrong symbol sends it to a dead (trap) state d. After baa is read, whatever follows is allowed, so the final state loops on both symbols.
Formal definition: M = ({q₀, q₁, q₂, q₃, d}, {a, b}, f, q₀, {q₃})
Transition table
| State | a | b |
|---|---|---|
| → q₀ | d | q₁ |
| q₁ | q₂ | d |
| q₂ | q₃ | d |
| *q₃ (final) | q₃ | q₃ |
| d (dead) | d | d |
Transition diagram
->(q0)--b-->(q1)--a-->(q2)--a-->((q3)) a,b loop
| | |
a b b
v v v
+--------->(d)<------+ d loops on a,b
Check
- baab: q₀ → q₁ → q₂ → q₃ → q₃. Accepted.
- bab: q₀ → q₁ → q₂ → d. Rejected. abaa: q₀ → d. Rejected.
- baa itself is accepted, since q₃ is reached at the end.
- Brute-force test (all strings up to length 10) confirmed the language is exactly the set of strings that begin with baa.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Design NFA for strings ending with aba · Discrete Structure, chapter 2
- Design FSA accepting even number of a's · Discrete Structure, chapter 2 · asked 4×
- Design FSA accepting odd number of b's · Discrete Structure, chapter 2 · asked 4×
- Define FSM; design FSA with two consecutive a's · Discrete Structure, chapter 2 · asked 4×
- Regular expression and FSA: at least three b's · Discrete Structure, chapter 2
- Construct FSA accepting reverse language · Discrete Structure, chapter 2
- DFA starts or ends with 01 · Theory of Computation, chapter 2