Skip to content

The star/forall System F fragment inside pure Fω

26 fully proved

Type translation

DefinitionLifting System F type-variable images under a star binder#✓fully proved

Extend images of System F type variables under a star-kinded binder.

def liftTypes {n : Nat} {Δ : List Kind} (φ : Fin n → Ty Δ .star) :
    Fin (n + 1) → Ty (.star :: Δ) .star :=
  Fin.cases (.var .zero) (fun i => (φ i).rename KVar.succ)
Uses 4 · Used by 18

DefinitionTranslation of System F types into Fω#✓fully proved

Translate System F types with arbitrary kind-star variable images.

def Ty.fromSystemF : {n : Nat} → {Δ : List Kind} →
    (Fin n → Ty Δ .star) → SystemF.Ty n → Ty Δ .star
  | _, _, φ, .var i => φ i
  | _, _, φ, .arr A B => .arr (fromSystemF φ A) (fromSystemF φ B)
  | _, _, φ, .all B => .all (fromSystemF (liftTypes φ) B)
Uses 4 · Used by 18

Properties of the type translation

TheoremType translation depends only on variable images#✓fully proved

The translation depends only on the images of free type variables.

theorem fromSystemF_congr {φ ψ : Fin n → Ty Δ .star}
    (h : ∀ i, φ i = ψ i) (t : SystemF.Ty n) :
    fromSystemF φ t = fromSystemF ψ t
Uses 4 · Used by 5

TheoremType translation commutes with target renaming#✓fully proved

Target kind-preserving renaming commutes with the System F translation.

theorem fromSystemF_target_rename (φ : Fin n → Ty Δ .star)
    (ρ : KRen Δ Ε) (t : SystemF.Ty n) :
    (fromSystemF φ t).rename ρ =
      fromSystemF (fun i => (φ i).rename ρ) t
Uses 12 · Used by 3

TheoremType translation commutes with target substitution#✓fully proved

Target type substitution commutes with the System F translation.

theorem fromSystemF_target_subst (φ : Fin n → Ty Δ .star)
    (σ : Sub Δ Ε) (t : SystemF.Ty n) :
    (fromSystemF φ t).subst σ =
      fromSystemF (fun i => (φ i).subst σ) t
Uses 10 · Used by 2

TheoremType translation of a source renaming#✓fully proved

Source type renaming is precomposition of the translated variable images.

theorem fromSystemF_source_rename (φ : Fin k → Ty Δ .star)
    (ρ : Fin n → Fin k) (t : SystemF.Ty n) :
    fromSystemF φ (t.rename ρ) = fromSystemF (fun i => φ (ρ i)) t
Uses 8 · Used by 3

TheoremType translation of a source substitution#✓fully proved

Source type substitution translates to simultaneous operator images.

theorem fromSystemF_source_subst (φ : Fin k → Ty Δ .star)
    (σ : Fin n → SystemF.Ty k) (t : SystemF.Ty n) :
    fromSystemF φ (t.subst σ) =
      fromSystemF (fun i => fromSystemF φ (σ i)) t
Uses 12 · Used by 2

TheoremType translation commutes with type-binder instantiation#✓fully proved

The System F translation commutes with type-binder instantiation.

theorem fromSystemF_instantiate (φ : Fin n → Ty Δ .star)
    (B : SystemF.Ty (n + 1)) (A : SystemF.Ty n) :
    fromSystemF φ (B.instantiate A) =
      (fromSystemF (liftTypes φ) B).instantiate (fromSystemF φ A)
Uses 15 · Used by 1

Term translation

DefinitionTranslation of System F terms into Fω#✓fully proved

Translate all five System F term constructors, retaining type binders.

def Tm.fromSystemF : {n m : Nat} → {Δ : List Kind} →
    (Fin n → Ty Δ .star) → SystemF.Tm n m → Tm Δ m
  | _, _, _, _, .var i => .var i
  | _, _, _, φ, .lam A b => .lam (Ty.fromSystemF φ A) (fromSystemF φ b)
  | _, _, _, φ, .app f a => .app (fromSystemF φ f) (fromSystemF φ a)
  | _, _, _, φ, .tabs b => .tabs (fromSystemF (liftTypes φ) b)
  | _, _, _, φ, .tapp f A => .tapp (fromSystemF φ f) (Ty.fromSystemF φ A)
