(* --------------------------------------------------------------------- *)
(* 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_Pi_exists : forall x G rho A B,
x `notin` dom G \u fv_tm_tm_tm B
→ AnnTyping ([(x, Tm A)] ++ G)
(open_tm_wrt_tm B (a_Var_f x)) a_Star
→ AnnTyping G A a_Star
→ AnnTyping G (a_Pi rho A B) a_Star.