Presentation is loading. Please wait.

Presentation is loading. Please wait.

NFAs accept the Regular Languages

Similar presentations


Presentation on theme: "NFAs accept the Regular Languages"— Presentation transcript:

1 NFAs accept the Regular Languages

2 Equivalence of Machines
Definition: Machine is equivalent to machine if

3 Example of equivalent machines
NFA FA

4 same computation power
We will prove: Languages accepted by NFAs Regular Languages Languages accepted by FAs NFAs and FAs have the same computation power

5 We will show: Languages accepted by NFAs Regular Languages Languages accepted by NFAs Regular Languages

6 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

7 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

8 Convert NFA to FA NFA FA

9 Convert NFA to FA NFA FA

10 Convert NFA to FA NFA FA

11 Convert NFA to FA NFA FA

12 Convert NFA to FA NFA FA

13 Convert NFA to FA NFA FA

14 Convert NFA to FA NFA FA

15 NFA to FA: Remarks We are given an NFA We want to convert it
to an equivalent FA With

16 If the NFA has states the FA has states in the powerset

17 Procedure NFA to FA 1. Initial state of NFA: Initial state of FA:

18 Example NFA FA

19 Procedure NFA to FA 2. For every FA’s state Compute in the NFA
Add transition to FA

20 Exampe NFA FA

21 Procedure NFA to FA Repeat Step 2 for all letters in alphabet, until
no more transitions can be added.

22 Example NFA FA

23 Procedure NFA to FA 3. For any FA state If is accepting state in NFA
Then, is accepting state in FA

24 Example NFA FA

25 Theorem Take NFA Apply procedure to obtain FA
Then and are equivalent :

26 Proof AND

27 First we show: Take arbitrary: We will prove:

28

29 denotes

30 We will show that if then

31 More generally, we will show that if in :
(arbitrary string) then

32 Proof by induction on Induction Basis: Is true by construction of

33 Induction hypothesis:

34 Induction Step:

35 Induction Step:

36 Therefore if then

37 We have shown: We also need to show: (proof is similar)

38 Single Accepting State for NFAs

39 Any NFA can be converted
to an equivalent NFA with a single accepting state

40 Example NFA Equivalent NFA

41 In General NFA Equivalent NFA Single accepting state

42 Extreme Case NFA without accepting state Add an accepting state
without transitions

43 Properties of Regular Languages

44 For regular languages and
we will prove that: Union: Are regular Languages Concatenation: Star: Reversal: Complement: Intersection:

45 We say: Regular languages are closed under
Union: Concatenation: Star: Reversal: Complement: Intersection:

46 Regular language Regular language NFA NFA Single aceepting state
Single accepting state NFA

47 Example

48 Union NFA for

49 Example NFA for

50 Concatenation NFA for

51 Example NFA for

52 Star Operation NFA for

53 Example NFA for

54 Reverse NFA for 1. Reverse all transitions
2. Make initial state accepting state and vice versa

55 Example

56 Complement 1. Take the FA that accepts 2. Make final states non-final,
and vice-versa

57 Example

58 Intersection regular We show regular regular

59 DeMorgan’s Law: regular

60 Example regular regular regular

61 Another Proof for Intersection Closure
Machine Machine FA for FA for Construct a new FA that accepts simulates in parallel and

62 States in State in State in

63 FA FA transition transition FA transition

64 FA FA initial state initial state FA Initial state

65 FA FA accept state accept states FA accept states Both constituents must be accepting states

66 Example:

67 Automaton for intersection

68 simulates in parallel and
accepts string if and only if accepts string and accepts string


Download ppt "NFAs accept the Regular Languages"

Similar presentations


Ads by Google