101 research outputs found

    A Generic Numbering System based on Catalan Families of Combinatorial Objects

    Full text link
    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 {\em 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.Comment: preprin

    On Two Infinite Families of Pairing Bijections

    Full text link
    We describe two general mechanisms for producing pairing bijections (bijective functions defined from N x N to N). The first mechanism, using n-adic valuations results in parameterized algorithms generating a countable family of distinct pairing bijections. The second mechanism, using characteristic functions of subsets of N provides 2^N distinct pairing bijections. Mechanisms to combine such pairing functions and their application to generate families of permutations of N are also described. The paper uses a small subset of the functional language Haskell to provide type checked executable specifications of all the functions defined in a literate programming style. The self-contained Haskell code extracted from the paper is available at http://logic.cse.unt.edu/tarau/research/2012/infpair.hs .Comment: UNPUBLISHED DRAF

    The BinProlog Experience: Architecture and Implementation Choices for Continuation Passing Prolog and First-Class Logic Engines

    Full text link
    We describe the BinProlog system's compilation technology, runtime system and its extensions supporting first-class Logic Engines while providing a short history of its development, details of some of its newer re-implementations as well as an overview of the most important architectural choices involved in their design. With focus on its differences with conventional WAM implementations, we explain key details of BinProlog's compilation technique, which replaces the WAM with a simplified continuation passing runtime system (the "BinWAM"), based on a mapping of full Prolog to binary logic programs. This is followed by a description of a term compression technique using a "tag-on-data" representation. Later derivatives, the Java-based Jinni Prolog compiler and the recently developed Lean Prolog system refine the BinProlog architecture with first-class Logic Engines, made generic through the use of an Interactor interface. An overview of their applications with focus on the ability to express at source level a wide variety of Prolog built-ins and extensions, covers these newer developments.Comment: To appear in Theory and Practice of Logic Programming (TPLP); Keywords: Prolog, logic programming system, continuation passing style compilation, implementation of Prolog, first-class logic engines, data-representations for Prolog run-time system

    Computing with Hereditarily Finite Sequences

    Full text link
    e use Prolog as a flexible meta-language to provide executable specifications of some fundamental mathematical objects and their transformations. In the process, isomorphisms are unraveled between natural numbers and combinatorial objects (rooted ordered trees representing hereditarily finite sequences and rooted ordered binary trees representing G\"odel's System {\bf T} types). This paper focuses on an application that can be seen as an unexpected "paradigm shift": we provide recursive definitions showing that the resulting representations are directly usable to perform symbolically arbitrary-length integer computations. Besides the theoretically interesting fact of "breaking the arithmetic/symbolic barrier", the 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 source code of the paper, organized as a literate Prolog program, is available at \url{http://logic.cse.unt.edu/tarau/research/2011/pPAR.pl}Comment: Online Proceedings of the 11th International Colloquium on Implementation of Constraint LOgic Programming Systems (CICLOPS 2011), Lexington, KY, U.S.A., July 10, 201

    Binary Tree Arithmetic with Generalized Constructors

    Full text link
    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.Comment: UNPUBLISHED DRAFt, 7 pages, 1 figur

    A Prolog Specification of Giant Number Arithmetic

    Full text link
    The tree based representation described in this paper, hereditarily binary numbers, applies recursively a run-length compression mechanism that enables computations limited by the structural complexity of their operands rather than by their bitsizes. While within constant factors from their traditional counterparts for their worst case behavior, our arithmetic operations open the doors for interesting numerical computations, impossible with traditional number representations. We provide a complete specification of our algorithms in the form of a purely declarative Prolog program.Comment: Proceedings of the 13th International Colloquium on Implementation of Constraint LOgic Programming Systems (CICLOPS 2013), Istanbul, Turkey, August 25, 201

    A Logic Programming Framework for Combinational Circuit Synthesis

    Full text link
    Logic Programming languages and combinational circuit synthesis tools share a common "combinatorial search over logic formulae" background. This paper attempts to reconnect the two fields with a fresh look at Prolog encodings for the combinatorial objects involved in circuit synthesis. While benefiting from Prolog's fast unification algorithm and built-in backtracking mechanism, efficiency of our search algorithm is ensured by using parallel bitstring operations together with logic variable equality propagation, as a mapping mechanism from primary inputs to the leaves of candidate Leaf-DAGs implementing a combinational circuit specification. After an exhaustive expressiveness comparison of various minimal libraries, a surprising first-runner, Strict Boolean Inequality "<" together with constant function "1" also turns out to have small transistor-count implementations, competitive to NAND-only or NOR-only libraries. As a practical outcome, a more realistic circuit synthesizer is implemented that combines rewriting-based simplification of (<,1) circuits with exhaustive Leaf-DAG circuit search. Keywords: logic programming and circuit design, combinatorial object generation, exact combinational circuit synthesis, universal boolean logic libraries, symbolic rewriting, minimal transistor-count circuit synthesi

    Interclausal Logic Variables

    Full text link
    Unification of logic variables instantly connects present and future observations of their value, independently of their location in the data areas of the runtime system. The paper extends this property to "interclausal logic variables", an easy to implement Prolog extension that supports instant global information exchanges without dynamic database updates. We illustrate their usefulness with two of algorithms, {\em graph coloring} and {\em minimum spanning tree}. Implementations of interclausal variables as source-level transformations and as abstract machine adaptations are given. To address the need for globally visible chained transitions of logic variables we describe a DCG-based program transformation that extends the functionality of interclausal variables.Comment: to appear as a ICLP'14 technical contributio

    High-Level Networking With Mobile Code And First Order AND-Continuations

    Full text link
    We describe a scheme for moving living code between a set of distributed processes coordinated with unification based Linda operations, and its application to building a comprehensive Logic programming based Internet programming framework. Mobile threads are implemented by capturing first order continuations in a compact data structure sent over the network. Code is fetched lazily from its original base turned into a server as the continuation executes at the remote site. Our code migration techniques, in combination with a dynamic recompilation scheme, ensure that heavily used code moves up smoothly on a speed hierarchy while volatile dynamic code is kept in a quickly updatable form. Among the examples, we describe how to build programmable client and server components (Web servers, in particular) and mobile agents.Comment: Appeared in Theory and Practice of Logic Programming, vol. 1, no. 3, 200

    Modality Definition Synthesis for Epistemic Intuitionistic Logic via a Theorem Prover

    Full text link
    We derive a Prolog theorem prover for an Intuitionistic Epistemic Logic by starting from the sequent calculus {\bf G4IP} that we extend with operator definitions providing an embedding in intuitionistic propositional logic ({\bf IPC}). With help of a candidate definition formula generator, we discover epistemic operators for which axioms and theorems of Artemov and Protopopescu's {\em Intuitionistic Epistemic Logic} ({\bf IEL}) hold and formulas expected to be non-theorems fail. We compare the embedding of {\bf IEL} in {\bf IPC} with a similarly discovered successful embedding of Dosen's double negation modality, judged inadequate as an epistemic operator. Finally, we discuss the failure of the {\em necessitation rule} for an otherwise successful {\bf S4} embedding and share our thoughts about the intuitions explaining these differences between epistemic and alethic modalities in the context of the Brouwer-Heyting-Kolmogorov semantics of intuitionistic reasoning and knowledge acquisition. Keywords: epistemic intuitionistic logic, propositional intuitionistic logic, Prolog-based theorem provers, automatic synthesis of logic systems, definition formula generation algorithms, embedding of modal logics into intuitionistic logic
    • …
    corecore