English

Binary Tree Arithmetic with Generalized Constructors

Mathematical Software 2013-01-03 v1 Discrete Mathematics Programming Languages

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.

Keywords

Cite

@article{arxiv.1301.0128,
  title  = {Binary Tree Arithmetic with Generalized Constructors},
  author = {Paul Tarau},
  journal= {arXiv preprint arXiv:1301.0128},
  year   = {2013}
}

Comments

UNPUBLISHED DRAFt, 7 pages, 1 figure

R2 v1 2026-06-21T23:02:41.254Z