Skip to main content

A Declarative Specification of Tree-Based Symbolic Arithmetic Computations

  • Conference paper
Book cover Practical Aspects of Declarative Languages (PADL 2012)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 7149))

Included in the following conference series:

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

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. Tarau, P.: Everything Is Everything Revisited: Shapeshifting Data Types with Isomorphisms and Hylomorphisms. Complex Systems (18) (2010)

    Google Scholar 

  3. McCarthy, J.: Recursive functions of symbolic expressions and their computation by machine, part i. Commun. ACM 3(4), 184–195 (1960)

    Article  MATH  Google Scholar 

  4. Rabin, M.O.: Decidability of second-order theories and automata on infinite trees. Transactions of the American Mathematical Society 141, 1–35 (1969)

    MathSciNet  MATH  Google Scholar 

  5. Gödel, K.: Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes. Dialectica 12, 280–287 (1958)

    Article  MathSciNet  MATH  Google Scholar 

  6. Berstel, J., Boasson, L.: Formal properties of XML grammars and languages. Acta Informatica 38(9), 649–671 (2002)

    Article  MathSciNet  MATH  Google Scholar 

  7. 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)

    MathSciNet  MATH  Google Scholar 

  8. 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)

    Chapter  Google Scholar 

  9. 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)

    Chapter  Google Scholar 

  10. Kraft, L.: A device for quantizing, grouping, and coding amplitude-modulated pulses. Master’s thesis, Massachusetts Institute of Technology. Dept. of Electrical Engineering (1949)

    Google Scholar 

  11. 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)

    Article  MathSciNet  MATH  Google Scholar 

  12. 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)

    Chapter  Google Scholar 

  13. 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)

    Chapter  Google Scholar 

  14. Knuth, D.E.: The Art of Computer Programming. Fascicle 1: Bitwise Tricks & Techniques; Binary Decision Diagrams, vol. 4. Addison-Wesley Professional (2009)

    Google Scholar 

  15. Takahashi, M.O.: A Foundation of Finite Mathematics. Publ. Res. Inst. Math. Sci. 12(3), 577–708 (1976)

    Article  MathSciNet  MATH  Google Scholar 

  16. Kaye, R., Wong, T.L.: On Interpretations of Arithmetic and Set Theory. Notre Dame J. Formal Logic 48(4), 497–510 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  17. Kirby, L.: Addition and multiplication of sets. Math. Log. Q. 53(1), 52–65 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  18. 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)

    Chapter  Google Scholar 

  19. 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)

    Google Scholar 

  20. 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

  21. 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)

    Chapter  Google Scholar 

  22. 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)

    Chapter  Google Scholar 

  23. Misra, J.: Powerlist: a structure for parallel recursion. ACM Transactions on Programming Languages and Systems 16, 1737–1767 (1994)

    Article  Google Scholar 

  24. Kiselyov, O.: Type arithmetics: Computation based on the theory of types. CoRR cs.CL/0104010 (2001)

    Google Scholar 

  25. 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)

    Google Scholar 

  26. Li, M., Vitányi, P.: An introduction to Kolmogorov complexity and its applications. Springer-Verlag New York, Inc., New York (1993)

    Book  MATH  Google Scholar 

  27. Elias, P.: Universal codeword sets and representations of the integers. IEEE Transactions on Information Theory 21(2), 194–203 (1975)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics