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

Lemma An_Abs_exists2
: ∀ (x : atom) (G : context) (rho : relflag) (A a B : tm),
x `notin` union (dom G) (union (fv_tm_tm_tm a) (fv_tm_tm_tm B))
→ AnnTyping ([(x, Tm A)] ++ G) (open_tm_wrt_tm a (a_Var_f x)) (open_tm_wrt_tm B (a_Var_f x))
→ RhoCheck rho x (erase_tm (open_tm_wrt_tm a (a_Var_f x)))
→ AnnTyping G (a_Abs rho A a) (a_Pi rho A B).