Abstract
We describe arithmetic algorithms on a canonical number representation based on the Catalan family of combinatorial objects specified as a Haskell type class.
Our algorithms work on a generic representation that we illustrate on instances members of the Catalan family, like ordered binary and multiway trees. We validate the correctness of our algorithms by defining an instance of the same type class based the usual bitstring-based natural numbers.
While their average and worst case complexity is within constant factors of their traditional counterparts, our algorithms provide super-exponential gains for numbers corresponding to Catalan objects of low representation size.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
In fact, one can see the functions e, e_ , c, c’, c_ as a generic API abstracting away the essential properties of the constructors E and C.
References
Goodstein, R.: On the restricted ordinal theorem. J. Symbolic Logic 9, 33–41 (1944)
Haraburda, D., Tarau, P.: Binary trees as a computational framework. Comput. Lang. Syst. Struct. 39(4), 163–181 (2013)
Knuth, D.E.: Mathematics and computer science: coping with finiteness. Science 194(4271), 1235–1242 (1976)
Knuth, D.E.: TCALC (1994). http://math.mit.edu/~rstan/ec/catadd.pdf
Knuth, D.E.: The Art of Computer Programming, Volume 4, Fascicle 4: Generating All Trees-History of Combinatorial Generation (Art of Computer Programming). Addison-Wesley Professional (2006)
Kreher, D.L., Stinson, D.: Combinatorial Algorithms: Generation, Enumeration, and Search. The CRC Press Series on Discrete Mathematics and its Applications, CRC PressINC (1999)
Stanley, R.P.: Enumerative Combinatorics. Wadsworth Publ. Co., Belmont (1986).http://www-cs-faculty.stanford.edu/~uno/programs/tcalc.w.gz
Stanley, R.P.: Catalan Addendum (2013). http://www-math.mit.edu/rstan/ec/catadd.pdf
Tarau, P.: A groupoid of isomorphic data transformations. In: Carette, J., Dixon, L., Coen, C.S., Watt, S.M. (eds.) MKM 2009, Held as Part of CICM 2009. LNCS, vol. 5625, pp. 170–185. Springer, Heidelberg (2009)
Tarau, P.: Bijective collection encodings and boolean operations with hereditarily binary natural numbers. In: Proceedings of the 16th international ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming, PPDP 2014. ACM, New York (2014)
Tarau, P.: A Generic Numbering System based on Catalan Families of Combinatorial Objects (2014). CoRR abs/1406.1796
Tarau, P.: Computing with Catalan families. In: Dediu, A.-H., MartÃn-Vide, C., Sierra-RodrÃguez, J.-L., Truthe, B. (eds.) LATA 2014. LNCS, vol. 8370, pp. 565–575. Springer, Heidelberg (2014)
Tarau, P.: The arithmetic of recursively run-length compressed natural numbers. In: Ciobanu, G., Méry, D. (eds.) ICTAC 2014. LNCS, vol. 8687, pp. 406–423. Springer, Heidelberg (2014)
Tarau, P.: A Size-proportionate Bijective Encoding of Lambda Terms as Catalan Objects endowed with Arithmetic Operations. In: Gavanelli, M., Reppy, J. (eds.) PADL 2016. LNCS, vol. 9585, pp. 99–116. Springer, Cham (2016)
Tarau, P., Buckles, B.: Arithmetic algorithms for hereditarily binary natural numbers. In: Proceedings of SAC 2014, ACM Symposium on Applied Computing, PL track. ACM, Gyeongju, March 2014
Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad-hoc. In: POPL, pp. 60–76 (1989)
Acknowledgement
This research has been supported by NSF grant 1423324. We thanks the reviewers of PADL’16 for their constructive suggestions and comments.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Tarau, P. (2016). Computing with Catalan Families, Generically. In: Gavanelli, M., Reppy, J. (eds) Practical Aspects of Declarative Languages. PADL 2016. Lecture Notes in Computer Science(), vol 9585. Springer, Cham. https://doi.org/10.1007/978-3-319-28228-2_8
Download citation
DOI: https://doi.org/10.1007/978-3-319-28228-2_8
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-28227-5
Online ISBN: 978-3-319-28228-2
eBook Packages: Computer ScienceComputer Science (R0)