Uses 7 · Used by 13

TheoremTerm translation preserves System F typing#✓fully proved

Every System F typing derivation is preserved by the star translation.

theorem Tm.fromSystemF_typing {n m : Nat} {Δ : List Kind}
    {Γ : SystemF.Ctx n m} {t : SystemF.Tm n m} {A : SystemF.Ty n}
    (h : SystemF.Typing Γ t A) (φ : Fin n → Ty Δ .star) :
    Typing (fun i => Ty.fromSystemF φ (Γ i)) (fromSystemF φ t)
      (Ty.fromSystemF φ A)
Uses 20 · Used by 1

DefinitionStar-kinded variable of an all-star telescope#✓fully proved

The corresponding star-kinded variable in an n-star telescope.

def KVar.ofFin : {n : Nat} → Fin n → KVar (List.replicate n .star) .star
  | 0, i => nomatch i
  | _n + 1, i => Fin.cases .zero (fun j => .succ (ofFin j)) i
Uses 2 · Used by 6

DefinitionCanonical embedding of System F types into Fω#✓fully proved

The canonical variable-for-variable embedding of System F types.

def Ty.embed {n : Nat} (t : SystemF.Ty n) : Ty (List.replicate n .star) .star :=
  fromSystemF (fun i => .var (KVar.ofFin i)) t
Uses 6 · Used by 2

DefinitionCanonical embedding of System F terms into Fω#✓fully proved

The canonical scoped embedding of System F terms into pure Fω.

def Tm.embed {n m : Nat} (t : SystemF.Tm n m) : Tm (List.replicate n .star) m :=
  fromSystemF (fun i => .var (KVar.ofFin i)) t
Uses 7 · Used by 5

TheoremCanonical embedding preserves System F typing#✓fully proved

Canonical embedding preserves every System F typing derivation.

theorem Tm.embed_typing {n m : Nat} {Γ : SystemF.Ctx n m}
    {t : SystemF.Tm n m} {A : SystemF.Ty n} (h : SystemF.Typing Γ t A) :
    Typing (fun i => Ty.embed (Γ i)) (Tm.embed t) (Ty.embed A)
Uses 12

TheoremTerm translation depends only on type-variable images#✓fully proved

Term translation depends only on the images of its free type variables.

theorem Tm.fromSystemF_congr {n m : Nat} {Δ : List Kind}
    {φ ψ : Fin n → Ty Δ .star} (h : ∀ i, φ i = ψ i) (t : SystemF.Tm n m) :
    fromSystemF φ t = fromSystemF ψ t
Uses 5 · Used by 3

TheoremTerm translation commutes with target type substitution#✓fully proved

Operator substitution commutes with translating System F terms.

theorem Tm.fromSystemF_target_tySubst {n m : Nat} {Δ Ε : List Kind}
    (φ : Fin n → Ty Δ .star) (σ : Ty.Sub Δ Ε) (t : SystemF.Tm n m) :
    (fromSystemF φ t).tySubst σ =
      fromSystemF (fun i => (φ i).subst σ) t
Uses 15 · Used by 2

TheoremTerm translation of a source type substitution#✓fully proved

Source type substitution commutes with the pure-term translation.

theorem Tm.fromSystemF_source_tySubst {n k m : Nat} {Δ : List Kind}
    (φ : Fin k → Ty Δ .star) (σ : Fin n → SystemF.Ty k)
    (t : SystemF.Tm n m) :
    fromSystemF φ (t.tySubst σ) =
      fromSystemF (fun i => Ty.fromSystemF φ (σ i)) t
Uses 17 · Used by 2

TheoremTerm translation commutes with weakening under a type binder#✓fully proved

Weakening beneath a type binder agrees in both calculus presentations.

