SlideShare a Scribd company logo
8
Most read
13
Most read
14
Most read
Finite Automata: Deterministic Finite
Automata and
Non-Deterministic Finite Automata
1
Prepared by –
AMAY JAISWAL
CS (4A) , 2100290120027
Theory Of Automata And Formal Language
Kiet Group Of Institutions
Automata
The term "Automata" is derived from the Greek word "αὐτόματα" which means
"self-acting". An automaton (Automata in plural) is an abstract self-propelled
computing device which follows a predetermined sequence of operations
automatically.
Finite Automata
An automaton with a finite number of states is called a Finite Automaton (FA) or Finite
State Machine (FSM).
A finite automata can be represented by a 5-tuple (Q, Σ, δ, q0, F), where:
• Q is a finite set of states.
• Σ is a finite set of symbols, called the alphabet of the automaton.
• δ is the transition function.
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).
Deterministic Finite Automaton (DFA)
In DFA, for each input symbol, one can determine the state to which the machine
will move. Hence, it is called Deterministic Automaton. As it has a finite number
of states, the machine is called Deterministic Finite Machine or Deterministic
Finite Automaton.
A DFA can be represented by a 5-tuple (Q, Σ, δ, q0, F) where:
• Q is a finite set of states.
• Σ is a finite set of symbols called the alphabet.
• δ is the transition function where δ: Q × Σ → Q
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).
Graphical Representation of a DFA
A DFA is represented by digraphs called state diagram.
• The vertices/circles represent the states.
• The arcs labeled with an input alphabet show the transitions.
• The initial state is denoted by an empty single incoming arc.
• The final state is indicated by double circles.
Example
Let a deterministic finite automaton be
• Q = {a, b, c},
• Σ = {0, 1},
• q0={a},
• F={c}, and
• Transition function δ as shown by the following table:
deterministicfiniteautomatondfa-181008145215 (1).pdf
Non-deterministic Finite Automaton
In NDFA, for a particular input symbol, the machine can move to any combination
of the states in the machine. In other words, the exact state to which the
machine moves cannot be determined. Hence, it is called Non-deterministic
Automaton. As it has finite number of states, the machine is called Non-
deterministic Finite Machine or Nondeterministic Finite Automaton.
An NDFA can be represented by a 5-tuple (Q, Σ, δ, q0, F) where:
• Q is a finite set of states.
• Σ is a finite set of symbols called the alphabets.
• δ is the transition function where δ: Q × Σ → 2𝑄
(Here the power set of Q (2𝑄) has been taken because in case of NDFA, from a
state, transition can occur to any combination of Q states)
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).
Graphical Representation of an NDFA
Graphical Representation of an NDFA: (same as DFA)
An NDFA is represented by digraphs called state diagram.
• The vertices/Circles represent the states.
• The arcs labeled with an input alphabet show the transitions.
• The initial state is denoted by an empty single incoming arc.
• The final state is indicated by double circles.
Example
Let a non-deterministic finite automaton be
• Q = {a, b, c}
• Σ = {0, 1}
• q0 = {a}
• F={c} and
• Transition function δ as shown by the following table:
deterministicfiniteautomatondfa-181008145215 (1).pdf
DFA vs NDFA
DFA NDFA
The transition from a state is to a single
particular next state for each input symbol.
Hence it is called deterministic.
The transition from a state can be to multiple
next states for each input symbol. Hence it is
called non-deterministic.
Empty string transitions are not seen in DFA. NDFA permits empty string transitions.
Backtracking is allowed in DFA In NDFA, backtracking is not always
possible.
Requires more space. Requires less space.
A string is accepted by a DFA, if it transits
to a final state.
A string is accepted by a NDFA, if at least
one of all possible transitions ends in a final
state.
NDFA to DFA Conversion
Problem Statement
Let X = (Qx, Σ, δx, q0, Fx) be an NDFA which accepts the language L(X). We have
to design an equivalent DFA Y = (Qy, Σ, δy, q0, Fy) such that L(Y) = L(X). The
following procedure converts the NDFA to its equivalent DFA:
Algorithm
Input: An NDFA
Output: An equivalent DFA
Step 1 Create state table from the given NDFA.
Step 2 Create a blank state table under possible input alphabets for the equivalent DFA.
Step 3 Mark the start state of the DFA by q0 (Same as the NDFA).
Step 4 Find out the combination of States {Q0, Q1,... , Qn} for each possible input alphabet.
Step 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.
Step 6 The states which contain any of the final states of the NDFA are the final states of the equivalent DFA.
Example
Let us consider the NDFA shown in the figure below.
Using the above algorithm, we find its equivalent DFA. The state table of the DFA
is shown in below.
The state diagram of the DFA is as follows:
Language Decidability
A language is called Decidable or Recursive if there is a Turing machine which
accepts and halts on every input string w. Every decidable language is Turing-
Acceptable.
A decision problem P is decidable if the language L of all yes instances to P is
decidable. For a decidable language, for each input string, the TM halts either at
the accept or the reject state as depicted in the following diagram:
Example 1
Find out whether the following problem is decidable or not:
Is a number ‘m’ prime?
Solution
Prime numbers = {2, 3, 5, 7, 11, 13, …………..}
Divide the number ‘m’ by all the numbers between ‘2’ and ‘√m’ starting from ‘2’.
If any of these numbers produce a remainder zero, then it goes to the “Rejected
state”, otherwise it goes to the “Accepted state”. So, here the answer could be
made by ‘Yes’ or ‘No’.
Hence, it is a decidable problem.
Example 2
Given a regular language L and string w, how can we check if w∈ L?
deterministicfiniteautomatondfa-181008145215 (1).pdf

