Reasoning on programs using Step-indexed Realizability Guilhem Jaber - - PowerPoint PPT Presentation

reasoning on programs using step indexed realizability
SMART_READER_LITE
LIVE PREVIEW

Reasoning on programs using Step-indexed Realizability Guilhem Jaber - - PowerPoint PPT Presentation

Reasoning on programs using Step-indexed Realizability Guilhem Jaber PPS, IRIF, Universite Paris Diderot Realizability in Uruguay 2016 July 19th 2016 1 / 23 How to reason formally on programs ? Program logics (Hoare, Separation, . . . ) Type


slide-1
SLIDE 1

Reasoning on programs using Step-indexed Realizability

Guilhem Jaber

PPS, IRIF, Universite Paris Diderot

Realizability in Uruguay 2016 July 19th 2016

1 / 23

slide-2
SLIDE 2

How to reason formally on programs ?

Program logics (Hoare, Separation, . . . ) Type systems (Dependent, Refinement, . . . ) Denotational models (Domains, Games, . . . ) Syntactic models (Realizability, Logical Relations, . . . )

2 / 23

slide-3
SLIDE 3

Outline of the Talk

What we will do: Semantics proof of soundness for a simple call-by-value language with fixed points; Realizability model for a language with refinment types. To show that: Semantic proofs of type soundness give a lot more information than syntactic one (Wright and Felleisen’s“progress and preservations” ); Step-indexing is a great technique to make these proofs feasible; We can abstract over step-indexes using Godel-Lob Logic; Gidel-Lob logic can be embedded into Dependent Type theory.

3 / 23

slide-4
SLIDE 4

Contents

1

Semantic proof of type soundness

2

Refinement types

3

Abstracting over step-indexing: Godel-Lob Logic

4

Going further into abstraction: Guarded recursive types

4 / 23

slide-5
SLIDE 5

A CBV λ-calculus with fixed points

v

def

= x | fix f (x).M | n | true | false (n ∈ N, x ∈ Var) M, N

def

= v | MN | if M then N1 else N2 | . . . K

def

=

  • | vK | KM | if K then M else M′ | . . .

τ, σ

def

= Nat | Bool | τ → σ (fix f (x).M) v → M{v/x}{fix f (x).M/f } if true then N1 else N2 → N1 if false then N1 else N2 → N2 M → M′ K[M] → K[M′] Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ

5 / 23

slide-6
SLIDE 6

Realizability model

Types interpreted as set of terms. VNat

def

= N VBool

def

= {true, false} Vτ → σ

def

= {fix f (x).M | ∀v ∈ Vτ.(fix f (x).M)v ∈ Eσ} Eτ

def

= {M | ∀v.(M →∗ v) ⇒ v ∈ Vτ} GΓ

def

= {γ | ∀(x, τ) ∈ Γ, γ(x) ∈ Vτ} M ∈ Eτ means that M realizes τ.

Theorem (Soundness)

If Γ ⊢ M : τ then for all γ ∈ GΓ, M{γ} ∈ Eτ.

6 / 23

slide-7
SLIDE 7

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ

7 / 23

slide-8
SLIDE 8

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?)

7 / 23

slide-9
SLIDE 9

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. fix f (x).M{γ} ∈ Vτ → σ (?)

7 / 23

slide-10
SLIDE 10

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, (fix f (x).M{γ})v ∈ Eσ (?)

7 / 23

slide-11
SLIDE 11

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, (fix f (x).M{γ})v ∈ Eσ (?) i.e. M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Eσ (?)

7 / 23

slide-12
SLIDE 12

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, (fix f (x).M{γ})v ∈ Eσ (?) i.e. M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Eσ (?) IH: for all γ′ ∈ GΓ, x : τ, f : τ → σ, M{γ′} ∈ Eτ → σ

7 / 23

slide-13
SLIDE 13

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, (fix f (x).M{γ})v ∈ Eσ (?) i.e. M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Eσ (?) IH: for all γ′ ∈ GΓ, x : τ, f : τ → σ, M{γ′} ∈ Eτ → σ Does γ · [x → v] · [f → fix f (x).M{γ}] ∈ GΓ, x : τ, f : τ → σ ?

7 / 23

slide-14
SLIDE 14

Proof of Soundness

