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 ---------- *)

Lemma subst_tm_erase : forall a x,
(forall b, tm_subst_tm_tm (erase a) x (erase b) =
erase (tm_subst_tm_tm a x b)) /\
(forall b, tm_subst_tm_brs (erase a) x (erase b) =
erase (tm_subst_tm_brs a x b)) /\
(forall g:co, True) /\
(forall p, tm_subst_tm_constraint (erase a) x (erase p) =
erase (tm_subst_tm_constraint a x p)).