- 2073 Chaitra
DFA avoiding substring 10110
Short answer
DFA tracks the longest suffix that is a prefix of '10110'. States q0–q4 represent progress: q0 start, q1 after '1', q2 '10', q3 '101', q4 '1011'. On reading the full pattern, go to dead state d (non-final). Example: 1011 ends in q4 (accepted); 0101100 hits d (rejected).
Design a DFA that accepts the language L = {x : x ∈ {0,1}* and 10110 does not occur as a substring}. Verify your design with a supporting example.
Idea. Use states q0..q4 to record the length of the longest suffix of the input read so far that is a prefix of 10110. If the whole pattern 10110 is seen, go to a dead (trap) state. All states except the dead state are final.
M = ({q0, q1, q2, q3, q4, d}, {0,1}, δ, q0, {q0, q1, q2, q3, q4})
Meaning: q0 = no progress; q1 = suffix "1"; q2 = "10"; q3 = "101"; q4 = "1011"; d = pattern found.
Transition table
| State | 0 | 1 |
|---|---|---|
| → *q0 | q0 | q1 |
| *q1 | q2 | q1 |
| *q2 | q0 | q3 |
| *q3 | q2 | q4 |
| *q4 | d | q1 |
| d | d | d |
Reasons for the less obvious moves:
- q1 on 1: input ends in "11"; the longest suffix that is a prefix is "1", so q1.
- q2 on 0: "100" has no suffix matching a prefix, so q0.
- q3 on 0: "1010" ends in "10", so q2.
- q4 on 1: "10111" ends in "1", so q1.
- q4 on 0 completes 10110, so d.
1 0 1 1 0
q0 ──► q1 ──► q2 ──► q3 ──► q4 ──► d
(all of q0..q4 are final; d is the trap)
Back edges: q0 ↻0 q1 ↻1 q2 -0-> q0
q3 -0-> q2 q4 -1-> q1
d ↻0,1
Verification
- Accepted: 1011. q0 →1 q1 →0 q2 →1 q3 →1 q4 (final). Also 101011: q0,q1,q2,q3,q2,q3,q4 (final); 10110 is not a substring.
- Rejected: 0101100. q0 →0 q0 →1 q1 →0 q2 →1 q3 →1 q4 →0 d →0 d, and d is not final (the string contains 10110).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- DFA for {00}*{11}* language · Theory of Computation, chapter 2
- Regular expression with substring 0101 · Theory of Computation, chapter 2
- Configuration of DFA; DFA with 01 and 10 · Theory of Computation, chapter 2
- DFA starts or ends with 01 · Theory of Computation, chapter 2
- DFA for (a(ab)*b)* · Theory of Computation, chapter 2
- DFA: even 0s and even 1s · Theory of Computation, chapter 2
- Language of grammar; grammar for strings not ending in ab · Discrete Structure, chapter 2
- DFA with no three consecutive 0's · Discrete Structure, chapter 2
- Interpret: book for second-language readers · Communication English, chapter 1
- Principles of mix design; factors not in DOE · Concrete Technology and Masonry Structure, chapter 3