By induction on the derivation tree of Γ ⊢ M : τ. Interesting case: typing rule for fixed points. Γ, x : τ, f : τ → σ ⊢ M : σ Γ ⊢ fix f (x).M : τ → σ Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, (fix f (x).M{γ})v ∈ Eσ (?) i.e. M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Eσ (?) IH: for all γ′ ∈ GΓ, x : τ, f : τ → σ, M{γ′} ∈ Eτ → σ Does γ · [x → v] · [f → fix f (x).M{γ}] ∈ GΓ, x : τ, f : τ → σ ? Only if fix f (x).M{γ} ∈ Vτ → σ ... That’s problematic !

7 / 23

slide-15
SLIDE 15

Step-Indexing to the rescue !

Idea: Stratify the model using natural numbers as indices ! (Appel & McAllester, Ahmed, . . . ) Vk Nat

def

= N Vk Bool

def

= {true, false} Vk τ → σ

def

= {fix f (x).M | ∀j ≤ k.∀v. v ∈ Vj τ ⇒ (fix f (x).M)v) ∈ Ej σ} Ek τ

def

= {M | ∀j < k.∀v.(M →j v) ⇒ v ∈ Vk−j τ} Gk Γ

def

= {ρ | ∀(x, τ) ∈ Γ, ρ(x) ∈ Vk τ} If M reduces in more than k steps to a value (or diverges), then M ∈ Eτk !!

Theorem (Monotonicity)

If M ∈ Ek τ then for all j ≤ k, M ∈ Ej τ.

8 / 23

slide-16
SLIDE 16

Soundness of the Step-indexed model

Theorem (Soundness)

If Γ ⊢ M : τ then for all γ ∈ Gk Γ, M{γ} ∈ Ek τ. By induction on the derivation tree of Γ ⊢ M : τ and on the step-index k.

9 / 23

slide-17
SLIDE 17

Compatibility lemma for the fixed point

Let γ ∈ Gk Γ, we must prove that (fix f (x).M){γ} ∈ Ek τ → σ (?)

10 / 23

slide-18
SLIDE 18

Compatibility lemma for the fixed point

Let γ ∈ Gk Γ, we must prove that (fix f (x).M){γ} ∈ Ek τ → σ (?) i.e. does fix f (x).(M{γ}) ∈ Vk τ → σ (?)

10 / 23

slide-19
SLIDE 19

Compatibility lemma for the fixed point

Let γ ∈ Gk Γ, we must prove that (fix f (x).M){γ} ∈ Ek τ → σ (?) i.e. does fix f (x).(M{γ}) ∈ Vk τ → σ (?) i.e. for all j ≤ k and v ∈ Vj τ, does (fix f (x).M{γ})v ∈ Ej σ (?)

10 / 23

slide-20
SLIDE 20

Compatibility lemma for the fixed point

Let γ ∈ Gk Γ, we must prove that (fix f (x).M){γ} ∈ Ek τ → σ (?) i.e. does fix f (x).(M{γ}) ∈ Vk τ → σ (?) i.e. for all j ≤ k and v ∈ Vj τ, does (fix f (x).M{γ})v ∈ Ej σ (?) i.e.does M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Ej−1 σ (?)

10 / 23

slide-21
SLIDE 21

Compatibility lemma for the fixed point

Let γ ∈ Gk Γ, we must prove that (fix f (x).M){γ} ∈ Ek τ → σ (?) i.e. does fix f (x).(M{γ}) ∈ Vk τ → σ (?) i.e. for all j ≤ k and v ∈ Vj τ, does (fix f (x).M{γ})v ∈ Ej σ (?) i.e.does M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Ej−1 σ (?) IH1: for all γ′ ∈ Gi Γ, x : τ, f : τ → σ , M{γ′} ∈ Ei σ IH2: for all i < k, fix f (x).M){γ} ∈ Ei τ → σ

10 / 23

slide-22
SLIDE 22

Compatibility lemma for the fixed point

Let γ ∈ Gk Γ, we must prove that (fix f (x).M){γ} ∈ Ek τ → σ (?) i.e. does fix f (x).(M{γ}) ∈ Vk τ → σ (?) i.e. for all j ≤ k and v ∈ Vj τ, does (fix f (x).M{γ})v ∈ Ej σ (?) i.e.does M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Ej−1 σ (?) IH1: for all γ′ ∈ Gi Γ, x : τ, f : τ → σ , M{γ′} ∈ Ei σ IH2: for all i < k, fix f (x).M){γ} ∈ Ei τ → σ Does (γ · [x → v] · [f → fix f (x).M{γ}]) ∈ Gj−1 Γ, x : τ, f : τ → σ ?

10 / 23

slide-23
SLIDE 23

