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
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Tarau, P.: An Embedded Declarative Data Transformation Language. In: Proceedings of 11th International ACM SIGPLAN Symposium PPDP 2009, Coimbra, Portugal, pp. 171–182. ACM (September 2009)
Tarau, P.: Everything Is Everything Revisited: Shapeshifting Data Types with Isomorphisms and Hylomorphisms. Complex Systems (18) (2010)
McCarthy, J.: Recursive functions of symbolic expressions and their computation by machine, part i. Commun. ACM 3(4), 184–195 (1960)
Rabin, M.O.: Decidability of second-order theories and automata on infinite trees. Transactions of the American Mathematical Society 141, 1–35 (1969)
Gödel, K.: Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes. Dialectica 12, 280–287 (1958)
Berstel, J., Boasson, L.: Formal properties of XML grammars and languages. Acta Informatica 38(9), 649–671 (2002)
Liebehenschel, J.: Ranking and unranking of a generalized Dyck language and the application to the generation of random trees. Séminaire Lotharingien de Combinatoire 43, 19 (2000)
Bertoni, A., Choffrut, C., Palano, B.: Context-Free Grammars and XML Languages. In: Ibarra, O.H., Dang, Z. (eds.) DLT 2006. LNCS, vol. 4036, pp. 108–119. Springer, Heidelberg (2006)
Berstel, J., Boasson, L.: Balanced Grammars and Their Languages. In: Brauer, W., Ehrig, H., Karhumäki, J., Salomaa, A. (eds.) Formal and Natural Computing. LNCS, vol. 2300, pp. 3–25. Springer, Heidelberg (2002)
Kraft, L.: A device for quantizing, grouping, and coding amplitude-modulated pulses. Master’s thesis, Massachusetts Institute of Technology. Dept. of Electrical Engineering (1949)
Gödel, K.: Über formal unentscheidbare Sätze der Principia Mathematica und verwandter Systeme I. Monatshefte für Mathematik und Physik 38, 173–198 (1931)
Hartmanis, J., Baker, T.P.: On Simple Goedel Numberings and Translations. In: Loeckx, J. (ed.) ICALP 1974. LNCS, vol. 14, pp. 301–316. Springer, Heidelberg (1974)
Martínez, C., Molinero, X.: Generic Algorithms for the Generation of Combinatorial Objects. In: Rovan, B., Vojtáš, P. (eds.) MFCS 2003. LNCS, vol. 2747, pp. 572–581. Springer, Heidelberg (2003)
Knuth, D.E.: The Art of Computer Programming. Fascicle 1: Bitwise Tricks & Techniques; Binary Decision Diagrams, vol. 4. Addison-Wesley Professional (2009)
Takahashi, M.O.: A Foundation of Finite Mathematics. Publ. Res. Inst. Math. Sci. 12(3), 577–708 (1976)
Kaye, R., Wong, T.L.: On Interpretations of Arithmetic and Set Theory. Notre Dame J. Formal Logic 48(4), 497–510 (2007)
Kirby, L.: Addition and multiplication of sets. Math. Log. Q. 53(1), 52–65 (2007)
Tarau, P.: A Groupoid of Isomorphic Data Transformations. In: Carette, J., Dixon, L., Coen, C.S., Watt, S.M. (eds.) Calculemus/MKM 2009. LNCS (LNAI), vol. 5625, pp. 170–185. Springer, Heidelberg (2009)
Tarau, P.: Isomorphisms, Hylomorphisms and Hereditarily Finite Data Types in Haskell. In: Proceedings of ACM SAC 2009, Honolulu, Hawaii, pp. 1898–1903. ACM (March 2009)
Tarau, P.: Declarative Combinatorics: Isomorphisms, Hylomorphisms and Hereditarily Finite Data Types in Haskell, pages 150 (January 2009), unpublished draft, http://arXiv.org/abs/0808.2953 , updated version at http://logic.cse.unt.edu/tarau/research/2010/ISO.pdf
Dershowitz, N.: Trees, Ordinals and Termination. In: Gaudel, M., Jouannaud, J. (eds.) CAAP 1993, FASE 1993, and TAPSOFT 1993. LNCS, vol. 668, pp. 243–250. Springer, Heidelberg (1993)
Kiselyov, O., Byrd, W.E., Shan, C.-c.: Pure, Declarative, and Constructive Arithmetic Relations (Declarative Pearl). In: Garrigue, J., Hermenegildo, M. (eds.) FLOPS 2008. LNCS, vol. 4989, pp. 64–80. Springer, Heidelberg (2008)
Misra, J.: Powerlist: a structure for parallel recursion. ACM Transactions on Programming Languages and Systems 16, 1737–1767 (1994)
Kiselyov, O.: Type arithmetics: Computation based on the theory of types. CoRR cs.CL/0104010 (2001)
Wen, J., Villasenor, J.: Reversible variable length codes for efficient and robust image and video coding. In: Proceedings Data Compression Conference, pp. 471–480 (1998)
Li, M., Vitányi, P.: An introduction to Kolmogorov complexity and its applications. Springer-Verlag New York, Inc., New York (1993)
Elias, P.: Universal codeword sets and representations of the integers. IEEE Transactions on Information Theory 21(2), 194–203 (1975)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Tarau, P. (2012). A Declarative Specification of Tree-Based Symbolic Arithmetic Computations. In: Russo, C., Zhou, NF. (eds) Practical Aspects of Declarative Languages. PADL 2012. Lecture Notes in Computer Science, vol 7149. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-27694-1_20
Download citation
DOI: https://doi.org/10.1007/978-3-642-27694-1_20
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-27693-4
Online ISBN: 978-3-642-27694-1
eBook Packages: Computer ScienceComputer Science (R0)