TheoWinterhalter/formal-type-theory
{ "createdAt": "2016-10-17T13:53:32Z", "defaultBranch": "master", "description": "Formalising Type Theory in a modular way for translations between type theories", "fullName": "TheoWinterhalter/formal-type-theory", "homepage": "", "language": "Coq", "name": "formal-type-theory", "pushedAt": "2018-01-10T15:25:03Z", "stargazersCount": 95, "topics": [ "formalization", "reflection", "type-theory" ], "updatedAt": "2025-05-17T23:00:18Z", "url": "https://github.com/TheoWinterhalter/formal-type-theory"}A formalization of type theory in Coq
Section titled “A formalization of type theory in Coq”This Coq library formalizes dependent type theory in the style of Per Martin-Löf. The formalization is configurable in the sense that various components can be turned on or off, or be left ambivalent. It is thus easy to instantiate many variants of type theory, such as extensional vs. intensional, with or without universes, etc. The library also formalizes several meta-theorems about type theory.
Requirements
Section titled “Requirements”Requirements for compiling the library
Section titled “Requirements for compiling the library”The library works with Coq 8.6, and probably with many other recent versions as well, as it does not use any special features of Coq. You may find out about the best way to install Coq at the Coq web site.
To compile the library you need Coq and make.
Requirements for generating the LaTeX version of rules
Section titled “Requirements for generating the LaTeX version of rules”In order to generate the LaTeX version of the rules you need Python (either version 2.7 or 3.x) and (obviously) LaTeX, as well as the mathpartir package by Didier Rémy.
Since the mathpartir package is GNU-licensed, and we do not want a viral license, the
compilation script attempts to download it using the curl and wget commands. If
neither is available, you will have
to download mathpartir manually
and place it in the latex subfolder of the repository.
Download
Section titled “Download”The best way to download the library is to clone it from GitHub. If you do not use git (you should) then you can just download the ZIP file of the latest version. Even better, you can fork the repository so that you can easily send us your improvements (see the section on contributions below).
Compiling
Section titled “Compiling”To compile the library and the LaTeX version of the rules run
makefrom the command line. The library is in the src subfolder and the PDF with the rules is latex/rules.pdf.
Specific targets for make are:
clean— clean fileslatex/rules.pdf— the rules in PDF, the file can be found inlatex/rules.pdflatex/rulesParanoid.pdf— the rules in PDF, but with preconditionslibrary— compile the library only
For example, make latex/rules.pdf generates the file latex/rules.pdf.
Using the library
Section titled “Using the library”This section briefly describes how the library is structured and how it can be used and extended.
The files
Section titled “The files”The src folder contains the Coq files. Here is an overview of what is in them:
config.v— configuration optionsconfig_tactics.v— tactics for dealing with configuration optionsett.v— economic type theoryett2ptt.v— proof that we can pass from economic to paranoid type theoryett_sanity.v— proof that economic type theory is saneinversion.v— inversion lemmasnegfunext.v— proof that function extensionality is not provable in MLTTptt.v— paranoid type theoryptt2ett.v— proof that we can pass from paranoid to economic type theoryptt_admissible.v— various admissibility lemmas for paranoid type theoryptt_inversion.v— inversion principles for paranoid type theoryptt_sanity.v— proof that paranoid type theory is sanesubstitution_elim.v— an attempt to show that explicit substitutions can be computedsyntax.v— definition of presytnaxtactics.v— tactics for working with the librarytt.v— all the rules of type theoryuniqueness.v— proof of uniqueness of typing
Git branches
Section titled “Git branches”The current version of the library is on the master branch, the rest is kept around for legacy:
mastercontains the current status of the translation (sanity is being handled, as well as uniqueness of typing),zero-shiftcontains another formulation of type theory where substitutions have context annotations (probably a bad idea)simpler-substitutionsremoves all annotations from substitutions but this results in the loss of uniqueness of typing,faster-magicis its counter-part and maybe should be kept instead ofsimpler-substitutions,untyped-reflcorrresponds to an experiment regarding the removal of typing annotation torefl,inversioncorresponds to inversion lemmata (probably subsumed by more recent work),into-coqandinto-coq-attemptwere branches where we were trying to eliminate reflection by translation from our formalised type theory to Coq directly, but e failed.bool-disjointis about showing thattrue = false -> Empty(inside the theory),bool-large-elimis about adding large elimination for Bool.
How the library is structured
Section titled “How the library is structured”(To be written)
Contributors
Section titled “Contributors”- [Théo Winterhalter]!()
- Andrej Bauer
- Philipp Haselwarter