Section Retyping.
Variable (X: Const).
Arguments s₀ {_} {_} _.
Arguments t₀ {_} {_} _.
Arguments Gamma₀ {_} {_} _.
Arguments A₀ {_} {_} _.
Definition retype_ctx (n: nat) (Gamma : ctx) :=
map (fun A => if dec2 le (ord A) n then A else alpha) Gamma.
Fixpoint retype_type (n: nat) (A : type) :=
match A with
| typevar beta => typevar beta
| A → B => (if dec2 le (ord A) n then A else alpha) → retype_type n B
end.

Lemma retype_type_id n A: ord A <= S n -> retype_type n A = A.