1 / 70

NFAs accept the Regular Languages

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

lajos
Download Presentation

NFAs accept the Regular Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. 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 Any NFA can be converted to an equivalent FA Proof: Any language accepted by an NFA is also accepted by a FA

  8. NFA to FA: Remarks • We are given an NFA • We want to convert it • to an equivalent FA • With

  9. If the NFA has states • the FA has states in the powerset

  10. Procedure NFA to FA • 1. Initial state of NFA: • Initial state of FA:

  11. Example NFA FA

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

  13. Example NFA FA

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

  15. Convert NFA to FA NFA FA

  16. Example NFA FA

  17. Example NFA FA

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

  19. Example NFA FA

  20. Convert NFA to FA NFA FA

  21. Convert NFA to FA NFA FA

  22. Convert NFA to FA NFA FA

  23. Convert NFA to FA NFA FA

  24. Convert NFA to FA NFA FA

  25. Convert NFA to FA NFA FA

  26. Convert NFA to FA NFA FA

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

  28. Proof AND

  29. First we show: Take arbitrary: We will prove:

  30. denotes

  31. We will show that if then

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

  33. Proof by induction on Induction Basis: Is true by construction of

  34. Induction hypothesis:

  35. Induction Step:

  36. Induction Step:

  37. Therefore if then

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

  39. Single Accepting State for NFAs

  40. Any NFA can be converted • to an equivalent NFA • with a single accepting state

  41. Example NFA Equivalent NFA

  42. In General NFA Equivalent NFA Single accepting state

  43. Add an accepting state without transitions Extreme Case NFA without accepting state

  44. Properties of Regular Languages

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

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

  47. Regular language Regular language NFA NFA Single accepting state Single accepting state

  48. Example

  49. Union • NFA for

More Related