More Related Content

PPTX
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Mohammad Ilyas Malik
 
PPTX
Chapter-twoChapter-three automata and complexity theory .pptx
anwarkade1
 
PPTX
Finite Automata fgyft rtrt rr uuy y.pptx
AsadBaig49
 
PDF
Finite Automata
A. S. M. Shafi
 
PPT
Finite automata
Bipul Roy Bpl
 
PDF
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
FariyaTasneem1
 
DOCX
Automata theory introduction
NAMRATA BORKAR
 
PDF
5. NFA & DFA.pdf
TANZINTANZINA
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Mohammad Ilyas Malik
 
Chapter-twoChapter-three automata and complexity theory .pptx
anwarkade1
 
Finite Automata fgyft rtrt rr uuy y.pptx
AsadBaig49
 
Finite Automata
A. S. M. Shafi
 
Finite automata
Bipul Roy Bpl
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
FariyaTasneem1
 
Automata theory introduction
NAMRATA BORKAR
 
5. NFA & DFA.pdf
TANZINTANZINA
 

Similar to deterministicfiniteautomatondfa-181008145215 (1).pdf (20)

PPTX
Finite automata
ManishTadhiyal
 
PPTX
Unit iv
TPLatchoumi
 
PPTX
INTRODUTION Formal Language and Automatic Theory.pptx
SUNEEL37
 
PDF
Theory of computation and automata
Prof. Dr. K. Adisesha
 
PDF
Theory of computation and automata
Prof. Dr. K. Adisesha
 
PDF
Automata theory
Pardeep Vats
 
PPTX
finiteautomata-160104102657.pptx
StudyvAbhi
 
PPTX
FiniteAutomata_anim.pptx
Meghnadh
 
PDF
Formal Languages and Automata Theory Unit 1
Srimatre K
 
PPTX
introduction-190804060837.pptx
shumPanwar
 
PPTX
Introduction TO Finite Automata
Ratnakar Mikkili
 
PPTX
Theory of automata
Arslan905905
 
PDF
flat unit1
Janhavi Vishwanath
 
PPTX
AUTOMATA THEORY AUTOMATA THEORYAutomata3Chapter2.pptx
ArjayBalberan1
 
PPTX
Theory of computation Unit 1 Lecute 2.pptx
RishabhGupta238479
 
PPTX
FiniteAutomata_anim.pptx
ranjan317165
 
PPTX
FiniteAutomata_anim.pptx
amara jyothi
 
PPTX
Formal language and automata theoryLAT Class notes.pptx
SrinivasRedyySarviga
 
PPTX
TOC Introduction
Thapar Institute
 