theorem Tm.fromSystemF_tyRename_succ {n m : Nat} {Δ : List Kind}
    (φ : Fin n → Ty Δ .star) (t : SystemF.Tm n m) :
    fromSystemF (liftTypes φ) (t.tyRename Fin.succ) =
      (fromSystemF φ t).tyRename KVar.succ
Uses 16 · Used by 1

TheoremTerm translation commutes with term-variable renaming#✓fully proved

Term-variable renaming commutes with the System F translation.

theorem Tm.fromSystemF_rename {n m k : Nat} {Δ : List Kind}
    (φ : Fin n → Ty Δ .star) (ρ : Fin m → Fin k) (t : SystemF.Tm n m) :
    fromSystemF φ (t.rename ρ) = (fromSystemF φ t).rename ρ
Uses 11 · Used by 1

TheoremTerm translation commutes with term substitution#✓fully proved

Simultaneous term substitution commutes with the System F translation.

theorem Tm.fromSystemF_subst {n m k : Nat} {Δ : List Kind}
    (φ : Fin n → Ty Δ .star) (σ : Fin m → SystemF.Tm n k)
    (t : SystemF.Tm n m) :
    fromSystemF φ (t.subst σ) =
      (fromSystemF φ t).subst (fun i => fromSystemF φ (σ i))
Uses 17 · Used by 1

TheoremTerm translation commutes with term-binder instantiation#✓fully proved

Term-binder instantiation commutes with the System F translation.

theorem Tm.fromSystemF_instantiate {n m : Nat} {Δ : List Kind}
    (φ : Fin n → Ty Δ .star) (b : SystemF.Tm n (m + 1))
    (a : SystemF.Tm n m) :
    fromSystemF φ (b.instantiate a) =
      (fromSystemF φ b).instantiate (fromSystemF φ a)
Uses 9 · Used by 1

TheoremTerm translation commutes with type-binder instantiation#✓fully proved

Type-binder discharge agrees for translated System F terms.

theorem Tm.fromSystemF_tyInstantiate {n m : Nat} {Δ : List Kind}
    (φ : Fin n → Ty Δ .star) (b : SystemF.Tm (n + 1) m)
    (A : SystemF.Ty n) :
    fromSystemF φ (b.tySubst (Fin.cases A SystemF.Ty.var)) =
      (fromSystemF (liftTypes φ) b).tySubst (Ty.single (Ty.fromSystemF φ A))
Uses 19 · Used by 1

TheoremTerm translation preserves weak call-by-value values#✓fully proved

The System F translation preserves both weak-CBV value forms.

theorem Tm.fromSystemF_value {n m : Nat} {Δ : List Kind}
    (φ : Fin n → Ty Δ .star) {t : SystemF.Tm n m} (h : SystemF.Value t) :
    Value (fromSystemF φ t)
Uses 10 · Used by 1

TheoremTerm translation simulates each weak call-by-value step#✓fully proved

Every System F weak-CBV step is simulated by one Fω weak-CBV step.

theorem Tm.fromSystemF_step {n m : Nat} {Δ : List Kind}
    (φ : Fin n → Ty Δ .star) {t t' : SystemF.Tm n m}
    (h : SystemF.Step t t') : Step (fromSystemF φ t) (fromSystemF φ t')
Uses 20 · Used by 1

TheoremCanonical embedding preserves single evaluation steps#✓fully proved

The canonical embedding preserves individual System F evaluation steps.

theorem Tm.embed_step {n m : Nat} {t t' : SystemF.Tm n m}
    (h : SystemF.Step t t') : Step (Tm.embed t) (Tm.embed t')
Uses 9 · Used by 1

TheoremCanonical embedding preserves multistep evaluation#✓fully proved

The canonical embedding preserves finite System F evaluation sequences.

theorem Tm.embed_steps {n m : Nat} {t t' : SystemF.Tm n m}
    (h : SystemF.Steps t t') :
    Relation.ReflTransGen Step (Tm.embed t) (Tm.embed t')
Uses 8

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.