Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nondeterministic Finite Automata

Similar presentations


Presentation on theme: "Nondeterministic Finite Automata"— Presentation transcript:

1 Nondeterministic Finite Automata
CS310 Nondeterministic Finite Automata Sections:1.2 page 47 September 12, 2008

2 Example (1.30) Accept string of at least length three that contains a 1 in the third from end What makes this difficult for a DFA? Equivalent DFA takes 8 states. Why 8? = 0,1 ; ∗ 1 0∪1 0∪1 Lets look at the language first. It is clear what this specifies? What does E* mean? U means?

3 Formal Definition of NFA
5 tuple ( Q,Σ, δ , q0,F) Σ ɛ =Σ∪ 𝑒 δ:𝑄× Σ ɛ →𝑃 𝑄 1, ε 1 q4 q1 q2 q3 0,1 1 ε q1 {q1.q2} ø q2 {q3} q3 {q4} Same as DFA. Don’t add e to the Alphabet. Just add e to the Alphabet for the transition table. Remember Q x E -> P(Q) means the RANGE of the function must come from P(Q) The transition table is now made up of sets, some of which are empty! And contains the e transitions. What happens with 10, 11, 0, 01

4 Formal Definition of Computing for NFA
Given a machine M= (Q, ∑ , δ,q0, F) and a string w=w1w2…wn over ∑, then M accepts w if there exists a sequence of states r0,r1…rn in Q such that: r0 = q0 δ (ri, wi+1) = ri+1 ,i=0,…,n-1 rn є F

5 Practice Construct a NFA with three states that recognizes {w | w ends with two 0s} Σ = {0,1}

6 Practice Construct a NFA with six states
{w | w even # 0s OR exactly two 1s} Σ = {0,1}

7 Practice Construct a NFA with three states 0*1*0*0 Σ = {0,1}


Download ppt "Nondeterministic Finite Automata"

Similar presentations


Ads by Google