(* --------------------------------------------------------------------- *)
(* This is the place for "smart constructors" and "smart inversion" lemmas. They are especialy useful for constructing derivations from a particular variable and avoiding the co-finite quantification stuff.  *)
(* In a locally nameless development, these should be stated and immediately proven after substitution. *)

Lemma An_Abs_exists :
∀ x (G:context) rho (A a B:tm),
x \notin dom G \u fv_tm_tm_tm a \u fv_tm_tm_tm B ->
AnnTyping G A a_Star ->
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).