1 / 16

NFAs

NFAs. Sipser 1.2 (pages 47–54). Recall…. Last time we showed that the class of regular languages is closed under: Complement Union Intersection. Concatenation operation. Let A and B be languages. The concatenation of A and B is A ° B = { xy | x ∈ A and y ∈ B} .

ghita
Download Presentation

NFAs

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 Sipser 1.2 (pages 47–54)

  2. Recall… • Last time we showed that the class of regular languages is closed under: • Complement • Union • Intersection

  3. Concatenation operation • Let A and B be languages. • The concatenation of A and B is A°B = {xy | x ∈A and y ∈ B}. Example • Let A = {w | wis a string of 0s and 1s containing an odd number of 1s} • Let B = {w | wis a string of 0s and 1s containing an even number of 1s} • What are A°B; B°A; A°A; B°B? • Are any of these languages regular?

  4. Concatenation • Conjecture: The class of regular languages is closed under the concatenation operation. • Proof idea:

  5. Hmm… • A = {w | wis a string of 0s and 1s containing an odd number of 1s} • B = {w | wis a string of 0s and 1s containing an even number of 1s} • Create a machine by gluing… how?

  6. We need another approach ?

  7. The empty symbol ε • Seems like it might work • Let’s try running it…

  8. Relaxing the rules Deterministic (DFA) Nondeterministic (NFA)

  9. Running DFA vs NFA DFA computation (path) NFA computation (tree)

  10. An example computation • What about 1011?

  11. Another example • What language is being recognized? • Hint: can you start listing strings accepted?

  12. Formally… • A nondeterministic finite automaton (NFA) is a 5-tuple (Q, Σ, δ,q0, F), where • Q is a finite set called the states • Σ is a finite set called the alphabet • δ: Q × Σε→ P(Q)is the transition function • q0∈Q is the start state • F⊆Q is a set of accept states • In-class exercise:

  13. NFA computation • Let N=(Q, Σ, δ, q0, F)be a NFA and let wbe a string over the alphabet Σ • Then Nacceptsw if • w can be written as w1w2w3…wm with each wi in Σε and • There exists a sequence of states s0,s1,s2,…,sm exists in Q with the following conditions: • s0=q0 • si+1∈δ(si,wi+1) fori = 0,…,m-1 • sn∈F

  14. Nondeterminism makes life easier • Let’s build an NFA that recognizes B = {w | wis a string over {a,b} that starts and ends with the same symbol} C = {w | wis a string over {0,1} that contains at least three 1’s} D = {w | wis a string over {0,1} that contains at least three consecutive 1’s}

  15. If at first you don’t succeed… … adjust your goal! We wanted to prove: The class of regular languages is closed under the concatenation operation.

  16. If at first you don’t succeed… … adjust your goal! Instead, let’s prove the theorem: The class of languages recognized by NFAs is closed under the concatenation operation.

More Related