Proof for a FA
About 1048 wordsAbout 13 min
2025-09-07
Let x be a string, and let M be a Finite Automaton with just one Final State that accepts the strings x and xx.
(a) Prove, by induction on n, that M accepts the string xn for every n ≥ 1.
(b) Would the same statement hold if M is a Nondeterministic Finite Automaton, also with just one Final State, instead? Why or why not?
Let the start state of M be q0 and the single final state be qf.
(a) Proof for a Deterministic Finite Automaton (FA)
Yes, this statement is true. We can prove it by induction on n.
Let δ∗(q,w) be the extended transition function, representing the state the machine is in after starting at state q and processing the entire string w.
1. Deriving the Crucial Premise:
Before starting the induction, we must use the given information.
- Premise 1: M accepts x. Since M is a DFA and has only one final state (qf), this means processing x from the start state q0 must lead to qf.
- Formally: δ∗(q0,x)=qf.
- Premise 2: M accepts xx. This means processing xx from q0 must also lead to qf.
- Formally: δ∗(q0,xx)=qf.
- Connecting the Premises: By the definition of the extended transition function, processing xx is the same as processing x from the state reached after processing the first x.
- δ∗(q0,xx)=δ∗(δ∗(q0,x),x)
- Substitution: We can now substitute our findings from Premise 1 into this equation:
- δ∗(q0,xx)=δ∗(qf,x)
- Conclusion: Since we know δ∗(q0,xx)=qf (from Premise 2), we can conclude:
- δ∗(qf,x)=qf
This is the critical fact: processing the string x from the final state leads back to that same final state. This creates a "loop" on the string x.
2. The Inductive Proof:
We will prove the proposition P(n): "M accepts xn", which means δ∗(q0,xn)=qf.
Base Case (n=1): We must show P(1) is true. P(1) states that M accepts x1, or just x. This is given explicitly in the problem statement (Premise 1). Thus, the base case holds.
Inductive Hypothesis (IH): Assume P(k) is true for some arbitrary integer k≥1. That is, assume δ∗(q0,xk)=qf.
Inductive Step: We must prove that P(k+1) is true, meaning we must show that δ∗(q0,xk+1)=qf.
- Start by definition: The string xk+1 is just the string xk followed by the string x.
- Using the definition of the extended transition function: δ∗(q0,xk+1)=δ∗(q0,xk⋅x)=δ∗(δ∗(q0,xk),x)
- By our Inductive Hypothesis, we know δ∗(q0,xk)=qf. We substitute this into the equation: δ∗(q0,xk+1)=δ∗(qf,x)
- From our initial derivation (Connecting the Premises), we proved that δ∗(qf,x)=qf.
- Therefore: δ∗(q0,xk+1)=qf.
Conclusion: This is exactly the statement P(k+1). Since we have established the base case and shown that P(k)⟹P(k+1), by the principle of mathematical induction, the statement P(n) is true for all n≥1.
(b) Case for a Nondeterministic Finite Automaton (NFA)
No, the same statement would not hold if M is an NFA.
Why:
The critical step in the proof for part (a) was concluding that δ∗(qf,x)=qf. This was possible because a DFA has exactly one computation path.
In an NFA, "acceptance" means at least one computation path ends in a final state. The accepting path for x and the accepting path for xx do not have to be related in the same way.
The NFA accepting x only guarantees that qf∈δ∗(q0,x) (where δ∗ now returns a set of states). The NFA accepting xx only guarantees that qf∈δ∗(q0,xx).
This second fact means there exists some state qi such that:
- qi∈δ∗(q0,x)
- qf∈δ∗(qi,x)
The problem is that this qi does not have to be qf. The machine could have two paths for x: one that goes to qf (to accept x) and another that goes to some intermediate state qi, which then goes to qf on another x (to accept xx). In this scenario, the final state qf itself can lead to no state at all on input x.
Counterexample:
Let x=a and let M be an NFA with:
- States: {q0,q1,qf}
- Start State: q0
- Final State (singular): {qf}
- Transitions:
- δ(q0,a)={q1,qf} (On 'a', the NFA can go to q1 OR qf)
- δ(q1,a)={qf} (From q1, an 'a' goes to qf)
- δ(qf,a)=∅ (From qf, an 'a' goes nowhere/crashes)
Let's check this counterexample against the problem's conditions:
- Is there only one Final State? Yes, {qf}.
- Does it accept x (which is a)? Yes. On input 'a', one computation path is q0→qf. Since this path ends in the final state, a is accepted.
- Does it accept xx (which is aa)? Yes. One computation path is q0aq1aqf. This path consumes all input (aa) and ends in the final state, so aa is accepted. (Note: the path q0aqfa... crashes, but that doesn't matter since another path succeeded).
Now, check the conclusion:
- Does it accept x3 (which is aaa)?
- Path 1: q0aqfa... (This path crashes after one 'a').
- Path 2: q0aq1aqfa... (This path crashes after two 'a's, because δ(qf,a) is empty).
Since all possible computation paths for aaa fail to consume the string while ending in a final state, the string aaa (x3) is rejected. This disproves the statement for NFAs.
Changelog
f50a2-docs: exam prep FAon
Copyright
Copyright Ownership:WARREN Y.F. LONG
License under:Attribution-NonCommercial-NoDerivatives 4.0 International (CC-BY-NC-ND-4.0)