Binary Tree Arithmetic with Generalized Constructors
Paul Tarau

TL;DR
This paper introduces a unified approach to binary tree arithmetic using generalized constructors and deconstructors, demonstrating implementation in Scala and extending to rational number operations.
Contribution
It presents a novel framework for binary tree arithmetic with generalized constructors, applying initial algebra semantics and implementing in Scala for arbitrary size rational computations.
Findings
Unified algebraic framework for binary tree arithmetic
Implementation of arithmetic operations in Scala
Extension to rational numbers via Calkin-Wilf bijection
Abstract
We describe arithmetic computations in terms of operations on some well known free algebras (S1S, S2S and ordered rooted binary trees) while emphasizing the common structure present in all them when seen as isomorphic with the set of natural numbers. Constructors and deconstructors seen through an initial algebra semantics are generalized to recursively defined functions obeying similar laws. Implementation using Scala's apply and unapply are discussed together with an application to a realistic arbitrary size arithmetic package written in Scala, based on the free algebra of rooted ordered binary trees, which also supports rational number operations through an extension to signed rationals of the Calkin-Wilf bijection.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Logic, Reasoning, and Knowledge · Computability, Logic, AI Algorithms
