
- Automata Theory - Applications
- Automata Terminology
- Basics of String in Automata
- Set Theory for Automata
- Finite Sets and Infinite Sets
- Algebraic Operations on Sets
- Relations Sets in Automata Theory
- Graph and Tree in Automata Theory
- Transition Table in Automata
- What is Queue Automata?
- Compound Finite Automata
- Complementation Process in DFA
- Closure Properties in Automata
- Concatenation Process in DFA
- Language and Grammars
- Language and Grammar
- Grammars in Theory of Computation
- Language Generated by a Grammar
- Chomsky Classification of Grammars
- Context-Sensitive Languages
- Finite Automata
- What is Finite Automata?
- Finite Automata Types
- Applications of Finite Automata
- Limitations of Finite Automata
- Two-way Deterministic Finite Automata
- Deterministic Finite Automaton (DFA)
- Non-deterministic Finite Automaton (NFA)
- NDFA to DFA Conversion
- Equivalence of NFA and DFA
- Dead State in Finite Automata
- Minimization of DFA
- Automata Moore Machine
- Automata Mealy Machine
- Moore vs Mealy Machines
- Moore to Mealy Machine
- Mealy to Moore Machine
- Myhill–Nerode Theorem
- Mealy Machine for 1’s Complement
- Finite Automata Exercises
- Complement of DFA
- Regular Expressions
- Regular Expression in Automata
- Regular Expression Identities
- Applications of Regular Expression
- Regular Expressions vs Regular Grammar
- Kleene Closure in Automata
- Arden’s Theorem in Automata
- Convert Regular Expression to Finite Automata
- Conversion of Regular Expression to DFA
- Equivalence of Two Finite Automata
- Equivalence of Two Regular Expressions
- Convert Regular Expression to Regular Grammar
- Convert Regular Grammar to Finite Automata
- Pumping Lemma in Theory of Computation
- Pumping Lemma for Regular Grammar
- Pumping Lemma for Regular Expression
- Pumping Lemma for Regular Languages
- Applications of Pumping Lemma
- Closure Properties of Regular Set
- Closure Properties of Regular Language
- Decision Problems for Regular Languages
- Decision Problems for Automata and Grammars
- Conversion of Epsilon-NFA to DFA
- Regular Sets in Theory of Computation
- Context-Free Grammars
- Context-Free Grammars (CFG)
- Derivation Tree
- Parse Tree
- Ambiguity in Context-Free Grammar
- CFG vs Regular Grammar
- Applications of Context-Free Grammar
- Left Recursion and Left Factoring
- Closure Properties of Context Free Languages
- Simplifying Context Free Grammars
- Removal of Useless Symbols in CFG
- Removal Unit Production in CFG
- Removal of Null Productions in CFG
- Linear Grammar
- Chomsky Normal Form (CNF)
- Greibach Normal Form (GNF)
- Pumping Lemma for Context-Free Grammars
- Decision Problems of CFG
- Pushdown Automata
- Pushdown Automata (PDA)
- Pushdown Automata Acceptance
- Deterministic Pushdown Automata
- Non-deterministic Pushdown Automata
- Construction of PDA from CFG
- CFG Equivalent to PDA Conversion
- Pushdown Automata Graphical Notation
- Pushdown Automata and Parsing
- Two-stack Pushdown Automata
- Turing Machines
- Basics of Turing Machine (TM)
- Representation of Turing Machine
- Examples of Turing Machine
- Turing Machine Accepted Languages
- Variations of Turing Machine
- Multi-tape Turing Machine
- Multi-head Turing Machine
- Multitrack Turing Machine
- Non-Deterministic Turing Machine
- Semi-Infinite Tape Turing Machine
- K-dimensional Turing Machine
- Enumerator Turing Machine
- Universal Turing Machine
- Restricted Turing Machine
- Convert Regular Expression to Turing Machine
- Two-stack PDA and Turing Machine
- Turing Machine as Integer Function
- Post–Turing Machine
- Turing Machine for Addition
- Turing Machine for Copying Data
- Turing Machine as Comparator
- Turing Machine for Multiplication
- Turing Machine for Subtraction
- Modifications to Standard Turing Machine
- Linear-Bounded Automata (LBA)
- Church's Thesis for Turing Machine
- Recursively Enumerable Language
- Computability & Undecidability
- Turing Language Decidability
- Undecidable Languages
- Turing Machine and Grammar
- Kuroda Normal Form
- Converting Grammar to Kuroda Normal Form
- Decidability
- Undecidability
- Reducibility
- Halting Problem
- Turing Machine Halting Problem
- Rice's Theorem in Theory of Computation
- Post’s Correspondence Problem (PCP)
- Types of Functions
- Recursive Functions
- Injective Functions
- Surjective Function
- Bijective Function
- Partial Recursive Function
- Total Recursive Function
- Primitive Recursive Function
- μ Recursive Function
- Ackermann’s Function
- Russell’s Paradox
- Gödel Numbering
- Recursive Enumerations
- Kleene's Theorem
- Kleene's Recursion Theorem
- Advanced Concepts
- Matrix Grammars
- Probabilistic Finite Automata
- Cellular Automata
- Reduction of CFG
- Reduction Theorem
- Regular expression to ∈-NFA
- Quotient Operation
- Parikh’s Theorem
- Ladner’s Theorem
Equivalence of Two Regular Expressions in Automata
Regular Expressions (REs) are used in defining patterns for string manipulation. Sometimes we have multiple regular expressions and we need to check their equivalence. Understanding the equivalence of REs is needed for designing efficient and reliable algorithms for pattern recognition and language processing.
In this chapter, we will focus on the concept of equivalence, exploring its meaning and the various methods to determine whether two given REs are equivalent or not.
Equivalence of Regular Expressions in Automata
Equivalence of Regular Expressions means the situation where two different REs represent the same set of strings. In simpler words, if two REs generate the same language, they are considered equivalent.
Checking whether two REs are equivalent is a fundamental problem in the theory of computation. Let us see the methods for checking.
Methods for Proving Equivalence
There are primarily three methods for proving the equivalence of two REs −
- Set Generation
- Identities
- Machine Equivalence
Let's understand each of these methods in detail.
Set Generation
This method involves generating the set of strings accepted by each RE and then comparing the two sets. If the sets are identical, the REs are equivalent. Let us understand this through an example −
- If we have RE1 = "1" and RE2 = "2," we can generate the set of strings accepted by each. Using RE1, the set would be {1}, and using RE2, the set would be {2}. Since these sets are different, we can conclude that RE1 and RE2 are not equivalent.
- On the other hand, if RE1 = "1" and RE2 = "1," the generated sets would both be {1}. Therefore, RE1 and RE2 are considered equivalent in this case.
Identities
This method uses a set of established identities that hold true for the regular expressions. These identities allow us to manipulate and simplify expressions. Ultimately checking whether the two expressions can be reduced to the same form or not.
For instance, one identity states that "ε + R* = R" where Epsilon represents the empty string. If we have RE1 = "ε + R" and RE2 = "R" we can use this identity to simplify RE1 to "R" which matches RE2. Consequently, we can say that RE1 and RE2 are equivalent.
Machine Equivalence
This method involves constructing finite automata (FA) for each RE and then checking whether the two FAs are equivalent or not. If the FAs accept the same set of strings, then the REs they represent are equivalent.
The machine equivalence method is typically used for more complex REs where set generation and identity application become problematic.
Examples to Prove Equivalence with Identities
Example 1
Let us consider an example to explain the use of identities for proving RE equivalence. Suppose we want to prove that −
$$\mathrm{(1\:+\:(00)^{*}\:1)\:+\:(1\:+\:(00)^{*}\:1)\:(0\:+\:(10)^{*}\:1)^{*}\:(0\:+\:(10)^{*}\:1)\:=\:0^{*}\:(1(0\:+\: (10)^{*}\:1))^{*}}$$
We can start by simplifying the left-hand side (LHS) of the equation using the identities −
The LHS is (1 + (00)* 1) + (1 + (00)* 1) (0 + (10)* 1)* (0 + (10)* 1)
Let us take (1 + 00* 1) as a common factor, so
$$\mathrm{(1 \:+\: (00)^{*} \:1)(ε \:+\: (0 \:+\: (10)^{*} 1)^{*} (0 \:+\: (10)^{*} 1))}$$
$$\mathrm{(ε \:+\: R^{*} R),\:\:where \:R \:=\: (0 \:+\: (10)^{*}\: 1)}$$
As we know,
$$\mathrm{(ε \:+\: R^{*}\: R) \:=\: (ε \:+\: RR^{*}) \:=\: R^{*}}$$
$$\mathrm{(1 \:+\: (00)^{*} 1) ((0 \:+\: (10)^{*}> 1)^{*})}$$
out of this consider,
$$\mathrm{(1 \:+\: (00)^{*} 1) (0 \:+\: (10)^{*} 1)^{*}}$$
Taking 1 as a common factor, we can get
$$\mathrm{(ε \:+\: (00)^{*}) 1 (0 \:+\: (10)^{*} 1)^{*}}$$
Applying ε + (00)* = 0*, we get
$$\mathrm{0^{*} 1 (0 \:+\: (10)^{*} 1)^{*}}$$
Which is the R.H.S.
Let us see another example using set equalization method −
Example 2
Prove that (0* 1*)* = (0 + 1)*
The LHS is (0* 1*)*
$$\mathrm{(0^{*} 1^{*})^{*} \:=\: \{ε,\:0,\:00,\:1,\:11,\:111,\:01,\:10,\:...\}}$$
This is any combination of 0's, any combination of 1's, any combination of 0 and 1, ε
On the RHS, (0 + 1)*
$$\mathrm{(0 \:+\: 1)^{*} \:=\: \{ε,\:0,\:00,\:1,\:11,\:111,\:01,\:10,\:...\}}$$
This is also any possible combination of 0s and 1s including null.
So, the sets are similar and these are equivalent.
Conclusion
In this chapter, we explained the concept of equivalence of regular expressions and described three methods to prove it.
Generating strings can be tedious; identities make the process easier for complex regular expressions. Constructing and comparing finite automata offers an automated approach but can be computationally expensive. The choice of method depends on the complexity of the regular expressions and the resources available.