Skip to content

The five typing rules of pure System F

7 fully proved

System F

InductiveExtrinsic typing of pure System F terms#✓fully proved

Extrinsic typing of scoped pure System F terms.

inductive Typing : {n m : Nat} → Ctx n m → Tm n m → Ty n → Prop where
  | var {n m : Nat} {Γ : Ctx n m} (i : Fin m) :
      Typing Γ (.var i) (Γ i)
  | lam {n m : Nat} {Γ : Ctx n m} {A B : Ty n} {b : Tm n (m + 1)} :
      Typing (Fin.cases A Γ) b B → Typing Γ (.lam A b) (.arr A B)
  | app {n m : Nat} {Γ : Ctx n m} {A B : Ty n} {f a : Tm n m} :
      Typing Γ f (.arr A B) → Typing Γ a A → Typing Γ (.app f a) B
  | tabs {n m : Nat} {Γ : Ctx n m} {b : Tm (n + 1) m} {C : Ty (n + 1)} :
      Typing (fun i => (Γ i).rename Fin.succ) b C →
      Typing Γ (.tabs b) (.all C)
  | tapp {n m : Nat} {Γ : Ctx n m} {f : Tm n m} {A : Ty n}
      {C : Ty (n + 1)} :
      Typing Γ f (.all C) → Typing Γ (.tapp f A) (C.instantiate A)
Uses 5 · Used by 20

Typing

TheoremType substitution preserves typing#✓fully proved

Type substitution preserves typing, including every context type.

theorem tySubst {k : Nat} (h : Typing Γ t A) (σ : Fin n → Ty k) :
    Typing (fun i => (Γ i).subst σ) (t.tySubst σ) (A.subst σ)
Uses 11 · Used by 2

TheoremType renaming preserves typing#✓fully proved

Type renaming preserves typing without adding term variables.

theorem tyRename {k : Nat} (h : Typing Γ t A) (ρ : Fin n → Fin k) :
    Typing (fun i => (Γ i).rename ρ) (t.tyRename ρ) (A.rename ρ)
Uses 10 · Used by 1

TheoremTerm renaming preserves typing#✓fully proved

A context-respecting term renaming preserves the type.

theorem rename {k : Nat} {Δ : Ctx n k} (h : Typing Γ t A)
    (ρ : Fin m → Fin k) (hρ : ∀ i, Δ (ρ i) = Γ i) :
    Typing Δ (t.rename ρ) A
Uses 8 · Used by 1

TheoremTerm substitution preserves typing#✓fully proved

Correctly typed simultaneous term substitution preserves typing.

theorem subst {k : Nat} {Δ : Ctx n k} (h : Typing Γ t A)
    (σ : Fin m → Tm n k) (hσ : ∀ i, Typing Δ (σ i) (Γ i)) :
    Typing Δ (t.subst σ) A
Uses 11 · Used by 1

TheoremInstantiating a term binder preserves typing#✓fully proved

Discharging a term binder preserves the body type.

theorem instantiate {B : Ty n} {b : Tm n (m + 1)} {a : Tm n m}
    (hb : Typing (Fin.cases A Γ) b B) (ha : Typing Γ a A) :
    Typing Γ (b.instantiate a) B
Uses 6 · Used by 1

TheoremInstantiating a type binder preserves typing#✓fully proved

Type binder discharge substitutes the type and restores the context.

theorem tyInstantiate {b : Tm (n + 1) m} {C : Ty (n + 1)}
    (hb : Typing (fun i => (Γ i).rename Fin.succ) b C) (A : Ty n) :
    Typing Γ (b.tySubst (Fin.cases A Ty.var)) (C.instantiate A)
Uses 10 · Used by 1

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.