Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lecture 16 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational.

Similar presentations


Presentation on theme: "1 Lecture 16 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational."— Presentation transcript:

1 1 Lecture 16 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational models

2 2 Nondeterministic Finite State Automata NFA’s

3 3 Change:  is a relation For an FSA M,  (q,a) results in one and only one state for all states q and characters a. –That is,  is a function For an NFA M,  (q,a) can result in a set of states –That is,  is now a relation –Next step is not determined (nondeterministic)

4 4 Example NFA aaab a,b Why is this only an NFA and not an FSA? Out of the first state, there are 2 transitions on a Out of the second state, there are 0 transitions on b Out of the third state, there are 0 transitions on a Out of the fourth state, there are 0 transitions on b

5 5 Computing with NFA’s Configurations: same as they are for FSA’s Computations are different –Initial configuration is identical –However, there may be several next configurations or there may be none. Computation is no longer a “path” but is now a “tree” rooted at the initial configuration –Definition of halting, accepting, and rejecting configurations is identical –Definition of acceptance must be modified

6 6 Computation Tree aaab a,b Input string aaaaba (1, aaaaba) (1, aaaba)(2, aaaba) (1, aaba)(2, aaba)(3, aaba)(1, aba)(2, aba)(3, aba)crash(1, ba)(2, ba)(3, ba) (1, a)(4, a) (1, )(2, )(5, )

7 7 Definition of |- unchanged aaab a,b Input string aaaaba (1, aaaaba) |- (1, aaaba) (1, aaaaba) |- (2, aaaba) (1, aaaaba) |- 3 (1, aba) (1, aaaaba) |- 3 (3, aba) (1, aaaaba) |- * (2, aba) (1, aaaaba) |- * (3, aba) (1, aaaaba) |- * (1, ) (1, aaaaba) |- * (5, ) (1, aaaaba) (1, aaaba)(2, aaaba) (1, aaba)(2, aaba)(3, aaba) (1, aba)(2, aba)(3, aba)crash (1, ba)(2, ba)(3, ba) (1, a)(4, a) (1, )(2, )(5, )

8 8 Acceptance and Rejection aaab a,b Input string aaaaba M accepts string x if one of the configurations reached is an accepting configuration (q 0, x) |- * (f, ),f e A M rejects string x if all configurations reached are either not halting configurations or are rejecting configurations (1, aaaaba) (1, aaaba)(2, aaaba) (1, aaba)(2, aaba)(3, aaba) (1, aba)(2, aba)(3, aba)crash (1, ba)(2, ba)(3, ba) (1, a)(4, a) (1, )(2, )(5, )

9 9 Comparison aaa a,b b b b b a FSA aaab a,b NFA

10 10 Defining L(M) and LNFA M accepts string x if one of the configurations reached is an accepting configuration –(q 0, x) |- * (f, ),f e A M rejects string x if all configurations reached are either not halting configurations or are rejecting configurations For an NFA M, L(M) is the set of strings accepted by M LNFA –Language L is in language class LNFA iff there exists an NFA M such that L(M) = L

11 11 Comparing language classes LFSA subset of LNFA

12 12 LFSA subset LNFA Let L be an arbitrary language in LFSA Let M be the FSA such that L(M) = L –M exists by definition of L in LFSA Construct an NFA M’ such that L(M’) = L Argue L(M’) = L There exists an NFA M’ such that L(M’) = L L is in LNFA –By definition of L in LNFA

13 13 Visualization LFSA LNFA FSA’s NFA’s L L M M’ Let L be an arbitrary language in LFSA Let M be an FSA such that L(M) = L M exists by definition of L in LFSA Construct NFA M’ from FSA M Argue L(M’) = L There exists an NFA M’ such that L(M’) = L L is in LNFA

14 14 Construction We need to make M into an NFA M’ such that L(M’) = L(M) How do we accomplish this? –Trivial –Every FSA already IS an NFA

15 15 Comparing computational models The previous slides show one method for comparing the relative power of two different computational models –Computational model CM 1 is at least as general or powerful as computational model CM 2 if Any program P 2 from computational model CM 2 can be converted into an equivalent program P 1 in computational model CM 1. –Question: How can we show two computational models are equivalent?


Download ppt "1 Lecture 16 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational."

Similar presentations


Ads by Google