Compatibility lemma for the fixed point

Let γ ∈ Gk Γ, we must prove that (fix f (x).M){γ} ∈ Ek τ → σ (?) i.e. does fix f (x).(M{γ}) ∈ Vk τ → σ (?) i.e. for all j ≤ k and v ∈ Vj τ, does (fix f (x).M{γ})v ∈ Ej σ (?) i.e.does M{γ}{v/x}{(fix f (x).M{γ})/f } ∈ Ej−1 σ (?) IH1: for all γ′ ∈ Gi Γ, x : τ, f : τ → σ , M{γ′} ∈ Ei σ IH2: for all i < k, fix f (x).M){γ} ∈ Ei τ → σ Does (γ · [x → v] · [f → fix f (x).M{γ}]) ∈ Gj−1 Γ, x : τ, f : τ → σ ? Only if fix f (x).M{γ} ∈ Vj−1 τ → σ ... IH2 to the rescue !

10 / 23

slide-24
SLIDE 24

Contents

1

Semantic proof of type soundness

2

Refinement types

3

Abstracting over step-indexing: Godel-Lob Logic

4

Going further into abstraction: Guarded recursive types

11 / 23

slide-25
SLIDE 25

Refinement types

Arithmetic formulas as types. Vk Nat{P}

def

= {m ∈ N | m ∈ P} Vk Bool

def

= {true, false} Vk τ ∧ σ

def

= Vk τ ∩ Vk σ Vk ∀a.τ

def

=

  • n∈N Vk τ{n/a}

Vk τ → σ

def

= {(λx.M, k) | ∀j ≤ k.∀v ∈ Vj τ . (λx.M)v ∈ Eσj} Ek τ

def

= {M | ∀j < k.∀v.(M →j v) ⇒ v ∈ Vk−j τ}

12 / 23

slide-26
SLIDE 26

McCarthy’s 91 function

fix MC(x).if x ≤ 100 then MC(MC(x + 11)) else x − 10

13 / 23

slide-27
SLIDE 27

McCarthy’s 91 function

fix MC(x).if x ≤ 100 then MC(MC(x + 11)) else x − 10 is in Vk

  • ∀n.
  • Nat{n ≤ 100} → Nat{91}
  • Nat{n > 100} → Nat{n − 10}
  • for all k ∈ N

13 / 23

slide-28
SLIDE 28

McCarthy’s 91 function

fix MC(x).if x ≤ 100 then MC(MC(x + 11)) else x − 10 is in Vk

  • ∀n.
  • Nat{n ≤ 100} → Nat{91}
  • Nat{n > 100} → Nat{n − 10}
  • for all k ∈ N

By induction over the step-indexed k: If k = 0, straightforward... if k > 0, let n ∈ N,

If n > 100, then we must prove that n − 10 ∈ Ek Nat{n − 10}: straightforward.

13 / 23

slide-29
SLIDE 29

McCarthy’s 91 function

fix MC(x).if x <= 100 then MC(MC(x + 11)) else x − 10 is in Vk

  • ∀n.
  • Nat{n ≤ 100} → Nat{91}
  • Nat{n > 100} → Nat{n − 10}
  • for all k ∈ N

If n ≤ 100, then we must prove that MC(MC(n + 11)) ∈ Ek−1 Nat{91}:

14 / 23

slide-30
SLIDE 30

McCarthy’s 91 function

fix MC(x).if x <= 100 then MC(MC(x + 11)) else x − 10 is in Vk

  • ∀n.
  • Nat{n ≤ 100} → Nat{91}
  • Nat{n > 100} → Nat{n − 10}
  • for all k ∈ N

If n ≤ 100, then we must prove that MC(MC(n + 11)) ∈ Ek−1 Nat{91}: if n ≤ 89, we know (IH) that MC(n + 11) ∈ Ek−1 Nat{91} and MC(91) ∈ Ek−1 Nat{91}

14 / 23

slide-31
SLIDE 31

McCarthy’s 91 function

fix MC(x).if x <= 100 then MC(MC(x + 11)) else x − 10 is in Vk

  • ∀n.
  • Nat{n ≤ 100} → Nat{91}
  • Nat{n > 100} → Nat{n − 10}
  • for all k ∈ N

If n ≤ 100, then we must prove that MC(MC(n + 11)) ∈ Ek−1 Nat{91}: if n ≤ 89, we know (IH) that MC(n + 11) ∈ Ek−1 Nat{91} and MC(91) ∈ Ek−1 Nat{91} if 89 < n < 100, we know (IH) that MC(n + 11) ∈ Ek−1 Nat{n + 1} and MC(n + 1) ∈ Ek−1 Nat{91}

