Module invert := fc_invert wf weak subst.Definition get_tpg (G : context) (a:tm) : tm :=
  get_tpg_n (size_tm a) G a.Definition get_deq (G : context) (g:co) : (tm*tm) :=
  get_deq_n (size_co g) G g.Definition get_iso (G : context) (g:co) : (constraint*constraint) :=
  get_iso_n (size_co g) G g.

Lemma get_n_correct : forall n, (forall G a A B, size_tm a <= n -> AnnTyping G a A -> get_tpg_n n G a = B -> A = B) /\ (forall G D g A B A' B', size_co g <= n -> AnnDefEq G D g A B -> get_deq_n n G g = (A',B') -> A = A' /\ B = B') /\ (forall G D g A B A' B', size_co g <= n -> AnnIso G D g A B -> get_iso_n n G g = (A',B') -> A = A' /\ B = B').