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.

(* Specifications: *)
Theorem infer_app : forall (e : env) (u v : term), wf e -> infer_ppal_type e (App u v).
Theorem infer_sort : forall (e : env) (s : sort), wf e -> infer_ppal_type e (Srt s).
Theorem infer_abs : forall (e : env) (A M : term), wf e -> infer_ppal_type e (Abs A M).
Theorem infer_prod : forall (e : env) (A B : term), wf e -> infer_ppal_type e (Prod A B).