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

(* This proof method is cool, but it is hard to extract the result in a way we can use  (* TODO: with an approriate mutual induction tactic, could be proved only with a : tm + brs + co + constraint *)
Lemma close_tmco_erase_all : ∀ (x : tmvar + covar),
(∀ (a : tm)         k, close_wrt k x (erase a) = erase (close_wrt k x a)) /\
(∀ (b : brs)        k, close_wrt k x (erase b) = erase (close_wrt k x b)) /\
(∀ _ : co, True) /\
(∀ (c : constraint) k, close_wrt k x (erase c) = erase (close_wrt k x c)).