Abstract

Type theory should be able to handle its own meta-theory, both to justify its foundational claims and to obtain a verified implementation. At the core of a type checker for intensional type theory lies an algorithm to check equality of types, or in other words, to check whether two types are convertible. We have formalized in Agda a practical conversion checking algorithm for a dependent type theory with one universe à la Russell, natural numbers, and η-equality for Π types. We prove the algorithm correct via a Kripke logical relation parameterized by a suitable notion of equivalence of terms. We then instantiate the parameterized fundamental lemma twice: once to obtain canonicity and injectivity of type formers, and once again to prove the completeness of the algorithm. Our proof relies on inductive-recursive definitions, but not on the uniqueness of identity proofs. Thus, it is valid in variants of intensional Martin-Löf Type Theory as long as they support induction-recursion, for instance, Extensional, Observational, or Homotopy Type Theory.

Highlights

  • A fundamental component of the implementation of a typed functional programming language is an algorithm that checks equality of types; even more so for dependently-typed languages where equality of types is non-trivial, as it depends on the equality of terms

  • The type-directed phase could be extended to η-equality for other types, by comparing how their elements behave under their eliminators, like it is done in Agda for records, singleton types and others

  • In previous works [Abel et al 2007; Abel and Scherer 2012; Harper and Pfenning 2005], two logical relations and two fundamental theorems are needed for the meta theory: one that entails soundness of the algorithmic equality, and one for completeness

Read more

Summary

INTRODUCTION

Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. In previous works [Abel et al 2007; Abel and Scherer 2012; Harper and Pfenning 2005], two logical relations and two fundamental theorems are needed for the meta theory: one that entails soundness of the algorithmic equality, and one for completeness. The abstract version of the fundamental theorem requires a logical relation parametrized on a generic notion of typed equality that is specified by 8 properties (see Section 3.1). We prove the properties necessary to instantiate the logical relation with the conversion algorithm and use the fundamental theorem to derive its completeness. With this we can derive the decidability of the conversion judgments, which proves the conversion algorithm’s correctness. This paper is best read in a PDF viewer, because definitions and lemmata in blue are clickable and will open the corresponding Agda code in a browser, which is available online.

A CORE TYPE THEORY WITH ONE UNIVERSE
Syntax
Rules and Semantics
KRIPKE LOGICAL RELATIONS
A Logical Relation for Reducibility
Properties of the Logical Relation
Validity Judgements
Properties of the Validity Judgements
DECIDABILITY
Conversion Algorithm
Properties of the Conversion Algorithm
CONCLUSION

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.