7 research outputs found

    Deriving a Fast Inverse of the Generalized Cantor N-tupling Bijection

    Get PDF
    We attack an interesting open problem (an efficient algorithm to invert the generalized Cantor N-tupling bijection) and solve it through a sequence of equivalence preserving transformations of logic programs, that take advantage of unique strengths of this programming paradigm. An extension to set and multiset tuple encodings, as well as a simple application to a "fair-search" mechanism illustrate practical uses of our algorithms. The code in the paper (a literate Prolog program, tested with SWI-Prolog and Lean Prolog) is available at http://logic.cse.unt.edu/tarau/research/2012/pcantor.pl

    Computing with Free Algebras, in

    Get PDF
    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 of 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. Implementations using GHC's view construct are discussed, based on the free algebra of rooted ordered binary trees. Categories and Subject Descriptors D.3.3 [PROGRAMMING LANGUAGES]: Language Constructs and Features-Data types and structures General Terms Algorithms, Languages, Theory Keywords arithmetic computations with free algebras, generalized constructors, declarative modeling of computational phenomena, bijective Gödel numberings and algebraic datatypes
    corecore