A declarative specification of tree-based symbolic arithmetic computations

  • Authors:
  • Paul Tarau

  • Affiliations:
  • Department of Computer Science and Engineering, University of North Texas

  • Venue:
  • PADL'12 Proceedings of the 14th international conference on Practical Aspects of Declarative Languages
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

We use Prolog as a flexible meta-language to provide executable specifications of some interesting mathematical objects and their operations. In the process, isomorphisms are unraveled between natural numbers and rooted ordered trees representing hereditarily finite sequences and rooted ordered binary trees representing Gödel's System T types. Our isomorphisms result in an interesting "paradigm shift": we provide recursive definitions that perform the equivalent of arbitrary-length integer computations directly on rooted ordered trees. Besides the theoretically interesting fact of "breaking the arithmetic/symbolic barrier", our arithmetic operations performed with symbolic objects like trees or types turn out to be genuinely efficient --- we derive implementations with asymptotic performance comparable to ordinary bitstring implementations of arbitrary-length integer arithmetic. The Prolog code of the paper, organized as a literate program, is available at http://logic.cse.unt.edu/tarau/research/2012/padl12.pl