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.
Program Instance unification_retract {n} (I: orduni n X) : orduni n Y :=
{
s₀ := subst_consts inj s₀;
t₀ := subst_consts inj t₀;
A₀ := A₀;
Gamma₀ := Gamma₀;
}.
Next Obligation.
eapply ordertyping_preservation_consts. eapply H1₀.
intros x H1. unfold inj. rewrite consts_agree.
econstructor. rewrite <-consts_agree.
eapply typing_constants. eapply H1₀. eauto.
Qed.
Next Obligation.
eapply ordertyping_preservation_consts. eapply H2₀.
intros x H1. unfold inj. rewrite consts_agree.
econstructor. rewrite <-consts_agree.
eapply typing_constants. eapply H2₀. eauto.
Qed.

Lemma unification_retract_backward n (I: orduni n X):
1 <= n -> OU n Y (unification_retract I) -> OU n X I.