14 / 23

slide-32
SLIDE 32

McCarthy’s 91 function

fix MC(x).if x <= 100 then MC(MC(x + 11)) else x − 10 is in Vk

  • ∀n.
  • Nat{n ≤ 100} → Nat{91}
  • Nat{n > 100} → Nat{n − 10}
  • for all k ∈ N

If n ≤ 100, then we must prove that MC(MC(n + 11)) ∈ Ek−1 Nat{91}: if n ≤ 89, we know (IH) that MC(n + 11) ∈ Ek−1 Nat{91} and MC(91) ∈ Ek−1 Nat{91} if 89 < n < 100, we know (IH) that MC(n + 11) ∈ Ek−1 Nat{n + 1} and MC(n + 1) ∈ Ek−1 Nat{91} if n = 100, we know (IH) that MC(111) ∈ Ek−1 Nat{101} and MC(101) ∈ Ek−1 Nat{91}.

14 / 23

slide-33
SLIDE 33

Contents

1

Semantic proof of type soundness

2

Refinement types

3

Abstracting over step-indexing: Godel-Lob Logic

4

Going further into abstraction: Guarded recursive types

15 / 23

slide-34
SLIDE 34

Kripke Semantics for the Metalogic

The metal-logic: Second-order modal logic with recursive predicates. k | = P ⇒ Q

def

= ∀j ≤ k.(j | = P) ⇒ (j | = Q) k | = P ∧ Q

def

= (k | = P) ∧ (k | = Q) k | = ∀x.P

def

= ∀x.(k | = P) 0 | = ⊲P

def

= True k | = ⊲P

def

= k − 1 | = P k | = µX.P

def

= k | = P{µX.P/X} . . . . . . Monotonicity: for all j, k, P, if j ≤ k then (k | = P) ⇒ (j | = P) Lob Rule: For all k, P : k | = (⊲P ⇒ P) ⇒ P (Nakano, LICS’00; Appel, McAllester, Mellies & Vouillon, POPL’04)

16 / 23

slide-35
SLIDE 35

Realizability model

Vαρ

def

= P where ρ(α) = (P, )} VUnitρ

def

= {()} Vτ → σρ

def

= {λx.M | ∀v.v ∈ Vτρ ⇒ (λx.M)v ∈ Eσρ} V∀α.τρ

def

= {Λα.M | ∀σ∀P ∈ Predσ(Λα.M)σ ∈ Eσρ·[α→(P,σ)]} V∃α.τρ

def

