Section Infer_Application.
Let le_type_prod_l := inv_prod_l _ (pa_inv_prod the_algos).
Let le_type_prod_r := inv_prod_r _ (pa_inv_prod the_algos).
Definition app_chk_err (u tu : term) (e : type_error) :=
match e with
| Expected_type v tv _ => Apply_err u tu v tv
| e => e
end.
(* Lemma app_chk_expln: (e:env)(u,a,b:term)(err:type_error) (typ_ppal e u (Prod a b))->(expln e err) ->(expln e (app_chk_err u (Prod a b) err)). Intros. (Inversion_clear H0; Simpl; Try Constructor; Trivial). Apply (pp_ok H).  Intros. Apply (pp_least H) with 1:=H0.  Simpl. *)

Theorem infer_app :
forall (e : env) (u v : term), wf e -> infer_ppal_type e (App u v).