Require Export FcEtt.fset_facts.
Require Export FcEtt.ett_inf.
Require Export FcEtt.tactics.
(* This file contains:  - Syntactic stuff that should be defined by lngen (and that we should get LNgen to generate in the future).  - Induction principles for the relations.  - Other tactics that are specialized to the relations.  *)
Set Bullet Behavior "Strict Subproofs".
Set Implicit Arguments.
(* --------------------------------------------------------- *)
Ltac invert_syntactic_equality :=
repeat match goal with
| [ H : a_Var_f _  = a_Var_f _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_Abs _ _ = a_Abs _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_UAbs _ _ = a_UAbs _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_Pi _ _ _ = a_Pi _ _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_App _ _ _ = a_App _ _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_Fam _  = a_Fam _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_Const _  = a_Const _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_Conv _ _ = a_Conv _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_UCAbs _ = a_UCAbs _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_CAbs + _ = a_CAbs _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_CApp _ _  = a_CApp _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : a_CPi _ _ = a_CPi _ _ |- _ ] =>
inversion H; subst; clear H
| [ H : Eq _ _ _ = Eq _ _ _ |- _ ] =>
inversion H; subst; clear H
end.
(* Invert an "interesting" assumption in the typing context *)
Ltac ann_invert_clear :=
match goal with
| H : AnnTyping _ a_Star _ |- _ => inversion H; subst; clear H
| H : AnnTyping _ (_ _) _ |- _ =>  inversion H; subst; clear H
| H : AnnPropWff _ _ |- _ => inversion H; subst; clear H
| H : AnnIso _ _ (_ _) _ _ |- _ => inversion H; subst; clear H
| H : AnnDefEq _ _ (_ _) _ _  |- _ => inversion H; subst; clear H
| H : AnnCtx ([(_,_)] ++ _) |- _ => inversion H; subst; clear H
| H : AnnCtx (_ :: _) |- _ => inversion H; subst; clear H
end.
(* ----------------------------- *)
(* By default, swaps apply to tm variables. *)

Lemma lc_swap : forall x x0 a,
x `notin` fv_tm_tm_tm a ->
lc_tm (open_tm_wrt_tm a (a_Var_f x)) ->
lc_tm (open_tm_wrt_tm a (a_Var_f x0)).