Experiments with implementations of two theoretical constructions

  • Torben Amtoft Hansen
  • Thomas Nikolajsen
  • Jesper Larsson Träff
  • Neil D. Jones
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 363)


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 [4] 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 [5], to specialize each of the two interpreters to fixed 2DPDAs. The result was a substantial speedup.


Recursive Function Computable Function Partial Evaluation Program Transformation Input Tape 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Alfred Aho, John Hopcroft, Jeffrey Ullman: The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
  2. [2]
    Torben Amtoft, Thomas Nikolajsen, Jesper Larsson Träff: Implementation of some Theoretical Constructs. DIKU, University of Copenhagen, student project report 1988.Google Scholar
  3. [3]
    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
  4. [4]
    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
  5. [5]
    A. P. Ershov: Mixed Computation: Potential applications and problems for study. Theoretical Computer Science 18, pp. 41–67, 1982.Google Scholar
  6. [6]
    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
  7. [7]
    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
  8. [8]
    Akira Kanda: Theory of Computation. Lecture notes, DIKU, University of Copenhagen, 1985.Google Scholar
  9. [9]
    Stephen Cole Kleene: Introduction to Metamathematics. North-Holland, 1952.Google Scholar
  10. [10]
    A. I. Mal'cev: Algorithms and recursive functions. Wolters-Noordhoff Publishing, 1970.Google Scholar
  11. [11]
    Hartley Rogers: Theory of Recursive Functions and Effective Computability. McGraw-Hill, 1967.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1989

Authors and Affiliations

  • Torben Amtoft Hansen
    • 1
  • Thomas Nikolajsen
    • 1
  • Jesper Larsson Träff
    • 1
  • Neil D. Jones
    • 1
  1. 1.DIKU, Department of Computer ScienceUniversity of CopenhagenCopenhagen ØDenmark

Personalised recommendations