1 / 17

Non-deterministic FSA

Non-deterministic FSA. Reading: 2.2 & 2.3. Reminder: . A Language is called Regular iff there is a DFA acceptor that defines it. There exists some DFA M such that L = L(M). NFA Formal Definition. Same as DFA’s, but δ : Q X ( Σ  { λ }) 2 Q Two non-deterministic elements:

ganya
Download Presentation

Non-deterministic FSA

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. Non-deterministic FSA Reading: 2.2 & 2.3

  2. Reminder: A Language is called Regular iff there is a DFA acceptor that defines it. There exists some DFA M such that L = L(M).

  3. NFA Formal Definition • Same as DFA’s, but δ: Q X (Σ {λ}) 2Q • Two non-deterministic elements: • Lambda transitions • 2 outarcs with same symbol • A String is accepted if there is SOME path that ends in an acceptor state.

  4. The language defined by a NFA is the set of all strings for which there is a walk with the string’s label from the initial state to some accepting state. NFA’s and Languages

  5. Example {ab, abc}* q1 a q0 b c,λ q2

  6. Example Is aaa accepted? ab? What language is this? q1 a q0 b a λ q2

  7. Things NFA’s make easy • L1 U L2 L1 λ λ L2 λ λ

  8. L1 Things NFA’s make easy • L1 ٠L2 λ L2 λ λ

  9. L1 Things NFA’s make easy • L1* λ λ λ λ

  10. Intuitive NFA’s • Example: Write a DFA & NFA that accept the strings containing the substring abbab

  11. Practice - write NFAs • Strings on {a,b}* that ends in aa. • A string on {a,b,c}* such that the final letter has occurred before.

  12. Equivalence • DFA’s and NFA’s are equally powerful. • That is, For every language accepted by a NFA, there exists some DFA that also accepts the language.

  13. Algorithm NFA -> DFA • start state in GD (deterministic graph) is {qo} U lambda-closure • While can add an edge to GD • Choose a state A = {qi,qj,…} with missing edge for some symbol a • Compute B = δ*(qi,a) U δ*(qj,a) U … • Add B to GD if it doesn’t exist • Add arc from A to B labeled a. • Add final states • If λ is in the language, make the start state final.

  14. Example 1 b a q2 qo q1 λ a

  15. Example 2 λ a q2 qo q1 b b a

  16. Example 3 0 0,1 0,1 q2 qo q1 1

  17. Questions • Argue: Any language accepted by an NFA can be accepted by a DFA • Graph construction has finite number of states • DFA construction algorithm halts

More Related