An Authoritarian Approach to Presheaves Pierre-Marie Pdrot INRIA - - PowerPoint PPT Presentation

an authoritarian approach to presheaves
SMART_READER_LITE
LIVE PREVIEW

An Authoritarian Approach to Presheaves Pierre-Marie Pdrot INRIA - - PowerPoint PPT Presentation

An Authoritarian Approach to Presheaves Pierre-Marie Pdrot INRIA Birmingham CS Seminar 5th June 2020 P.-M. Pdrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 1 / 63 CIC, a very fancy intuitionistic logical system . CIC, a


slide-1
SLIDE 1

An Authoritarian Approach to Presheaves

Pierre-Marie Pédrot INRIA

Birmingham CS Seminar

5th June 2020 P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 1 / 63
slide-2
SLIDE 2

It’s Time to CIC Ass CIC, the Calculus of Inductive Constructions.

CIC, a very fancy intuitionistic logical system. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types CIC, a very powerful functional programming language. Finest types to describe your programs No clear phase separation between runtime and compile time

The Pinnacle of the Curry-Howard correspondence

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 2 / 63
slide-3
SLIDE 3

It’s Time to CIC Ass CIC, the Calculus of Inductive Constructions.

CIC, a very fancy intuitionistic logical system. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types CIC, a very powerful functional programming language. Finest types to describe your programs No clear phase separation between runtime and compile time

The Pinnacle of the Curry-Howard correspondence

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 2 / 63
slide-4
SLIDE 4

It’s Time to CIC Ass CIC, the Calculus of Inductive Constructions.

CIC, a very fancy intuitionistic logical system. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types CIC, a very powerful functional programming language. Finest types to describe your programs No clear phase separation between runtime and compile time

The Pinnacle of the Curry-Howard correspondence

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 2 / 63
slide-5
SLIDE 5

It’s Time to CIC Ass CIC, the Calculus of Inductive Constructions.

CIC, a very fancy intuitionistic logical system. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types CIC, a very powerful functional programming language. Finest types to describe your programs No clear phase separation between runtime and compile time

The Pinnacle of the Curry-Howard correspondence

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 2 / 63
slide-6
SLIDE 6

It’s Time to CIC Ass CIC, the Calculus of Inductive Constructions.

CIC, a very fancy intuitionistic logical system. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types CIC, a very powerful functional programming language. Finest types to describe your programs No clear phase separation between runtime and compile time

The Pinnacle of the Curry-Howard correspondence

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 2 / 63
slide-7
SLIDE 7

Good Properties We Love

Consistency There is no proof of False. Implementability Type-checking is decidable. Canonicity Closed integers are indeed integers, i.e ⊢ M : N implies M ≡ S . . . S O Assuming we have a notion of reduction compatible with conversion: Normalization Reduction is normalizing Subject reduction Reduction is compatible with typing

Some of these properties are interdependent

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 3 / 63
slide-8
SLIDE 8

Good Properties We Love

Consistency There is no proof of False. Implementability Type-checking is decidable. Canonicity Closed integers are indeed integers, i.e ⊢ M : N implies M ≡ S . . . S O Assuming we have a notion of reduction compatible with conversion: Normalization Reduction is normalizing Subject reduction Reduction is compatible with typing

Some of these properties are interdependent

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 3 / 63
slide-9
SLIDE 9

Extending Coq

Our mission: to boldly extend type theory with new principles

we need to design models for that. and ensure they satisfy the good properties. Today we will focus on a specifjc family of models...

Presheaves!

Bread and Butter of Model Construction Proof-relevant Kripke semantics a.k.a. Intuitionistic Forcing

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 4 / 63
slide-10
SLIDE 10

Extending Coq

Our mission: to boldly extend type theory with new principles

⇝ we need to design models for that. ⇝ and ensure they satisfy the good properties. Today we will focus on a specifjc family of models...

Presheaves!

Bread and Butter of Model Construction Proof-relevant Kripke semantics a.k.a. Intuitionistic Forcing

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 4 / 63
slide-11
SLIDE 11

Extending Coq

Our mission: to boldly extend type theory with new principles

⇝ we need to design models for that. ⇝ and ensure they satisfy the good properties. Today we will focus on a specifjc family of models...

Presheaves!

Bread and Butter of Model Construction Proof-relevant Kripke semantics a.k.a. Intuitionistic Forcing

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 4 / 63
slide-12
SLIDE 12

A Bit of Categorical Nonsense

Defjnition Let P be a category. A presheaf over P is just a functor Pop → Set.

(In what follows we will fjx the base category P once and for all.)

Theorem Presheaves with nat. transformations as morphisms form a category Psh .

Actually Psh is even a topos! Bear with me, we will handwave through this in the next slides.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 5 / 63
slide-13
SLIDE 13

A Bit of Categorical Nonsense

Defjnition Let P be a category. A presheaf over P is just a functor Pop → Set.

(In what follows we will fjx the base category P once and for all.)

Theorem Presheaves with nat. transformations as morphisms form a category Psh(P).

Actually Psh is even a topos! Bear with me, we will handwave through this in the next slides.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 5 / 63
slide-14
SLIDE 14

A Bit of Categorical Nonsense

Defjnition Let P be a category. A presheaf over P is just a functor Pop → Set.

(In what follows we will fjx the base category P once and for all.)

Theorem Presheaves with nat. transformations as morphisms form a category Psh(P).

Actually Psh(P) is even a topos! Bear with me, we will handwave through this in the next slides.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 5 / 63
slide-15
SLIDE 15

A Bit of Categorical Nonsense

Defjnition Let P be a category. A presheaf over P is just a functor Pop → Set.

(In what follows we will fjx the base category P once and for all.)

Theorem Presheaves with nat. transformations as morphisms form a category Psh(P).

Actually Psh(P) is even a topos! Bear with me, we will handwave through this in the next slides.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 5 / 63
slide-16
SLIDE 16

All Your Base Category Are Belong to Us

What is Psh(P)?

Objects: A presheaf A

A is given by

A family of

  • indexed sets Ap

Set A family of “restriction morphisms”

A

p q q p Ap Aq

“ A x lowers its argument x along q p ”

s.t. given x Ap, q p and r q :

A idp x

x

A

x

A A

x

“Lowering is compatible with the structure of ”

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 6 / 63
slide-17
SLIDE 17

All Your Base Category Are Belong to Us

What is Psh(P)?

Objects: A presheaf (A, θA) is given by A family of P-indexed sets Ap : Set A family of “restriction morphisms” θA : Π{p, q ∈ P} (α ∈ P(q, p)). Ap → Aq

“ A x lowers its argument x along q p ”

s.t. given x Ap, q p and r q :

A idp x

x

A

x

A A

x

“Lowering is compatible with the structure of ”

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 6 / 63
slide-18
SLIDE 18

All Your Base Category Are Belong to Us

What is Psh(P)?

Objects: A presheaf (A, θA) is given by A family of P-indexed sets Ap : Set A family of “restriction morphisms” θA : Π{p, q ∈ P} (α ∈ P(q, p)). Ap → Aq

“θA α x lowers its argument x along α ∈ P(q, p)”

s.t. given x Ap, q p and r q :

A idp x

x

A

x

A A

x

“Lowering is compatible with the structure of ”

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 6 / 63
slide-19
SLIDE 19

All Your Base Category Are Belong to Us

What is Psh(P)?

Objects: A presheaf (A, θA) is given by A family of P-indexed sets Ap : Set A family of “restriction morphisms” θA : Π{p, q ∈ P} (α ∈ P(q, p)). Ap → Aq

“θA α x lowers its argument x along α ∈ P(q, p)”

s.t. given x ∈ Ap, α ∈ P(q, p) and β ∈ P(r, q): θA idp x ≡ x θA (β ◦ α) x ≡ θA β (θA α x)

“Lowering is compatible with the structure of ”

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 6 / 63
slide-20
SLIDE 20

All Your Base Category Are Belong to Us

What is Psh(P)?

Objects: A presheaf (A, θA) is given by A family of P-indexed sets Ap : Set A family of “restriction morphisms” θA : Π{p, q ∈ P} (α ∈ P(q, p)). Ap → Aq

“θA α x lowers its argument x along α ∈ P(q, p)”

s.t. given x ∈ Ap, α ∈ P(q, p) and β ∈ P(r, q): θA idp x ≡ x θA (β ◦ α) x ≡ θA β (θA α x)

“Lowering is compatible with the structure of P”

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 6 / 63
slide-21
SLIDE 21

All Your Base Category Are Belong to Us

What is Psh(P)?

Morphisms: A morphism from A

A to B B is given by

A family of

  • index functions fp

Ap Bp which is natural, i.e. given x Ap and q p

B

fp x fq

A

x

“f is compatible with restriction”

Ap

fp A

Bp

B

Aq

fq

Bq

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 7 / 63
slide-22
SLIDE 22

All Your Base Category Are Belong to Us

What is Psh(P)?

Morphisms: A morphism from (A, θA) to (B, θB) is given by A family of P-index functions fp : Ap → Bp which is natural, i.e. given x ∈ Ap and α ∈ P(q, p) θB α (fp x) ≡ fq (θA α x)

“f is compatible with restriction”

Ap

fp A

Bp

B

Aq

fq

Bq

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 7 / 63
slide-23
SLIDE 23

All Your Base Category Are Belong to Us

What is Psh(P)?

Morphisms: A morphism from (A, θA) to (B, θB) is given by A family of P-index functions fp : Ap → Bp which is natural, i.e. given x ∈ Ap and α ∈ P(q, p) θB α (fp x) ≡ fq (θA α x)

“f is compatible with restriction”

Ap

fp
  • θA α
  • Bp
θB α
  • Aq
fq Bq P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 7 / 63
slide-24
SLIDE 24

The Wise Speak Only of What They Know

Psh(P) is a topos.

“Speak, friend, and pullback.”

Merely a categorical curse word

For our purposes, that means that Psh is some kind of type theory ... in particular, it contains the simply-typed

  • calculus
P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 8 / 63
slide-25
SLIDE 25

The Wise Speak Only of What They Know

Psh(P) is a topos.

“Speak, friend, and pullback.”

Merely a categorical curse word

For our purposes, that means that Psh is some kind of type theory ... in particular, it contains the simply-typed

  • calculus
P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 8 / 63
slide-26
SLIDE 26

The Wise Speak Only of What They Know

Psh(P) is a topos.

“Speak, friend, and pullback.”

Merely a categorical curse word

For our purposes, that means that Psh(P) is some kind of type theory ... in particular, it contains the simply-typed λ-calculus

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 8 / 63
slide-27
SLIDE 27

Presheaves, Presheaves Everywhere

Who cares about topoi? Presheaves actually form a model of CIC.

