Type-substitution algebra for impredicative System F
System F
TheoremLifted identity renaming is the identity#✓fully proved
Lifting the identity renaming gives the identity.
@[simp] theorem liftRen_id {n : Nat} :
liftRen (id : Fin n → Fin n) = id
def liftRen {n k : Nat} (ρ : Fin n → Fin k) :
Fin (n + 1) → Fin (k + 1) :=
Fin.cases 0 (fun i => (ρ i).succ)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:38
Uses 1 · Used by 1
TheoremLifting preserves composition of renamings#✓fully proved
Lifting preserves composition of renamings.
theorem liftRen_comp {n k l : Nat} (ρ : Fin n → Fin k)
(η : Fin k → Fin l) :
liftRen (η ∘ ρ) = liftRen η ∘ liftRen ρ
def liftRen {n k : Nat} (ρ : Fin n → Fin k) :
Fin (n + 1) → Fin (k + 1) :=
Fin.cases 0 (fun i => (ρ i).succ)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:38
Uses 1 · Used by 1
Renaming and substitution laws
TheoremIdentity renaming fixes every type#✓fully proved
Type renaming by the identity does not change a type.
@[simp] theorem rename_id {n : Nat} (A : Ty n) : rename id A = A
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def rename {n k : Nat} (ρ : Fin n → Fin k) : Ty n → Ty k
| .var i => .var (ρ i)
| .arr A B => .arr (rename ρ A) (rename ρ B)
| .all B => .all (rename (liftRen ρ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:53
Uses 4
TheoremSuccessive type renamings fuse into their composition#✓fully proved
Two type renamings fuse into their composition.
theorem rename_comp {n k l : Nat} (ρ : Fin n → Fin k)
(η : Fin k → Fin l) (A : Ty n) :
rename η (rename ρ A) = rename (η ∘ ρ) A
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def rename {n k : Nat} (ρ : Fin n → Fin k) : Ty n → Ty k
| .var i => .var (ρ i)
| .arr A B => .arr (rename ρ A) (rename ρ B)
| .all B => .all (rename (liftRen ρ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:53
Uses 4 · Used by 1
TheoremSubstitution after a type renaming#✓fully proved
Substitution after renaming composes the variable environments.
theorem subst_rename {n k l : Nat} (ρ : Fin n → Fin k)
(σ : Fin k → Ty l) (A : Ty n) :
subst σ (rename ρ A) = subst (σ ∘ ρ) A
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def subst {n k : Nat} (σ : Fin n → Ty k) : Ty n → Ty k
| .var i => σ i
| .arr A B => .arr (subst σ A) (subst σ B)
| .all B => .all (subst (liftSub σ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:63
@[simp] def rename {n k : Nat} (ρ : Fin n → Fin k) : Ty n → Ty k
| .var i => .var (ρ i)
| .arr A B => .arr (rename ρ A) (rename ρ B)
| .all B => .all (rename (liftRen ρ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:53
Uses 5 · Used by 4
TheoremRenaming after a type substitution#✓fully proved
Renaming after substitution renames each substituted image.
theorem rename_subst {n k l : Nat} (σ : Fin n → Ty k)
(ρ : Fin k → Fin l) (A : Ty n) :
rename ρ (subst σ A) = subst (fun i => rename ρ (σ i)) A
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def rename {n k : Nat} (ρ : Fin n → Fin k) : Ty n → Ty k
| .var i => .var (ρ i)
| .arr A B => .arr (rename ρ A) (rename ρ B)
| .all B => .all (rename (liftRen ρ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:53
@[simp] def subst {n k : Nat} (σ : Fin n → Ty k) : Ty n → Ty k
| .var i => σ i
| .arr A B => .arr (subst σ A) (subst σ B)
| .all B => .all (subst (liftSub σ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:63
Uses 6 · Used by 1
TheoremLifted identity type substitution is the identity#✓fully proved
Lifting the variable substitution gives the variable substitution.
@[simp] theorem liftSub_var {n : Nat} :
liftSub (var : Fin n → Ty n) = var
def liftSub {n k : Nat} (σ : Fin n → Ty k) : Fin (n + 1) → Ty (k + 1) :=
Fin.cases (.var 0) (fun i => rename Fin.succ (σ i))
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:59
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
Uses 2 · Used by 1
TheoremIdentity type substitution fixes every type#✓fully proved
Substitution of each type variable by itself is the identity.
@[simp] theorem subst_id {n : Nat} (A : Ty n) : subst var A = A
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def subst {n k : Nat} (σ : Fin n → Ty k) : Ty n → Ty k
| .var i => σ i
| .arr A B => .arr (subst σ A) (subst σ B)
| .all B => .all (subst (liftSub σ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:63
Uses 4 · Used by 3
TheoremVariable-valued substitution is a type renaming#✓fully proved
A variable-valued substitution is the corresponding type renaming.
@[simp] theorem subst_var_rename {n k : Nat} (ρ : Fin n → Fin k)
(A : Ty n) : subst (fun i => var (ρ i)) A = rename ρ A
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def subst {n k : Nat} (σ : Fin n → Ty k) : Ty n → Ty k
| .var i => σ i
| .arr A B => .arr (subst σ A) (subst σ B)
| .all B => .all (subst (liftSub σ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:63
@[simp] def rename {n k : Nat} (ρ : Fin n → Fin k) : Ty n → Ty k
| .var i => .var (ρ i)
| .arr A B => .arr (rename ρ A) (rename ρ B)
| .all B => .all (rename (liftRen ρ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:53
Uses 5 · Used by 1
TheoremLifted type substitution commutes with weakening#✓fully proved
Lifted type substitution commutes with weakening an old type.
theorem subst_lift_rename {n k : Nat} (σ : Fin n → Ty k) (A : Ty n) :
subst (liftSub σ) (rename Fin.succ A) =
rename Fin.succ (subst σ A)
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def subst {n k : Nat} (σ : Fin n → Ty k) : Ty n → Ty k
| .var i => σ i
| .arr A B => .arr (subst σ A) (subst σ B)
| .all B => .all (subst (liftSub σ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:63
def liftSub {n k : Nat} (σ : Fin n → Ty k) : Fin (n + 1) → Ty (k + 1) :=
Fin.cases (.var 0) (fun i => rename Fin.succ (σ i))
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:59
@[simp] def rename {n k : Nat} (ρ : Fin n → Fin k) : Ty n → Ty k
| .var i => .var (ρ i)
| .arr A B => .arr (rename ρ A) (rename ρ B)
| .all B => .all (rename (liftRen ρ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:53
Uses 6 · Used by 2
TheoremSuccessive type substitutions fuse into one substitution#✓fully proved
Two simultaneous type substitutions fuse by substituting each image.
theorem subst_comp {n k l : Nat} (σ : Fin n → Ty k)
(τ : Fin k → Ty l) (A : Ty n) :
subst τ (subst σ A) = subst (fun i => subst τ (σ i)) A
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def subst {n k : Nat} (σ : Fin n → Ty k) : Ty n → Ty k
| .var i => σ i
| .arr A B => .arr (subst σ A) (subst σ B)
| .all B => .all (subst (liftSub σ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:63
Uses 4 · Used by 1
TheoremType substitution commutes with instantiation#✓fully proved
Type substitution commutes with discharging a type binder.
theorem subst_instantiate {n k : Nat} (σ : Fin n → Ty k)
(B : Ty (n + 1)) (A : Ty n) :
subst σ (instantiate B A) =
instantiate (subst (liftSub σ) B) (subst σ A)
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
@[simp] def subst {n k : Nat} (σ : Fin n → Ty k) : Ty n → Ty k
| .var i => σ i
| .arr A B => .arr (subst σ A) (subst σ B)
| .all B => .all (subst (liftSub σ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:63
def instantiate {n : Nat} (B : Ty (n + 1)) (A : Ty n) : Ty n :=
subst (Fin.cases A Ty.var) B
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:69
def liftSub {n k : Nat} (σ : Fin n → Ty k) : Fin (n + 1) → Ty (k + 1) :=
Fin.cases (.var 0) (fun i => rename Fin.succ (σ i))
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:59
Uses 8 · Used by 1
TheoremInstantiating a weakened type restores it#✓fully proved
Instantiating a freshly weakened type restores the original type.
@[simp] theorem instantiate_rename {n : Nat} (B A : Ty n) :
instantiate (rename Fin.succ B) A = B
inductive Ty : Nat → Type where
| var {n : Nat} : Fin n → Ty n
| arr {n : Nat} : Ty n → Ty n → Ty n
| all {n : Nat} : Ty (n + 1) → Ty n
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:31
def instantiate {n : Nat} (B : Ty (n + 1)) (A : Ty n) : Ty n :=
subst (Fin.cases A Ty.var) B
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:69
@[simp] def rename {n k : Nat} (ρ : Fin n → Fin k) : Ty n → Ty k
| .var i => .var (ρ i)
| .arr A B => .arr (rename ρ A) (rename ρ B)
| .all B => .all (rename (liftRen ρ) B)
CSLibExt/Languages/LambdaCalculus/SystemF/Syntax.lean:53
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.