Finite automata
ManishTadhiyal
 
Unit iv
TPLatchoumi
 
INTRODUTION Formal Language and Automatic Theory.pptx
SUNEEL37
 
Theory of computation and automata
Prof. Dr. K. Adisesha
 
Theory of computation and automata
Prof. Dr. K. Adisesha
 
Automata theory
Pardeep Vats
 
finiteautomata-160104102657.pptx
StudyvAbhi
 
FiniteAutomata_anim.pptx
Meghnadh
 
Formal Languages and Automata Theory Unit 1
Srimatre K
 
introduction-190804060837.pptx
shumPanwar
 
Introduction TO Finite Automata
Ratnakar Mikkili
 
Theory of automata
Arslan905905
 
flat unit1
Janhavi Vishwanath
 
AUTOMATA THEORY AUTOMATA THEORYAutomata3Chapter2.pptx
ArjayBalberan1
 
Theory of computation Unit 1 Lecute 2.pptx
RishabhGupta238479
 
FiniteAutomata_anim.pptx
ranjan317165
 
FiniteAutomata_anim.pptx
amara jyothi
 
Formal language and automata theoryLAT Class notes.pptx
SrinivasRedyySarviga
 
TOC Introduction
Thapar Institute
 
Ad

More from AmayJaiswal4 (9)

PPTX
EMPLOYEE MANAGEMENT SYSTEM FINAL presentation
AmayJaiswal4
 
PPTX
agile development models IN SOFTWARE ENGINEERING
AmayJaiswal4
 
PPTX
Mobile application for diet recall presentatiob
AmayJaiswal4
 
PPT
economic inequality in India to consider.ppt
AmayJaiswal4
 
PPTX
diet recall
AmayJaiswal4
 
PDF
Unit-1 DAA_Notes.pdf
AmayJaiswal4
 
PDF
loops.pdf
AmayJaiswal4
 
PPT
4.1 Interview skills.ppt
AmayJaiswal4
 
PPTX
Mobile Appliction For Diet Recall.pptx
AmayJaiswal4
 
EMPLOYEE MANAGEMENT SYSTEM FINAL presentation
AmayJaiswal4
 
agile development models IN SOFTWARE ENGINEERING
AmayJaiswal4
 
Mobile application for diet recall presentatiob
AmayJaiswal4
 
economic inequality in India to consider.ppt
AmayJaiswal4
 
diet recall
AmayJaiswal4
 
Unit-1 DAA_Notes.pdf
AmayJaiswal4
 
loops.pdf
AmayJaiswal4
 
4.1 Interview skills.ppt
AmayJaiswal4
 
Mobile Appliction For Diet Recall.pptx
AmayJaiswal4
 
Ad

Recently uploaded (20)

PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 

