
- 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
Turing Machine and Grammars in Automata Theory
In this chapter, we will cover the grammars associated with Turing Machines. These concepts are fundamental to understand how the languages can be generated and recognized. Here, we will look into the relationship between Turing machines and unrestricted grammar, and explore how these two concepts connect each other and how a Turing machine can be transformed into an unrestricted grammar.
Turing Machine
For a very brief overview, a Turing machine is a mathematical model of computation that defines an abstract machine. This machine manipulates symbols on a strip of tape according to a set of rules.
A Turing machine can be visualized as having a tape divided into cells, where each cell contains a symbol from a finite alphabet. A read / write head moves left or right across the tape, reading symbols and making decisions based on a finite set of states and transition functions. The Turing machine continues this process until it reaches a halting state, either accepting or rejecting the input string.
Turing Decidability
A problem is said to be Turing decidable if there exists a Turing machine that halts and provides a "yes" or "no" answer for every possible input. The recursive languages that can be decided by Turing machines always lead to a halt, while recursively enumerable languages may not halt, looping infinitely.
Unrestricted Grammar
Unrestricted grammar is a type of formal grammar that is defined without any restrictions on the form of its production rules.
Formally, a grammar G = (VN, Σ, P, S) is called an unrestricted grammar if all its productions are in the form LS → RS, where LS is a string of non-terminal and terminal symbols, and RS is a string of non-terminal and terminal symbols or the empty string. This form of grammar is known as Type 0 grammar in the Chomsky hierarchy, and it is the most general form of grammar.

The lack of restrictions allows for a more flexible and powerful method of string generation, which leads to the capabilities of a Turing machine.
Every language that can be generated by an unrestricted grammar can be recognized by a Turing machine, and vice versa. This states the idea that the set of languages generated by unrestricted grammar is equivalent to the set of recursively enumerable languages.
Turing Machine and Unrestricted Grammar
The connection between Turing machines and unrestricted grammar can be understood by observing how the rules of a Turing machine can be mapped to the production rules of an unrestricted grammar.
Constructing Type 0 Grammar from a Turing Machine
To convert a Turing machine into an equivalent unrestricted grammar, we follow a systematic process that involves translating the transition functions of the Turing machine into production rules of the grammar.
No Change in Length
- Right Move − If the Turing machine has a transition δ(qi, aj) → (qk, al, R), where the machine moves right after reading aj in state qi , the corresponding production rule in the grammar is qiaj → al qk.
- Left Move − If the Turing machine has a transition δ(qi,aj) → (qk, al, L), where the machine moves left, the corresponding production rule in the grammar is ap qi aj → qk ap al, for all allowable tape symbols ap.
Change in Length:
- Left Bracket ‘[‘ at the Left End − If the Turing machine moves left beyond the leftmost boundary, we introduce a production rule like [ qi aj → qk B al to handle this boundary condition.
- Right Bracket ‘]’ at the Right End − When the Turing machine moves right beyond the rightmost boundary, a production rule like qi ] → qi B ] is added.
Handling End Markers
To manage the string boundaries, we introduce end markers ψ and $ and corresponding production rules such as [ qi ψ → [ qi and ap for each symbol ap .
Example 1: 1's Complement Conversion
Let us see the idea through some examples for a better understanding. Consider a Turing machine designed to compute the 1's complement of a binary number. The machine's transition functions can be converted into a Type 0 grammar as follows −
Transitions −
$$\mathrm{\delta(Q_{0},\: 0)\: \rightarrow \:(Q_{0},\: 1,\: R)\: becomes \:Q_{0}0\: \rightarrow \:1Q_{0}}$$
$$\mathrm{\delta(Q_{0},\: 1)\: \rightarrow \:(Q_{0},\: 0,\: R)\: becomes \:Q_{0}1\: \rightarrow \:0Q_{0}}$$
$$\mathrm{\delta(Q_{0},\: B)\: \rightarrow \:(Q_{f},\: B,\: R)\: becomes \:Q_{0}B\: \rightarrow \:0Q_{f}}$$
End Markers −
- [ Qf B] → S, where S is the start symbol of the grammar.
These rules collectively define the unrestricted grammar that is equivalent to the given Turing machine.
Example 2: Even String of 'a'
Let us see another example. Consider a Turing machine that accepts strings containing an even number of 'a's. The equivalent Type 0 grammar can be constructed as follows −
Transitions −
$$\mathrm{\delta(Q_{0},\: a)\: \rightarrow \:(Q_{1},\: B,\: R)\: becomes\: Q_{0}\: a\: \rightarrow \:B\: Q_{1}}$$
$$\mathrm{\delta(Q_{1},\: a)\: \rightarrow \:(Q_{0},\: B,\: R)\: becomes\: Q_{1}\: a\: \rightarrow \:B \:Q_{0}}$$
End Markers −
$$\mathrm{[Q_{0}\: \psi \: \rightarrow \:[ Q_{0}}$$
$$\mathrm{[Q_{1}\: B]\: \rightarrow \: S}$$
This grammar will generate strings that belong to the language of even numbers of 'a's.
Conclusion
Turing Machines use unrestricted grammars. Here we discussed the transformation of a Turing machine into unrestricted grammar, which states the deep connection between computation and language theory.
Unrestricted grammars are the most general form of formal grammars. In this chapter, we presented the examples of two machines with grammars for a clear understanding.