Seal of Good Local Governance (SGLG) 2024Final.pptx
finiteautomata-160104102657.pptx
1. Finite Automata:
Two categories of FiniteAutomata:
Deterministic Finite Automata(DFA)
The machinecanexist in onlyone state at any
given time
Non-deterministic Finite Automata (NFA)
The machinecanexist in multiple states at the
same time
1
2. Deterministic Finite
Automata (DFA):
A Deterministic Finite Automaton (DFA) is a finite
state machine that accepts/rejects finite strings
(sequence of symbols or alphabets) and perform
unique computation for eachinput string.
Deterministic refers to the uniqueness of the
computation.
2
3. Deterministic Finite
Automata (DFA):
ADFAis defined by the 5-tuples:
{Q, ∑ , q0,F, δ }
It consists of:
Q ==> afinite set ofstates
∑ ==> afinite set ofinput symbols(alphabets)
q0==> astart state (q0Q)
F==> set offinalstates (subset of Q)
δ ==> atransition function, from Q x ∑ ==> Q
3
4. DFA Computation [1/3]:
Let us consider an example, where a string is given
and have to calculate that the string is present in
the language or not?
Given, LisaFinite language;
∑ = { a,b}
L1= Setofallstrings starts with “a”
={ a, aa, ab, aaa,….}
String, S= aab
The DFAfor this calculationisgivenin next slide:
4
6. DFA Computation [3/3]:
Steps:
Start from the “start state/ initial state”
Foreveryinput symbolin the string we do the
following:
Compute the next state from the current state, giventhe
current input symbolfrom the string andthe transition
function
After allsymbolsin that stringsare calculated, ifthe
current state isone ofthe finalstates (F) then we cansay
the string will be acceptedbythat DFA;
Otherwise, the string will berejected.
6
7. DFA Computation:
Let us consider another example, where a string is
given and have to calculate that the string is present
in the language or not?
Given, Lisainfinite language;
∑ = { a,b}
L1= Setofallstrings starts with “a”
={ a, aa, ab, aaa,….}
String, S= bba
Here, S= bbaisnot present in the languageandit isinvalid
operation for computation.
7
8. Construct a DFA:
BuildaDFAfor the followinglanguage:
L= {w | w is a binary string that contains 01 as a
substring}
Steps for buildinga DFA:
∑ = {0,1}
Decide on the states: Q
Designate start state andfinal state(s)
δ: Decideon the transitions
Finalstates == acceptingstates
Other states == non-acceptingstates
8
9. DFA for strings containing
{01}
q0
start
q1
0
1 0,1
0
1
q2
Final
state
• Q = {q0,q1,q2}
• ∑ = {0,1}
• start state = q0
2
• F = {q }
Transition Table
0 1
q0 q1 q0
q1 q1 q2
*q2 q2 q2
states
symbols
State Diagram
10. Construct a DFA:
BuildaDFAfor the followinglanguage:
W {a,b}; |W | ≥ 2
Solution:
∑ = {a,b}
L= {aa, ab, ba, bb, aaa…,bbb….}
State Diagram:
A B
10
C
a, b
a , b
a, b