deterministicfiniteautomatondfa-181008145215 (1).pdf

  • 1. Finite Automata: Deterministic Finite Automata and Non-Deterministic Finite Automata 1 Prepared by – AMAY JAISWAL CS (4A) , 2100290120027 Theory Of Automata And Formal Language Kiet Group Of Institutions
  • 2. Automata The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined sequence of operations automatically.
  • 3. Finite Automata An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM). A finite automata can be represented by a 5-tuple (Q, Σ, δ, q0, F), where: • Q is a finite set of states. • Σ is a finite set of symbols, called the alphabet of the automaton. • δ is the transition function. • q0 is the initial state from where any input is processed (q0 ∈ Q). • F is a set of final state/states of Q (F ⊆ Q).
  • 4. Deterministic Finite Automaton (DFA) In DFA, for each input symbol, one can determine the state to which the machine will move. Hence, it is called Deterministic Automaton. As it has a finite number of states, the machine is called Deterministic Finite Machine or Deterministic Finite Automaton.
  • 5. A DFA can be represented by a 5-tuple (Q, Σ, δ, q0, F) where: • Q is a finite set of states. • Σ is a finite set of symbols called the alphabet. • δ is the transition function where δ: Q × Σ → Q • q0 is the initial state from where any input is processed (q0 ∈ Q). • F is a set of final state/states of Q (F ⊆ Q).
  • 6. Graphical Representation of a DFA A DFA is represented by digraphs called state diagram. • The vertices/circles represent the states. • The arcs labeled with an input alphabet show the transitions. • The initial state is denoted by an empty single incoming arc. • The final state is indicated by double circles.
  • 7. Example Let a deterministic finite automaton be • Q = {a, b, c}, • Σ = {0, 1}, • q0={a}, • F={c}, and • Transition function δ as shown by the following table:
  • 9. Non-deterministic Finite Automaton In NDFA, for a particular input symbol, the machine can move to any combination of the states in the machine. In other words, the exact state to which the machine moves cannot be determined. Hence, it is called Non-deterministic Automaton. As it has finite number of states, the machine is called Non- deterministic Finite Machine or Nondeterministic Finite Automaton.
  • 10. An NDFA can be represented by a 5-tuple (Q, Σ, δ, q0, F) where: • Q is a finite set of states. • Σ is a finite set of symbols called the alphabets. • δ is the transition function where δ: Q × Σ → 2𝑄 (Here the power set of Q (2𝑄) has been taken because in case of NDFA, from a state, transition can occur to any combination of Q states) • q0 is the initial state from where any input is processed (q0 ∈ Q). • F is a set of final state/states of Q (F ⊆ Q).
  • 11. Graphical Representation of an NDFA Graphical Representation of an NDFA: (same as DFA) An NDFA is represented by digraphs called state diagram. • The vertices/Circles represent the states. • The arcs labeled with an input alphabet show the transitions. • The initial state is denoted by an empty single incoming arc. • The final state is indicated by double circles.
  • 12. Example Let a non-deterministic finite automaton be • Q = {a, b, c} • Σ = {0, 1} • q0 = {a} • F={c} and • Transition function δ as shown by the following table:
  • 14. DFA vs NDFA DFA NDFA The transition from a state is to a single particular next state for each input symbol. Hence it is called deterministic. The transition from a state can be to multiple next states for each input symbol. Hence it is called non-deterministic. Empty string transitions are not seen in DFA. NDFA permits empty string transitions. Backtracking is allowed in DFA In NDFA, backtracking is not always possible. Requires more space. Requires less space. A string is accepted by a DFA, if it transits to a final state. A string is accepted by a NDFA, if at least one of all possible transitions ends in a final state.
  • 15. NDFA to DFA Conversion Problem Statement Let X = (Qx, Σ, δx, q0, Fx) be an NDFA which accepts the language L(X). We have to design an equivalent DFA Y = (Qy, Σ, δy, q0, Fy) such that L(Y) = L(X). The following procedure converts the NDFA to its equivalent DFA:
  • 16. Algorithm Input: An NDFA Output: An equivalent DFA Step 1 Create state table from the given NDFA. Step 2 Create a blank state table under possible input alphabets for the equivalent DFA. Step 3 Mark the start state of the DFA by q0 (Same as the NDFA). Step 4 Find out the combination of States {Q0, Q1,... , Qn} for each possible input alphabet. Step 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. Step 6 The states which contain any of the final states of the NDFA are the final states of the equivalent DFA.
  • 17. Example Let us consider the NDFA shown in the figure below.
  • 18. Using the above algorithm, we find its equivalent DFA. The state table of the DFA is shown in below.
  • 19. The state diagram of the DFA is as follows:
  • 20. Language Decidability A language is called Decidable or Recursive if there is a Turing machine which accepts and halts on every input string w. Every decidable language is Turing- Acceptable.
  • 21. A decision problem P is decidable if the language L of all yes instances to P is decidable. For a decidable language, for each input string, the TM halts either at the accept or the reject state as depicted in the following diagram:
  • 22. Example 1 Find out whether the following problem is decidable or not: Is a number ‘m’ prime? Solution Prime numbers = {2, 3, 5, 7, 11, 13, …………..} Divide the number ‘m’ by all the numbers between ‘2’ and ‘√m’ starting from ‘2’. If any of these numbers produce a remainder zero, then it goes to the “Rejected state”, otherwise it goes to the “Accepted state”. So, here the answer could be made by ‘Yes’ or ‘No’. Hence, it is a decidable problem.
  • 23. Example 2 Given a regular language L and string w, how can we check if w∈ L?