Require Export FcEtt.ett_inf_cs.
Require Export FcEtt.ett_ind.
Set Implicit Arguments.
Set Bullet Behavior "Strict Subproofs".
(* Syntactic properties about the erasure operation. TODO: add these to a hint database? -------------------------------------------------  erase (open t u) = open (erase t) (erase u)  erase (open_co t g) = erase t erase (open_co t g) = open_co (erase t) g  x notin fv t -> x notin fv (erase t)  erase (close x t) = close x (erase t)  erase (subst x u t) = subst x (erase u) (erase t)  lc u -> lc (erase u)  dom G = dom (erase_context G)  *)
(* ----- open ---------- *)
(* In general: erase (open t u) = open (erase t) (erase u) *)
(* ----- close ----------------- *)
Definition close_tm_rec_erase_tm := fun x => proj1 (close_tm_erase_all x).
Definition close_co_rec_erase_tm := fun x => proj1 (close_co_erase_all x).
Definition close_tm_erase_all := fun x => close_tmco_erase_all (inl x).
Definition close_co_erase_all := fun x => close_tmco_erase_all (inr x).
Definition close_tm_erase_tm := fun x => proj1 (close_tm_erase_all x).
Definition close_co_erase_tm := fun x => proj1 (close_co_erase_all x).
*)
(* Pointless to close erased terms wrt co variables *)
(* ----- fv  ---------- *)
(* ----- substitution ---------- *)
(* ----- preservation of erasure under substitution ---------- *)

Theorem erase_subst_mutual a x :
(∀ A B,       erase_tm A = erase_tm B ->
erase_tm (tm_subst_tm_tm a x A) = erase_tm (tm_subst_tm_tm a x B))
∧
(∀ Bs1 Bs2,   erase_brs Bs1 = erase_brs Bs2 ->
erase_brs (tm_subst_tm_brs a x Bs1) =
erase_brs (tm_subst_tm_brs a x Bs2))
∧
(∀ g1 g2 : co, True)
∧
(∀ phi1 phi2, erase_constraint phi1 = erase_constraint phi2 ->
erase_constraint (tm_subst_tm_constraint a x phi1) =
erase_constraint (tm_subst_tm_constraint a x phi2)).