Algebra of programming in Agda: Dependent types for relational program derivation
نویسندگان
چکیده
Relational program derivation is the technique of stepwise refining a relational specification to a program by algebraic rules. The program thus obtained is correct by construction. Meanwhile, dependent type theory is rich enough to express various correctness properties to be verified by the type checker. We have developed a library, AoPA, to encode relational derivations in the dependently typed programming language Agda. A program is coupled with an algebraic derivation whose correctness is guaranteed by the type system. Two non-trivial examples are presented: an optimisation problem, and a derivation of quicksort where well-founded recursion is used to model terminating hylomorphisms in a language with inductive types.
منابع مشابه
On dependent types and intuitionism in programming mathematics
It is discussed a practical possibility of a provable programming of mathematics basing on intuitionism and the dependent types feature of a programming language. The principles of constructive mathematics and provable programming are illustrated with examples taken from algebra. The discourse follows the experience in designing in Agda a computer algebra library DoCon-A, which deals with gener...
متن کاملDependent types for an adequate programming of algebra
This research compares the author’s experience in programming algebra in Haskell and in Agda (currently the former experience is large, and the latter is small). There are discussed certain hopes and doubts related to the dependently typed and verified programming of symbolic computation. This concerns the 1) author’s experience history, 2) algebraic class hierarchy design, 3) proof cost overhe...
متن کاملAlgebra of Programming Using Dependent Types
Dependent type theory is rich enough to express that a program satisfies an input/output relational specification, but it could be hard to construct the proof term. On the other hand, squiggolists know very well how to show that one relation is included in another by algebraic reasoning. We demonstrate how to encode functional and relational derivations in a dependently typed programming langua...
متن کاملA formal derivation of an executable Krivine machine
There is a close relationship between lambda calculi with explicit substitutions and abstract machines. Biernacka and Danvy [7] have shown how to derive several well-known abstract machines including the Krivine machine [14, 15, 21, 22], the CEK machine [19], and the Zinc machine [23]. Starting with a functional program that evaluates by repeated head reduction, each of these abstract machines ...
متن کاملA Brief Overview of Agda - A Functional Language with Dependent Types
We give an overview of Agda, the latest in a series of dependently typed programming languages developed in Gothenburg. Agda is based on Martin-Löf’s intuitionistic type theory but extends it with numerous programming language features. It supports a wide range of inductive data types, including inductive families and inductive-recursive types, with associated flexible pattern-matching. Unlike ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- J. Funct. Program.
دوره 19 شماره
صفحات -
تاریخ انتشار 2009