Ghost Reflection Overview

Formalisation of the “Dependent Ghosts Have a Reflection For Free” paper

The list of lemmas and theorems of the paper is replicated in Assumptions.

Utility

General tactics, lemmas and notations are defined in Util.

Syntax

We define the syntax for two languages: the Calculus of Constructions (CC) and our own Ghost Type Theory (GTT). BasicAST contains the notion of mode and of universe levels. autosubst/CCAST.sig and autosubst/GAST.sig are used to generate the autosubst/CCAST and autosubst/GAST modules. autosubst/core, autosubst/unscoped and SubstNotations contain the Autosubst library and some notations. autosubst/RAsimpl contains implementation for the rasimpl tactic, whereas [autosubst/CCAST_rasimpl] and [autosubst/GAST_rasimpl] provide the corresponding instances for CC and GTT.

ContextDecl defines contexts for both theories.

Ghost Type Theory

Module Description
CastRemoval Operation which removes casts from a term.
Scoping Definition of scoping (checks modes)
TermMode Syntactic computation of mode
Univ Utility on universes (successor, max…)
TermNotations Some shorthands for implication and so on…
Typing Conversion and typing judgements
BasicMetaTheory Meta-theory like substitution and validity

Calculus of Constructions

Module Description
CScoping Scoping
CTyping Typing
CCMetaTheory Substitution and the like

Model

Module Description
Erasure Erasure translation
Revival Revival translation
Param Parametricity translation
Model Consequences of the model
Admissible Simpler typing rules for GTT, assuming injectivity of Π-types
FreeTheorem Proof-of-concept free theorem for GTT
Examples Examples from the paper

GRTT (theory with reflection of equality)

Module Description
RTyping Typing for GRTT
Potential Notion of potential translation
ElimReflection Translation from GRTT to GTT

Inductive types

We handle booleans directly in the syntax of GTT and CC, but for natural numbers and vectors we opted for a different approach: we build the terms directly in Coq as it is much easier to do. We then assume constants in CC with exactly the types we inhabit in TransNat and TransVec.

Module Description
TransNat Erasure and parametricity for nat
TransVec Erasure and parametricity for vec