(* -------------------- *)

(* Specifications: *)
Lemma Typing_swap : forall x1 x G a A B,
x1 `notin` fv_tm_tm_tm a \u fv_tm_tm_tm B
-> x `notin` dom G \u {{ x1 }}
-> Typing ([(x1, Tm A)] ++ G) (open_tm_wrt_tm a (a_Var_f x1))
(open_tm_wrt_tm B (a_Var_f x1))
-> Typing ([(x, Tm A)] ++ G) (open_tm_wrt_tm a (a_Var_f x))
(open_tm_wrt_tm B (a_Var_f x)).
Lemma DefEq_swap : forall x1 x G A1 D b1 b2 B,
x1 `notin` fv_tm_tm_tm b1 \u fv_tm_tm_tm b2 \u fv_tm_tm_tm B
-> x `notin` dom G \u {{ x1 }}
-> DefEq ([(x1, Tm A1)] ++ G) D
(open_tm_wrt_tm b1 (a_Var_f x1)) (open_tm_wrt_tm b2 (a_Var_f x1))
(open_tm_wrt_tm B (a_Var_f x1))
-> DefEq ([(x, Tm A1)] ++ G) D
(open_tm_wrt_tm b1 (a_Var_f x)) (open_tm_wrt_tm b2 (a_Var_f x))
(open_tm_wrt_tm B (a_Var_f x)).
Lemma E_Pi_exists : forall x (G : context) (rho : relflag) (A B : tm),
x `notin` dom G \u fv_tm_tm_tm B
-> Typing ([(x, Tm A)] ++ G) (open_tm_wrt_tm B (a_Var_f x)) a_Star
-> Typing G A a_Star -> Typing G (a_Pi rho A B) a_Star.
Lemma E_Abs_exists :  forall x (G : context) (rho : relflag) (a A B : tm),
x `notin` fv_tm_tm_tm a \u fv_tm_tm_tm B
-> Typing ([(x, Tm A)] ++ G) (open_tm_wrt_tm a (a_Var_f x)) (open_tm_wrt_tm B (a_Var_f x))
-> Typing G A a_Star
-> RhoCheck rho x (open_tm_wrt_tm a (a_Var_f x))
-> Typing G (a_UAbs rho a) (a_Pi rho A B).