= {(packσ, v | ∃P ∈ Predσ.v ∈ Vτρ·[α→(P,σ)]} Vτ1 × τ2ρ

def

= {u1, u2 | ∀i ∈ {1, 2}, ui ∈ Vτiρ} Vτ1 + τ2ρ

def

= {inji(u) | i ∈ {1, 2} ∧ u ∈ Vτiρ} Vµα.τρ

def

= µP.{foldv | ⊲ v ∈ Vτρ·[α→[(P,ρ(µα.τ))]} Eτρ

def

= µP.{M | ∀h : w.∀M′.(M, h) → (M′, h) ⇒ ⊲(M′ ∈ Eτρ)}

17 / 23

slide-36
SLIDE 36

Soundness of the model

Theorem (Fundamental Theorem)

If ∆; Σ, Γ ⊢ M : τ then for all k ∈ N, k | = ∀ρ ∈ D∆, γ ∈ GΓρ, M{γ}{ρ} ∈ Eτρ. By induction on the derivation tree of Γ ⊢ M : τ, the proof being done inside the metalogic.

18 / 23

slide-37
SLIDE 37

Compatibility lemma for the fixed point

Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?)

19 / 23

slide-38
SLIDE 38

Compatibility lemma for the fixed point

Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. does fix f (x).M{γ} ∈ Vτ → σ (?)

19 / 23

slide-39
SLIDE 39

Compatibility lemma for the fixed point

Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. does fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, does (fix f (x).M{γ})v ∈ Eσ (?)

19 / 23

slide-40
SLIDE 40

Compatibility lemma for the fixed point

Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. does fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, does (fix f (x).M{γ})v ∈ Eσ (?) i.e. does ⊲

  • M{γ}{v/x}{fix f (x).M{γ}/f } ∈ Eσ
  • (?)

19 / 23

slide-41
SLIDE 41

Compatibility lemma for the fixed point

Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. does fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, does (fix f (x).M{γ})v ∈ Eσ (?) i.e. does ⊲

  • M{γ}{v/x}{fix f (x).M{γ}/f } ∈ Eσ
  • (?)

IH: for all γ′ ∈ GΓ, x : τ, f : τ → σ, M{γ′} ∈ Eσ Monotonicity: for all γ′, ⊲

  • γ′ ∈ GΓ, x : τ, f : τ → σ
  • ⇒ ⊲
  • M{γ′} ∈ Eσ
  • 19 / 23
slide-42
SLIDE 42

Compatibility lemma for the fixed point

Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. does fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, does (fix f (x).M{γ})v ∈ Eσ (?) i.e. does ⊲

  • M{γ}{v/x}{fix f (x).M{γ}/f } ∈ Eσ
  • (?)

IH: for all γ′ ∈ GΓ, x : τ, f : τ → σ, M{γ′} ∈ Eσ Monotonicity: for all γ′, ⊲

  • γ′ ∈ GΓ, x : τ, f : τ → σ
  • ⇒ ⊲
  • M{γ′} ∈ Eσ
  • Does ⊲
  • γ · [x → v] · [f → fix f (x).M{γ}] ∈ GΓ, x : τ, f : τ → σ
  • ?

19 / 23

slide-43
SLIDE 43

Compatibility lemma for the fixed point

Let γ ∈ GΓ, we must prove that (fix f (x).M){γ} ∈ Eτ → σ (?) i.e. does fix f (x).M{γ} ∈ Vτ → σ (?) i.e. for all v ∈ Vτ, does (fix f (x).M{γ})v ∈ Eσ (?) i.e. does ⊲

  • M{γ}{v/x}{fix f (x).M{γ}/f } ∈ Eσ
  • (?)

IH: for all γ′ ∈ GΓ, x : τ, f : τ → σ, M{γ′} ∈ Eσ Monotonicity: for all γ′, ⊲

  • γ′ ∈ GΓ, x : τ, f : τ → σ
  • ⇒ ⊲
  • M{γ′} ∈ Eσ
  • Does ⊲
  • γ · [x → v] · [f → fix f (x).M{γ}] ∈ GΓ, x : τ, f : τ → σ
  • ?

Only if ⊲

  • fix f (x).M{γ} ∈ Vτ → σ
  • ... Lob rule to the rescue !

Writing P for fix f (x).M{γ} ∈ Vτ → σ, we have (⊲P ⇒ P) ⇒ P.

19 / 23

slide-44
SLIDE 44

Contents

1

Semantic proof of type soundness

2

Refinement types

3

Abstracting over step-indexing: Godel-Lob Logic

4

Going further into abstraction: Guarded recursive types

20 / 23

slide-45
SLIDE 45

Generalizing the metalogic

Goal: A Framework to Solve recursive domain equations as in the category of bisected ultrametric spaces, Hide step-indexing using Godel-Lob logic. A semantic model: “Topos of trees”S = Presheaves over N (Birkedal et al., LICS’10): F : N → Set for all k ≥ j, restrictions maps θk→j : F(k) → F(j) s.t.

θk→k = idF(k) θk→j ◦ θj→i = θk→i.

S is a topos ⇒ we can model dependent type theory in it.

21 / 23

slide-46
SLIDE 46

Calculus of Construction as the Metalogic

Dependent Products and Sums, Hierarchy of universe: Πx : T.U, Σx : T.U, Prop, (Typei)i∈N), . . . Basic ingredients to define guarded recursive types: for all type universe U ∈ {Prop, Typei}, a term ⊲ : U → U, for all types T, a term fixT : (⊲T → T) → T,

when T is a proposition: Lob rule,

for all types T, a term nextT : T → ⊲T, for all type universe U ∈ {Prop, Typei}, a term switch : ⊲U → U,

s.t. switch(nextU(T)) = ⊲T.

fix(f ) = f (next(fix(f )))

22 / 23

slide-47
SLIDE 47

Going Further

Step-indexing is an instance of Forcing !

Composition of Forcing and Realizability.

In practice: Logical Relations rather than Realizability

Binary v.s. Unary predicates. Biorthogonal definitions (similar to Krivine realizability). Great tool to prove contextual equivalence and“free theorems” .

Connection with recursive domain equations

1-bounded bisected ultrametric spaces (Birkedal et al., POPL’11)

Guarded Recursive Types

Useful to encode productive coinductive types.

23 / 23