700 likes | 811 Views
NFAs accept the Regular Languages. Equivalence of Machines. Definition: Machine is equivalent to machine if. Example of equivalent machines. NFA. FA. We will prove:. Languages accepted by NFAs. Regular Languages. Languages accepted by FAs. NFAs and FAs have the
E N D
Equivalence of Machines • Definition: • Machine is equivalent to machine • if
We will prove: Languages accepted by NFAs Regular Languages Languages accepted by FAs NFAs and FAs have the same computation power
We will show: Languages accepted by NFAs Regular Languages Languages accepted by NFAs Regular Languages
Proof-Step 1 Languages accepted by NFAs Regular Languages Proof: Every FA is trivially an NFA Any language accepted by a FA is also accepted by an NFA
Proof-Step 2 Languages accepted by NFAs Regular Languages Any NFA can be converted to an equivalent FA Proof: Any language accepted by an NFA is also accepted by a FA
NFA to FA: Remarks • We are given an NFA • We want to convert it • to an equivalent FA • With
If the NFA has states • the FA has states in the powerset
Procedure NFA to FA • 1. Initial state of NFA: • Initial state of FA:
Example NFA FA
Procedure NFA to FA • 2. For every FA’s state • Compute in the NFA • Add transition to FA
Example NFA FA
Procedure NFA to FA • Repeat Step 2 for all letters in alphabet, • until • no more transitions can be added.
Convert NFA to FA NFA FA
Example NFA FA
Example NFA FA
Procedure NFA to FA • 3. For any FA state • If is accepting state in NFA • Then, • is accepting state in FA
Example NFA FA
Convert NFA to FA NFA FA
Convert NFA to FA NFA FA
Convert NFA to FA NFA FA
Convert NFA to FA NFA FA
Convert NFA to FA NFA FA
Convert NFA to FA NFA FA
Convert NFA to FA NFA FA
Theorem Take NFA Apply procedure to obtain FA Then and are equivalent :
Proof AND
First we show: Take arbitrary: We will prove:
We will show that if then
More generally, we will show that if in : (arbitrary string) then
Proof by induction on Induction Basis: Is true by construction of
Therefore if then
We have shown: We also need to show: (proof is similar)
Any NFA can be converted • to an equivalent NFA • with a single accepting state
Example NFA Equivalent NFA
In General NFA Equivalent NFA Single accepting state
Add an accepting state without transitions Extreme Case NFA without accepting state
Union: Concatenation: Are regular Languages For regular languages and we will prove that: Star: Reversal: Complement: Intersection:
Union: Concatenation: We say: Regular languages are closed under Star: Reversal: Complement: Intersection:
Regular language Regular language NFA NFA Single accepting state Single accepting state
Union • NFA for