8,392 research outputs found

    Static Type Inference for the Q language using Constraint Logic Programming

    Get PDF
    We describe an application of Prolog: a type inference tool for the Q functional language. Q is a terse vector processing language, a descendant of APL, which is getting more and more popular, especially in financial applications. Q is a dynamically typed language, much like Prolog. Extending Q with static typing improves both the readability of programs and programmer productivity, as type errors are discovered by the tool at compile time, rather than through debugging the program execution. We map the task of type inference onto a constraint satisfaction problem and use constraint logic programming, in particular the Constraint Handling Rules extension of Prolog. We determine the possible type values for each program expression and detect inconsistencies. As most built-in function names of Q are overloaded, i.e. their meaning depends on the argument types, a quite complex system of constraints had to be implemented

    Implementazione in un linguaggio logico con vincoli di ordine superiore della type inference di Haskell

    Get PDF
    Implementazione in ELPI, un linguaggio logico con vincoli di ordine superiore, dell'algoritmo di type inference di Haskell. ELPI è un'estensione con vincoli di lambda Prolog. Utilizzando lambda Prolog risulta impossibile implementare la type inference di Haskell. Si è reso dunque necessario l'utilizzo di ELPI, più espressivo (non nel senso di Turing completezza) di lambda Prolog. La presente trattazione ha una duplice finalità. La prima consiste nel dimostrare che le estensioni a lambda Prolog presenti in ELPI permettono di risolvere problemi non risolvibili in lambda Prolog. La seconda, non ancora implementata ma lasciata agli sviluppi futuri, prevede di fare del mio lavoro uno strumento di prova per testare, implementare e studiare nuove estensioni al meccanismo delle type class di Haskell. Infatti, essendo ELPI un linguaggio di più alto livello e più semplice (grazie alle features del linguaggio) rispetto ad Haskell, aggiungere estensioni al meccanismo base delle type class dovrebbe risultare banale (in confronto alla complessità di eseguire tale operazione in Haskell)

    A partial breadth-first execution model for prolog

    Get PDF
    MEM (Multipath Execution Model) is a novel model for the execution of Prolog programs which combines a depth-first and breadth-first exploration of the search tree. The breadth-first search allows more than one path of the SLD-tree to be explored at the same time. In this way, the computational cost of traversing the whole search tree associated to a program can be decreased because the MEM model reduces the overhead due to the execution of control instructions and also diminishes the number of unifications to be performed. This paper focuses on the description of the MEM model and its sequential implementation. Moreover, the MEM execution model can be implemented in order to exploit a new kind of parallelism, called path parallelism, which allows the parallel execution of unify operations related to simultaneously traversed pathsPeer ReviewedPostprint (published version

    Detecting Determinacy in Prolog Programs: 22nd International Conference, ICLP 2006, Seattle, WA, USA, August 17-20, 2006. Proceedings

    Get PDF
    In program development it is useful to know that a call to a Prolog program will not inadvertently leave a choice-point on the stack. Determinacy inference has been proposed for solving this problem yet the analysis was found to be wanting in that it could not infer determinacy conditions for programs that contained cuts or applied certain tests to select a clause. This paper shows how to remedy these serious deficiencies. It also addresses the problem of identifying those predicates which can be rewritten in a more deterministic fashion. To this end, a radically new form of determinacy inference is introduced, which is founded on ideas in ccp, that is capable of reasoning about the way bindings imposed by a rightmost goal can make a leftmost goal deterministic

    Upside-down Deduction

    Get PDF
    Over the recent years, several proposals were made to enhance database systems with automated reasoning. In this article we analyze two such enhancements based on meta-interpretation. We consider on the one hand the theorem prover Satchmo, on the other hand the Alexander and Magic Set methods. Although they achieve different goals and are based on distinct reasoning paradigms, Satchmo and the Alexander or Magic Set methods can be similarly described by upside-down meta-interpreters, i.e., meta-interpreters implementing one reasoning principle in terms of the other. Upside-down meta-interpretation gives rise to simple and efficient implementations, but has not been investigated in the past. This article is devoted to studying this technique. We show that it permits one to inherit a search strategy from an inference engine, instead of implementing it, and to combine bottom-up and top-down reasoning. These properties yield an explanation for the efficiency of Satchmo and a justification for the unconventional approach to top-down reasoning of the Alexander and Magic Set methods
    • …
    corecore