SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler offline
FINITE AUTOMATA
Mrs.D.Jena Catherine Bel,
AP/CSE,
Velammal Engineering College,
Chennai
1
Terminologies
ā€¢ Alphabet
ā€¢ Finite, non empty set of symbols
ā€¢ Basic elements of a language
ā€¢ Denoted by āˆ‘
ā€¢ String
ā€¢ Finite sequence of symbols chosen from some alphabets
ā€¢ Empty string
ā€¢ Length of the string
ā€¢ Power of an alphabet
ā€¢ Language
ā€¢ Set of all strings which are chosen from āˆ‘*
2
Example
ā€¢ English
ā€¢ Alphabet ā€“ [a-z]
ā€¢ String ā€“{hi,hello,ā€¦}
ā€¢ Binary number
ā€¢ Alphabet ā€“ [0,1]
ā€¢ String ā€“{0,1,00,01,10,11ā€¦}
ā€¢ Hexadecimal
ā€¢ Alphabet ā€“[0-9][a-e]
ā€¢ String ā€“[0,1,1A3,ā€¦]
3
Finite Automata
ā€¢ Finite automata are used to recognize patterns.
ā€¢ It takes the string of symbol as input and changes its state
accordingly. When the desired symbol is found, then the
transition occurs.
ā€¢ At the time of transition, the automata can either move to the
next state or stay in the same state.
ā€¢ Finite automata have two states, Accept state or Reject state.
When the input string is processed successfully, and the
automata reached its final state, then it will accept.
4
ā€¢ Input Tape
ā€¢ It is a linear tape having some number of cells. Each input symbol is
placed in each cell.
ā€¢ Finite control
ā€¢ It decides the next state on receiving particular input from input
tape.
ā€¢ Tape reader
ā€¢ It reads the cells one by one from left to right, and at a time only
one input symbol is read.
5
ā€¢ A finite automaton consists of:
ā€¢ a finite set S of N states
ā€¢ a special start state
ā€¢ a set of final (or accepting) states
ā€¢ a set of transitions T from one state to another, labelled with
chars in C
6
ā€¢ Execution of FA on an input sequence as follows:
ā€¢ Begin in the start state
ā€¢ If the next input char matches the label on a transition from the
current state to a new state, go to that new state
ā€¢ Continue making transitions on each input char
ā€¢ If no move is possible, then stop
ā€¢ If in accepting state, then accept
7
Deterministic Finite Automata
ā€¢ Deterministic refers to the uniqueness of the computation.
ā€¢ On each input there is one and only one state to which the
automaton can transition from its current state
ā€¢ DFA does not accept the null move.
8
Formal Definition of DFA
ā€¢ A deterministic ļ¬nite automaton (DFA) is a 5-tuple
(Q,Ī£,Ī“,q0,F),where
ā€¢ Q is a ļ¬nite set called the states,
ā€¢ Ī£ is a ļ¬nite set called the alphabet,
ā€¢ Ī“:QƗĪ£ā†’Q is the transition function,
ā€¢ q0 āˆˆ Q is the start state, and
ā€¢ F āŠ† Q is the set of accepting states.
9
Transition Table
ā€¢ A transition table is a tabular representation of the transition
function that takes two arguments and returns a state.
ā€¢ The column contains the state in which the automaton will be
on the input represented by that column.
ā€¢ The row corresponds to the state the finite control unit can be
in.
ā€¢ The entry for one row corresponding to state q and the
column corresponds to input a is the state Ī“(q, a).
10
Transition Diagram
ā€¢ Transition graph can be interpreted as a flowchart for an
algorithm recognizing a language.
ā€¢ A transition graph consists of three things:
ā€¢ A finite set of states, at least one of which is designated the start
state and some of which are designated as final states.
ā€¢ An alphabet Ī£ of possible input symbols from which the input
strings are formed.
ā€¢ A finite set of transitions that show the change of state from the
given state on a given input.
11
Example DFA
12
states A b
ļƒ q0 q1 q2
q1 q1 q3
q2 q2 q3
*q3 q3 q3
A=({q0,q1,q2,q3},{a,b}Ī“,q0,{q3})
Ī“ is given by
Ī“(q0,a)=q1
Ī“(q0,b)=q2
Ī“(q1,a)=q1
Ī“(q2,b)=q2
Ī“(q1,b)=q3
Ī“(q2,a)=q3
Ī“(q3,a)=q3
Ī“(q3,b)=q3
ā€¢ Design a DFA with āˆ‘ = {0, 1} accepts those string which starts
with 1 and ends with 0.
ā€¢ Design a DFA with āˆ‘ = {0, 1} accepts the only input 101.
13
ā€¢ Design a DFA with āˆ‘ = {0, 1} accepts the strings with an even
number of 0's end by single 1.
14
Extended transition function Ī“
ā€¢ The DFA define a language: the set of all strings that result in a
sequence of state transitions from the start state to an accepting
state
ā€¢ Extended Transition Function
ā€¢ Describes what happens when we start in any state and follow any
sequence of inputs
ā€¢ If Ī“ is our transition function, then the extended transition function is
denoted by Ī“
ā€¢ The extended transition function is a function that takes a state q and
a string w and returns a state p (the state that the automaton
reaches when starting in state q and processing the sequence of
inputs w)
ā€¢ Let w=va then
Ī“(q, va) = Ī“(Ī“ (q, v), a). 15
Language accepted by DFA
ā€¢ The language of a DFA A = (Q, Ī£, Ī“, q0, F), denoted L(A) is
defined by
L(A) = { w | Ī“(q0, w) is in F }
ā€¢ The language of A is the set of strings w that take the start
state q0 to one of the accepting states
ā€¢ If L is a L(A) from some DFA, then L is a regular language
16
Nondeterministic Finite
Automata
ā€¢ An NFA is like a DFA, except that it can be in several states at
once.
ā€¢ This can be seen as the ability to guess something about the
input.
ā€¢ Useful for searching texts
17
Formal Definition of NFA
ā€¢ A nondeterministic ļ¬nite automaton (NFA) is a 5-tuple
(Q,Ī£,Ī“,q0,F),where
ā€¢ Q is a ļ¬nite set called the states,
ā€¢ Ī£ is a ļ¬nite set called the alphabet,
ā€¢ Ī“:QƗĪ£ā†’P(Q) is the transition function,
ā€¢ q0 āˆˆ Q is the start state, and
ā€¢ F āŠ† Q is the set of accepting states.
18
Extended transition function Ī“
ā€¢ The extended transition function is a function that takes a
state q and a string w and returns a set of states P (The set of
possible state that the automaton reaches when starting in
state q and processing the sequence of inputs w)
ā€¢ Let w=va then
Ī“ š‘ž0, š‘£š‘Ž = Ī“(
š‘žā€²āˆˆ Ī“ š‘ž0,š‘£
š‘žā€²,a)
19
Language accepted by NFA
ā€¢ The language L(A) accepted by the NFA A is defined as follows:
L(A) = {w | Ī“(q0, w) āˆ© F ā‰  āˆ…}
20
Example NFA
21
ā€¢ Design an NFA with āˆ‘ = {0, 1} in which double '1' is followed by
double '0'.
ā€¢ Design an NFA with āˆ‘ = {0, 1} accepts all string in which the
third symbol from the right end is always 0.
22
Epsilon Nondeterministic Finite
Automata
ā€¢ Formal Definition
A Īµ-NFA is a quintuple A=(Q,Ī£,Ī“,q0,F) where
ā€¢ Q is a set of states
ā€¢ Ī£ is the alphabet of input symbols
ā€¢ Īµ is never a member of Ī£. Ī£Īµ is defined to be (Ī£ āˆŖ Īµ)
ā€¢ Ī“: Q Ɨ Ī£Īµ ā†’ P(Q) is the transition function
ā€¢ q0 āˆˆ Q is the initial state
ā€¢ F āŠ† Q is the set of final states
23
Example Īµ-NFA
Īµ-NFA for a language which contain Os followed by 0 or more 1s.
24
Īµ- closure
ā€¢ Epsilon means present state can goto other state without any
input. This can happen only if the present state have epsilon
transition to other state.
ā€¢ Epsilon closure is finding all the states which can be reached
from the present state on one or more epsilon transitions.
Īµ- closure (0)={0,1,2}
Īµ- closure(1)={1,2}
Īµ- closure(2)={2}
25
Try it
Īµ-closure of state a
26
Try itā€¦
Īµ-closure of state 0,1,2,3,4
27
Try it..
28
Ī“ - Īµ-NFA
Ī“ š‘ž0, š‘£š‘Ž = Ī“(š‘š‘–, š‘Ž)
š‘˜
š‘–=1 = šøš‘š‘™š‘œš‘ š‘’(rj)
š‘š
š‘—=1
Where Ī“ (q0,v)= {p1,p2,ā€¦,pk } &
Ī“(š‘š‘–, š‘Ž)
š‘˜
š‘–=1 = {r1,r2,ā€¦,rm }
29
Language accepted by Īµ-NFA
The language of an Īµ-NFA E = (Q, Ī£, Ī“, q0, F) is
L(E) = {w | Ė† Ī“(q0, w) āˆ© F ā‰  āˆ…}
30
Relationship between FAs
31
ā€¢ Every DFA is NFA but not vice versa.
ā€¢ Both NFA and DFA have same power and each NFA can be
translated into a DFA.
ā€¢ There can be multiple final states in both DFA and NFA.
ā€¢ NFA is more of a theoretical concept.
ā€¢ DFA is used in Lexical Analysis in Compiler.
ā€¢ Every NFA is Īµ-NFA but not vice-versa
32
Conversion of NFA to DFA
ā€¢ Subset Construction Method
1. Create state table from the given NFA.
2. Create a blank state table under possible input alphabets for the
equivalent DFA.
3. Mark the start state of the DFA by q0 (Same as the NFA).
4. Find out the combination of States {Q0, Q1,... , Qn} for each
possible input alphabet.
5. Each time we generate a new DFA state under the input
alphabet columns, we have to apply step 4 again, otherwise go
to step 6.
6. The states which contain any of the final states of the NFA are
the final states of the equivalent DFA.
33
NFA
34
Subset construction
35
Transition Diagram for the
subset
36
Converted DFA
37
NFA ļƒ  DFA
38
State 0 1
ā†’q0 q0 q1
q1 {q1, q2} q1
*q2 q2 {q1, q2}
Now we will obtain Ī“' transition for state q0.
Ī“'([q0], 0) = [q0]
Ī“'([q0], 1) = [q1]
The Ī“' transition for state q1 is obtained as:
Ī“'([q1], 0) = [q1, q2] (new state generated)
Ī“'([q1], 1) = [q1]
39
Now we will obtain Ī“' transition on [q1, q2].
Ī“'([q1, q2], 0) = Ī“(q1, 0) āˆŖ Ī“(q2, 0)
= {q1, q2} āˆŖ {q2}
= [q1, q2]
Ī“'([q1, q2], 1) = Ī“(q1, 1) āˆŖ Ī“(q2, 1)
= {q1} āˆŖ {q1, q2}
= {q1, q2}
= [q1, q2]
The state [q1, q2] is the final state as well because
it contains a final state q2. 40
State 0 1
ā†’[q0] [q0] [q1]
[q1] [q1, q2] [q1]
*[q1, q2] [q1, q2] [q1, q2]
The transition table for the constructed DFA will
be:
41
Conversion of Īµ-NFA to DFA
ā€¢ Modified subset construction
1. Find the Īµ-closure for the starting state of Īµ - NFA as a starting
state of DFA.
2. Find the states for each input symbol that can be traversed from
the present. That means the union of transition value and their
closures for each state of NFA present in the current state of
DFA.
3. If a new state is found, take it as current state and repeat step
2.
4. Repeat Step 2 and Step 3 until there is no new state present in
the transition table of DFA.
5. Mark the states of DFA as a final state which contains the final
state of Īµ-NFA. 42
Example
ā€¢ Let us obtain Īµ-closure of each state.
Īµ-closure {q0} = {q0, q1, q2}
Īµ-closure {q1} = {q1}
Īµ-closure {q2} = {q2}
Īµ-closure {q3} = {q3}
Īµ-closure {q4} = {q4}
43
ā€¢ let Īµ-closure {q0} = {q0, q1, q2} be state A
Ī“'(A, 0) = Īµ-closure {Ī“((q0, q1, q2), 0) }
= Īµ-closure {Ī“(q0, 0) āˆŖ Ī“(q1, 0) āˆŖ Ī“(q2, 0) }
= Īµ-closure {q3}
= {q3} call it as state B.
Ī“'(A, 1) = Īµ-closure {Ī“((q0, q1, q2), 1) }
= Īµ-closure {Ī“((q0, 1) āˆŖ Ī“(q1, 1) āˆŖ Ī“(q2, 1)}
= Īµ-closure {q3}
= {q3} = B.
44
Ī“'(B, 0) = Īµ-closure {Ī“(q3, 0) }
= Ļ•
Ī“'(B, 1) = Īµ-closure {Ī“(q3, 1) }
= Īµ-closure {q4}
= {q4} i.e. state C
Ī“'(C, 0) = Īµ-closure {Ī“(q4, 0) }
= Ļ•
Ī“'(C, 1) = Īµ-closure {Ī“(q4, 1) }
= Ļ•
45
Īµ-closure(q0) = {q0, q1, q2}
Īµ-closure(q1) = {q1, q2}
Īµ-closure(q2) = {q2}
46
Ī“'(A, 0) = Īµ-closure{Ī“((q0, q1, q2), 0)}
= Īµ-closure{Ī“(q0, 0) āˆŖ Ī“(q1, 0) āˆŖ Ī“(q2, 0)}
= Īµ-closure{q0}
= {q0, q1, q2}
Ī“'(A, 1) = Īµ-closure{Ī“((q0, q1, q2), 1)}
= Īµ-closure{Ī“(q0, 1) āˆŖ Ī“(q1, 1) āˆŖ Ī“(q2, 1)}
= Īµ-closure{q1}
= {q1, q2} call it as state B
Ī“'(A, 2) = Īµ-closure{Ī“((q0, q1, q2), 2)}
= Īµ-closure{Ī“(q0, 2) āˆŖ Ī“(q1, 2) āˆŖ Ī“(q2, 2)}
= Īµ-closure{q2}
= {q2} call it state C
47
Ī“'(B, 0) = Īµ-closure{Ī“((q1, q2), 0)}
= Īµ-closure{Ī“(q1, 0) āˆŖ Ī“(q2, 0)}
= Īµ-closure{Ļ•}
= Ļ•
Ī“'(B, 1) = Īµ-closure{Ī“((q1, q2), 1)}
= Īµ-closure{Ī“(q1, 1) āˆŖ Ī“(q2, 1)}
= Īµ-closure{q1}
= {q1, q2} i.e. state B itself
Ī“'(B, 2) = Īµ-closure{Ī“((q1, q2), 2)}
= Īµ-closure{Ī“(q1, 2) āˆŖ Ī“(q2, 2)}
= Īµ-closure{q2}
= {q2} i.e. state C itself
48
Ī“'(C, 0) = Īµ-closure{Ī“(q2, 0)}
= Īµ-closure{Ļ•}
= Ļ•
Ī“'(C, 1) = Īµ-closure{Ī“(q2, 1)}
= Īµ-closure{Ļ•}
= Ļ•
Ī“'(C, 2) = Īµ-closure{Ī“(q2, 2)}
= {q2}
49
ENFA to DFA
50

Mais conteĆŗdo relacionado

Mais procurados

Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
Adel Al-Ofairi
Ā 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
Srimatre K
Ā 

Mais procurados (20)

Automaton
AutomatonAutomaton
Automaton
Ā 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
Ā 
push down automata
push down automatapush down automata
push down automata
Ā 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Ā 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
Ā 
Automata theory -Conversion of Īµ nfa to nfa
Automata theory -Conversion of Īµ nfa to nfaAutomata theory -Conversion of Īµ nfa to nfa
Automata theory -Conversion of Īµ nfa to nfa
Ā 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
Ā 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
Ā 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
Ā 
FInite Automata
FInite AutomataFInite Automata
FInite Automata
Ā 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
Ā 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
Ā 
Pda
PdaPda
Pda
Ā 
Push down automata
Push down automataPush down automata
Push down automata
Ā 
Pumping lemma for regular set h1
Pumping lemma for regular set h1Pumping lemma for regular set h1
Pumping lemma for regular set h1
Ā 
Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
Ā 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Ā 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
Ā 
Turing machine
Turing machineTuring machine
Turing machine
Ā 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTES
Ā 

Semelhante a Automata

deterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdfdeterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdf
AmayJaiswal4
Ā 
Nondeterministic Finite Automat
Nondeterministic Finite AutomatNondeterministic Finite Automat
Nondeterministic Finite Automat
Adel Al-Ofairi
Ā 
1. finite_automata_new.ppt
1. finite_automata_new.ppt1. finite_automata_new.ppt
1. finite_automata_new.ppt
SanthoshS508159
Ā 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
RohitPaul71
Ā 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
ankitamakin
Ā 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
ankitamakin
Ā 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
FariyaTasneem1
Ā 

Semelhante a Automata (20)

Nondeterministic Finite Automata
Nondeterministic Finite Automata Nondeterministic Finite Automata
Nondeterministic Finite Automata
Ā 
Theory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsTheory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and Problems
Ā 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Ā 
5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
Ā 
deterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdfdeterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdf
Ā 
TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
Ā 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Ā 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition Diagram
Ā 
Nondeterministic Finite Automat
Nondeterministic Finite AutomatNondeterministic Finite Automat
Nondeterministic Finite Automat
Ā 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptx
Ā 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptx
Ā 
1. finite_automata_new.ppt
1. finite_automata_new.ppt1. finite_automata_new.ppt
1. finite_automata_new.ppt
Ā 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
Ā 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
Ā 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
Ā 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
Ā 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
Ā 
NFA and DFA
NFA and DFANFA and DFA
NFA and DFA
Ā 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Ā 
Theory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsTheory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite Acceptors
Ā 

Mais de Jena Catherine Bel D (10)

Compiler Design Unit 5
Compiler Design Unit 5Compiler Design Unit 5
Compiler Design Unit 5
Ā 
Compiler Design Unit 4
Compiler Design Unit 4Compiler Design Unit 4
Compiler Design Unit 4
Ā 
Compiler Design Unit 3
Compiler Design Unit 3Compiler Design Unit 3
Compiler Design Unit 3
Ā 
Compiler Design Unit 2
Compiler Design Unit 2Compiler Design Unit 2
Compiler Design Unit 2
Ā 
Compiler Design Unit 1
Compiler Design Unit 1Compiler Design Unit 1
Compiler Design Unit 1
Ā 
Theory of Computation Unit 5
Theory of Computation Unit 5Theory of Computation Unit 5
Theory of Computation Unit 5
Ā 
Theory of Computation Unit 4
Theory of Computation Unit 4Theory of Computation Unit 4
Theory of Computation Unit 4
Ā 
Theory of Computation Unit 3
Theory of Computation Unit 3Theory of Computation Unit 3
Theory of Computation Unit 3
Ā 
Theory of Computation Unit 2
Theory of Computation Unit 2Theory of Computation Unit 2
Theory of Computation Unit 2
Ā 
Theory of Computation Unit 1
Theory of Computation Unit 1Theory of Computation Unit 1
Theory of Computation Unit 1
Ā 

ƚltimo

Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Ā 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
Ā 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
Ā 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
Ā 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
Ā 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
Ā 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
Ā 

ƚltimo (20)

Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
Ā 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
Ā 
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Ā 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
Ā 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
Ā 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Ā 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
Ā 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
Ā 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Ā 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
Ā 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
Ā 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Ā 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
Ā 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
Ā 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Ā 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
Ā 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
Ā 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
Ā 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
Ā 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Ā 

Automata

  • 1. FINITE AUTOMATA Mrs.D.Jena Catherine Bel, AP/CSE, Velammal Engineering College, Chennai 1
  • 2. Terminologies ā€¢ Alphabet ā€¢ Finite, non empty set of symbols ā€¢ Basic elements of a language ā€¢ Denoted by āˆ‘ ā€¢ String ā€¢ Finite sequence of symbols chosen from some alphabets ā€¢ Empty string ā€¢ Length of the string ā€¢ Power of an alphabet ā€¢ Language ā€¢ Set of all strings which are chosen from āˆ‘* 2
  • 3. Example ā€¢ English ā€¢ Alphabet ā€“ [a-z] ā€¢ String ā€“{hi,hello,ā€¦} ā€¢ Binary number ā€¢ Alphabet ā€“ [0,1] ā€¢ String ā€“{0,1,00,01,10,11ā€¦} ā€¢ Hexadecimal ā€¢ Alphabet ā€“[0-9][a-e] ā€¢ String ā€“[0,1,1A3,ā€¦] 3
  • 4. Finite Automata ā€¢ Finite automata are used to recognize patterns. ā€¢ It takes the string of symbol as input and changes its state accordingly. When the desired symbol is found, then the transition occurs. ā€¢ At the time of transition, the automata can either move to the next state or stay in the same state. ā€¢ Finite automata have two states, Accept state or Reject state. When the input string is processed successfully, and the automata reached its final state, then it will accept. 4
  • 5. ā€¢ Input Tape ā€¢ It is a linear tape having some number of cells. Each input symbol is placed in each cell. ā€¢ Finite control ā€¢ It decides the next state on receiving particular input from input tape. ā€¢ Tape reader ā€¢ It reads the cells one by one from left to right, and at a time only one input symbol is read. 5
  • 6. ā€¢ A finite automaton consists of: ā€¢ a finite set S of N states ā€¢ a special start state ā€¢ a set of final (or accepting) states ā€¢ a set of transitions T from one state to another, labelled with chars in C 6
  • 7. ā€¢ Execution of FA on an input sequence as follows: ā€¢ Begin in the start state ā€¢ If the next input char matches the label on a transition from the current state to a new state, go to that new state ā€¢ Continue making transitions on each input char ā€¢ If no move is possible, then stop ā€¢ If in accepting state, then accept 7
  • 8. Deterministic Finite Automata ā€¢ Deterministic refers to the uniqueness of the computation. ā€¢ On each input there is one and only one state to which the automaton can transition from its current state ā€¢ DFA does not accept the null move. 8
  • 9. Formal Definition of DFA ā€¢ A deterministic ļ¬nite automaton (DFA) is a 5-tuple (Q,Ī£,Ī“,q0,F),where ā€¢ Q is a ļ¬nite set called the states, ā€¢ Ī£ is a ļ¬nite set called the alphabet, ā€¢ Ī“:QƗĪ£ā†’Q is the transition function, ā€¢ q0 āˆˆ Q is the start state, and ā€¢ F āŠ† Q is the set of accepting states. 9
  • 10. Transition Table ā€¢ A transition table is a tabular representation of the transition function that takes two arguments and returns a state. ā€¢ The column contains the state in which the automaton will be on the input represented by that column. ā€¢ The row corresponds to the state the finite control unit can be in. ā€¢ The entry for one row corresponding to state q and the column corresponds to input a is the state Ī“(q, a). 10
  • 11. Transition Diagram ā€¢ Transition graph can be interpreted as a flowchart for an algorithm recognizing a language. ā€¢ A transition graph consists of three things: ā€¢ A finite set of states, at least one of which is designated the start state and some of which are designated as final states. ā€¢ An alphabet Ī£ of possible input symbols from which the input strings are formed. ā€¢ A finite set of transitions that show the change of state from the given state on a given input. 11
  • 12. Example DFA 12 states A b ļƒ q0 q1 q2 q1 q1 q3 q2 q2 q3 *q3 q3 q3 A=({q0,q1,q2,q3},{a,b}Ī“,q0,{q3}) Ī“ is given by Ī“(q0,a)=q1 Ī“(q0,b)=q2 Ī“(q1,a)=q1 Ī“(q2,b)=q2 Ī“(q1,b)=q3 Ī“(q2,a)=q3 Ī“(q3,a)=q3 Ī“(q3,b)=q3
  • 13. ā€¢ Design a DFA with āˆ‘ = {0, 1} accepts those string which starts with 1 and ends with 0. ā€¢ Design a DFA with āˆ‘ = {0, 1} accepts the only input 101. 13
  • 14. ā€¢ Design a DFA with āˆ‘ = {0, 1} accepts the strings with an even number of 0's end by single 1. 14
  • 15. Extended transition function Ī“ ā€¢ The DFA define a language: the set of all strings that result in a sequence of state transitions from the start state to an accepting state ā€¢ Extended Transition Function ā€¢ Describes what happens when we start in any state and follow any sequence of inputs ā€¢ If Ī“ is our transition function, then the extended transition function is denoted by Ī“ ā€¢ The extended transition function is a function that takes a state q and a string w and returns a state p (the state that the automaton reaches when starting in state q and processing the sequence of inputs w) ā€¢ Let w=va then Ī“(q, va) = Ī“(Ī“ (q, v), a). 15
  • 16. Language accepted by DFA ā€¢ The language of a DFA A = (Q, Ī£, Ī“, q0, F), denoted L(A) is defined by L(A) = { w | Ī“(q0, w) is in F } ā€¢ The language of A is the set of strings w that take the start state q0 to one of the accepting states ā€¢ If L is a L(A) from some DFA, then L is a regular language 16
  • 17. Nondeterministic Finite Automata ā€¢ An NFA is like a DFA, except that it can be in several states at once. ā€¢ This can be seen as the ability to guess something about the input. ā€¢ Useful for searching texts 17
  • 18. Formal Definition of NFA ā€¢ A nondeterministic ļ¬nite automaton (NFA) is a 5-tuple (Q,Ī£,Ī“,q0,F),where ā€¢ Q is a ļ¬nite set called the states, ā€¢ Ī£ is a ļ¬nite set called the alphabet, ā€¢ Ī“:QƗĪ£ā†’P(Q) is the transition function, ā€¢ q0 āˆˆ Q is the start state, and ā€¢ F āŠ† Q is the set of accepting states. 18
  • 19. Extended transition function Ī“ ā€¢ The extended transition function is a function that takes a state q and a string w and returns a set of states P (The set of possible state that the automaton reaches when starting in state q and processing the sequence of inputs w) ā€¢ Let w=va then Ī“ š‘ž0, š‘£š‘Ž = Ī“( š‘žā€²āˆˆ Ī“ š‘ž0,š‘£ š‘žā€²,a) 19
  • 20. Language accepted by NFA ā€¢ The language L(A) accepted by the NFA A is defined as follows: L(A) = {w | Ī“(q0, w) āˆ© F ā‰  āˆ…} 20
  • 22. ā€¢ Design an NFA with āˆ‘ = {0, 1} in which double '1' is followed by double '0'. ā€¢ Design an NFA with āˆ‘ = {0, 1} accepts all string in which the third symbol from the right end is always 0. 22
  • 23. Epsilon Nondeterministic Finite Automata ā€¢ Formal Definition A Īµ-NFA is a quintuple A=(Q,Ī£,Ī“,q0,F) where ā€¢ Q is a set of states ā€¢ Ī£ is the alphabet of input symbols ā€¢ Īµ is never a member of Ī£. Ī£Īµ is defined to be (Ī£ āˆŖ Īµ) ā€¢ Ī“: Q Ɨ Ī£Īµ ā†’ P(Q) is the transition function ā€¢ q0 āˆˆ Q is the initial state ā€¢ F āŠ† Q is the set of final states 23
  • 24. Example Īµ-NFA Īµ-NFA for a language which contain Os followed by 0 or more 1s. 24
  • 25. Īµ- closure ā€¢ Epsilon means present state can goto other state without any input. This can happen only if the present state have epsilon transition to other state. ā€¢ Epsilon closure is finding all the states which can be reached from the present state on one or more epsilon transitions. Īµ- closure (0)={0,1,2} Īµ- closure(1)={1,2} Īµ- closure(2)={2} 25
  • 27. Try itā€¦ Īµ-closure of state 0,1,2,3,4 27
  • 29. Ī“ - Īµ-NFA Ī“ š‘ž0, š‘£š‘Ž = Ī“(š‘š‘–, š‘Ž) š‘˜ š‘–=1 = šøš‘š‘™š‘œš‘ š‘’(rj) š‘š š‘—=1 Where Ī“ (q0,v)= {p1,p2,ā€¦,pk } & Ī“(š‘š‘–, š‘Ž) š‘˜ š‘–=1 = {r1,r2,ā€¦,rm } 29
  • 30. Language accepted by Īµ-NFA The language of an Īµ-NFA E = (Q, Ī£, Ī“, q0, F) is L(E) = {w | Ė† Ī“(q0, w) āˆ© F ā‰  āˆ…} 30
  • 32. ā€¢ Every DFA is NFA but not vice versa. ā€¢ Both NFA and DFA have same power and each NFA can be translated into a DFA. ā€¢ There can be multiple final states in both DFA and NFA. ā€¢ NFA is more of a theoretical concept. ā€¢ DFA is used in Lexical Analysis in Compiler. ā€¢ Every NFA is Īµ-NFA but not vice-versa 32
  • 33. Conversion of NFA to DFA ā€¢ Subset Construction Method 1. Create state table from the given NFA. 2. Create a blank state table under possible input alphabets for the equivalent DFA. 3. Mark the start state of the DFA by q0 (Same as the NFA). 4. Find out the combination of States {Q0, Q1,... , Qn} for each possible input alphabet. 5. Each time we generate a new DFA state under the input alphabet columns, we have to apply step 4 again, otherwise go to step 6. 6. The states which contain any of the final states of the NFA are the final states of the equivalent DFA. 33
  • 36. Transition Diagram for the subset 36
  • 38. NFA ļƒ  DFA 38 State 0 1 ā†’q0 q0 q1 q1 {q1, q2} q1 *q2 q2 {q1, q2}
  • 39. Now we will obtain Ī“' transition for state q0. Ī“'([q0], 0) = [q0] Ī“'([q0], 1) = [q1] The Ī“' transition for state q1 is obtained as: Ī“'([q1], 0) = [q1, q2] (new state generated) Ī“'([q1], 1) = [q1] 39
  • 40. Now we will obtain Ī“' transition on [q1, q2]. Ī“'([q1, q2], 0) = Ī“(q1, 0) āˆŖ Ī“(q2, 0) = {q1, q2} āˆŖ {q2} = [q1, q2] Ī“'([q1, q2], 1) = Ī“(q1, 1) āˆŖ Ī“(q2, 1) = {q1} āˆŖ {q1, q2} = {q1, q2} = [q1, q2] The state [q1, q2] is the final state as well because it contains a final state q2. 40
  • 41. State 0 1 ā†’[q0] [q0] [q1] [q1] [q1, q2] [q1] *[q1, q2] [q1, q2] [q1, q2] The transition table for the constructed DFA will be: 41
  • 42. Conversion of Īµ-NFA to DFA ā€¢ Modified subset construction 1. Find the Īµ-closure for the starting state of Īµ - NFA as a starting state of DFA. 2. Find the states for each input symbol that can be traversed from the present. That means the union of transition value and their closures for each state of NFA present in the current state of DFA. 3. If a new state is found, take it as current state and repeat step 2. 4. Repeat Step 2 and Step 3 until there is no new state present in the transition table of DFA. 5. Mark the states of DFA as a final state which contains the final state of Īµ-NFA. 42
  • 43. Example ā€¢ Let us obtain Īµ-closure of each state. Īµ-closure {q0} = {q0, q1, q2} Īµ-closure {q1} = {q1} Īµ-closure {q2} = {q2} Īµ-closure {q3} = {q3} Īµ-closure {q4} = {q4} 43
  • 44. ā€¢ let Īµ-closure {q0} = {q0, q1, q2} be state A Ī“'(A, 0) = Īµ-closure {Ī“((q0, q1, q2), 0) } = Īµ-closure {Ī“(q0, 0) āˆŖ Ī“(q1, 0) āˆŖ Ī“(q2, 0) } = Īµ-closure {q3} = {q3} call it as state B. Ī“'(A, 1) = Īµ-closure {Ī“((q0, q1, q2), 1) } = Īµ-closure {Ī“((q0, 1) āˆŖ Ī“(q1, 1) āˆŖ Ī“(q2, 1)} = Īµ-closure {q3} = {q3} = B. 44
  • 45. Ī“'(B, 0) = Īµ-closure {Ī“(q3, 0) } = Ļ• Ī“'(B, 1) = Īµ-closure {Ī“(q3, 1) } = Īµ-closure {q4} = {q4} i.e. state C Ī“'(C, 0) = Īµ-closure {Ī“(q4, 0) } = Ļ• Ī“'(C, 1) = Īµ-closure {Ī“(q4, 1) } = Ļ• 45
  • 46. Īµ-closure(q0) = {q0, q1, q2} Īµ-closure(q1) = {q1, q2} Īµ-closure(q2) = {q2} 46
  • 47. Ī“'(A, 0) = Īµ-closure{Ī“((q0, q1, q2), 0)} = Īµ-closure{Ī“(q0, 0) āˆŖ Ī“(q1, 0) āˆŖ Ī“(q2, 0)} = Īµ-closure{q0} = {q0, q1, q2} Ī“'(A, 1) = Īµ-closure{Ī“((q0, q1, q2), 1)} = Īµ-closure{Ī“(q0, 1) āˆŖ Ī“(q1, 1) āˆŖ Ī“(q2, 1)} = Īµ-closure{q1} = {q1, q2} call it as state B Ī“'(A, 2) = Īµ-closure{Ī“((q0, q1, q2), 2)} = Īµ-closure{Ī“(q0, 2) āˆŖ Ī“(q1, 2) āˆŖ Ī“(q2, 2)} = Īµ-closure{q2} = {q2} call it state C 47
  • 48. Ī“'(B, 0) = Īµ-closure{Ī“((q1, q2), 0)} = Īµ-closure{Ī“(q1, 0) āˆŖ Ī“(q2, 0)} = Īµ-closure{Ļ•} = Ļ• Ī“'(B, 1) = Īµ-closure{Ī“((q1, q2), 1)} = Īµ-closure{Ī“(q1, 1) āˆŖ Ī“(q2, 1)} = Īµ-closure{q1} = {q1, q2} i.e. state B itself Ī“'(B, 2) = Īµ-closure{Ī“((q1, q2), 2)} = Īµ-closure{Ī“(q1, 2) āˆŖ Ī“(q2, 2)} = Īµ-closure{q2} = {q2} i.e. state C itself 48
  • 49. Ī“'(C, 0) = Īµ-closure{Ī“(q2, 0)} = Īµ-closure{Ļ•} = Ļ• Ī“'(C, 1) = Īµ-closure{Ī“(q2, 1)} = Īµ-closure{Ļ•} = Ļ• Ī“'(C, 2) = Īµ-closure{Ī“(q2, 2)} = {q2} 49