Set Bullet Behavior "Strict Subproofs".
Set Implicit Arguments.
(*  This module proves the following results:  Lemma AnnSig_an_toplevel: AnnSig an_toplevel. Lemma Sig_toplevel: Sig toplevel.   It *should* be the only place in the development that unfolds the definition of an_toplevel. That way, if we change the definition of the signature in ett.ott, we only need to change this file.  In this case, it uses the fact that an_toplevel (defined in ett.ott) contains the following definitions:  Definition Fix : atom. pick fresh F. exact F. Qed.  Definition FixDef : tm := (a_Abs Irrel a_Star (a_Abs Rel (a_Pi Rel (a_Var_b 0) (a_Var_b 1)) (a_App (a_Var_b 0) Rel (a_App (a_App (a_Fam Fix) Irrel (a_Var_b 1)) Rel (a_Var_b 0))))).  Definition FixTy : tm := a_Pi Irrel a_Star (a_Pi Rel (a_Pi Rel (a_Var_b 0) (a_Var_b 1)) (a_Var_b 1)). *)
unfold an_toplevel.
eauto.
Qed.
Ltac an_use_binder f x :=
pick fresh x and apply f; eauto;
unfold open_tm_wrt_tm; simpl; simpl_env; eauto;
match goal with
[ |- AnnTyping ?ctx ?a ?A ] =>
assert (AnnCtx ctx); [econstructor; eauto|idtac]
end.

Lemma An_App_intro :
forall (G : context) (b : tm) (rho : relflag) (a B A C : tm),
AnnTyping G b (a_Pi rho A B) -> (open_tm_wrt_tm B a) = C ->
AnnTyping G a A -> AnnTyping G (a_App b rho a) C.