Dependent 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. Yet, the trustworthiness comes for a price: type inference involves an increasing number of proof
obligations.
Automation of this process becomes necessary for any system with dependent
types that aims to be usable in practice. At the same time, implementation of automation in a verified manner is prohibitively complex. Sometimes, external solvers
are used to aid the automation. These solvers may be based on classical logic and
may not be themselves verified, thus compromising the guarantees provided by constructive nature of type theory. In this thesis, we explore the idea of proof relevant
resolution that allows automation of type inference in type theory in a verifiable and
constructive manner, hence to restore the confidence in programs and the trustworthiness of software.
Technical content of this thesis is threefold. First, we propose a novel framework for proof-relevant resolution. We take two constructive logics, Horn-clause
and hereditary Harrop formulae logics as a starting point. We formulate the standard big-step operational semantics of these logics. We expose their Curry-Howard
nature by treating formulae of these logics as types and proofs as terms thus developing a theory of proof-relevant resolution. We develop small-step operational
semantics of proof-relevant resolution and prove it sound with respect to the big-step
operational semantics.
Secondly, we demonstrate our approach on an example of type inference in Logical Framework (LF). We translate a type-inference problem in LF into resolution
in proof-relevant Horn-clause logic. Such resolution provides, besides an answer
substitution to logic variables, a proof term that captures the resolution tree. We
interpret the proof term as a derivation of well-formedness judgement of the object in the original problem. This allows for a straightforward implementation of
type checking of the resolved solution since type checking is reduced to verifying the derivation captured by the proof term. The theoretical development is substantiated
by an implementation.
Finally, we demonstrate that our approach allows to reason about semantic properties of code. Type class resolution has been well-known to be a proof-relevant fragment of Horn-clause logic, and recently its coinductive extensions were introduced.
In this thesis, we show that all of these extensions amalgamate with the theoretical
framework we introduce. Our novel result here is exposing that the coinductive
extensions are actually based on hereditary Harrop logic, rather than Horn-clause
logic. We establish a number of soundness and completeness results for them. We
also discuss soundness of program transformation that are allowed by proof-relevant
presentation of type class resolution