Download presentation

Presentation is loading. Please wait.

1
NFAs Sipser 1.2 (pages 47–54)

2
CS 311 Fall 2008 2 Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union –Intersection

3
CS 311 Fall 2008 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 | w is a string of 0 s and 1 s containing an odd number of 1 s } Let B = {w | w is a string of 0 s and 1 s containing an even number of 1 s } What are A ° B ; B ° A ; A ° A ; B ° B ? –Are any of these languages regular?

4
CS 311 Fall 2008 4 Concatenation Conjecture: The class of regular languages is closed under the concatenation operation. Proof idea:

5
CS 311 Fall 2008 5 Hmm… A = {w | w is a string of 0 s and 1 s containing an odd number of 1 s } B = {w | w is a string of 0 s and 1 s containing an even number of 1 s } Create a machine by gluing… how?

6
CS 311 Fall 2008 6 We need another approach ? ?

7
CS 311 Fall 2008 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
CS 311 Fall 2008 10 An example computation What about 1011?

11
CS 311 Fall 2008 11 Another example What language is being recognized? Hint: can you start listing strings accepted?

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

13
CS 311 Fall 2008 13 NFA computation Let N=(Q, Σ, δ, q 0, F) be a NFA and let w be a string over the alphabet Σ Then N accepts w if – w can be written as w 1 w 2 w 3 …w m with each w i in Σε and –There exists a sequence of states s 0,s 1,s 2,…,s m exists in Q with the following conditions: 1.s 0 =q 0 2.s i+1 ∈ δ(s i,w i+1 ) for i = 0,…,m-1 3.s n ∈ F

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

15
CS 311 Fall 2008 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
CS 311 Fall 2008 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.

Similar presentations

© 2020 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google