620 likes | 836 Views
Deterministic Finite Automata. DFA. A primitive computing machine with very limited amount of memory. Example (inspired from Sipser’s book): Automatic door mechanism :. DOOR. Front pad. Rear pad. Example. DOOR. Front pad. Rear pad. FRONT REAR BOTH. NEITHER. FRONT REAR
E N D
DFA • A primitive computing machine with very limited amount of memory. • Example (inspired from Sipser’s book): Automatic door mechanism: DOOR Front pad Rear pad
Example DOOR Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
DOOR Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
DOOR Front pad Rear pad FRONT REAR BOTH NEITHER FRONT REAR BOTH CLOSED OPEN NEITHER
DFA D F A INPUT TAPE ACCEPT or REJECT
DFA parts a b b q0 q1 q2 q3 a a a b b q4 a b TRANSITION GRAPH
DFA parts a b b q0 q1 q2 q3 a a a b b q4 a b STATES : {q0 , q1, q2, q3, q4}
DFA parts a b b q0 q1 q2 q3 ACCEPTING STATE a a a b b q4 a b
DFA parts NON-ACCEPTING STATE a b b q0 q1 q2 q3 a a a b b q4 a b
DFA parts a b b q0 q1 q2 q3 START STATE a a a b b q4 a b
DFA parts ALPHABET: Σ = {a,b} a b b q0 q1 q2 q3 a a a b b q4 a b
DFA parts ALPHABET: Σ = {a,b} a b b q0 q1 q2 q3 a a a b b TRANSITION q4 a b
DFA parts ALPHABET: Σ = {a,b} a b b q0 q1 q2 q3 a a a b b q4 a b Exactlyone transition from every state under each symbol in the alphabet.
DFA parts ALPHABET: Σ = {a,b} a b b q0 q1 q2 q3 a a a b b q4 a b Exactlyone transition from every state under each symbol in the alphabet.
DFA transition graph a b b q0 q1 q2 q3 a a a b b q4 a b
DFA transition graph a b b q0 q1 q2 q3 a a a b b q4 a b JUNK or TRAP STATE
DFA continued a b b q0 q1 q2 q3 a a a b b TAPE q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b b bba q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b a b bb q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b b bb q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b b b b q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b b b q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b b b q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b b q4 a b
DFA continued Input string: abb a b b q0 q1 q2 q3 a a a b b q4 ACCEPT a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a a b b bbba q4 a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a a b a b bbb q4 a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a a b b abb q4 a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a a b b b bb q4 a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a a b b bb q4 a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a a b b b b q4 a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a a b b q4 b a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a b b a q4 b a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a b a q4 b a b
DFA continued Input string: abbb a b b q0 q1 q2 q3 a a b a q4 b REJECT a b
Empty string • Denoted by the Greek letters εorλ. • Contains no letters.
Empty string Input string: ε a b b q0 q1 q2 q3 a a a b b q4 a b The tape is empty
Empty string Input string: ε a b b q0 q1 q2 q3 a a a b b q4 REJECT a b
Other Example More than one accepting states a b b q0 q1 q2 q3 a a a b b q4 a b
Other Example Input string: ε a b b q0 q1 q2 q3 a a a b b q4 a b
Other Example Input string: ε a b b q0 q1 q2 q3 a a a b b q4 ACCEPT a b
Other Example Input string: ε a b b q0 q1 q2 q3 a a a b b q4 ACCEPT a b • The automaton accepts with input the empty string εiff the START state is an ACCEPTING state.
DFA formally • In order to completely determine a DFA we need five things: • Its set of states, • the alphabet of the input strings, • a the transition function between states, • a start statefrom which the computation begins and • the set of states for which the DFA accepts.
DFA formally • A DFA M is a quintuple (Q, Σ, δ, q0, F) where a b b q0 q1 q2 q3 a a a b b q4 a b