Skip to content

Semantic kind interpretation and substitution

9 fully proved

Semantic interpretation of kinds

DefinitionSemantic interpretation of kinds#✓fully proved

Interpret kinds over a carrier for term types.

def Kind.Sem (α : Type u) : Kind → Type u
  | .star => α
  | .arrow κ μ => Kind.Sem α κ → Kind.Sem α μ
Uses 1 · Used by 25

AbbreviationKinded semantic environment#✓fully proved

An environment supplies a value of the declared kind for every variable.

abbrev KEnv (α : Type u) (Δ : List Kind) :=
  ∀ {κ}, KVar Δ κ → Kind.Sem α κ
Uses 3 · Used by 23

DefinitionExtension of a kinded semantic environment#✓fully proved

Extend a semantic environment at its newest kinded variable.

def KEnv.extend {α : Type u} {Δ : List Kind} {κ : Kind}
    (ρ : KEnv α Δ) (a : Kind.Sem α κ) : KEnv α (κ :: Δ)
  | _, .zero => a
  | _, .succ x => ρ x
Uses 4 · Used by 11

StructureKind algebra of arrow and universal type constructors#✓fully proved

The two type constructors at star; higher kinds need no extra laws.

structure KindAlgebra (α : Type u) where
  arr : α → α → α
  all : {κ : Kind} → (Kind.Sem α κ → α) → α
Uses 2 · Used by 8

Evaluation of type operators

DefinitionSemantic evaluation of kinded type operators#✓fully proved

Interpret a kinded operator by ordinary function abstraction/application.

def eval (M : KindAlgebra α) : {Δ : List Kind} → KEnv α Δ →
    {κ : Kind} → Ty Δ κ → Kind.Sem α κ
  | _, ρ, _, .var x => ρ x
  | _, ρ, _, .lam b => fun a => eval M (KEnv.extend ρ a) b
  | _, ρ, _, .app f a => eval M ρ f (eval M ρ a)
  | _, ρ, _, .arr a b => M.arr (eval M ρ a) (eval M ρ b)
  | _, ρ, _, .all b => M.all (fun a => eval M (KEnv.extend ρ a) b)
Uses 7 · Used by 9

TheoremEvaluation depends only on the environment pointwise#✓fully proved

Interpretation depends only on the pointwise kinded environment.

theorem eval_congr (M : KindAlgebra α) {ρ τ : KEnv α Δ}
    (h : ∀ {ν} (x : KVar Δ ν), ρ x = τ x) (t : Ty Δ κ) :
    eval M ρ t = eval M τ t
Uses 7 · Used by 3

TheoremEvaluation of a renamed type operator#✓fully proved

Semantic renaming is precomposition of the kinded environment.

theorem eval_rename (M : KindAlgebra α) (η : KEnv α Ε)
    (ρ : KRen Δ Ε) (t : Ty Δ κ) :
    eval M η (rename ρ t) = eval M (fun {_} x => η (ρ x)) t
Uses 12 · Used by 2

TheoremEvaluation of a substituted type operator#✓fully proved

Semantic simultaneous substitution at every kind, including higher kinds.

theorem eval_subst (M : KindAlgebra α) (η : KEnv α Ε)
    (σ : Sub Δ Ε) (t : Ty Δ κ) :
    eval M η (subst σ t) =
      eval M (fun {_} x => eval M η (σ x)) t
Uses 13 · Used by 2

TheoremEvaluation of an instantiated type operator#✓fully proved

Semantic instantiation is environment extension by the argument value.

theorem eval_instantiate (M : KindAlgebra α) (η : KEnv α Δ)
    (b : Ty (μ :: Δ) κ) (a : Ty Δ μ) :
    eval M η (instantiate b a) =
      eval M (KEnv.extend η (eval M η a)) b
Uses 13 · Used by 2

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.