120 likes | 302 Views
Non-deterministic FSA. Regular Languages . 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. Two non-deterministic elements: Lambda transitions 2 outarcs with same symbol
E N D
Regular Languages 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 • 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.
Example {ab, abc}* q1 a q0 b c,λ q2
Example Is aaa accepted? ab? a? abb? b? q1 a q0 b a λ q2
Intuitive NFA’s • Example: Write a DFA & NFA that accept the strings containing the substring abbab
Practice - write NFAs • Strings on {a,b}* that have exactly 2 a’s or more than 2 b’s. • A string on {a,b}* that starts and ends with “ab”.
Things NFA’s make easy • Practice: • Prove if L is regular, LR is regular.
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.
Equivalence - Proof by construction • Idea: Take every subset of states in DFA. Those are states in NFA. Make appropriate arcs. Any state with a final state in DFA becomes final in NFA.
Example b a q2 qo q1 λ a
b a q2 qo q1 λ a a q1orq2 qo b a