Dr. Fouzia Jabeen: Theory of Automata
Dr. Fouzia Jabeen: Theory of Automata
3
Finite Automaton (FA)
Informally, a state diagram that comprehensively captures
all possible states and transitions that a machine can take
while responding to a stream or sequence of input symbols
Recognizer for “Regular Languages”
4
Deterministic Finite Automata - Definition
A Deterministic Finite Automaton (DFA) consists
of:
Q ==> a finite set of states
∑ ==> a finite set of input symbols (alphabet)
q ==> a start state
0
F ==> set of accepting states
δ ==> a transition function, which is a mapping
between Q x ∑ ==> Q
A DFA is defined by the 5-tuple:
{Q, ∑ , q ,F, δ }
0
5
Example #1
Build a DFA for the following language:
L = {w | w is a binary string that contains 01 as a substring}
Steps for building a DFA to recognize L:
∑ = {0,1}
Decide on the states: Q
Designate start state and final state(s)
δ: Decide on the transitions:
“Final” states == same as “accepting states”
Other states == same as “non-accepting states”
6
DFA for strings containing 01
1 0,1 • ∑ = {0,1}
0
• start state = q0
start 0 1
q0 q1 q2 • F = {q2}
Accepting • Transition table
state symbols
0 1
q0 q1 q0
states
q1 q1 q2
*q2 q2 q2
7
What does a DFA do on reading an input
string?
Input: a word w in ∑*
Question: Is w acceptable by the DFA?
Steps:
Start at the “start state” q
0
For every input symbol in the sequence w do
Compute the next state from the current state, given the current
input symbol in w and the transition function
If after all symbols in w are consumed, the current state
is one of the accepting states (F) then accept w;
Otherwise, reject w.
8
Finite Automata : Examples action
On/Off switch
state
9
Languages & Grammars
Languages: “A language is a
Or “words” collection of sentences of finite
length all constructed from a
finite alphabet of symbols”
Grammars: “A grammar can
be regarded as a device that
enumerates the sentences of a
language” - nothing more,
nothing less
https://www.tutorialspoint.com/automata_theory/reg
ular_expressions.htm