CSC262 · 2081 · 5 marks
Design the DFA that accepts binary string ending with '00' and show its extended transition function for the string 111000.
Design the DFA that accepts binary string ending with '00' and show its extended transition function for the string 111000. [5]
DFA Accepting Binary Strings Ending with '00'
Given
- Alphabet: $\Sigma = {0, 1}$
- Language: $L = {w \in \Sigma^* \mid w \text{ ends with } 00}$
- Test string for extended transition function: $111000$
No numeric data missing; the problem is fully solvable.
Solution
Part 1: DFA Design
We track the relevant suffix (last two symbols). Three states suffice:
| State | Meaning |
|---|---|
| $q_0$ | Start; string is empty or does not end in a useful $0$ |
| $q_1$ | String currently ends with exactly one $0$ |
| $q_2$ | String ends with $00$ (Accepting) |
Formal 5-tuple: $$M = ({q_0, q_1, q_2},\ {0,1},\ \delta,\ q_0,\ {q_2})$$
Transition Table:
| State | 0 | 1 |
|---|---|---|
| $\to q_0$ | $q_1$ | $q_0$ |
| $q_1$ | $q_2$ | $q_0$ |
| $*q_2$ | $q_2$ | $q_0$ |
Transition Function:
- $\delta(q_0, 0) = q_1,\quad \delta(q_0, 1) = q_0$
- $\delta(q_1, 0) = q_2,\quad \delta(q_1, 1) = q_0$
- $\delta(q_2, 0) = q_2,\quad \delta(q_2, 1) = q_0$
State Diagram (description):
1 1
(loop) (self on q2 via 1 back to q0)
┌────┐
↓ │
→( q0 )──0──▶( q1 )──0──▶(( q2 ))──0──▶ (self loop 0)
▲ │ │
└─────1──────┘ │
▲──────────────1───────────┘
- $q_0$: on $1$ self-loop; on $0 \to q_1$
- $q_1$: on $0 \to q_2$; on $1 \to q_0$
- $q_2$ (accepting): on $0$ self-loop; on $1 \to q_0$
Part 2: Extended Transition Function $\delta^*(q_0, 111000)$
Definition: $$\delta^(q, \varepsilon) = q, \qquad \delta^(q, wa) = \delta(\delta^*(q, w), a)$$
| Step | Expression | Computation | Result |
|---|---|---|---|
| 0 | $\delta^*(q_0, \varepsilon)$ | base case | $q_0$ |
| 1 | $\delta^*(q_0, 1)$ | $\delta(q_0, 1)$ | $q_0$ |
| 2 | $\delta^*(q_0, 11)$ | $\delta(q_0, 1)$ | $q_0$ |
| 3 | $\delta^*(q_0, 111)$ | $\delta(q_0, 1)$ | $q_0$ |
| 4 | $\delta^*(q_0, 1110)$ | $\delta(q_0, 0)$ | $q_1$ |
| 5 | $\delta^*(q_0, 11100)$ | $\delta(q_1, 0)$ | $q_2$ |
| 6 | $\delta^*(q_0, 111000)$ | $\delta(q_2, 0)$ | $q_2$ |
Result
$$\delta^*(q_0,\ 111000) = q_2$$
Since $q_2$ is the accepting state, the string $111000$ (which ends in $00$) is accepted. The DFA design is verified correct.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.