Conversion of NFA to RE
Theory
Non-Deterministic Finite Automata(NFA)
A Nondeterministic Finite Automaton (NFA) is a theoretical machine used in formal language theory to recognize regular languages. It is defined as a 5-tuple:
NFA = (Q, Σ, δ, q₀, F)
where:- Q is a finite set of states
- Σ is a finite input alphabet
- δ is the transition function: δ: Q × (Σ ∪ {ε}) → 2^Q
- q₀ ∈ Q is the initial (start) state
- F ⊆ Q is the set of accepting (final) states
In an NFA, the transition function allows multiple possible next states for a given input, including transitions on the empty string (ε). A string is accepted if at least one computation path leads from the start state to a final state while consuming the entire input.
Regular Expressions
A Regular Expression (RE)is a symbolic representation used to describe a regular language. It defines a set of strings over a given alphabet using specific operators and rules.
Regular expressions are built using:
- Union (|): Represents a choice between expressions. For example, a|b matches either "a" or "b".
- Concatenation: Represents sequences. For example, ab matches "a" followed by "b".
- Kleene Star (*): Represents repetition (zero or more times). For example, a* matches "", "a", "aa", "aaa", etc.
A regular expression describes the same class of languages that can be recognized by finite automata. Thus, for every regular expression, there exists an equivalent NFA that accepts the same language, and vice versa.
In this experiment, we use the State Elimination Method to convert a given Nondeterministic Finite Automaton (NFA) into an equivalent Regular Expression (RE). This method is widely used due to its systematic and intuitive approach for eliminating states and building up the corresponding expression.
State Elimination Method
The State Elimination Method involves simplifying the NFA step-by-step by removing intermediate states while preserving the language accepted by the automaton. At each step, transitions between the remaining states are updated using regular expressions that represent the combined paths.
The process generally includes the following steps:
Step-1:
If there are incoming transitions to the initial state:

Step-2:
If there are outgoing transitions from the final state:

Step-3:
If the automaton has multiple final states:

Step-4:
Eliminate all the states one by one except initial state and final state to get the final result which is the regular expression for the given NFA