Shallow Embedding of Type Theory is Morally Correct

07/17/2019
by   Ambrus Kaposi, et al.
0

There are multiple ways to formalise the metatheory of type theory. For some purposes, it is enough to consider specific models of a type theory, but sometimes it is necessary to refer to the syntax, for example in proofs of canonicity and normalisation. One option is to embed the syntax deeply, by using inductive definitions in a proof assistant. However, in this case the handling of definitional equalities becomes technically challenging. Alternatively, we can reuse conversion checking in the metatheory by shallowly embedding the object theory. In this paper, we consider the standard model of a type theoretic object theory in Agda. This model has the property that all of its equalities hold definitionally, and we can use it as a shallow embedding by building expressions from the components of this model. However, if we are to reason soundly about the syntax with this setup, we must ensure that distinguishable syntactic constructs do not become provably equal when shallowly embedded. First, we prove that shallow embedding is injective up to definitional equality, by modelling the embedding as a syntactic translation targeting the metatheory. Second, we use an implementation hiding trick to disallow illegal propositional equality proofs and constructions which do not come from the syntax. We showcase our technique with very short formalisations of canonicity and parametricity for Martin-Löf type theory. Our technique only requires features which are available in all major proof assistants based on dependent type theory.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/30/2023

Formalizing Monoidal Categories and Actions for Syntax with Binders

We discuss some aspects of our work on the mechanization of syntax and s...
research
02/01/2019

Signatures and Induction Principles for Higher Inductive-Inductive Types

Higher inductive-inductive types (HIITs) generalize inductive types of d...
research
11/19/2019

Failure of Normalization in Impredicative Type Theory with Proof-Irrelevant Propositional Equality

In type theory with an impredicative universe of propositions and a proo...
research
02/01/2021

Quadratic type checking for objective type theory

We introduce a modification of standard Martin-Lof type theory in which ...
research
02/01/2018

HOL Light QE

We are interested in algorithms that manipulate mathematical expressions...
research
03/02/2022

Characteristics of de Bruijn's early proof checker Automath

The `mathematical language' Automath, conceived by N.G. de Bruijn in 196...
research
03/11/2016

A Set Theoretic Approach for Knowledge Representation: the Representation Part

In this paper, we propose a set theoretic approach for knowledge represe...

Please sign up or login with your details

Forgot password? Click here to reset