COQHOTT A NEW PROOF-ASSISTANT THAT REVISITS THE THEORETICAL FOUNDATIONS OF COQ USING HOMOTOPY TYPE THEORY NICOLAS TABAREAU
The CoqHoTT project Design and implement a brand-new proof assistant by revisiting the theoretical foundations of Coq. Type Theory Homotopy Type Theory 2
Coq: a success but... Based on the correspondence: Formula Type Proof Program Type Theory has been developed, providing a common language for mathematics and computer science Coq Program certification CompCert Compiler Theorem Proving The 4 Colour Theorem 3
Coq: a success but... Program certification: First ever certified C-Compiler CompCert Compiler Theorem proving: High impact in computer science as well as in mathematics extraction The 4 Colour Theorem 3
... not the last word Many weaknesses cannot be solved without changing the theoretical foundations of Coq: common operators/principles cannot be constructed (eg., general fixpoints or the law of excluded middle) the notion of equality is too weak 4
... not the last word Many weaknesses cannot be solved without changing the theoretical foundations of Coq: common operators/principles cannot be constructed (eg., general fixpoints or the law of excluded middle) the notion of equality is too weak Example: bounded integers (n;bounded_n) (n;bounded_n) 4
Only one way out make use of axioms consistency issues valid axioms can be wrong altogether breaks the extraction mechanism axioms have no computational meaning limits possibility of automation can not use reflection in the proof 5
The CoqHoTT project Design and implement a brand-new proof assistant by revisiting the theoretical foundations of Coq. Type Theory Homotopy Type Theory 6
The CoqHoTT project Design and implement a brand-new proof assistant by revisiting the theoretical foundations of Coq. Type Theory Homotopy Type Theory Uniform equality (syntactic) Relativized equality (semantic) 6
Wait, what is Type Theory about? 7
The denotational semantics trinity 8
The denotational semantics trinity Curry-Howard Correspondance 9
The simply typed λ-calculus variable abstraction application weakening contraction exchange x :A x :A, x :A P :B x.p :A B P :A B Q :A, PQ :B P :B, x :A P :B, x :A, y :A P :B, z :A P [x, y z] :B, x :A, y :B, P :C, y :B, x :A, P :C 10
Intuitionistic minimal logic axiom I E weakening contraction exchange x :A x :A, x :A P :B x.p :A B P :A B Q :A, PQ :B P :B, x :A P :B, x :A, y :A P :B, z :A P [x, y z] :B, x :A, y :B, P :C, y :B, x :A, P :C 10
Intuitionistic minimal logic axiom I E weakening Curry Howard contraction exchange x :A x :A, x :A P :B x.p :A B P :A B Q :A, PQ :B P :B, x :A P :B, x :A, y :A P :B, z :A P [x, y z] :B, x :A, y :B, P :C, y :B, x :A, P :C 10
Other correspondances Cut elimination β-reduction 11
Type Theory of Coq Lifting the Curry-Howard correspondance to dependent types more complex formulas n : nat. m : nat. Id (m, n + 1) n : nat. m : nat. m = n + 1 12
Type Theory of Coq Lifting the Curry-Howard correspondance to dependent types more complex formulas ` Prod/Sigma,x: A ` B type ` / x : A.B type 13
Type Theory of Coq Lifting the Curry-Howard correspondance to dependent types more complex formulas ` Prod/Sigma,x: A ` B type ` / x : A.B type Type checking Correctness checking 13
Type Theory and Logic Types Logic A proposition a : A proof B(x) predicate b(x) : B(x) conditional proof 0, 1?, > A + B A_ B A B A^ B A! B A ) B Â (x:a) B(x) 9 x:a B(x) (x:a) B(x) 8 x:a B(x) Id A equality = 14
Type Theory and Logic Types Logic A proposition a : A proof B(x) predicate b(x) : B(x) conditional proof 0, 1?, > A + B A_ B A B A^ B A! B A ) B Â (x:a) B(x) 9 x:a B(x) (x:a) B(x) 8 x:a B(x) Id A equality = How is equality modeled? 14
Equality in Type Theory Equality is described using Martin-Löf Identity Type. refl : a:a (a = A a) Path induction: Given a family and a function there is a function such that C : x,y:a c : x:a f : (x,y:a) (x = A y)! U C(x, x, refl x ), (p:x= A y) C(x, y, p) f (x, x, refl x ) : c(x). 15
Equality in Type Theory Equality is described using Martin-Löf Identity Type. refl : a:a (a = A a) Leibniz principle of Indiscernability of Identicals Path induction: Given a family and a function there is a function such that C : x,y:a c : x:a f : (x,y:a) (x = A y)! U C(x, x, refl x ), (p:x= A y) C(x, y, p) f (x, x, refl x ) : c(x). 15
Equality in Type Theory A formulation using the type system: ` ` { } Id ` T type ` A, B : T ` Id T ABtype Id-Intro ` t : T ` refl T t : Id T tt Id-Elim (J) ` i : Id T tu,x: T,e : Id T tx`p type ` p : P {t/x, refl T t/e} ` J x e.p ip: P {u/x, i/e} 16
Type and Set Theory Types A a : A B(x) b(x) : B(x) 0, 1 A + B A B A! B Â (x:a) B(x) (x:a) B(x) Id A Sets set element family of sets family of elements, { } disjoint union set of pairs set of functions disjoint sum product { (x, x) x 2 A } view on type-theoreti 17
Problem with Identity Type The following definitions should coincides with equality. Functional Extensionality: ( f g) : x:a ( f (x) =g(x)). Univalence: (A ' B) : Â f :A!B isequiv( f ). where isequiv( f ) : Â g:b!a ( f g id B ) Â h:b!a (h f id A )! 18
Type and Homotopy Theory Types A a : A B(x) b(x) : B(x) 0, 1 A + B A B A! B Â (x:a) B(x) (x:a) B(x) Id A Homotopy space point fibration section, coproduct product space function space total space space of sections path space A I 19
Type and Homotopy Theory From an homotopy theoretic perspective, functional extensionality and univalence are perfectly valid. Problem: How to enhance Type Theory in order to reflect homotopic intuition? 20
The Big Challenge Revisit the theory behind Coq using HoTT and provide a brand-new proof assistant with: equality as a first-class citizen axiom-free extensions of the logic 21
The Big Challenge Revisit the theory behind Coq using HoTT and provide a brand-new proof assistant with: equality as a first-class citizen axiom-free extensions of the logic Apart from relaxing the drawbacks of using axioms, it will simplify a lot the development of new proofs for users. (n;bounded_n) = (n;bounded_n) 21
State of the art. Homotopy Type Theory Idea: equality homotopy + the univalence principle [Streicher, Voevodsky], which allows to derive equality principles used in mathematics: Definition univalence := 8 TU: Type, T U! T = U. 22
State of the art. Homotopy Type Theory Idea: equality homotopy + the univalence principle [Streicher, Voevodsky], which allows to derive equality principles used in mathematics: Definition univalence := 8 TU: Type, T U! T = U. Issue: Univalence is still stated as an axiom. 22
State of the art. Logic Extension in Mathematical Logic Idea: Translating formulas of rich logic into formulas of a simpler logic by using complex proof transformations logic with new principles forcing sheafification original logic 23
State of the art. Logic Extension in Mathematical Logic Idea: Translating formulas of rich logic into formulas of a simpler logic by using complex proof transformations logic with new principles forcing sheafification original logic Issue: Type Theory Mathematical Logic 23
CoqHoTT Challenges C1 Type Theory with a built-in notion of univalence C2 Implement CoqHoTT without overhead C3 Define and implement Higher Inductive Types C4 Extend Type Theory without axioms 24
CoqHoTT Challenges C1 Type Theory with a built-in notion of univalence C2 Implement CoqHoTT without overhead C3 Define and implement Higher Inductive Types C4 Extend Type Theory without axioms 24
Type Theory with Univalence type T is a space 25
Type Theory with Univalence type T is a space programs a:t are points proofs of equality p : a = b are paths 25
Type Theory with Univalence type T is a space Path operations: id p -1 q o p : a =T a : b =T a : a =T c Homotopies: left-id : id o p =a=b p programs a:t are points proofs of equality p : a = b are paths right-id : p o id =a=b p assoc : r o (q o p) = a=d (r o q) o p 25
Type Theory with Univalence and Higher Homotopies Equality Homotopy -Groupoid reflexivity constant path identity morphism symmetry inversion of paths inverse morphism transitivity concatenation of paths composition of morphisms Because of proof-relevance, we can t stop after proving symmetry and transitivity of equality: we need to know that these operations on equalities are well-behaved. 26
Type Theory with Univalence and Higher Homotopies The main novelty of this approach is to realize that homotopies between homotopies cannot be omitted, and this up to infinite dimension. 27
Type Theory with Univalence and Higher Homotopies The main novelty of this approach is to realize that homotopies between homotopies cannot be omitted, and this up to infinite dimension. Requires to consider types as -groupoids 27
A hierarchy of types HoTT classifies types based on the complexity of the equality type. Simplest (singleton) types are called contractible: iscontr(a) : Â (a:a) (x:a) (a = x). 28
A hierarchy of types HoTT classifies types based on the complexity of the equality type. Then, n-types are defined inductively: Define the predicate is-n-type : U! U for n 2 by recursion as follows: is-n-type(x) : ( iscontr(x) if n = 2, (x,y:x) is-n 0 -type(x = X y) if n = n 0 + 1. 29
A hierarchy of types This defines the following hierarchy: Level of Type (-2)-Type (-1)-Type 0-Type 1-Type Type Homotopy Type Theory unit / contactible type h-propositions h-sets h-groupoids -groupoids 30
How to reflect this new point of view on equality in type theory while keeping decidable type inference? 31
How to reflect this new point of view on equality in type theory while keeping decidable type inference? Idea: Extend type theory with new constructors, such as Kan fillers. 31
Compilation to Type Theory Our approach is to provide a meaning to HoTT by a compilation/translation to Type Theory. 32
Compilation to Type Theory Our approach is to provide a meaning to HoTT by a compilation/translation to Type Theory. Homotopy Type Theory Compilation Type Theory Type-Checker Relativized equality Uniform equality Correct a p p -1 b q Univalence Higher algebraic structure Incorrect c This compilation phase uses higher algebraic structure (e.g., -groupoids, cubical sets [Coquand et al.]) 32
Extend Type Theory without Axioms We will use the fact that: Homotopy Type Theory = Higher Mathematical Logic 33
Extend Type Theory without Axioms Using Compilation Phases We will use the fact that: Homotopy Type Theory = Higher Mathematical Logic Consider logical transformations (forcing, sheafification) of mathematical logic as compilation phases in HoTT: increase the power of the logic without axioms change the logic at compile time, according to a trade-off between efficiency and logical expressivity 33
Extend Type Theory without Axioms Using Compilation Phases We will use the fact that: Homotopy Type Theory = Higher Topos Theory [Lurie] Consider logical transformations (forcing, sheafification) of mathematical logic as compilation phases in HoTT: increase the power of the logic without axioms change the logic at compile time, according to a trade-off between efficiency and logical expressivity 33
Extend Type Theory without axioms using a compilation phase CoqHoTT + Classical Logic Added principle : Excluded Middle Sheaf Translation w/ Dense Topology Forcing Translation w/ Natural Numbers CoqHoTT + General Induction Added principles : General Inductive Types Löb Rule CoqHoTT CoqHoTT + Axiom of Choice CoqHoTT + Kripke Semantics Added principle : Dependent AC Sheaf Translation w/ Dense Topology Natural Numbers Forcing Translation w/ worlds Added principle : Modal Logic 34
Methodology. Distinct compilation phases II Compile complex type theories into simpler ones. Full CoqHoTT w/o Axiom of Choice w/o General Fixpoints inherit consistency of Coq w/o Univalence w/o Kripke Semantics w/o Classical Logic split the complexity Kernel of Coq Compiled Coq of type checking 35
Expected Impacts Our expectation is that CoqHoTT will become a popular proof assistant among: software engineers : faster and simpler developments computer scientists: integration of type isomorphisms mathematicians : new equality and logical expressivity 36
The CoqHoTT team The PI (75 % of his time) will take charge of the overall scientific direction. Matthieu Sozeau (20%) is one of the main developers of Coq and its expertise on the subject is crucial to the CoqHoTT project. Non-Permanent Staff (ERC): 3 PhD, 5 Post-Docs, 1 software engineer Non-Permanent Staff (Host Institution, Inria): 1 PhD, 1 Post-Doc, 1 support engineer and hopefully more CoqHoTT, Coq for Homotopy Type Theory 37
inside a very active community CoqHoTT, Coq for Homotopy Type Theory 37
CoqHoTT in a nutshell New proof-assistant based on HoTT Equality as a first-class citizen Axiom-free extensions of the logic Defined using distinct compilations phases A world-class group on a new generation of proof assistants 38
Bibliography [1] Homotopy Type Theory: Univalent Foundations of Mathematics. The Univalent Foundations Program. Institute for Advanced Study. [2] A Model of Type Theory in Cubical Sets. Bezem M., Coquand T., Huber S. (2013). [3] Higher Topos Theory. Lurie J. Annals of Mathematics Studies, Princeton University Press, 2009. 39