
- 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
Parikhs Theorem in Automata Theory
The Parikhs Theorem provides a unique perspective on context-free languages (CFLs). It focuses on the number of occurrences of terminal symbols in CFL, disregarding their order. This theorem was first proved by Rohit Parikh in 1961 and later republished in 1966. In this chapter, we will cover the basics of Parikh's Theorem.
Basics of Parikh's Theorem
To get the basic idea of Parikhs Theorem, it states that if we consider only the frequency of terminal symbols in strings of a context-free language, the language cannot be distinguishable from a regular language. This is because the Parikh image of a context-free language is semi-linear.
In simpler terms, we can say that every context-free language can be matched to some regular language that has the same frequency distribution of symbols.
The Theorem Statement
It says that the Parikh image of a context-free language is semi-linear or, equivalently, that every context-free language has the same Parikh image as some regular language. So for any given context-free grammar, there exists a finite automaton that can recognize a regular language with the same Parikh image.
Parikh Image
We have talked about the Parikh image, let us see the concept of Parikh Image. The Parikh image of a word over an alphabet is a vector that counts the number of occurrences of each symbol in the word.
For a language, the Parikh image is the set of all such vectors for every word in the language.
Example of Parikh Image
Let us see two examples to illustrate this −
Example 1
Consider the word bccba over the alphabet {a, b, c}.
The Parikh image of this word is (1, 2, 2), where 1 represents the occurrence of a, 2 represents the occurrence of b, and 2 represents the occurrence of c.
We denote this as,
$$\mathrm{\Pi \{a, b, c\} (bccba) = (1, 2, 2)}$$
Example 2
Consider the word cabaaabb over the alphabet {a, b, c}.
The Parikh image of this word is (4, 3, 1), where 4 represents the occurrence of a, 3 represents the occurrence of b, and 1 represents the occurrence of c.
We denote this as,
$$\mathrm{\Pi \{a, b, c\} (\text{cabaaabb}) = (4, 3, 1)}$$
Derivation of Parikhs Theorem
Let us see Parikh vector for a word over a given alphabet.
Parikh Vector Definition
Let ∑ be an alphabet consisting of symbols {a1, a2, …, ak}.
The Parikh vector of a word is a function that maps a word to a vector of natural numbers (Nk).
This vector counts the number of occurrences of each symbol in the word. Formally, for a word w, the Parikh vector p(w) is defined as p(w) = (|w|a1, |w|a2, …, |w|ak).
- Statement 1 − Let L be a context-free language. The set of Parikh vectors for words in L, denoted as P(L), is a semi-linear set. This means that the Parikh vectors of words in a context-free language form a semi-linear set, which is a Presburger-definable subset of Nk.
- Statement 2 − If S is any semi-linear set, the language of words whose Parikh vectors belong to S is commutatively equivalent to some regular language. In essence, this implies that every context-free language is commutatively equivalent to some regular language.
These statements highlight that the image under p (Parikh vector function) of both context-free languages and regular languages is the same, represented as a set of semi-linear sets.
Application in Bounded Languages
Parikh's Theorem has a particular significance for bounded languages. A language L is bounded if it is a subset of w1*……..wk*, where w1,….. , wk are fixed words.
Ginsburg and Spanier extended Parikh's Theorem by providing a necessary and sufficient condition for bounded languages to be context-free.
Ginsburg-Spanier Theorem
The theorem states that a bounded language L is context-free if and only if the set {(n1,…….,nk) | w1n1…… wknk ∈ L} is a stratified semi-linear set.
Examples of Parikhs Theorem
Let us see some practical examples to see how Parikhs Theorem works.
Example 1: Context-Free Language L = {0n1n | n >= 1}
Here, the language consists of strings where the number of 0s equals the number of 1s.
For instance, the string 000111 belongs to this language because it has three 0s and three 1s.
The Parikh vector for this string w = '000111' is P(w) = {3, 3}.
Example 2: Context-Free Language L = {0n1n | n < 3 , n >= 1}
In this case, the language consists of strings where the number of 0s and 1s are equal, but the number of 0s and 1s is either 1 or 2.
For n = 1, the string is 01, and for n = 2, the string is 0011.
The Parikh vectors for these strings are:
- P(‘01’) = {1, 1}
- P(‘0011’) = {2, 2}
Therefore, the Parikh image of this language is P(L) = { {1,1}, {2,2} }.
Since we can determine the set of Parikh vectors for the given language, we can construct a deterministic finite automaton (DFA) for this language. This DFA is commutatively equivalent to some regular language.
Corollaries of Parikhs Theorem
Parikh's Theorem concludes several corollaries:
- Every CFL is "letter-equivalent" to a regular language − For example, the context-free language {anbn | n ≥ 0} is letter-equivalent to the regular language (ab)*.
- Lengths of a CFL form an ultimately periodic set
- CFLs over a single-letter alphabet are regular.
- Parikh's Theorem is useful for deciding whether strings with a given number of terminals are accepted by context-free grammar.
Conclusion
In this chapter, we explained the concept of Parikh's Theorem, which shows the relationship between context-free languages and regular languages by focusing on the number of terminal symbols rather than their order.
We covered the concept of Parikh images along with the derivation of the theorem, and its application to bounded languages. Through examples, we showed how Parikh vectors help us understand the properties of context-free languages and their equivalence to regular languages.