Module unique := fc_unique wf subst.
Set Implicit Arguments.
Set Bullet Behavior "Strict Subproofs".
Hint Constructors Typing PropWff Iso DefEq Ctx.
Ltac dispatch_rho  :=
match goal with
|  H11 : ∀ x : atom,
¬ x `in` ?L0 →
RhoCheck ?rho x (erase_tm (open_tm_wrt_tm ?b1 (a_Var_f x)))
|-
∀ x : atom,
¬ x `in` ?LL → RhoCheck ?rho x (open_tm_wrt_tm (erase_tm ?b1) (a_Var_f x))
=>
let Fr := fresh in
let r' := fresh in
intros x; intros;
assert (FrL0 : x `notin` L0); eauto;
move: (H11 x FrL0) => r';
autorewcshyp r';
rewrite -open_tm_erase_tm in r'; eapply r'
end.
(* ------------------------------------------ *)

Lemma erase_mutual :
(forall G a A, AnnTyping G a A ->
Typing (erase_context G) (erase a) (erase A)) /\
(forall G phi, AnnPropWff G phi ->
PropWff (erase_context G) (erase phi)) /\
(forall G D g p1 p2, AnnIso G D g p1 p2 ->
Iso (erase_context G) D
(erase_constraint p1) (erase_constraint p2)) /\
(forall G D g a b,
AnnDefEq G D g a b ->
forall A, AnnTyping G a A ->
DefEq (erase_context G) D (erase a) (erase b) (erase A)) /\
(forall G, AnnCtx G -> Ctx (erase_context G) /\
forall c t, binds c t G -> binds c (erase_sort t) (erase_context G)).