The document discusses deterministic finite automata (DFA) and nondeterministic finite automata (NFA), highlighting their definitions, differences, and applications. It explains that DFAs have unique transitions for each state and input, while NFAs can have multiple paths for a given input. The document also covers the acceptance of languages by DFAs and NFAs, along with examples and advantages of using NFAs in computational theory.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
14 views32 pages
1.dfa Nfa
The document discusses deterministic finite automata (DFA) and nondeterministic finite automata (NFA), highlighting their definitions, differences, and applications. It explains that DFAs have unique transitions for each state and input, while NFAs can have multiple paths for a given input. The document also covers the acceptance of languages by DFAs and NFAs, along with examples and advantages of using NFAs in computational theory.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32
DFA & NFA
DFA & NFA
• In automata theory, a finite-state machine is called a deterministic finite automaton (DFA), if • each of its transitions is uniquely determined by its source state and input symbol, and • reading an input symbol is required for each state transition. • A nondeterministic finite automaton (NFA), or nondeterministic finite-state machine, does not need to obey these restrictions. DFA Ex • Automaton accepts all strings of 0s and 1s • Automaton accepts strings ending in 1 • Automaton accepts strings having an odd number of 1s • Automaton accepts strings having an odd number of 1s and odd number of 0s Solution • https://courses.engr.illinois.edu/cs373/sp2013 /Lectures/lec02.pdf DFA Applications • grep • Thermostats • Coke Machines • Elevators • Train Track Switches • Security Properties • Lexical Analyzers for Parsers NFA • NFA stands for non-deterministic finite automata. • It is easy to construct an NFA than DFA for a given regular language. • The finite automata are called NFA when there exist many paths for specific input from the current state to the next state. • In particular, every DFA is also an NFA. • Every NFA is not DFA, but each NFA can be translated into DFA. EX • Draw a deterministic and non-deterministic finite automaton which accept 00 or 11 at the end of a string containing 0, 1 in it EX • Draw a deterministic and non-deterministic finite automate which accept 00 and 11 at the end of a string containing 0, 1 in it EX • Draw a deterministic and non-deterministic finite automate which accept 00 and 11 at the end of a string containing 0, 1 in it EX • Draw a deterministic and non-deterministic finite automate which accept 00 and 11 at the end of a string containing 0, 1 in it NFA Ex • https://www.javatpoint.com/examples-of- non-deterministic-finite-automata Adv of NFA • It is important because NFAs can be used to reduce the complexity of the mathematical work required to establish many important properties in the theory of computation. • For example, it is much easier to prove closure properties of regular languages using NFAs than DFAs. Acceptance/Recognition • The language accepted or recognized by a DFA M over alphabet Σ is L(M) = {w Σ | M accepts w}. • A language L is said to be accepted/recognized by M if L = L(M). Acceptance/Recognition • A (formal) language L over an alphabet Σ is just a set of strings in Σ . • Thus any subset L Σ determines a language over Σ. Theorem (Kleene) • The class of regular languages is exactly the same as the class of languages accepted by DFAs Identify language? Identify language? • L(M) = {u | u contains three consecutive a’s}.
• RE • r = (a|b) aaa (a|b) Identify language and RE? Identify language?
The language of the DFA is
{ ab^n , bb^m | n ϵ W, m ϵ W } Identify language? DFA Ex • Design FA with ∑ = {0, 1} accepts even number of 0's and even number of 1's Identify lang even number of a's and even number of b's
• State 1: even number of a's and even number of b's
State 2: odd number of a's and even number of b's State 3: even number of a's and odd number of b's State 4: odd number of a's and odd number of b's Whats wrong in this DFA? It accepts aa,aaa,… Corrected DFA for a+aa*b+a*b • A better DFA a) Phi is an empty set, having no element. i.e. this dfa accepts nothing
b) This dfa accepts only null string, i.e. str having no