30 research outputs found

    Type Targeted Testing

    Full text link
    We present a new technique called type targeted testing, which translates precise refinement types into comprehensive test-suites. The key insight behind our approach is that through the lens of SMT solvers, refinement types can also be viewed as a high-level, declarative, test generation technique, wherein types are converted to SMT queries whose models can be decoded into concrete program inputs. Our approach enables the systematic and exhaustive testing of implementations from high-level declarative specifications, and furthermore, provides a gradual path from testing to full verification. We have implemented our approach as a Haskell testing tool called TARGET, and present an evaluation that shows how TARGET can be used to test a wide variety of properties and how it compares against state-of-the-art testing approaches

    Extrapolate: generalizing counterexamples of functional test properties

    Get PDF
    This paper presents a new tool called Extrapolate that automatically generalizes counterexamples found by property-based testing in Haskell. Example applications show that generalized counterexamples can inform the programmer more fully and more immediately what characterises failures. Extrapolate is able to produce more general results than similar tools. Although it is intrinsically unsound, as reported generalizations are based on testing, it works well for examples drawn from previous published work in this area

    How functional programming mattered

    Get PDF
    In 1989 when functional programming was still considered a niche topic, Hughes wrote a visionary paper arguing convincingly ‘why functional programming matters’. More than two decades have passed. Has functional programming really mattered? Our answer is a resounding ‘Yes!’. Functional programming is now at the forefront of a new generation of programming technologies, and enjoying increasing popularity and influence. In this paper, we review the impact of functional programming, focusing on how it has changed the way we may construct programs, the way we may verify programs, and fundamentally the way we may think about programs

    Nested window management and task-oriented user interfaces

    Get PDF
    QDWM is an experimental window manager for X11 which distinguishes itself with the ability to run in a resizeable window managed by an existing X11 window manager, several times over. This abstract touches upon its implementation, related work and emerging opportunities for research.peer-reviewe

    LiquidHaskell : Liquid Types for Haskell

    Get PDF
    Ακόμα και τα ασφαλή προγράμματα μπορούν να έχουν λάθη. Προγράμματα που έχουν μεταγλωτιστεί με βάση κάποιο ισχυρό σύστημα τύπων, όπως αυτό της Haskell, μπορούν να πετάξουν σφάλμα κατα τον χρόνο εκτέλεσης ή να δώσουν μη αναμενώμενη απάντηση. Τα refinement συστήματα τύπων αντιμετωπίζουν αυτήν την κατάσταση αφού επιτρέπουν την έκφραση σημασιολογικών προδιαφραφών των προγραμμάτων. Αναλύουμε την απόδειξη των προδιαγραφών σε αυτά τα συστήματα. Πολύ εκφραστικά συστήματα απαιτούν ελέγχους κατά τον χρόνο εκτέλεσης ή ρητές αποδείξεις από τον χρήστη, για την αποδειξη των προδιαγραφών, Λιγότερο εκφραστικά συστήματα τύπων επιτρέπουν την αυτόματη απόδειξη των προδιαγραφών, κατά τον χρόνο μεταγλώτισης. Παρουσιάζουμε τους liquidTypes ένα σύστημα τύπων που επιτρέπει την αυτόματη απόδειξη προδιαγραφών κατά τον χρόνο μεταγλώτισης. Επεκτείνουμε τους liquidTypes με abstract refinement, έναν μηχανισμό που αυξάνει την εκφραστικότητα του συστήματος, χωρίς να αυξάνει την πολυπλοκοτητά του. Υλοποιήσαμε την LiquidHaskell ένα σύστημα τύπων για Haskell που συνδιάζει liquidTypes με abstract refinement και το χρησιμοποιήσαμε για να αποδείξουμε ιδιώτητες πραγματικων βιβλιοθηκών της Haskell.Even well-typed programs can go wrong, by returning a wrong answer or throwing a run-time error. A popular response is to allow programmers use refinement type systems to express semantic specifications about programs. We study verification in such systems. On the one hand, expressive refinement type systems require run-time checks or explicit proofs to verify specifications. On the other, less expressive type systems allow static and automatic proofs of the specifications. Next, we present abstract refinement types, a means to enhance the expressiveness of a refinement type system without increasing its complexity. Then, we present LiquidHaskell that combines liquidTypes with abstraction over refinements to enhance expressiveness of LiquidTypes. LiquidHaskell is a quite expressive verification tool for Haskell programs that can be used to check termination, totality and general functional correctness. Finally, we evaluate LiquidHaskell in real world Haskell libraries

    Tools for Discovery, Refinement and Generalization of Functional Properties by Enumerative Testing

    Get PDF
    This thesis presents techniques for discovery, refinement and generalization of properties about functional programs. These techniques work by reasoning from test results: their results are surprisingly accurate in practice, despite an inherent uncertainty in principle. These techniques are validated by corresponding implementations in Haskell and for Haskell programs: Speculate, FitSpec and Extrapolate. Speculate discovers properties given a collection of black-box function signatures. Properties discovered by Speculate include inequalities and conditional equations. These properties can contribute to program understanding, documentation and regression testing. FitSpec guides refinements of properties based on results of black-box mutation testing. These refinements include completion and minimization of property sets. Extrapolate generalizes counterexamples of test properties. Generalized counterexamples include repeated variables and side-conditions and can inform the programmer what characterizes failures. Several example applications demonstrate the effectiveness of Speculate, FitSpec and Extrapolate

    HaskHOL: A Haskell Hosted Domain Specific Language for Higher-Order Logic Theorem Proving

    Get PDF
    HaskHOL is an implementation of a HOL theorem proving capability in Haskell. Motivated by a need to integrate theorem proving capabilities into a Haskell-based tool suite, HaskHOL began as a simple port of HOL Light to Haskell. However, Haskell's laziness, immutable data, and monadic extensions both complicate an implementation and enable a new feature class. This thesis describes HaskHOL, its motivation and implementation. Its use to implement a primitive, interactive theorem prover is explored and its performance is evaluated using a collection of intuitionistically valid problems

    Algorithmic debugging for complex lazy functional programs

    Get PDF
    An algorithmic debugger finds defects in programs by systematic search. It relies on the programmer to direct the search by answering a series of yes/no questions about the correctness of specific function applications and their results. Existing algorithmic debuggers for a lazy functional language work well for small simple programs but cannot be used to locate defects in complex programs for two reasons: Firstly, to collect the information required for algorithmic debugging existing debuggers use different but complex implementations. Therefore, these debuggers are hard to maintain and do not support all the latest language features. As a consequence, programs with unsupported language features cannot be debugged. Also inclusion of a library using unsupported languages features can make algorithmic debugging unusable even when the programmer is not interested in debugging the library. Secondly, algorithmic debugging breaks down when the size or number of questions is too great for the programmer to handle. This is a pity, because, even though algorithmic debugging is a promising method for locating defects, many real-world programs are too complex for the method to be usuable. I claim that the techniques in in this thesis make algorithmic debugging useable for a much more complex lazy functional programs. I present a novel method for collecting the information required for algorithmically debugging a lazy functional program. The method is non-invasive, uses program annotations in suspected modules only and has a simple implementation. My method supports all of Haskell, including laziness, higher-order functions and exceptions. Future language extensions can be supported without changes, or with minimal changes, to the implementation of the debugger. With my method the programmer can focus on untrusted code -- lots of trusted libraries are unaffected. This makes traces, and hence the amount of questions that needs to be answered, more manageable. I give a type-generic definition to support custom types defined by the programmer. Furthermore, I propose a method that re-uses properties to answer automatically some of the questions arising during algorithmic debugging, and to replace others by simpler questions. Properties may already be present in the code for testing; the programmer can also encode a specification or reference implementation as a property, or add a new property in response to a statement they are asked to judge

    Zipper-based modular and deforested computations

    Get PDF
    In this paper we present a methodology to implement multiple traversal algorithms in a functional programming setting. The implementations we obtain s of highly modular and intermediate structure free programs, that rely on the concept of functional zippers to navigate on data structures.Even though our methodology is developed and presented under Haskell, a lazy functional language, we do not make essential use of laziness. This is an essential difference with respect to other attribute grammar embeddings. This also means that an approach similar to ours can be followed in a strict functional setting such as Ocaml, for example.In the paper, our technique is applied to a significant number of problems that are well-known to the functional programming community, demonstrating its practical interest.- (undefined

    A Mechanized Proof of a Textbook Type Unification Algorithm

    Get PDF
    Unification is the core of type inference algorithms for modern functional programming languages, like Haskell and SML. As a first step towards a formalization of a type inference algorithm for such programming languages, we present a formalization in Coq of a type unification algorithm that follows classic algorithms presented in programming language textbooks. We also report on the use of such formalization to build a correct type inference algorithm for the simply typed λ-calculus
    corecore