0% found this document useful (0 votes)
9 views10 pages

Hritariddha Acharjee

The document discusses the conversion of Non-Deterministic Finite Automata (NFA) to Deterministic Finite Automata (DFA), highlighting the definitions, advantages, and reasons for conversion. It outlines the steps involved in the conversion process and provides examples to illustrate the concepts. Ultimately, it emphasizes that while NFAs offer flexibility, DFAs are more efficient and structured for practical applications like compilers and lexical analyzers.

Uploaded by

acharjeesani8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views10 pages

Hritariddha Acharjee

The document discusses the conversion of Non-Deterministic Finite Automata (NFA) to Deterministic Finite Automata (DFA), highlighting the definitions, advantages, and reasons for conversion. It outlines the steps involved in the conversion process and provides examples to illustrate the concepts. Ultimately, it emphasizes that while NFAs offer flexibility, DFAs are more efficient and structured for practical applications like compilers and lexical analyzers.

Uploaded by

acharjeesani8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Topic: NFA TO DFA CONVERTION

Name: Hritariddha Acharjee


University Roll No: 11700223038
Paper Name: Compiler Design
Paper Code: PCCCS501
Continuous Assessment – 1 (Academic Session: 2024 – 2025)

Department of Information Technology 1


CONTENT
1. Introduction to NFA
2. Formal Definition of NFA
3. Example Transition System of NFA
4. Why Convert NFA to DFA?
5. Conversion from NFA to DFA
6. Example Conversion from NFA to DFA
7. Conclusion
8. References

Department of Information Technology 2


Introduction to NFA
What is an NFA?
A Non-Deterministic Finite Automaton (NFA) is a mathematical model of computation used to recognize patterns and
languages. Unlike a Deterministic Finite Automaton (DFA), an NFA allows:
Multiple possible transitions for the same input.
ε-transitions (state changes without consuming input).
The ability to be in multiple states at once

Example of NFA Behaviour:


Suppose an NFA is in state q0 and reads input '0'. It may move to both q1 and q2 simultaneously.
In contrast, a DFA would have exactly one state transition for each input.

3
Department of Information Technology
Formal Definition of NFA
Definition of NFA
A Non-Deterministic Finite Automaton (NFA) is formally defined as a 5-tuple:
M=(Q,Σ,δ,q0,F)
where:
Q = Finite set of states
Σ = Input alphabet (set of symbols)
δ = Transition function
q₀ = Initial state
F = Set of final or accepting states

Department of Information Technology 4


Example Transition System of NFA
State Input Input
Example NFA 0 1
Consider an NFA with the following components:
States: Q={q0,q1,q2}
q₀ {q₀, q₁} {q₀}
Alphabet: Σ={0,1} q₁ {q₂}
Transitions:
δ(q0,0)={q0,q1}
q₂ {q₂}
δ(q0,1)={q0}
δ(q1,1)={q2}
δ(q2,0)={q2}
Start State: q0
Final State: q2

Department of Information Technology 5


Why Convert NFA to DFA?
Limitations of NFA:
1. Multiple transitions for the same input → Hard to track execution.
2. ε-transitions make it less structured and harder to implement.
3. Parallel states require additional processing power.
4. Not directly used in real-world applications like compilers and lexical analysers.

Advantages of DFA over NFA:


1. Deterministic Execution → Only one possible transition for each input.
2. Easier Implementation → Used in real-world applications (lexical analysers, regex engines).
3. Faster Processing → Eliminates ambiguity in state transitions.
4. More Predictable → No need to check multiple paths.
Key Reason for Conversion:
Computers require deterministic behaviour, and DFAs provide a structured, efficient model for processing input strings.

6
Department of Information Technology
Conversion from NFA to DFA

Steps to Convert NFA to DFA:


• Start with the NFA’s initial state → This becomes the DFA’s initial state.
• Find all possible transitions from the initial state (considering multiple transitions and ε-closures).
• Form new states in the DFA by grouping NFA states (each DFA state represents a set of NFA states).
• Determine transitions for each DFA state using NFA transitions.
• Mark final states → Any DFA state containing at least one NFA final state is a final state in the DFA.

Key Idea:
• DFA states = Power set of NFA states
• A DFA has at most 2ⁿ states if the NFA has n states.

7
Department of Information Technology
Example Conversion from NFA to DFA

Department of Information Technology 8


Conclusion
o NFA and DFA are both used for recognizing patterns in input.
o NFA allows multiple paths for the same input, making it flexible but harder to implement.
o DFA has a fixed path for each input, making it faster and more efficient.
o Converting NFA to DFA helps in removing uncertainty and making computations simpler.
o DFA is widely used in applications like compilers, lexical analyzers, and search engines.
o Although DFA may have more states than NFA, it is more structured and reliable for practical use.

Department of Information Technology 9


References
1. John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman, Introduction to
Automata Theory, Languages, and Computation, Pearson Education Asia.
2. 2. Harry R. Lewis and Christos H. Papadimitriou, Elements of the Theory of
Computation, Pearson Education Asia.
3. https://www.geeksforgeeks.org/conversion-from-nfa-to-dfa/

Department of Information Technology 10

You might also like