Failure is Not an Option
The Curry-Howard-Shadok correspondence
Pierre-Marie Pédrot joint work with Nicolas Tabareau
Max Planck Institute for Software Systems
Séminaire PPS
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 1 / 44
Failure is Not an Option The Curry-Howard-Shadok correspondence - - PowerPoint PPT Presentation
Failure is Not an Option The Curry-Howard-Shadok correspondence Pierre-Marie Pdrot joint work with Nicolas Tabareau Max Planck Institute for Software Systems Sminaire PPS P.-M. Pdrot (MPI-SWS) Failure is Not an Option 22/02/2018 1 / 44
The Curry-Howard-Shadok correspondence
Pierre-Marie Pédrot joint work with Nicolas Tabareau
Max Planck Institute for Software Systems
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 1 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 3 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 3 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 3 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 3 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 4 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 4 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 4 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 5 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 5 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 5 / 44
Weaker conversion rule Full dependent elimination Good old ML semantics Full conversion rule Weaker dependent elimination Strange PL realm
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 6 / 44
Weaker conversion rule Full dependent elimination Good old ML semantics Full conversion rule Weaker dependent elimination Strange PL realm
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 6 / 44
CBV / algebra hom.)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 7 / 44
= CBV / algebra hom.)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 7 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 8 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 9 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 9 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 9 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 9 / 44
raise x A B e x A raise B e match raise e ret P with p raise P raise e e
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 10 / 44
raise (Πx : A. B) e ≡ λx : A. raise B e match (raise I e) ret P with ⃗ p ≡ raise (P (raise I e)) e
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 10 / 44
raise (Πx : A. B) e ≡ λx : A. raise B e match (raise I e) ret P with ⃗ p ≡ raise (P (raise I e)) e
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 10 / 44
raise (Πx : A. B) e ≡ λx : A. raise B e
catch P P true P false e E P raise e b P b
rect
P P true P false b P b
catch P pt pf pe true pt catch P pt pf pe false pf catch P pt pf pe raise e pe e
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 11 / 44
raise (Πx : A. B) e ≡ λx : A. raise B e
catchB : ΠP : B → □. P true → P false → (Πe : E. P (raise B e)) → Πb : B. P b Brect : ΠP : B → □. P true → P false → Πb : B. P b
catchB P pt pf pe true ≡ pt catchB P pt pf pe false ≡ pf catchB P pt pf pe (raise B e) ≡ pe e
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 11 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 12 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 12 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 12 / 44
Pro: Sets! Con: Sets!
Pro: Computational, computer-science friendly. Con: Not foundational (requires an alien meta-theory), not decidable.
Pro: Abstract, subsumes the two former ones. Con: Realizability + very low level, gazillion variants, intrisically typed, static.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 13 / 44
Pro: Sets! Con: Sets!
Pro: Computational, computer-science friendly. Con: Not foundational (requires an alien meta-theory), not decidable.
Pro: Abstract, subsumes the two former ones. Con: Realizability + very low level, gazillion variants, intrisically typed, static.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 13 / 44
Pro: Sets! Con: Sets!
Pro: Computational, computer-science friendly. Con: Not foundational (requires an alien meta-theory), not decidable.
Pro: Abstract, subsumes the two former ones. Con: Realizability + very low level, gazillion variants, intrisically typed, static.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 13 / 44
Pro: Sets! Con: Sets!
Pro: Computational, computer-science friendly. Con: Not foundational (requires an alien meta-theory), not decidable.
Pro: Abstract, subsumes the two former ones. Con: Realizability + very low level, gazillion variants, intrisically typed, static.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 13 / 44
Pro: Sets! Con: Sets!
Pro: Computational, computer-science friendly. Con: Not foundational (requires an alien meta-theory), not decidable.
Pro: Abstract, subsumes the two former ones. Con: Realizability + very low level, gazillion variants, intrisically typed, static.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 13 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 14 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 14 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 14 / 44
CIC M
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 15 / 44
CIC M
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 15 / 44
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 15 / 44
∆
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 15 / 44
∆
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 15 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 16 / 44
CIC
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 17 / 44
CIC
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 17 / 44
CIC
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 17 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 17 / 44
CIC M
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 18 / 44
CIC M
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 18 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 18 / 44
raise x A B e x A raise B e x A B e x A B e e x A B e
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 19 / 44
raise x A B e x A raise B e x A B e x A B e e x A B e
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 19 / 44
[raise (Πx : A. B) e] ≡ [λx : A. raise B e] ≡ ≡ π2 ((Πx : [ [A] ]. [ [B] ]), (λ(e : E) (x : [ [A] ]). π2 [ [B] ] e)) [e] ≡ λx : [ [A] ]. π2 [B] [e]
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 19 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 20 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 20 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 20 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 21 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 21 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 22 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 22 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 22 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 22 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 23 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 23 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 23 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 23 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 23 / 44
CIC P
CIC
CIC
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 24 / 44
CIC P
CIC
CIC
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 24 / 44
1 type, then ⊢CIC [
CIC
CIC
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 24 / 44
1 type, then ⊢CIC [
1 types, ⊢CIC Πp : P. ¬¬Q implies ⊢CIC Πp : P. Q.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 24 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 25 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 26 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 26 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 26 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 27 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 27 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 27 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 27 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 27 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 27 / 44
CIC M
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 28 / 44
CIC M
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 28 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 28 / 44
CIC M
CIC M
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 29 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 29 / 44
E the resulting theory. It inherits a lot from CIC!
E is consistent.
E enjoys canonicity, i.e if ⊢T p
E M : N then M ⇝∗ ¯
E has decidable type-checking, strong normalization and whatnot.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 30 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 31 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 31 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 31 / 44
E is not a conservative extension of CIC.
p
p a semantical layer atop of it.
p is the embodiement of Kreisel modifjed realizability in CIC.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 32 / 44
E is not a conservative extension of CIC.
E
p a semantical layer atop of it.
p is the embodiement of Kreisel modifjed realizability in CIC.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 32 / 44
E is not a conservative extension of CIC.
E
p a semantical layer atop of it.
p is the embodiement of Kreisel modifjed realizability in CIC.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 32 / 44
E is not a conservative extension of CIC.
E
E a semantical layer atop of it.
p is the embodiement of Kreisel modifjed realizability in CIC.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 32 / 44
E is not a conservative extension of CIC.
E
E a semantical layer atop of it.
E is the embodiement of Kreisel modifjed realizability in CIC.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 32 / 44
E
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 33 / 44
E
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 33 / 44
p, AC
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 34 / 44
E , ACN is a consequence of dependent elimination.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 34 / 44
E , ACN is a consequence of dependent elimination.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 34 / 44
KR
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 35 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 35 / 44
E validates IP, owing to the fact that in TE, every type is inhabited.
In , build a term ip IP Given f A n P n, apply it to raise A e. If the returned integer is pure, return it with the associated proof. Otherwise, return a dummy integer and failing proof. Easy to show that ip is actually valid in
p.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 36 / 44
E validates IP, owing to the fact that in TE, every type is inhabited.
In TE, build a term ip : IP Given f : ¬A → Σn : N. P n, apply it to raise (¬A) e. If the returned integer is pure, return it with the associated proof. Otherwise, return a dummy integer and failing proof. Easy to show that ip is actually valid in T p
E .
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 36 / 44
p MP and thus
CIC MP.
(This was proved recently by Coquand-Mannaa, although in a completely difgerent way.)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 37 / 44
p MP and thus
CIC MP.
(This was proved recently by Coquand-Mannaa, although in a completely difgerent way.)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 37 / 44
p MP and thus
CIC MP.
(This was proved recently by Coquand-Mannaa, although in a completely difgerent way.)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 37 / 44
E MP and thus ̸⊢CIC MP.
(This was proved recently by Coquand-Mannaa, although in a completely difgerent way.)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 37 / 44
E satisfjes defjnitional η-expansion: λx : A. M x ≡ M.
E Πi : 1. i = tt
E (λi : 1. i) ̸= (λi : 1. tt)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 38 / 44
E satisfjes defjnitional η-expansion: λx : A. M x ≡ M.
E Πi : 1. i = tt
E (λi : 1. i) ̸= (λi : 1. tt)
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 38 / 44
E ?
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 39 / 44
E in Coq in a plugin.
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 40 / 44
p, a type theory that allows local failure!
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 41 / 44
E , a type theory that allows local failure!
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 41 / 44
E , a type theory that allows local failure!
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 41 / 44
E , a type theory that allows local failure!
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 41 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 42 / 44
P.-M. Pédrot (MPI-SWS) Failure is Not an Option 22/02/2018 44 / 44