- 2072 Kartik
DFA for {00}*{11}* language
Short answer
The DFA has states q0 (even 0s, no 1s, final), q1 (odd 0s), q3 (odd 1s), q2 (even 1s, final), and dead state d. Transitions: q0-0->q1, q1-0->q0, q0-1->q3, q3-1->q2, q2-1->q3; any 0 after a 1 or 1 after odd 0s goes to d.
Design a DFA accepting strings over the alphabet {0,1} defined by {00}{11}. [Printed expression unclear in scan.]
Reading of the question. The scan is unclear; we take the language L = {00}{11} = (00)(11), i.e. an even number of 0's followed by an even number of 1's (the blocks are 00 and 11). The method is the same for similar expressions.
Idea. Phase 1 reads pairs of 0's; phase 2 reads pairs of 1's; after any 1 is read, a 0 is not allowed.
States:
- q0: even number of 0's read, no 1 yet (start, final)
- q1: odd number of 0's read
- q3: in the 1-phase with an odd number of 1's read
- q2: in the 1-phase with an even number (≥ 2) of 1's read (final)
- d: dead state
M = ({q0, q1, q2, q3, d}, {0,1}, δ, q0, {q0, q2})
| State | 0 | 1 |
|---|---|---|
| → *q0 | q1 | q3 |
| q1 | q0 | d |
| q3 | d | q2 |
| *q2 | d | q3 |
| d | d | d |
Phase 1 (pairs of 0): ((q0)) <--0--> (q1) q1 --1--> d
Phase 2 (pairs of 1): q0 --1--> (q3) <--1--> ((q2))
q3, q2 --0--> d
d loops on 0,1. Start: q0. Finals: q0, q2.
Edges: q0 –0→ q1, q1 –0→ q0, q0 –1→ q3, q3 –1→ q2, q2 –1→ q3. All other moves go to d (e.g. q1 –1→ d, q2 –0→ d, q3 –0→ d).
Test
- "0011": q0 → q1 → q0 → q3 → q2, final. Accepted.
- "00": q0 → q1 → q0 final, accepted. ε is accepted too.
- "011": q0 → q1 → d. Rejected (odd 0's).
- "1100": q0 → q3 → q2 → d → d. Rejected (0 after 1).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- DFA starts or ends with 01 · Theory of Computation, chapter 2
- DFA: even a and odd b · Theory of Computation, chapter 2
- DFA avoiding substring 10110 · Theory of Computation, chapter 2
- Configuration of DFA; DFA with 01 and 10 · Theory of Computation, chapter 2
- DFA for (a(ab)*b)* · Theory of Computation, chapter 2
- TM accepting wwᴿ; process 101101 · Theory of Computation, chapter 4
- Construct FSA accepting reverse language · Discrete Structure, chapter 2
- Language of grammar; grammar for strings not ending in ab · 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×