1.35k likes | 1.53k Views
CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010. Content Finite Automata, FA Deterministic Finite Automata, DFA Nondeterministic Automata NFA NFA DFA Equivalence. Finite Automata FA (Finite State Machines).
E N D
CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010
Content • Finite Automata, FA • Deterministic Finite Automata, DFA • Nondeterministic Automata NFA • NFA DFA Equivalence
Finite Automata FA (Finite State Machines)
There is no formal general definition for "automaton". Instead, there are various kinds of automata, each with it's own formal definition. Generally, an automaton • has some form of input • has some form of output • has internal states, • may or may not have some form of storage • is hard-wired rather than programmable
Finite Automaton Input String Output Finite Automaton String
Input String Output “Accept” or “Reject” Finite Automaton Finite Accepter
FA as Directed Graph • Nodes = States • Edges = Transitions • An edge with several symbols is a short-hand for several edges:
DFA • Deterministic • there is no element of choice • Finite • only a finite number of states and arcs • Acceptors • produce only a yes/no answer
Alphabet = Transition Graph abba -Finite Acceptor initial state final state “accept” transition state
Formally • For a DFA • Language accepted by : alphabet transition function initial state final states
Language rejected by Observation • Language accepted by
Regular Languages A language is regular if there is a DFA such that All regular languages form a language family
: set of states : input alphabet : transition function : initial state : set of final states Formal definitions • Deterministic Finite Accepter (DFA)
Observation: There is a walk from to with label
( ) d = * q , ab 0 ( ) d d = * ( q , a ), b 0 ( ( ( ) ) ) d d d l = * q , , a , b 0 ( ( ) ) d d = q , a , b 0 ( ) q d = q , b 2 1
Languages Accepted by DFAs • Take DFA • Definition: • The language contains • all input strings accepted by • = { strings that drive to a final state}
Alphabet = Example accept
Alphabet = Another Example accept accept accept
Formally • For a DFA • Language accepted by : alphabet transition function initial state final states
Language rejected by Observation • Language accepted by
Alphabet = More Examples accept trap state
Alphabet = = { all strings with prefix } accept
= { all strings without substring } Alphabet =
A language is regular if there is a DFA such that Regular Languages All regular languages form a language family
Alphabet = Example The language is regular
NFA • Nondeterministic • there is an element of choice: in a given state NFA can act on a given string in different ways. Several start/final states are allowed. -transitions are allowed. • Finite • only a finite number of states and arcs • Acceptors • produce only a yes/no answer
Nondeterministic Finite Accepter (NFA) Alphabet = Two choices
First Choice “accept”
Second Choice No transition: the automaton hangs