As usual: A A Psh M A M Nat A I won’t give further details here. One remark though.

Yet another

  • model!
P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 9 / 63
slide-28
SLIDE 28

Presheaves, Presheaves Everywhere

Who cares about topoi? Presheaves actually form a model of CIC.

As usual: A A Psh M A M Nat A I won’t give further details here. One remark though.

Yet another

  • model!
P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 9 / 63
slide-29
SLIDE 29

Presheaves, Presheaves Everywhere

Who cares about topoi? Presheaves actually form a model of CIC.

As usual: ⊢ A : □ ⇝ [ [A] ] ∈ Psh(P) ⊢ M : A ⇝ [M] ∈ Nat(1, [ [A] ]) I won’t give further details here. One remark though.

Yet another

  • model!
P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 9 / 63
slide-30
SLIDE 30

Presheaves, Presheaves Everywhere

Who cares about topoi? Presheaves actually form a model of CIC.

As usual: ⊢ A : □ ⇝ [ [A] ] ∈ Psh(P) ⊢ M : A ⇝ [M] ∈ Nat(1, [ [A] ]) I won’t give further details here. One remark though.

Yet another set-theoretical model!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 9 / 63
slide-31
SLIDE 31

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? M “ C ZF-implies” M S S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-32
SLIDE 32

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False.

Canonicity Closed integers are integers... are they? M “ C ZF-implies” M S S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-33
SLIDE 33

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? M “ C ZF-implies” M S S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-34
SLIDE 34

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? ⊢ M : N “(C)ZF-implies” M ≡ S . . . S O

😖

Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-35
SLIDE 35

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? ⊢ M : N “(C)ZF-implies” M ≡ S . . . S O 😖 Implementability Type-checking is not decidable.

Reduction Never heard of that. What’s syntax already? 😲 Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-36
SLIDE 36

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? ⊢ M : N “(C)ZF-implies” M ≡ S . . . S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-37
SLIDE 37

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? ⊢ M : N “(C)ZF-implies” M ≡ S . . . S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already?

😲

Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-38
SLIDE 38

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? ⊢ M : N “(C)ZF-implies” M ≡ S . . . S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-39
SLIDE 39

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? ⊢ M : N “(C)ZF-implies” M ≡ S . . . S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 ⇝ Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-40
SLIDE 40

Cantor’s Hell

Let’s have a look at the good properties we long for.

Consistency There is no proof of False. ☺ Canonicity Closed integers are integers... are they? ⊢ M : N “(C)ZF-implies” M ≡ S . . . S O 😖 Implementability Type-checking is not decidable. ☹ Reduction Never heard of that. What’s syntax already? 😲 ⇝ Exeunt Normalization and Subject reduction. Phenomenological Law

Set-theoretical models suck.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 10 / 63
slide-41
SLIDE 41

Down With Semantics

Syntactic Models

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 11 / 63
slide-42
SLIDE 42

Stepping Back

What is a model?

Takes syntax as input. Interprets it into some low-level language. Must preserve the meaning of the source. Refjnes the behaviour of under-specifjed structures. This looks suspiciously familiar...

“By Jove, this is a compiler!”

This is a folklore in the Curry-Howard community.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 12 / 63
slide-43
SLIDE 43

Stepping Back

What is a model?

Takes syntax as input. Interprets it into some low-level language. Must preserve the meaning of the source. Refjnes the behaviour of under-specifjed structures. This looks suspiciously familiar...

“By Jove, this is a compiler!”

This is a folklore in the Curry-Howard community.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 12 / 63
slide-44
SLIDE 44

Stepping Back

What is a model?

Takes syntax as input. Interprets it into some low-level language. Must preserve the meaning of the source. Refjnes the behaviour of under-specifjed structures. This looks suspiciously familiar...

“By Jove, this is a compiler!”

This is a folklore in the Curry-Howard community.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 12 / 63
slide-45
SLIDE 45

Stepping Back

What is a model?

Takes syntax as input. Interprets it into some low-level language. Must preserve the meaning of the source. Refjnes the behaviour of under-specifjed structures. This looks suspiciously familiar...

“By Jove, this is a compiler!”

This is a folklore in the Curry-Howard community.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 12 / 63
slide-46
SLIDE 46

On Curry-Howard Poetry

Usual models are more like interpreters.

No separation between { implementation meta } vs. { host target } languages ⊢S A

meta

− → ⊨M A Notably, ⊨M lives in the semantical world. Example: NbE, external realizability.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 13 / 63
slide-47
SLIDE 47

On Curry-Howard Poetry

Syntactic models are proper compilers.

Target and meta languages are clearly distinct. ⊢S A

meta

− → ⊢T [ [A] ] Now ⊢T is pure syntax, only soundness lives in the meta! Example: CPS translation, internal realizability. We will be interested in instances where are type theories.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 14 / 63
slide-48
SLIDE 48

On Curry-Howard Poetry

Syntactic models are proper compilers.

Target and meta languages are clearly distinct. ⊢S A

meta

− → ⊢T [ [A] ] Now ⊢T is pure syntax, only soundness lives in the meta! Example: CPS translation, internal realizability. We will be interested in instances where S, T are type theories.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 14 / 63
slide-49
SLIDE 49

Syntactic Models, Details

Step 0: Pick two type theories, a source S and a target T . Typically both theories are CIC. Step 1: Defjne

  • n the syntax of

and derive from it s.t. M A implies M A Proving this is the one appeal to a (weak) meta. Step 2: Flip views and actually pose M A M A Step 3: Expand by going down to the assembly language, implementing new terms through the translation.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 15 / 63
slide-50
SLIDE 50

Syntactic Models, Details

Step 0: Pick two type theories, a source S and a target T . Typically both theories are CIC. Step 1: Defjne [·] on the syntax of S and derive [ [·] ] from it s.t. ⊢S M : A implies ⊢T [M] : [ [A] ] Proving this is the one appeal to a (weak) meta. Step 2: Flip views and actually pose M A M A Step 3: Expand by going down to the assembly language, implementing new terms through the translation.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 15 / 63
slide-51
SLIDE 51

Syntactic Models, Details

Step 0: Pick two type theories, a source S and a target T . Typically both theories are CIC. Step 1: Defjne [·] on the syntax of S and derive [ [·] ] from it s.t. ⊢S M : A implies ⊢T [M] : [ [A] ] Proving this is the one appeal to a (weak) meta. Step 2: Flip views and actually pose ⊢S M : A := ⊢T [M] : [ [A] ] Step 3: Expand by going down to the assembly language, implementing new terms through the translation.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 15 / 63
slide-52
SLIDE 52

Syntactic Models, Details

Step 0: Pick two type theories, a source S and a target T . Typically both theories are CIC. Step 1: Defjne [·] on the syntax of S and derive [ [·] ] from it s.t. ⊢S M : A implies ⊢T [M] : [ [A] ] Proving this is the one appeal to a (weak) meta. Step 2: Flip views and actually pose ⊢S M : A := ⊢T [M] : [ [A] ] Step 3: Expand S by going down to the T assembly language, implementing new terms through the [·] translation.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 15 / 63
slide-53
SLIDE 53

Why Syntactic Models?

Obviously, that’s subtle. The translation [·] must preserve typing (not easy) In particular, it must preserve conversion (even worse) Yet, a lot of nice consequences. Does not require non-type-theoretical foundations (monism) Can be implemented in Coq (software monism) Easy to show (relative) consistency, look at False Inherit properties from CIC: computationality, decidability, implementation...

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 16 / 63
slide-54
SLIDE 54

Why Syntactic Models?

Obviously, that’s subtle. The translation [·] must preserve typing (not easy) In particular, it must preserve conversion (even worse) Yet, a lot of nice consequences. Does not require non-type-theoretical foundations (monism) Can be implemented in Coq (software monism) Easy to show (relative) consistency, look at [ [False] ] Inherit properties from CIC: computationality, decidability, implementation...

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 16 / 63
slide-55
SLIDE 55

On Syntactic Models

They were fjrst introduced by Martin Hofmann in his PhD (1997). ... then somewhat neglected. At Gallinette, we have been using them successfully in the recent years For efgectful type theories mostly But the one model that originally sparked our interest was...

Presheaves!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 17 / 63
slide-56
SLIDE 56

On Syntactic Models

They were fjrst introduced by Martin Hofmann in his PhD (1997). ... then somewhat neglected. At Gallinette, we have been using them successfully in the recent years For efgectful type theories mostly But the one model that originally sparked our interest was...

Presheaves!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 17 / 63
slide-57
SLIDE 57

On Syntactic Models

They were fjrst introduced by Martin Hofmann in his PhD (1997). ... then somewhat neglected. At Gallinette, we have been using them successfully in the recent years For efgectful type theories mostly But the one model that originally sparked our interest was...

Presheaves!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 17 / 63
slide-58
SLIDE 58

“Is it possible to see the presheaf construction as a syntactic model?”

French Coat of Arms Sheaf P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 18 / 63
slide-59
SLIDE 59

Persevere Diabolicum

Why the hell am I talking about syntactic presheaves today?

fi

It is the journey, not the destination

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 19 / 63
slide-60
SLIDE 60

Persevere Diabolicum

Why the hell am I talking about syntactic presheaves today?

2012 2016 2020

Extending Type Theory with Forcing The Definitional Side of the Forcing (LICS, Jaber, Tabareau, Sozeau) (LICS, Jaber, Lewertowski, Pédrot, Tabareau, Sozeau) Russian Constructivism in a Prefascist Theory

FAIL FAIL YAY?

(LICS, Pédrot)

It is the journey, not the destination

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 19 / 63
slide-61
SLIDE 61

Persevere Diabolicum

Why the hell am I talking about syntactic presheaves today?

2012 2016 2020

Extending Type Theory with Forcing The Definitional Side of the Forcing (LICS, Jaber, Tabareau, Sozeau) (LICS, Jaber, Lewertowski, Pédrot, Tabareau, Sozeau) Russian Constructivism in a Prefascist Theory

FAIL FAIL YAY?

(LICS, Pédrot)

