NFAs accept the Regular Languages
Equivalence of Machines Definition: Machine is equivalent to machine if
Example of equivalent machines NFA FA
same computation power 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 Proof: Any NFA can be converted to an equivalent FA Any language accepted by an NFA is also accepted by a 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
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
Exampe NFA FA
Procedure NFA to FA Repeat Step 2 for all letters in alphabet, until no more transitions can be added.
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
Theorem Take NFA Apply procedure to obtain FA Then and are equivalent :
Proof AND
First we show: Take arbitrary: We will prove:
denotes
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
Induction hypothesis:
Induction Step:
Induction Step:
Therefore if then
We have shown: We also need to show: (proof is similar)
Single Accepting State for NFAs
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
Extreme Case NFA without accepting state Add an accepting state without transitions
Properties of Regular Languages
For regular languages and we will prove that: Union: Are regular Languages Concatenation: Star: Reversal: Complement: Intersection:
We say: Regular languages are closed under Union: Concatenation: Star: Reversal: Complement: Intersection:
Regular language Regular language NFA NFA Single aceepting state Single accepting state NFA
Example
Union NFA for
Example NFA for
Concatenation NFA for
Example NFA for
Star Operation NFA for
Example NFA for
Reverse NFA for 1. Reverse all transitions 2. Make initial state accepting state and vice versa
Example
Complement 1. Take the FA that accepts 2. Make final states non-final, and vice-versa
Example
Intersection regular We show regular regular
DeMorgan’s Law: regular
Example regular regular regular
Another Proof for Intersection Closure Machine Machine FA for FA for Construct a new FA that accepts simulates in parallel and
States in State in State in
FA FA transition transition FA transition
FA FA initial state initial state FA Initial state
FA FA accept state accept states FA accept states Both constituents must be accepting states
Example:
Automaton for intersection
simulates in parallel and accepts string if and only if accepts string and accepts string