Automatic generation of proof terms in dependently typed programming languages
Abstract
Dependent type theories are a kind of mathematical foundations investigated both for the formalisation of mathematics and for reasoning about programs. They are implemented as the kernel of many proof assistants and programming languages with proofs (Coq, Agda, Idris, Dedukti, Matita, etc). Dependent types allow to encode elegantly and constructively the universal and existential quantifications of higher-order logics and are therefore adapted for writing logical propositions and proofs. However, their usage is not limited to the area of pure logic. Indeed, some recent work has shown that they can also be powerful for driving the construction of programs. Using more precise types not only helps to gain confidence about the program built, but it can also help its construction, giving rise to a new style of programming called Type-Driven Development.
However, one difficulty with reasoning and programming with dependent types is that proof obligations arise naturally once programs become even moderately sized. For example, implementing an adder for binary numbers indexed over their natural number equivalents naturally leads to proof obligations for equalities of expressions over natural numbers. The need for these equality proofs comes, in intensional type theories (like CIC and ML) from the fact that in a non-empty context, the propositional equality allows us to prove as equal (with the induction principles) terms that are not judgementally equal, which implies that the typechecker can't always obtain equality proofs by reduction.
As far as possible, we would like to solve such proof obligations automatically, and we absolutely need it if we want dependent types to be used more broadly, and perhaps one day to become the standard in functional programming. In this thesis, we show one way to automate these proofs by reflection in the dependently typed programming language Idris. However, the method that we follow is independent from the language being used, and this work could be reproduced in any dependently-typed language. We present an original type-safe reflection mechanism, where reflected terms are indexed by the original Idris expression that they represent, and show how it allows us to easily construct and manipulate proofs. We build a hierarchy of correct-by-construction tactics for proving equivalences in semi-groups, monoids, commutative monoids, groups, commutative groups, semi-rings and rings. We also show how each tactic reuses those from simpler structures, thus avoiding duplication of code and proofs. Finally, and as a conclusion, we discuss the trust we can have in such machine-checked proofs.
Type
Thesis, PhD Doctor of Philosophy
Rights
Attribution-NonCommercial-NoDerivatives 4.0 International
http://creativecommons.org/licenses/by-nc-nd/4.0/
Collections
Except where otherwise noted within the work, this item's licence for re-use is described as Attribution-NonCommercial-NoDerivatives 4.0 International
Items in the St Andrews Research Repository are protected by copyright, with all rights reserved, unless otherwise indicated.
Related items
Showing items related by title, author, creator and subject.
-
Automating Event-B invariant proofs by rippling and proof patching
Lin, Yuhui; Bundy, Alan; Grov, Gudmund; Maclean, Ewen (2019-02) - Journal articleThe use of formal method techniques can contribute to the production of more reliable and dependable systems. However, a common bottleneck for industrial adoption of such techniques is the needs for interactive proofs. We ... -
Proof-relevant resolution - the foundations of constructive proof automation
Farka, František (University of St Andrews, 2021-06-30) - ThesisDependent type theory is an expressive programming language. This language allows to write programs that carry proofs of their properties. This in turn gives high confidence in such programs, making the software trustworthy. ... -
Normalisation techniques in proof theory and category theory
Hamza, Taher Tawfik Ahmed (University of St Andrews, 1986) - ThesisThe word problem for the free categories with some structure generated by a category X can be solved using proof-theoretical means. These free categories give a semantics in which derivations of GENTZEN's propositional ...