It is the journey, not the destination

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 19 / 63
slide-62
SLIDE 62 (We were warned.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 20 / 63
slide-63
SLIDE 63

Syntactic Presheaves, 2012 Edition

“A presheaf is just a functor Pop → Set.”

“Hold my beer!”

Replace Set everywhere with CIC.

What could possibly go wrong?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 21 / 63
slide-64
SLIDE 64

Syntactic Presheaves, 2012 Edition

“A presheaf is just a functor Pop → Set.”

“Hold my beer!”

Replace Set everywhere with CIC.

What could possibly go wrong?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 21 / 63
slide-65
SLIDE 65

Syntactic Presheaves, 2012 Edition

“A presheaf is just a functor Pop → Set.”

“Hold my beer!”

Replace Set everywhere with CIC.

What could possibly go wrong?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 21 / 63
slide-66
SLIDE 66

Syntactic Presheaves, 2012 Edition

“A presheaf is just a functor Pop → Set.”

“Hold my beer!”

Replace Set everywhere with CIC.

What could possibly go wrong?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 21 / 63
slide-67
SLIDE 67

Close Encounters of the Third Type

Replace Set everywhere with CIC. Cat id p p p p q r p q q r p r eqn Psh A

A

p q q p Ap Aq eqn El A

A e

el p A p eqn And voilá, the Great Typifjcation is an utter success!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 22 / 63
slide-68
SLIDE 68

Close Encounters of the Third Type

Replace Set everywhere with CIC. Cat : □ :=            P : □ ≤: P → P → □ id : Πp. p ≤ p

  • : Πp q r. p ≤ q → q ≤ r → p ≤ r

eqn : . . . ;            Psh : □ :=    A : P → □ θA : Π(p q : P) (α : q ≤ p). Ap → Aq eqn : . . . ;    El (A, θA, e) : □ := { el : Π(p : P). A p eqn : . . . ; } And voilá, the Great Typifjcation is an utter success!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 22 / 63
slide-69
SLIDE 69

Close Encounters of the Third Type

Replace Set everywhere with CIC. Cat : □ :=            P : □ ≤: P → P → □ id : Πp. p ≤ p

  • : Πp q r. p ≤ q → q ≤ r → p ≤ r

eqn : . . . ;            Psh : □ :=    A : P → □ θA : Π(p q : P) (α : q ≤ p). Ap → Aq eqn : . . . ;    El (A, θA, e) : □ := { el : Π(p : P). A p eqn : . . . ; } And voilá, the Great Typifjcation is an utter success!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 22 / 63
slide-70
SLIDE 70

Equality is Too Serious a Matter

This almost works... ... except that equations are propositional !!! El A

A e

el p A p eqn

CIC M

N M N

CIC M

N e M N

😲

You need to introduce rewriting everywhere

😲

“The Coherence Hell”

😲

Thus the target theory must be EXTENSIONAL

😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 23 / 63
slide-71
SLIDE 71

Equality is Too Serious a Matter

This almost works... ... except that equations are propositional !!! El (A, θA, e) : □ := { el : Π(p : P). A p eqn : . . . ; } ⊢CIC M ≡ N − → ⊢ [M] ≡ [N] ⊢CIC M ≡ N − → ⊢ e : [M] = [N]

😲

You need to introduce rewriting everywhere

😲

“The Coherence Hell”

😲

Thus the target theory must be EXTENSIONAL

😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 23 / 63
slide-72
SLIDE 72

Equality is Too Serious a Matter

This almost works... ... except that equations are propositional !!! El (A, θA, e) : □ := { el : Π(p : P). A p eqn : . . . ; } ⊢CIC M ≡ N − → ⊢ [M] ≡ [N] ⊢CIC M ≡ N − → ⊢ e : [M] = [N]

😲

You need to introduce rewriting everywhere

😲

“The Coherence Hell”

😲

Thus the target theory must be EXTENSIONAL

😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 23 / 63
slide-73
SLIDE 73

Equality is Too Serious a Matter

This almost works... ... except that equations are propositional !!! El (A, θA, e) : □ := { el : Π(p : P). A p eqn : . . . ; } ⊢CIC M ≡ N − → ⊢ [M] ≡ [N] ⊢CIC M ≡ N − → ⊢ e : [M] = [N]

😲

You need to introduce rewriting everywhere

😲

“The Coherence Hell”

😲

Thus the target theory must be EXTENSIONAL

😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 23 / 63
slide-74
SLIDE 74

That Was Not My Intension

Extensional Type Theory (ETT) is defjned by Santa Claus conversion. Γ ⊢ e : M = N Γ ⊢ M ≡ N Arguably better than ZFC (“constructive”) ... but undecidable type checking ... no computation, e.g.

  • reduction is undecidable

See Théo Winterhalter’s soon to be defended PhD for more horrors No True Scotsman Syntactic models into ETT are not really syntactic models .

To be more precise, I believe that ETT is not really a type theory. P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 24 / 63
slide-75
SLIDE 75

That Was Not My Intension

Extensional Type Theory (ETT) is defjned by Santa Claus conversion. Γ ⊢ e : M = N Γ ⊢ M ≡ N Arguably better than ZFC (“constructive”) ... but undecidable type checking ... no computation, e.g.

  • reduction is undecidable

See Théo Winterhalter’s soon to be defended PhD for more horrors No True Scotsman Syntactic models into ETT are not really syntactic models .

To be more precise, I believe that ETT is not really a type theory. P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 24 / 63
slide-76
SLIDE 76

That Was Not My Intension

Extensional Type Theory (ETT) is defjned by Santa Claus conversion. Γ ⊢ e : M = N Γ ⊢ M ≡ N Arguably better than ZFC (“constructive”) ... but undecidable type checking ... no computation, e.g. β-reduction is undecidable See Théo Winterhalter’s soon to be defended PhD for more horrors No True Scotsman Syntactic models into ETT are not really syntactic models .

To be more precise, I believe that ETT is not really a type theory. P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 24 / 63
slide-77
SLIDE 77

That Was Not My Intension

Extensional Type Theory (ETT) is defjned by Santa Claus conversion. Γ ⊢ e : M = N Γ ⊢ M ≡ N Arguably better than ZFC (“constructive”) ... but undecidable type checking ... no computation, e.g. β-reduction is undecidable See Théo Winterhalter’s soon to be defended PhD for more horrors No True Scotsman Syntactic models into ETT are not really syntactic models†.

To be more precise, I believe that ETT is not really a type theory. P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 24 / 63
slide-78
SLIDE 78

That Was Not My Intension

Extensional Type Theory (ETT) is defjned by Santa Claus conversion. Γ ⊢ e : M = N Γ ⊢ M ≡ N Arguably better than ZFC (“constructive”) ... but undecidable type checking ... no computation, e.g. β-reduction is undecidable See Théo Winterhalter’s soon to be defended PhD for more horrors No True Scotsman Syntactic models into ETT are not really syntactic models†.

(†) To be more precise, I believe that ETT is not really a type theory. P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 24 / 63
slide-79
SLIDE 79 (Make conversion great again, and break everything else.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 25 / 63
slide-80
SLIDE 80

Squaring the Circle

(Me to Guilhem, Nicolas and Matthieu, some time before defending PhD.)

— You people are doing it wrong. It cannot work! — Why?

— Because presheaves are call-by-value!

... and you’re trying to intepret a call-by-name language!

— What on earth does that even mean?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 26 / 63
slide-81
SLIDE 81

Squaring the Circle

(Me to Guilhem, Nicolas and Matthieu, some time before defending PhD.)

— You people are doing it wrong. It cannot work! — Why?

— Because presheaves are call-by-value!

... and you’re trying to intepret a call-by-name language!

— What on earth does that even mean?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 26 / 63
slide-82
SLIDE 82

Squaring the Circle

(Me to Guilhem, Nicolas and Matthieu, some time before defending PhD.)

— You people are doing it wrong. It cannot work! — Why?

— Because presheaves are call-by-value!

... and you’re trying to intepret a call-by-name language!

— What on earth does that even mean?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 26 / 63
slide-83
SLIDE 83

Squaring the Circle

(Me to Guilhem, Nicolas and Matthieu, some time before defending PhD.)

— You people are doing it wrong. It cannot work! — Why?

— Because presheaves are call-by-value!

... and you’re trying to intepret a call-by-name language!

— What on earth does that even mean?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 26 / 63
slide-84
SLIDE 84

Squaring the Circle

(Me to Guilhem, Nicolas and Matthieu, some time before defending PhD.)

— You people are doing it wrong. It cannot work! — Why?

— Because presheaves are call-by-value!

... and you’re trying to intepret a call-by-name language!

— What on earth does that even mean?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 26 / 63
slide-85
SLIDE 85

This is the Left Adjoint, Right?

CBPV is a nice framework to study efgects.

Yet I won’t present it here because it’s Birmingham.

Theorem (Somewhere inside PBL’s humongous PhD)

Kripke models factorize through CBPV. X computation type X c Set A value type A v Fun

  • p Set

A X c

p

A v

p

X c

p

A c

p

A v

p

X v

p

q q p X c

q

(free functoriality)

X v q p x X v p r r q x r P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 27 / 63
slide-86
SLIDE 86

This is the Left Adjoint, Right?

CBPV is a nice framework to study efgects.

Yet I won’t present it here because it’s Birmingham.

Theorem (Somewhere inside PBL’s humongous PhD)

Kripke models factorize through CBPV. X computation type X c Set A value type A v Fun

  • p Set

A X c

p

A v

p

X c

p

A c

p

A v

p

X v

p

q q p X c

q

(free functoriality)

X v q p x X v p r r q x r P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 27 / 63
slide-87
SLIDE 87

This is the Left Adjoint, Right?

CBPV is a nice framework to study efgects.

Yet I won’t present it here because it’s Birmingham.

Theorem (Somewhere inside PBL’s humongous PhD)

Kripke models factorize through CBPV. X computation type X c Set A value type A v Fun

  • p Set

A X c

p

A v

p

X c

p

A c

p

A v

p

X v

p

q q p X c

q

(free functoriality)

X v q p x X v p r r q x r P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 27 / 63
slide-88
SLIDE 88

This is the Left Adjoint, Right?

CBPV is a nice framework to study efgects.

Yet I won’t present it here because it’s Birmingham.

Theorem (Somewhere inside PBL’s humongous PhD)

Kripke models factorize through CBPV. X computation type → [ [X] ]c : |P| → Set A value type → [ [A] ]v : Fun(Pop, Set) [ [A → X] ]c

p

:= [ [A] ]v

p → [

[X] ]c

p

[ [F A] ]c

p

:= |[ [A] ]v

p|

[ [U X] ]v

p

:= Π(q : P)(α : q ≤ p). [ [X] ]c

q

(free functoriality)

θ[ [U X] ]v (α : q ≤ p)(x : [ [U X] ]v p) := λ(r : P)(β : r ≤ q). x r (α ◦ β) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 27 / 63
slide-89
SLIDE 89

More Than One Way to Do It

Theorem

Kripke models factorize through CBPV. Canonical embeddings of λ-calculus into CBPV: CBN (σ → τ)N := U σN → τ N

(a computation type)

CBV (σ → τ)V := U (σV → F τ V)

(a value type)

Thus, composing the CBV embedding with the “Kripke” interpretation:

V v p

q q p

V v q V v q

This is the presheaf interpretation of arrows! (up to naturality)

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 28 / 63
slide-90
SLIDE 90

More Than One Way to Do It

Theorem

Kripke models factorize through CBPV. Canonical embeddings of λ-calculus into CBPV: CBN (σ → τ)N := U σN → τ N

(a computation type)

CBV (σ → τ)V := U (σV → F τ V)

(a value type)

Thus, composing the CBV embedding with the “Kripke” interpretation: [ [(σ → τ)V] ]v

p := Π(q : P)(α : q ≤ p). [

[σV] ]v

q → [

[τ V] ]v

q

This is the presheaf interpretation of arrows! (up to naturality)

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 28 / 63
slide-91
SLIDE 91

More Than One Way to Do It

Theorem

Kripke models factorize through CBPV. Canonical embeddings of λ-calculus into CBPV: CBN (σ → τ)N := U σN → τ N

(a computation type)

CBV (σ → τ)V := U (σV → F τ V)

(a value type)

Thus, composing the CBV embedding with the “Kripke” interpretation: [ [(σ → τ)V] ]v

p := Π(q : P)(α : q ≤ p). [

[σV] ]v

q → [

[τ V] ]v

q

This is the presheaf interpretation of arrows! (up to naturality)∗∗

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 28 / 63
slide-92
SLIDE 92

Le Clash

Presheaves are call-by-value!

In particular, they only satisfy the CBV equational theory generated by x t V

v t x

V because t

v u

tV

CBPV uV

tV p uV p

Type theory is call-by-name!

M B A B (Conv) M A Folklore

Call-by-name is not call-by-value!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 29 / 63
slide-93
SLIDE 93

Le Clash

Presheaves are call-by-value!

In particular, they only satisfy the CBV equational theory generated by (λx. t) V ≡βv t{x := V} because t ≡βv u − → tV ≡CBPV uV − → [tV]p ≡T [uV]p

Type theory is call-by-name!

M B A B (Conv) M A Folklore

Call-by-name is not call-by-value!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 29 / 63
slide-94
SLIDE 94

Le Clash

Presheaves are call-by-value!

In particular, they only satisfy the CBV equational theory generated by (λx. t) V ≡βv t{x := V} because t ≡βv u − → tV ≡CBPV uV − → [tV]p ≡T [uV]p

Type theory is call-by-name!

M B A B (Conv) M A Folklore

Call-by-name is not call-by-value!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 29 / 63
slide-95
SLIDE 95

Le Clash

Presheaves are call-by-value!

In particular, they only satisfy the CBV equational theory generated by (λx. t) V ≡βv t{x := V} because t ≡βv u − → tV ≡CBPV uV − → [tV]p ≡T [uV]p

Type theory is call-by-name!

Γ ⊢ M : B Γ ⊢ A ≡β B (Conv) Γ ⊢ M : A Folklore

Call-by-name is not call-by-value!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 29 / 63
slide-96
SLIDE 96

Le Clash

Presheaves are call-by-value!

In particular, they only satisfy the CBV equational theory generated by (λx. t) V ≡βv t{x := V} because t ≡βv u − → tV ≡CBPV uV − → [tV]p ≡T [uV]p

Type theory is call-by-name!

Γ ⊢ M : B Γ ⊢ A ≡β B (Conv) Γ ⊢ M : A Folklore

Call-by-name is not call-by-value!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 29 / 63
slide-97
SLIDE 97

If There is No Solution, There is No Problem

Easy solution! Pick the CBN decomposition instead.

[ [(σ → τ)N] ]c

p := (Π(q : P)(α : q ≤ p). [

[σN] ]c

q) → [

[τ N] ]c

p

This adapts straightforwardly to the dependently-typed setting. Theorem (Jaber & al. 2016)

There is a syntactic presheaf model of CC into CIC.

where CC is CIC without inductive types. CC A p CIC A p q q p CC M A p CIC M p A p p idp CC M N p CIC M p N p P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 30 / 63
slide-98
SLIDE 98

If There is No Solution, There is No Problem

Easy solution! Pick the CBN decomposition instead.

[ [(σ → τ)N] ]c

p := (Π(q : P)(α : q ≤ p). [

[σN] ]c

q) → [

[τ N] ]c

p

This adapts straightforwardly to the dependently-typed setting. Theorem (Jaber & al. 2016)

There is a syntactic presheaf model of CC into CIC.

where CC is CIC without inductive types. CC A p CIC A p q q p CC M A p CIC M p A p p idp CC M N p CIC M p N p P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 30 / 63
slide-99
SLIDE 99

If There is No Solution, There is No Problem

Easy solution! Pick the CBN decomposition instead.

[ [(σ → τ)N] ]c

p := (Π(q : P)(α : q ≤ p). [

[σN] ]c

q) → [

[τ N] ]c

p

This adapts straightforwardly to the dependently-typed setting. Theorem (Jaber & al. 2016)

There is a syntactic presheaf model of CCω into CIC.

where CCω is CIC without inductive types. CC A p CIC A p q q p CC M A p CIC M p A p p idp CC M N p CIC M p N p P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 30 / 63
slide-100
SLIDE 100

If There is No Solution, There is No Problem

Easy solution! Pick the CBN decomposition instead.

[ [(σ → τ)N] ]c

p := (Π(q : P)(α : q ≤ p). [

[σN] ]c

q) → [

[τ N] ]c

p

This adapts straightforwardly to the dependently-typed setting. Theorem (Jaber & al. 2016)

There is a syntactic presheaf model of CCω into CIC.

where CCω is CIC without inductive types. ⊢CCω A : □ − → p : P ⊢CIC [A]p : Π(q : P)(α : q ≤ p). □ ⊢CCω M : A − → p : P ⊢CIC [M]p : [A]p p idp ⊢CCω M ≡ N − → p : P ⊢CIC [M]p ≡ [N]p P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 30 / 63
slide-101
SLIDE 101

Robbing Peter to Pay Paul

There is a syntactic presheaf model of CCω into CIC.

“What about inductive types?” The model disproves dependent elimination!

in general P P tt P ff b P b because there are non-standard booleans.

It only validates it for specifjc predicates P

P tt P ff b P b if P strict

Any predicate P can be made strict canonically (using storage operators) In presence of dep. elim. strictifjcation is the identity P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 31 / 63
slide-102
SLIDE 102

Robbing Peter to Pay Paul

There is a syntactic presheaf model of CCω into CIC.

“What about inductive types?” The model disproves dependent elimination!

in general P P tt P ff b P b because there are non-standard booleans.

It only validates it for specifjc predicates P

P tt P ff b P b if P strict

Any predicate P can be made strict canonically (using storage operators) In presence of dep. elim. strictifjcation is the identity P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 31 / 63
slide-103
SLIDE 103

Robbing Peter to Pay Paul

There is a syntactic presheaf model of CCω into CIC.

“What about inductive types?” The model disproves dependent elimination!

in general ⊢ Π(P : B → □). P tt → P ff → Π(b : B). P b because there are non-standard booleans.

It only validates it for specifjc predicates P

P tt P ff b P b if P strict

Any predicate P can be made strict canonically (using storage operators) In presence of dep. elim. strictifjcation is the identity P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 31 / 63
slide-104
SLIDE 104

Robbing Peter to Pay Paul

There is a syntactic presheaf model of CCω into CIC.

“What about inductive types?” The model disproves dependent elimination!

in general ⊢ Π(P : B → □). P tt → P ff → Π(b : B). P b because there are non-standard booleans.

It only validates it for specifjc predicates P

⊢ P tt → P ff → Π(b : B). P b if P strict

Any predicate P can be made strict canonically (using storage operators) In presence of dep. elim. strictifjcation is the identity P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 31 / 63
slide-105
SLIDE 105

Robbing Peter to Pay Paul

In retrospective, this is not surprising. The Kripke translation introduces an efgect!

It can be seen as a monotonic variant of the reader efgect.

The Proverbial Paul

CBPV Folklore

In efgectful CBV, functions are not functions. (no substitution) In efgectful CBN, inductive types are not inductive types. (no dep. elim.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 32 / 63
slide-106
SLIDE 106

Robbing Peter to Pay Paul

In retrospective, this is not surprising. The Kripke translation introduces an efgect!

It can be seen as a monotonic variant of the reader efgect.

The Proverbial Paul

CBPV Folklore

In efgectful CBV, functions are not functions. (no substitution) In efgectful CBN, inductive types are not inductive types. (no dep. elim.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 32 / 63
slide-107
SLIDE 107

Robbing Peter to Pay Paul

In retrospective, this is not surprising. The Kripke translation introduces an efgect!

It can be seen as a monotonic variant of the reader efgect.

The Proverbial Paul

CBPV Folklore

In efgectful CBV, functions are not functions. (no substitution) In efgectful CBN, inductive types are not inductive types. (no dep. elim.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 32 / 63
slide-108
SLIDE 108

Conclusion of the Episode II

Good News

This is one of the fjrst reasonable example of dependent efgects.

Bad News

We still don’t have a syntactic presheaf model.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 33 / 63
slide-109
SLIDE 109

Conclusion of the Episode II

Good News

This is one of the fjrst reasonable example of dependent efgects.

Bad News

We still don’t have a syntactic presheaf model.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 33 / 63
slide-110
SLIDE 110

Interlude

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 34 / 63
slide-111
SLIDE 111

Interlude

In the meantime we worked quite a bit on efgectful type theories

Weaning translation Baclofen Type Theory Exceptional Type Theory ...

This helped us understand what we fjrst missed!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 35 / 63
slide-112
SLIDE 112

Interlude

In the meantime we worked quite a bit on efgectful type theories

Weaning translation Baclofen Type Theory Exceptional Type Theory ...

This helped us understand what we fjrst missed!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 35 / 63
slide-113
SLIDE 113

Values Are Not What They Once Were

Categorical presheaves form a model of the whole λ-calculus. ... in particular, it does interpret full β-conversion (although extensionally). This is because of the naturality requirement on functions.

A B p f q p A q B q s.t. A q fq A B q B A r fr B r

We do not have an equivalent in our CBN interpretation Isn’t this some ad-hoc trick?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 36 / 63
slide-114
SLIDE 114

Values Are Not What They Once Were

Categorical presheaves form a model of the whole λ-calculus. ... in particular, it does interpret full β-conversion (although extensionally). This is because of the naturality requirement on functions.

[ [A → B] ]p := f : Π(q ≤ p). [ [A] ]q → [ [B] ]q s.t. [ [A] ]q fq α θA β
  • [
[B] ]q θB β
  • [
[A] ]r fr (α◦β) [ [B] ]r

We do not have an equivalent in our CBN interpretation Isn’t this some ad-hoc trick?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 36 / 63
slide-115
SLIDE 115

Values Are Not What They Once Were

Categorical presheaves form a model of the whole λ-calculus. ... in particular, it does interpret full β-conversion (although extensionally). This is because of the naturality requirement on functions.

[ [A → B] ]p := f : Π(q ≤ p). [ [A] ]q → [ [B] ]q s.t. [ [A] ]q fq α θA β
  • [
[B] ]q θB β
  • [
[A] ]r fr (α◦β) [ [B] ]r

We do not have an equivalent in our CBN interpretation Isn’t this some ad-hoc trick?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 36 / 63
slide-116
SLIDE 116

Completely Unrelated Slide

Consider an efgectful CBV λ-calculus.

Defjnition (Führmann ’99)

A term t : A is said to be thunkable if it satisfjes the equation let x := t in λ(). x ≡ λ(). t Thunkability intuitively captures “purity” It does so generically, i.e. does not depend on efgect considered In a pure language, all terms are thunkable

Theorem (Folklore Realizability)

The sublanguage of hereditarily thunkable terms satisfjes full

  • conversion.

f A B u u A f u thk f u B

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 37 / 63
slide-117
SLIDE 117

Completely Unrelated Slide

Consider an efgectful CBV λ-calculus.

Defjnition (Führmann ’99)

A term t : A is said to be thunkable if it satisfjes the equation let x := t in λ(). x ≡ λ(). t Thunkability intuitively captures “purity” It does so generically, i.e. does not depend on efgect considered In a pure language, all terms are thunkable

Theorem (Folklore Realizability)

The sublanguage of hereditarily thunkable terms satisfjes full

  • conversion.

f A B u u A f u thk f u B

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 37 / 63
slide-118
SLIDE 118

Completely Unrelated Slide

Consider an efgectful CBV λ-calculus.

Defjnition (Führmann ’99)

A term t : A is said to be thunkable if it satisfjes the equation let x := t in λ(). x ≡ λ(). t Thunkability intuitively captures “purity” It does so generically, i.e. does not depend on efgect considered In a pure language, all terms are thunkable

Theorem (Folklore Realizability)

The sublanguage of hereditarily thunkable terms satisfjes full β-conversion. f ⊩ A → B := ∀u. u ⊩ A − → f u thk ∧ f u ⊩ B

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 37 / 63
slide-119
SLIDE 119

Presheaves Are (Pure) Call-By-Value!

Theorem

A term x : A ⊢ t : B is thunkable in the Kripke semantics ifg [t]p is natural.

Proof.

Literal unfolding of the defjnitions.

Psh is the “pure” subcategory of an efgectful CBV language!

This is a systematic construction. Unfortunately it relies on extensionality. We know how to port this to the CBN setting intensionally.

The CBN equivalent is parametricity!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 38 / 63
slide-120
SLIDE 120

Presheaves Are (Pure) Call-By-Value!

Theorem

A term x : A ⊢ t : B is thunkable in the Kripke semantics ifg [t]p is natural.

Proof.

Literal unfolding of the defjnitions.

Psh is the “pure” subcategory of an efgectful CBV language!

This is a systematic construction. Unfortunately it relies on extensionality. We know how to port this to the CBN setting intensionally.

The CBN equivalent is parametricity!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 38 / 63
slide-121
SLIDE 121

Presheaves Are (Pure) Call-By-Value!

Theorem

A term x : A ⊢ t : B is thunkable in the Kripke semantics ifg [t]p is natural.

Proof.

Literal unfolding of the defjnitions.

Psh(P) is the “pure” subcategory of an efgectful CBV language!

This is a systematic construction. Unfortunately it relies on extensionality. We know how to port this to the CBN setting intensionally.

The CBN equivalent is parametricity!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 38 / 63
slide-122
SLIDE 122

Presheaves Are (Pure) Call-By-Value!

Theorem

A term x : A ⊢ t : B is thunkable in the Kripke semantics ifg [t]p is natural.

Proof.

Literal unfolding of the defjnitions.

Psh(P) is the “pure” subcategory of an efgectful CBV language!

This is a systematic construction. Unfortunately it relies on extensionality. We know how to port this to the CBN setting intensionally.

The CBN equivalent is parametricity!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 38 / 63
slide-123
SLIDE 123

Syntactic Models For Free

Bernardy-Lasson ’11 There is a well-known parametricity interpretation for type theory Γ ⊢CIC M : A − → [ [Γ] ]ε ⊢CIC [M]ε : [ [A] ]ε M where [ [·] ]ε := · and [ [Γ, x : A] ]ε := [ [Γ] ]ε, x : A, xε : [ [A] ]ε x Turns out it is a syntactic model! It is a special case of a more general internal realizability interpretation. A M M A Given another syntactic model we can defjne

CIC M

A

CIC M

A

CIC M

A M

x A x A x A x

Bernardy-Lasson is parametricity over identity.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 39 / 63
slide-124
SLIDE 124

Syntactic Models For Free

Bernardy-Lasson ’11 There is a well-known parametricity interpretation for type theory Γ ⊢CIC M : A − → [ [Γ] ]ε ⊢CIC [M]ε : [ [A] ]ε M where [ [·] ]ε := · and [ [Γ, x : A] ]ε := [ [Γ] ]ε, x : A, xε : [ [A] ]ε x Turns out it is a syntactic model! It is a special case of a more general internal realizability interpretation. A M M A Given another syntactic model we can defjne

CIC M

A

CIC M

A

CIC M

A M

x A x A x A x

Bernardy-Lasson is parametricity over identity.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 39 / 63
slide-125
SLIDE 125

Syntactic Models For Free

Bernardy-Lasson ’11 There is a well-known parametricity interpretation for type theory Γ ⊢CIC M : A − → [ [Γ] ]ε ⊢CIC [M]ε : [ [A] ]ε M where [ [·] ]ε := · and [ [Γ, x : A] ]ε := [ [Γ] ]ε, x : A, xε : [ [A] ]ε x Turns out it is a syntactic model! It is a special case of a more general internal realizability interpretation. [ [A] ]ε M := M ⊩ A Given another syntactic model we can defjne

CIC M

A

CIC M

A

CIC M

A M

x A x A x A x

Bernardy-Lasson is parametricity over identity.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 39 / 63
slide-126
SLIDE 126

Syntactic Models For Free

Bernardy-Lasson ’11 There is a well-known parametricity interpretation for type theory Γ ⊢CIC M : A − → [ [Γ] ]ε ⊢CIC [M]ε : [ [A] ]ε M where [ [·] ]ε := · and [ [Γ, x : A] ]ε := [ [Γ] ]ε, x : A, xε : [ [A] ]ε x Turns out it is a syntactic model! It is a special case of a more general internal realizability interpretation. [ [A] ]ε M := M ⊩ A Given another syntactic model [−]/[ [−] ] we can defjne Γ ⊢CIC M : A − → [ [Γ] ]ε ⊢CIC [M] : [ [A] ] + [ [Γ] ]ε ⊢CIC [M]ε : [ [A] ]ε [M]

(x : A − → x : [ [A] ], xε : [ [A] ]ε x)

Bernardy-Lasson is parametricity over identity.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 39 / 63
slide-127
SLIDE 127

Syntactic Models For Free

Bernardy-Lasson ’11 There is a well-known parametricity interpretation for type theory Γ ⊢CIC M : A − → [ [Γ] ]ε ⊢CIC [M]ε : [ [A] ]ε M where [ [·] ]ε := · and [ [Γ, x : A] ]ε := [ [Γ] ]ε, x : A, xε : [ [A] ]ε x Turns out it is a syntactic model! It is a special case of a more general internal realizability interpretation. [ [A] ]ε M := M ⊩ A Given another syntactic model [−]/[ [−] ] we can defjne Γ ⊢CIC M : A − → [ [Γ] ]ε ⊢CIC [M] : [ [A] ] + [ [Γ] ]ε ⊢CIC [M]ε : [ [A] ]ε [M]

(x : A − → x : [ [A] ], xε : [ [A] ]ε x)

Bernardy-Lasson is parametricity over identity.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 39 / 63
slide-128
SLIDE 128

On Parametric Presheaves

What does parametricity look like on the CBN presheaf model? x : B − → { x : (Π(q : P)(α : q ≤ p). B) xε : Bε p x We have a bit of constraints. To get dependent elimination we need:

1

p x ifg x q tt or x q ff

2 in a unique way, i.e. b

b p x b b

(i.e. a HoTT proposition)

But we also critically need to be compatible with the presheaf structure!

3 That is,

q p p x q x

4 with further defjnitional functoriality to avoid coherence issues

😲 Guess what? The CBV vs. CBN conundrum is back. 😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 40 / 63
slide-129
SLIDE 129

On Parametric Presheaves

What does parametricity look like on the CBN presheaf model? x : B − → { x : (Π(q : P)(α : q ≤ p). B) xε : Bε p x We have a bit of constraints. To get dependent elimination we need:

1 Bε p x ifg (x = λq α. tt) or (x = λq α. ff) 2 in a unique way, i.e. b

b p x b b

(i.e. a HoTT proposition)

But we also critically need to be compatible with the presheaf structure!

3 That is,

q p p x q x

4 with further defjnitional functoriality to avoid coherence issues

😲 Guess what? The CBV vs. CBN conundrum is back. 😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 40 / 63
slide-130
SLIDE 130

On Parametric Presheaves

What does parametricity look like on the CBN presheaf model? x : B − → { x : (Π(q : P)(α : q ≤ p). B) xε : Bε p x We have a bit of constraints. To get dependent elimination we need:

1 Bε p x ifg (x = λq α. tt) or (x = λq α. ff) 2 in a unique way, i.e. b1, b2 : Bε p x ⊢ b1 = b2 (i.e. a HoTT proposition)

But we also critically need to be compatible with the presheaf structure!

3 That is,

q p p x q x

4 with further defjnitional functoriality to avoid coherence issues

😲 Guess what? The CBV vs. CBN conundrum is back. 😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 40 / 63
slide-131
SLIDE 131

On Parametric Presheaves

What does parametricity look like on the CBN presheaf model? x : B − → { x : (Π(q : P)(α : q ≤ p). B) xε : Bε p x We have a bit of constraints. To get dependent elimination we need:

1 Bε p x ifg (x = λq α. tt) or (x = λq α. ff) 2 in a unique way, i.e. b1, b2 : Bε p x ⊢ b1 = b2 (i.e. a HoTT proposition)

But we also critically need to be compatible with the presheaf structure!

3 That is, θBε (α : q ≤ p) : Bε p x → Bε q (α · x) 4 with further defjnitional functoriality to avoid coherence issues

😲 Guess what? The CBV vs. CBN conundrum is back. 😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 40 / 63
slide-132
SLIDE 132

On Parametric Presheaves

What does parametricity look like on the CBN presheaf model? x : B − → { x : (Π(q : P)(α : q ≤ p). B) xε : Bε p x We have a bit of constraints. To get dependent elimination we need:

1 Bε p x ifg (x = λq α. tt) or (x = λq α. ff) 2 in a unique way, i.e. b1, b2 : Bε p x ⊢ b1 = b2 (i.e. a HoTT proposition)

But we also critically need to be compatible with the presheaf structure!

3 That is, θBε (α : q ≤ p) : Bε p x → Bε q (α · x) 4 with further defjnitional functoriality to avoid coherence issues

😲 Guess what? The CBV vs. CBN conundrum is back. 😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 40 / 63
slide-133
SLIDE 133

On Parametric Presheaves

What does parametricity look like on the CBN presheaf model? x : B − → { x : (Π(q : P)(α : q ≤ p). B) xε : Bε p x We have a bit of constraints. To get dependent elimination we need:

1 Bε p x ifg (x = λq α. tt) or (x = λq α. ff) 2 in a unique way, i.e. b1, b2 : Bε p x ⊢ b1 = b2 (i.e. a HoTT proposition)

But we also critically need to be compatible with the presheaf structure!

3 That is, θBε (α : q ≤ p) : Bε p x → Bε q (α · x) 4 with further defjnitional functoriality to avoid coherence issues

😲 Guess what? The CBV vs. CBN conundrum is back. 😲

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 40 / 63
slide-134
SLIDE 134

Trouble All The Way Up

This is exactly the CBV vs. CBN conundrum one level higher Either you pick Bε p x := (x = λq α. tt) + (x = λq α. ff)

⇝ this satisfjes unicity but breaks defjnitionality (i.e. CBV).

Or you freeify Bε p x := Πq α.(α · x = λr β. tt) + (α · x = λr β. ff)

⇝ this satisfjes defjnitionality but breaks unicity (i.e. CBN).

It is not possible to get both at the same time in CIC!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 41 / 63
slide-135
SLIDE 135

Trouble All The Way Up

This is exactly the CBV vs. CBN conundrum one level higher Either you pick Bε p x := (x = λq α. tt) + (x = λq α. ff)

⇝ this satisfjes unicity but breaks defjnitionality (i.e. CBV).

Or you freeify Bε p x := Πq α.(α · x = λr β. tt) + (α · x = λr β. ff)

⇝ this satisfjes defjnitionality but breaks unicity (i.e. CBN).

It is not possible to get both at the same time in CIC!

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 41 / 63
slide-136
SLIDE 136

Playing Cubes

We could solve this with infjnite towers of parametricity.

That is, the n-level proof is guaranteed to be pure by then (n + 1)-level one.

``Oh noes, not cubical type theory again!'' But CuTT itself is justifjed by presheaf models. What would be the point to implement presheaves using presheaves?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 42 / 63
slide-137
SLIDE 137

Playing Cubes

We could solve this with infjnite towers of parametricity.

That is, the n-level proof is guaranteed to be pure by then (n + 1)-level one.

``Oh noes, not cubical type theory again!'' But CuTT itself is justifjed by presheaf models. What would be the point to implement presheaves using presheaves?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 42 / 63
slide-138
SLIDE 138

Playing Cubes

We could solve this with infjnite towers of parametricity.

That is, the n-level proof is guaranteed to be pure by then (n + 1)-level one.

``Oh noes, not cubical type theory again!'' But CuTT itself is justifjed by presheaf models. What would be the point to implement presheaves using presheaves?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 42 / 63
slide-139
SLIDE 139

2 2

(On the virtues of Authoritarianism.)

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 43 / 63
slide-140
SLIDE 140

A New Hope

Essentially, we were blocked on this issue since then. When suddenly...

Gaëtan Gilbert, Jesper Cockx, Matthieu Sozeau, and Nicolas Tabareau. Defjnitional proof-irrelevance without K.
  • Proc. ACM Program. Lang., 3(POPL):3:1–3:28, 2019.

They introduce a new sort SProp of strict propositions. M N A SProp M N It can be seen as a well-behaved subset of Prop It is compatible with HoTT It enjoys all good syntactic properties (SN, canonicity, decidability...) Coq has it impredicative, Agda has a parallel hierarchy SPropi

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 44 / 63
slide-141
SLIDE 141

A New Hope

Essentially, we were blocked on this issue since then. When suddenly...

Gaëtan Gilbert, Jesper Cockx, Matthieu Sozeau, and Nicolas Tabareau. Defjnitional proof-irrelevance without K.
  • Proc. ACM Program. Lang., 3(POPL):3:1–3:28, 2019.

They introduce a new sort SProp of strict propositions. M N A SProp M N It can be seen as a well-behaved subset of Prop It is compatible with HoTT It enjoys all good syntactic properties (SN, canonicity, decidability...) Coq has it impredicative, Agda has a parallel hierarchy SPropi

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 44 / 63
slide-142
SLIDE 142

A New Hope

Essentially, we were blocked on this issue since then. When suddenly...

Gaëtan Gilbert, Jesper Cockx, Matthieu Sozeau, and Nicolas Tabareau. Defjnitional proof-irrelevance without K.
  • Proc. ACM Program. Lang., 3(POPL):3:1–3:28, 2019.

They introduce a new sort SProp of strict propositions. M, N : A : SProp − → ⊢ M ≡ N It can be seen as a well-behaved subset of Prop It is compatible with HoTT It enjoys all good syntactic properties (SN, canonicity, decidability...) Coq has it impredicative, Agda has a parallel hierarchy SPropi

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 44 / 63
slide-143
SLIDE 143

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to A restriction of singleton elimination: constructor + irrelevant args Three archetypical examples in Prop False elimination valid ☺ Acc implies undecidability of type-checking ☹ eq implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-144
SLIDE 144

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to □ A restriction of singleton elimination: ≤ 1 constructor + irrelevant args Three archetypical examples in Prop False elimination valid ☺ Acc implies undecidability of type-checking ☹ eq implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-145
SLIDE 145

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to □ A restriction of singleton elimination: ≤ 1 constructor + irrelevant args Three archetypical examples in Prop False elimination valid ☺ Acc implies undecidability of type-checking ☹ eq implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-146
SLIDE 146

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to □ A restriction of singleton elimination: ≤ 1 constructor + irrelevant args Three archetypical examples in Prop False elimination valid ☺ Acc implies undecidability of type-checking ☹ eq implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-147
SLIDE 147

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to □ A restriction of singleton elimination: ≤ 1 constructor + irrelevant args Three archetypical examples in Prop False ⇝ elimination valid ☺ Acc implies undecidability of type-checking ☹ eq implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-148
SLIDE 148

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to □ A restriction of singleton elimination: ≤ 1 constructor + irrelevant args Three archetypical examples in Prop False ⇝ elimination valid ☺ Acc ⇝ implies undecidability of type-checking ☹ eq implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-149
SLIDE 149

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to □ A restriction of singleton elimination: ≤ 1 constructor + irrelevant args Three archetypical examples in Prop False ⇝ elimination valid ☺ Acc ⇝ implies undecidability of type-checking ☹ eq ⇝ implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-150
SLIDE 150

Strict Propositions

Critically, SProp is closed under products. ⊢ A : □, x : A ⊢ B : SProp − → ⊢ Π(x : A). B : SProp The hard question is elimination from SProp to □ A restriction of singleton elimination: ≤ 1 constructor + irrelevant args Three archetypical examples in Prop False ⇝ elimination valid ☺ Acc ⇝ implies undecidability of type-checking ☹ eq ⇝ implies UIP, incompatible with HoTT 😖(who cares?) Accepting the elimination of eq gives rise to a strict equality.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 45 / 63
slide-151
SLIDE 151

A Strict Doctrine

When the libertarian HoTT freely adds infjnite towers of equalities... ... the authoritarian CIC will instead guillotine all higher equalities.

  • Art. 1. All humans are born uniquely equal in rights.

Strict equality is the authoritarian way to solve the coherence hell.

(By default, SProp as implemented in Coq doesn’t take side, you have to opt-in.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 46 / 63
slide-152
SLIDE 152

A Strict Doctrine

When the libertarian HoTT freely adds infjnite towers of equalities... ... the authoritarian sCIC will instead guillotine all higher equalities.

  • Art. 1. All humans are born uniquely equal in rights.

Strict equality is the authoritarian way to solve the coherence hell.

(By default, SProp as implemented in Coq doesn’t take side, you have to opt-in.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 46 / 63
slide-153
SLIDE 153

A Strict Doctrine

When the libertarian HoTT freely adds infjnite towers of equalities... ... the authoritarian sCIC will instead guillotine all higher equalities.

  • Art. 1. All humans are born uniquely equal in rights.

Strict equality is the authoritarian way to solve the coherence hell.

(By default, SProp as implemented in Coq doesn’t take side, you have to opt-in.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 46 / 63
slide-154
SLIDE 154

A Strict Doctrine

When the libertarian HoTT freely adds infjnite towers of equalities... ... the authoritarian sCIC will instead guillotine all higher equalities.

  • Art. 1. All humans are born uniquely equal in rights.

Strict equality is the authoritarian way to solve the coherence hell.

(By default, SProp as implemented in Coq doesn’t take side, you have to opt-in.) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 46 / 63
slide-155
SLIDE 155

Strict Parametricity

In the parametric presheaf translation, make the parametricity predicate free ⇝ defjnitional functoriality require it to be a strict proposition ⇝ proof uniqueness x : A − → { x : (Π(q : P)(α : q ≤ p). [ [A] ]q) xε : (Π(q : P)(α : q ≤ p). [ [A] ]ε q (α · x))

where critically [ [A] ]ε p x : SProp.

We call the result the prefascist translation. (lat. fascis : sheaf)

Theorem (Pédrot ’20)

The prefascist translation is a syntactic model of CIC into CIC.

Full conversion, full dependent elimination. The actual construction is a tad involved, but boils down to the above. Unsurprinsingly, UIP is required to interpret universes (tricky!). P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 47 / 63
slide-156
SLIDE 156

Strict Parametricity

In the parametric presheaf translation, make the parametricity predicate free ⇝ defjnitional functoriality require it to be a strict proposition ⇝ proof uniqueness x : A − → { x : (Π(q : P)(α : q ≤ p). [ [A] ]q) xε : (Π(q : P)(α : q ≤ p). [ [A] ]ε q (α · x))

where critically [ [A] ]ε p x : SProp.

We call the result the prefascist translation. (lat. fascis : sheaf)

Theorem (Pédrot ’20)

The prefascist translation is a syntactic model of CIC into CIC.

Full conversion, full dependent elimination. The actual construction is a tad involved, but boils down to the above. Unsurprinsingly, UIP is required to interpret universes (tricky!). P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 47 / 63
slide-157
SLIDE 157

Strict Parametricity

In the parametric presheaf translation, make the parametricity predicate free ⇝ defjnitional functoriality require it to be a strict proposition ⇝ proof uniqueness x : A − → { x : (Π(q : P)(α : q ≤ p). [ [A] ]q) xε : (Π(q : P)(α : q ≤ p). [ [A] ]ε q (α · x))

where critically [ [A] ]ε p x : SProp.

We call the result the prefascist translation. (lat. fascis : sheaf)

Theorem (Pédrot ’20)

The prefascist translation is a syntactic model of CIC into sCIC.

Full conversion, full dependent elimination. The actual construction is a tad involved, but boils down to the above. Unsurprinsingly, UIP is required to interpret universes (tricky!). P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 47 / 63
slide-158
SLIDE 158

No Pain, No Gain

sCIC is way weaker than ETT sCIC is conjectured to enjoy the usual good syntactic properties. Canonicity seems relatively easy to show UIP makes reduction depend on conversion though SN is problematic, e.g. sCIC + an impredicative universe is not SN Hoping that SN holds in the predicative case, decidability follows We don’t rely on impredicativity in the prefascist model We would inherit the purported good properties CIC for free.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 48 / 63
slide-159
SLIDE 159

No Pain, No Gain

sCIC is way weaker than ETT sCIC is conjectured to enjoy the usual good syntactic properties. Canonicity seems relatively easy to show UIP makes reduction depend on conversion though SN is problematic, e.g. sCIC + an impredicative universe is not SN Hoping that SN holds in the predicative case, decidability follows We don’t rely on impredicativity in the prefascist model We would inherit the purported good properties sCIC for free.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 48 / 63
slide-160
SLIDE 160

Back to Set

Set is a model of sCIC Thus, the prefascist model can also be described set-theoretically.

A prefascist set p p
  • ver a category
is given by a family of sets p for p . a family of predicates p Conep q q p q A prefascist morphism f from to is a family of functions fp Elp p preserving predicates, i.e. x Elp appp f x p where Elp x Conep q q p x q appp f x q q p fq x P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 49 / 63
slide-161
SLIDE 161

Back to Set

Set is a model of sCIC Thus, the prefascist model can also be described set-theoretically.

A prefascist set A := (Ap, (−) ⊩p A) over a category P is given by a family of sets Ap for p ∈ P. a family of predicates (−) ⊩p A ⊆ Conep(A) := Π(q : P)(α : q ≤ p). Aq A prefascist morphism f from to is a family of functions fp Elp p preserving predicates, i.e. x Elp appp f x p where Elp x Conep q q p x q appp f x q q p fq x P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 49 / 63
slide-162
SLIDE 162

Back to Set

Set is a model of sCIC Thus, the prefascist model can also be described set-theoretically.

A prefascist set A := (Ap, (−) ⊩p A) over a category P is given by a family of sets Ap for p ∈ P. a family of predicates (−) ⊩p A ⊆ Conep(A) := Π(q : P)(α : q ≤ p). Aq A prefascist morphism f from A to B is a family of functions fp : Elp A → Bp preserving predicates, i.e. ∀x : Elp A. appp(f, x) ⊩p B where Elp A := {x : Conep(A) | ∀q (α : q ≤ p). (α · x) ⊩q A} appp(f, x) := λq (α : q ≤ p). fq (α · x) P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 49 / 63
slide-163
SLIDE 163

Through The Looking Glass

Theorem

Prefascist sets over P form a category Pfs(P) with defjnitional laws.

Theorem

As categories, Psh and Pfs are equivalent. Proving this requires extensionality principles! Hence, in a set-theoretical meta, both describe the same objects Yet, Pfs is better behaved in an intensional setting This could come in handy for higher category theory...

Takeaway: prefascist sets are a better presentation of presheaves

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 50 / 63
slide-164
SLIDE 164

Through The Looking Glass

Theorem

Prefascist sets over P form a category Pfs(P) with defjnitional laws.

Theorem

As categories, Psh(P) and Pfs(P) are equivalent. Proving this requires extensionality principles! Hence, in a set-theoretical meta, both describe the same objects Yet, Pfs is better behaved in an intensional setting This could come in handy for higher category theory...

Takeaway: prefascist sets are a better presentation of presheaves

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 50 / 63
slide-165
SLIDE 165

Through The Looking Glass

Theorem

Prefascist sets over P form a category Pfs(P) with defjnitional laws.

Theorem

As categories, Psh(P) and Pfs(P) are equivalent. Proving this requires extensionality principles! Hence, in a set-theoretical meta, both describe the same objects Yet, Pfs(P) is better behaved in an intensional setting This could come in handy for higher category theory...

Takeaway: prefascist sets are a better presentation of presheaves

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 50 / 63
slide-166
SLIDE 166

Through The Looking Glass

Theorem

Prefascist sets over P form a category Pfs(P) with defjnitional laws.

Theorem

As categories, Psh(P) and Pfs(P) are equivalent. Proving this requires extensionality principles! Hence, in a set-theoretical meta, both describe the same objects Yet, Pfs(P) is better behaved in an intensional setting This could come in handy for higher category theory...

Takeaway: prefascist sets are a better presentation of presheaves

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 50 / 63
slide-167
SLIDE 167

Application

ОТРАСЛЯМ ПО ВСЕМ ЛОГИКИ

Russian Constructivism

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 51 / 63
slide-168
SLIDE 168

Russian Constructivist School

A splinter group of constructivists, whose core tenet can be summarized as: Proofs are Kleene realizers Thus, the principle that puts it apart both from Brouwer and Bishop: Markov’s Principle (MP) f n f n tt n f n tt

A lot of equivalent statements, e.g. a TM that doesn’t loop terminates Semi-classical: HA HA MP PA Known to preserve existence property (i.e. canonicity)

What if we tried to extend CIC with MP through a syntactic model?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 52 / 63
slide-169
SLIDE 169

Russian Constructivist School

A splinter group of constructivists, whose core tenet can be summarized as: Proofs are Kleene realizers Thus, the principle that puts it apart both from Brouwer and Bishop: Markov’s Principle (MP) ∀(f : N → B). ¬¬(∃n : N. f n = tt) → ∃n : N. f n = tt

A lot of equivalent statements, e.g. a TM that doesn’t loop terminates Semi-classical: HAω ⊊ HAω + MP ⊊ PAω Known to preserve existence property (i.e. canonicity)

What if we tried to extend CIC with MP through a syntactic model?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 52 / 63
slide-170
SLIDE 170

Russian Constructivist School

A splinter group of constructivists, whose core tenet can be summarized as: Proofs are Kleene realizers Thus, the principle that puts it apart both from Brouwer and Bishop: Markov’s Principle (MP) ∀(f : N → B). ¬¬(∃n : N. f n = tt) → ∃n : N. f n = tt

A lot of equivalent statements, e.g. a TM that doesn’t loop terminates Semi-classical: HAω ⊊ HAω + MP ⊊ PAω Known to preserve existence property (i.e. canonicity)

What if we tried to extend CIC with MP through a syntactic model?

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 52 / 63
slide-171
SLIDE 171

MP in Kleene Realizability

Let’s look at the realizer ∀(f : N → B). ¬¬(∃n : N. f n = tt) → ∃n : N. f n = tt

let mp f _ := let n := ref 0 in while true do if f !n then return n else n := n + 1 done

Proving mp MP needs MP in the meta-theory!

As such, this is cheating The realizer doesn’t use the doubly-negated proof Relies on a semi-classical meta-theory and unbounded loops We have little hope to implement this in CIC with a syntactic model

We need something else...

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 53 / 63
slide-172
SLIDE 172

MP in Kleene Realizability

Let’s look at the realizer ∀(f : N → B). ¬¬(∃n : N. f n = tt) → ∃n : N. f n = tt

let mp f _ := let n := ref 0 in while true do if f !n then return n else n := n + 1 done

Proving mp ⊩ MP needs MP in the meta-theory!

As such, this is cheating The realizer doesn’t use the doubly-negated proof Relies on a semi-classical meta-theory and unbounded loops We have little hope to implement this in CIC with a syntactic model

We need something else...

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 53 / 63
slide-173
SLIDE 173

MP in Kleene Realizability

Let’s look at the realizer ∀(f : N → B). ¬¬(∃n : N. f n = tt) → ∃n : N. f n = tt

let mp f _ := let n := ref 0 in while true do if f !n then return n else n := n + 1 done

Proving mp ⊩ MP needs MP in the meta-theory!

As such, this is cheating The realizer doesn’t use the doubly-negated proof Relies on a semi-classical meta-theory and unbounded loops We have little hope to implement this in CIC with a syntactic model

We need something else...

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 53 / 63
slide-174
SLIDE 174

What Else?

Not one, but at least two alternatives! Coquand-Hofmann’s syntactic model for HA MP Herbelin’s direct style proof using static exceptions mp p n f n tt try

e p

k k n raise n with n n In the remainder, we’ll show that Coquand-Hofmann’s model scales to CIC It can be presented as the composition of two translations It has the same computational content as Herbelin’s proof

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 54 / 63
slide-175
SLIDE 175

What Else?

Not one, but at least two alternatives! Coquand-Hofmann’s syntactic model for HAω + MP Herbelin’s direct style proof using static exceptions mp (p : ¬¬(∃n. f n = tt)) := tryα ⊥e (p (λk. k (λn. raiseα n))) with α n → n In the remainder, we’ll show that Coquand-Hofmann’s model scales to CIC It can be presented as the composition of two translations It has the same computational content as Herbelin’s proof

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 54 / 63
slide-176
SLIDE 176

What Else?

Not one, but at least two alternatives! Coquand-Hofmann’s syntactic model for HAω + MP Herbelin’s direct style proof using static exceptions mp (p : ¬¬(∃n. f n = tt)) := tryα ⊥e (p (λk. k (λn. raiseα n))) with α n → n In the remainder, we’ll show that Coquand-Hofmann’s model scales to CIC It can be presented as the composition of two translations It has the same computational content as Herbelin’s proof

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 54 / 63
slide-177
SLIDE 177

High-level view

CH’s model is a mix of Kripke semantics and Friedman’s A-translation. Kripke semantics ⇝ global cell A-translation ⇝ exceptions They specifjcally pick: Kripke cell of type , where q p n p n tt q n tt (q truer than p) Exceptions of type Ep n p n tt The secret sauce is that the exception type depends on the current p

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 55 / 63
slide-178
SLIDE 178

High-level view

CH’s model is a mix of Kripke semantics and Friedman’s A-translation. Kripke semantics ⇝ global cell A-translation ⇝ exceptions They specifjcally pick: Kripke cell of type N → B, where q ≤ p := ∀n : N. p n = tt → q n = tt (q truer than p) Exceptions of type Ep := ∃n : N. p n = tt The secret sauce is that the exception type depends on the current p

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 55 / 63
slide-179
SLIDE 179

High-level view

CH’s model is a mix of Kripke semantics and Friedman’s A-translation. Kripke semantics ⇝ global cell A-translation ⇝ exceptions They specifjcally pick: Kripke cell of type N → B, where q ≤ p := ∀n : N. p n = tt → q n = tt (q truer than p) Exceptions of type Ep := ∃n : N. p n = tt The secret sauce is that the exception type depends on the current p

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 55 / 63
slide-180
SLIDE 180

Pipelining

Coquand-Hofmann’s model is a bit ad-hoc Instead, we present our CIC variant synthetically as the composition CIC

Exn

CIC

Pfs

CIC where Pfs is the prefascist model described before Exn is the exceptional model, a CIC-worthy A-translation

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 56 / 63
slide-181
SLIDE 181

Pipelining

Coquand-Hofmann’s model is a bit ad-hoc Instead, we present our CIC variant synthetically as the composition CIC

Exn

− → CIC + E

Pfs

− → sCIC where Pfs is the prefascist model described before Exn is the exceptional model, a CIC-worthy A-translation

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 56 / 63
slide-182
SLIDE 182

Failure is Not an Option

Exn is a very simple syntactic model of CIC Pick a fjxed exception type in the target theory. A A A A A A M A M A Every type A comes with its failure function A A

Functions are interpreted as x A B x A B Inductive types are interpreted pointwise + a dedicated constructor for error tt ff

Theorem

Provided there is no closed M in the target theory, the source theory enjoys canonicity. In particular, it is consistent.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 57 / 63
slide-183
SLIDE 183

Failure is Not an Option

Exn is a very simple syntactic model of CIC Pick a fjxed exception type E in the target theory. ⊢S A : □ − → ⊢T [A] := ([ [A] ], [A]∅) : ΣA0 : □. (E → A0) ⊢S M : A − → ⊢T [M] : [ [A] ] Every type [ [A] ] comes with its failure function [A]∅ : E → [ [A] ]

Functions are interpreted as x A B x A B Inductive types are interpreted pointwise + a dedicated constructor for error tt ff

Theorem

Provided there is no closed M in the target theory, the source theory enjoys canonicity. In particular, it is consistent.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 57 / 63
slide-184
SLIDE 184

Failure is Not an Option

Exn is a very simple syntactic model of CIC Pick a fjxed exception type E in the target theory. ⊢S A : □ − → ⊢T [A] := ([ [A] ], [A]∅) : ΣA0 : □. (E → A0) ⊢S M : A − → ⊢T [M] : [ [A] ] Every type [ [A] ] comes with its failure function [A]∅ : E → [ [A] ]

Functions are interpreted as [ [Πx : A. B] ] := Πx : [ [A] ]. [ [B] ] Inductive types are interpreted pointwise + a dedicated constructor for error [ [B] ] := ttE : [ [B] ] | ffE : [ [B] ] | B∅ : E → [ [B] ]

Theorem

Provided there is no closed M in the target theory, the source theory enjoys canonicity. In particular, it is consistent.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 57 / 63
slide-185
SLIDE 185

Failure is Not an Option

Exn is a very simple syntactic model of CIC Pick a fjxed exception type E in the target theory. ⊢S A : □ − → ⊢T [A] := ([ [A] ], [A]∅) : ΣA0 : □. (E → A0) ⊢S M : A − → ⊢T [M] : [ [A] ] Every type [ [A] ] comes with its failure function [A]∅ : E → [ [A] ]

Functions are interpreted as [ [Πx : A. B] ] := Πx : [ [A] ]. [ [B] ] Inductive types are interpreted pointwise + a dedicated constructor for error [ [B] ] := ttE : [ [B] ] | ffE : [ [B] ] | B∅ : E → [ [B] ]

Theorem

Provided there is no closed M : E in the target theory, the source theory enjoys canonicity. In particular, it is consistent.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 57 / 63
slide-186
SLIDE 186

Somebody Set Up Us The Bomb

We perform the exceptional translation over an exotic type of exceptions CIC

Exn

− → CIC + E

Pfs

− → sCIC E exists in the prefascist model over P := N → B. Ep := Σn : N. p n = tt There is no closed proof of in CIC since

p

n ff tt for p constantly ff

(We do not have CIC though.)

Therefore, the leftmost source theory is consistent.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 58 / 63
slide-187
SLIDE 187

Somebody Set Up Us The Bomb

We perform the exceptional translation over an exotic type of exceptions CIC

Exn

− → CIC + E

Pfs

− → sCIC E exists in the prefascist model over P := N → B. Ep := Σn : N. p n = tt There is no closed proof of E in CIC + E since Ep := Σn : N. ff = tt for p constantly ff

(We do not have ⊢CIC+E ¬E though.)

Therefore, the leftmost source theory is consistent.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 58 / 63
slide-188
SLIDE 188

Somebody Set Up Us The Bomb

We perform the exceptional translation over an exotic type of exceptions CIC

Exn

− → CIC + E

Pfs

− → sCIC E exists in the prefascist model over P := N → B. Ep := Σn : N. p n = tt There is no closed proof of E in CIC + E since Ep := Σn : N. ff = tt for p constantly ff

(We do not have ⊢CIC+E ¬E though.)

Therefore, the leftmost source theory is consistent.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 58 / 63
slide-189
SLIDE 189

Realizing MP

We also have a modality in CIC + E

local : (N → B) → □ → □ [local ϕ A]p := [A]p∧ϕ return : A → local ϕ A local commutes to arrows and positive types local ϕ E ∼ = E + (Σn : N. ϕ n = tt)

To realize MP, we perform intuitionistic symbol pushing in CIC

n n tt n n tt local n n tt n n tt local local n n tt n n tt P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 59 / 63
slide-190
SLIDE 190

Realizing MP

We also have a modality in CIC + E

local : (N → B) → □ → □ [local ϕ A]p := [A]p∧ϕ return : A → local ϕ A local commutes to arrows and positive types local ϕ E ∼ = E + (Σn : N. ϕ n = tt)

To realize MP, we perform intuitionistic symbol pushing in CIC + E

[ [¬¬(Σn : N. ϕ n = tt)] ]E ∼ = ((Σn : N. ϕ n = tt) → E) → E → local ϕ (((Σn : N. ϕ n = tt) → E) → E) ∼ = ((Σn : N. ϕ n = tt) → local ϕ E) → local ϕ E → E + (Σn : N. ϕ n = tt) → [ [Σn : N. ϕ n = tt] ]E P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 59 / 63
slide-191
SLIDE 191

A Computational Analysis of MP

Every time we go under local we get new exceptions! local ϕ E ∼ = E + (Σn : N. ϕ n = tt) return is a delimited continuation prompt / static exception binder. The structure of the realizer thus follows closely Herbelin’s proof. mp p n f n tt try

e p

k k n raise n with n n In particular p can raise exceptions from outside, which is refmected here. Thus, Herbelin’s proof is the direct style variant of Coquand-Hofmann

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 60 / 63
slide-192
SLIDE 192

A Computational Analysis of MP

Every time we go under local we get new exceptions! local ϕ E ∼ = E + (Σn : N. ϕ n = tt) return is a delimited continuation prompt / static exception binder. The structure of the realizer thus follows closely Herbelin’s proof. mp (p : ¬¬(∃n. f n = tt)) := tryα ⊥e (p (λk. k (λn. raiseα n))) with α n → n In particular p can raise exceptions from outside, which is refmected here. Thus, Herbelin’s proof is the direct style variant of Coquand-Hofmann

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 60 / 63
slide-193
SLIDE 193

A Computational Analysis of MP

Every time we go under local we get new exceptions! local ϕ E ∼ = E + (Σn : N. ϕ n = tt) return is a delimited continuation prompt / static exception binder. The structure of the realizer thus follows closely Herbelin’s proof. mp (p : ¬¬(∃n. f n = tt)) := tryα ⊥e (p (λk. k (λn. raiseα n))) with α n → n In particular p can raise exceptions from outside, which is refmected here. Thus, Herbelin’s proof is the direct style variant of Coquand-Hofmann

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 60 / 63
slide-194
SLIDE 194

Final Digression

This is also highly reminiscent of NbE models Two canonical ways to extend Kripke completeness to positive types: Add neutral terms to the semantic of positive types Add MP in the meta Neutral terms behave as statically bound exceptions As our model shows, this two techniques are morally equivalent. This also highlights suspicious ties between delimited continuations and presheaves.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 61 / 63
slide-195
SLIDE 195

Final Digression

This is also highly reminiscent of NbE models Two canonical ways to extend Kripke completeness to positive types: Add neutral terms to the semantic of positive types Add MP in the meta Neutral terms behave as statically bound exceptions As our model shows, this two techniques are morally equivalent. This also highlights suspicious ties between delimited continuations and presheaves.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 61 / 63
slide-196
SLIDE 196

Conclusion

On presheaves: Presheaves are a purifjed sublanguage of a monotonic reader efgect We have given a better-behaved presentation of presheaves It is a syntactic model that relies on strict equality in the target Provides for free extensions of CIC with SN, canonicity and the like ... assuming sCIC enjoys this (†) On MP: Composition of the prefascist model with another model of ours This provides a computational extension of CIC that validates MP Once again, good properties for free TODO: Implement cubical type theory in this model

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 62 / 63
slide-197
SLIDE 197

Conclusion

On presheaves: Presheaves are a purifjed sublanguage of a monotonic reader efgect We have given a better-behaved presentation of presheaves It is a syntactic model that relies on strict equality in the target Provides for free extensions of CIC with SN, canonicity and the like ... assuming sCIC enjoys this (†) On MP: Composition of the prefascist model with another model of ours This provides a computational extension of CIC that validates MP Once again, good properties for free TODO: Implement cubical type theory in this model

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 62 / 63
slide-198
SLIDE 198

Conclusion

On presheaves: Presheaves are a purifjed sublanguage of a monotonic reader efgect We have given a better-behaved presentation of presheaves It is a syntactic model that relies on strict equality in the target Provides for free extensions of CIC with SN, canonicity and the like ... assuming sCIC enjoys this (†) On MP: Composition of the prefascist model with another model of ours This provides a computational extension of CIC that validates MP Once again, good properties for free TODO: Implement cubical type theory in this model

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 62 / 63
slide-199
SLIDE 199

Scribitur ad narrandum, non ad probandum

Thanks for your attention.

P.-M. Pédrot (INRIA) An Authoritarian Approach to Presheaves 05/06/2020 63 / 63