Section Retracts.
Variable (X Y: Const).
Variable (RE: retract X Y).
Hypothesis consts_agree: forall x: X, ctype X x = ctype Y (I x).
Let inj (c: X) := const (I c).
Let re (f: Y -> nat) (d: Y) :=
match tight RE d with
| Some x => const x
| None => inhab X (f d) (ctype Y d)
end.

Lemma re_typing n Delta f sigma Gamma:
1 <= n ->
Delta ⊩(n) sigma : Gamma ->
(forall x c, x ∈ dom Gamma -> c ∈ consts (sigma x) -> nth Delta (f c) = Some (target (ctype Y c))) ->
Delta ⊩(n) sigma >> subst_consts (re f) : Gamma.