1,480 research outputs found

    Combining Static and Dynamic Contract Checking for Curry

    Full text link
    Static type systems are usually not sufficient to express all requirements on function calls. Hence, contracts with pre- and postconditions can be used to express more complex constraints on operations. Contracts can be checked at run time to ensure that operations are only invoked with reasonable arguments and return intended results. Although such dynamic contract checking provides more reliable program execution, it requires execution time and could lead to program crashes that might be detected with more advanced methods at compile time. To improve this situation for declarative languages, we present an approach to combine static and dynamic contract checking for the functional logic language Curry. Based on a formal model of contract checking for functional logic programming, we propose an automatic method to verify contracts at compile time. If a contract is successfully verified, dynamic checking of it can be omitted. This method decreases execution time without degrading reliable program execution. In the best case, when all contracts are statically verified, it provides trust in the software since crashes due to contract violations cannot occur during program execution.Comment: Pre-proceedings paper presented at the 27th International Symposium on Logic-Based Program Synthesis and Transformation (LOPSTR 2017), Namur, Belgium, 10-12 October 2017 (arXiv:1708.07854

    Singular and Plural Functions for Functional Logic Programming

    Full text link
    Functional logic programming (FLP) languages use non-terminating and non-confluent constructor systems (CS's) as programs in order to define non-strict non-determi-nistic functions. Two semantic alternatives have been usually considered for parameter passing with this kind of functions: call-time choice and run-time choice. While the former is the standard choice of modern FLP languages, the latter lacks some properties---mainly compositionality---that have prevented its use in practical FLP systems. Traditionally it has been considered that call-time choice induces a singular denotational semantics, while run-time choice induces a plural semantics. We have discovered that this latter identification is wrong when pattern matching is involved, and thus we propose two novel compositional plural semantics for CS's that are different from run-time choice. We study the basic properties of our plural semantics---compositionality, polarity, monotonicity for substitutions, and a restricted form of the bubbling property for constructor systems---and the relation between them and to previous proposals, concluding that these semantics form a hierarchy in the sense of set inclusion of the set of computed values. We have also identified a class of programs characterized by a syntactic criterion for which the proposed plural semantics behave the same, and a program transformation that can be used to simulate one of them by term rewriting. At the practical level, we study how to use the expressive capabilities of these semantics for improving the declarative flavour of programs. We also propose a language which combines call-time choice and our plural semantics, that we have implemented in Maude. The resulting interpreter is employed to test several significant examples showing the capabilities of the combined semantics. To appear in Theory and Practice of Logic Programming (TPLP)Comment: 53 pages, 5 figure

    Lazy Evaluation and Delimited Control

    Full text link
    The call-by-need lambda calculus provides an equational framework for reasoning syntactically about lazy evaluation. This paper examines its operational characteristics. By a series of reasoning steps, we systematically unpack the standard-order reduction relation of the calculus and discover a novel abstract machine definition which, like the calculus, goes "under lambdas." We prove that machine evaluation is equivalent to standard-order evaluation. Unlike traditional abstract machines, delimited control plays a significant role in the machine's behavior. In particular, the machine replaces the manipulation of a heap using store-based effects with disciplined management of the evaluation stack using control-based effects. In short, state is replaced with control. To further articulate this observation, we present a simulation of call-by-need in a call-by-value language using delimited control operations

    Semantic Versioning Checking in a Declarative Package Manager

    Get PDF
    Semantic versioning is a principle to associate version numbers to different software releases in a meaningful manner. The correct use of version numbers is important in software package systems where packages depend on other packages with specific releases. When patch or minor version numbers are incremented, the API is unchanged or extended, respectively, but the semantics of the operations should not be affected (apart from bug fixes). Although many software package management systems assumes this principle, they do not check it or perform only simple syntactic signature checks. In this paper we show that more substantive and fully automatic checks are possible for declarative languages. We extend a package manager for the functional logic language Curry with features to check the semantic equivalence of two different versions of a software package. For this purpose, we combine CurryCheck, a tool for automated property testing, with program analysis techniques in order to ensure the termination of the checker even in case of possibly non-terminating operations defined in some package. As a result, we obtain a software package manager which checks semantic versioning and, thus, supports a reliable and also specification-based development of software packages

    Lazy unification with inductive simplification

    No full text
    Unification in the presence of an equational theory is an important problem in theorem-proving and in the integration of functional and logic programming languages. This paper presents an improvement of the proposed lazy unification methods by incorporating simplification with inductive axioms into the unification process. Inductive simplification reduces the search space so that in some case infinite search spaces are reduced to finite ones. Consequently, more efficient unification algorithms can be achieved. We prove soundness and completeness of our method for equational theories represented by ground confluent and terminating rewrite systems

    The Interactive Curry Observation Debugger iCODE

    Get PDF
    AbstractDebugging by observing the evaluation of expressions and functions is a useful approach for finding bugs in lazy functional and functional logic programs. However, adding and removing observation annotations to a program is an effort making the use of this debugging technique in practice uncomfortable. Having tool support for managing observations is desirable. We developed a tool that provides this ability for programmers. Without annotating expressions in a program, the evaluation of functions, data structures and arbitrary subexpressions can be observed by selecting them from a tree-structure representing the whole program. Furthermore, the tool provides a step by step performing of observations where each observation is shown in a separated viewer. Beside searching bugs, the tool can be used to assist beginners in learning the non-deterministic behavior of lazy functional logic programs. To find a surrounding area that contains the failure, the tool can furthermore show the executed part of the program by marking the expressions that are activated during program execution
    corecore