Experiments with implementations of two theoretical constructions
This paper reports two experiments with implementations of constructions from theoretical computer science. The first one deals with Kleene's and Rogers' second recursion theorems and the second is an implementation of Cook's linear time simulation of two way deterministic pushdown automata (2DPDAs). Both experiments involve the treatment of programs as data objects and their execution by means of interpreters.
For our implementations we have been using a small LISP-like language called Mixwell, originally devised for the partial evaluator MIX used in the second experiment. LISP-like languages are especially suitable since programs are data (S-expressions) so the tedious coding of programs as Gödel numbers so familiar from recursive function theory is completely avoided.
We programmed the constructions in the standard proofs of Kleene's and Rogers' recursion theorems and found (as expected) the programs so constructed to be far too inefficient for practical use. We then designed and implemented a new programming language called Reflect in which Kleene and Rogers “fixed-point” programs can be expressed elegantly and much more efficiently. We have programmed some examples in Reflect in an as yet incomplete attempt to find out for which sort of problems the second recursion theorems are useful program generating tools.
The second experiment concerns an automaton that can solve many non-trivial pattern matching problems. Cook  has shown that any 2DPDA can be simulated in linear time by a clever memoization technique. We wrote a simple interpreter to execute 2DPDA programs and an interpreter using Cook's algorithm, and we observed that the latter was indeed much faster on certain language recognition problems. Both have, however, a high computational overhead, since they in effect work by interpretation rather than compilation. In order to alleviate this we applied the principle of partial evaluation, see , to specialize each of the two interpreters to fixed 2DPDAs. The result was a substantial speedup.
KeywordsRecursive Function Computable Function Partial Evaluation Program Transformation Input Tape
Unable to display preview. Download preview PDF.
- Alfred Aho, John Hopcroft, Jeffrey Ullman: The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
- Torben Amtoft, Thomas Nikolajsen, Jesper Larsson Träff: Implementation of some Theoretical Constructs. DIKU, University of Copenhagen, student project report 1988.Google Scholar
- Manuel Blum: A Machine-Independent Theory of the Complexity of Recursive Functions. Journal of the Association for Computing Machinery, vol. 14, no. 2, April 1967, pp. 322–336.Google Scholar
- Stephen A. Cook: Linear Time Simulation of Deterministic Two-Way Pushdown Automata. Information Processing 71, pp. 75–80, North-Holland Publishing Company, 1972.Google Scholar
- A. P. Ershov: Mixed Computation: Potential applications and problems for study. Theoretical Computer Science 18, pp. 41–67, 1982.Google Scholar
- Neil D. Jones: A Note on Linear Time Simulation of Deterministic Two-Way Pushdown Automata. Information Processing Letters, vol. 6 no. 4, 1977.Google Scholar
- Neil D. Jones, Peter Sestoft, Harald Søndergaard: MIX: A Self-applicable partial Evaluator for Experiments in Compiler Generation (Revised Version). Lisp and Symbolic Computation, issue 2, fall 1988.Google Scholar
- Akira Kanda: Theory of Computation. Lecture notes, DIKU, University of Copenhagen, 1985.Google Scholar
- Stephen Cole Kleene: Introduction to Metamathematics. North-Holland, 1952.Google Scholar
- A. I. Mal'cev: Algorithms and recursive functions. Wolters-Noordhoff Publishing, 1970.Google Scholar
- Hartley Rogers: Theory of Recursive Functions and Effective Computability. McGraw-Hill, 1967.Google Scholar