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 ---------- *)
intros. eapply lc_erase. auto. Qed.
intros. eapply lc_erase. auto. Qed.
intros. eapply lc_erase. auto. Qed.
Hint Resolve lc_tm_erase lc_brs_erase lc_constraint_erase : lc.
Hint Resolve lc_tm_open_tm_wrt_tm_erase_tm lc_tm_open_tm_wrt_co_erase_tm : lc.
(* ----- automation ---------- *)
(* TODO *)
Hint Rewrite open_co_erase_tm open_co_erase_tm2 open_tm_erase_tm : TODO.
Hint Resolve lc_erase binds_map_2.
Ltac auto_rew_erase :=
multimatch goal with
| [ e: erase _ = erase _ |- _ ] => rewrite e in *; clear e
end.
(* ----- useful property for pi types -------------- *)
(* ------- contexts ---------------------- *)
(* value_type *)
(* ---------------------------------- *)

Lemma ann_rho_swap : forall rho x x0 a,
x `notin` fv_tm_tm_tm (erase_tm a) ->
x0 `notin` fv_tm_tm_tm (erase_tm a) ->
RhoCheck rho x (erase_tm (open_tm_wrt_tm a (a_Var_f x))) ->
RhoCheck rho x0 (erase_tm (open_tm_wrt_tm a (a_Var_f x0))).