
- 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
Kleene's Recursion Theorem in TOC
The Kleene's Recursion Theorem is a fundamental concept in computability theory. In this chapter, we will see basics of this theorem and its implications, and a practical example for a better understanding.
Kleene's Recursion Theorem
The Kleene's Recursion Theorem states that for any acceptable numbering of partial recursive functions and any total recursive function, there exists a task that behaves the same way before and after the application of the total recursive function.
Formally, we can state the theorem like the following −
Let φ(k, n) be an acceptable numbering of partial recursive functions. For any total recursive function f, there exists an n such that −
$$\mathrm{\phi(k,\: n) \:=\: \phi(k,\: f(n))}$$
It seems complex, but we are breaking it down in steps.
Important Concepts
Before entering into the details of Kleenes Recursion Theorem, let us see some key concepts −
- Partial Recursive Functions − These are functions that may not be defined for all inputs.
- Total Recursive Functions − These are functions that are defined for all inputs and always terminate.
- Acceptable Numbering − This is a way of assigning unique numbers to all partial recursive functions.
The Virus Analogy
To understand Kleene's Recursion Theorem better, let us recall an interesting idea that we have also covered in some previous article, the virus analogy.
The Virus Scenario
Imagine a scenario where a company called A wants to create a virus (A-Virus) that affects every program in a competing programming system. The virus is supposed to compute a total recursive function v such that for each n and k −
$$\mathrm{\phi(k,\: n)\: \neq \:\phi(k,\: v(n))}$$
In other words, the virus aims to change the behaviour of every program in the system.
The Continuous Line Analogy
Another analogy is continuous line analogy. In this scenario, it is similar to trying to draw a continuous line across a unit square without touching the diagonal. It is impossible because the diagonal is always "in the way".
Similarly, Kleene's Recursion Theorem shows that it's impossible to create a virus that affects every program.
Proof of Kleene's Recursion Theorem
We start with an acceptable numbering of partial recursive functions, called φ(k, n).
We consider an arbitrary total recursive function f(our "virus").
The Table Analogy
Imagine a two-dimensional table where each cell T[n, m] contains the function φ(φ(n, m), x).
- The Diagonal of the Table − The diagonal of this table (φ(φ(0, 0), x), φ(φ(1, 1), x), φ(φ(2, 2), x), ...) is actually a row of the table itself.
- Constructing the Fixed Point − Using the universal property and s-m-n theorem, we can construct a total recursive function g such that:
$$\mathrm{\phi\:(\phi\:(j,\: n),\: x) \:=\: \phi\:(\phi\:(n,\: n),\: x)}$$
$$\mathrm{\text{where }\: \phi(j) \:=\: g}$$
Applying the Virus
When we apply our "virus" f to this function g, we find that there's a point where −
$$\mathrm{\phi(f(g(n)),\: x) \:=\: \phi\:(\phi(n,\: n),\: x) \:=\: \phi(g(n),\: x)}$$
It means that the behaviour of the index g(n) is unaffected by f, proving the theorem.
Applications of Kleene's Recursion Theorem
Kleene's Recursion Theorem has several applications including −
- Self-Referential Programs − One interesting application is the creation of self-referential programs, like a program that prints its own source code.
- Formal Proofs − The theorem allows us to formally prove properties of recursive functions without relying on the Church-Turing thesis.
- Limitations of Viruses − As our analogy showed, the theorem proves that it's impossible to create a virus that affects every program in a system.
Example of Self-Printing Program
Let us see one interesting example for the theorem. The example is to create a self-printing program.
At first, creating a self-printing program seems simple. We might think we could just write −
print(program)
But this will not work because it would print "program", not the actual program itself.
Solution
Using Kleene's Recursion Theorem, we can create a truly self-referential program. Here's how:
- We start with a projection function p(2, 2).
- We apply the s-m-n theorem to get a function s.
- We compose this with a constant function to get a total recursive function g.
- Applying the Recursion Theorem, we get an m such that φ(m) = φ(g(m)).
- This m is our self-referential program!
Conclusion
In this chapter, we explained the Kleene's Recursion Theorem in detail. We started with the basics, explaining what the theorem states and the key concepts involved. We then used an interesting analogy of a computer virus to illustrate the theorem's implications.
We understood the simplified proof of the theorem, using the concept of a two-dimensional table of functions and showing how the diagonal of this table relates to the theorem. We discussed the implications and applications of the theorem, including its use in creating self-referential programs and its role in formal proofs.