inversion_clear H1.
apply typ_wf with (1 := H2).
apply typ_wf with (1 := pp_ok H0).
cut (wf (Ax t :: e0)); intros.
apply inv_wf with (1 := H2).
apply typ_wf with (1 := pp_ok H0).
apply typ_wf with (1 := H0).
apply typ_wf with (1 := H0).
apply typ_wf with (1 := H0).
Qed.
Inductive inf_error : term -> type_error -> Prop :=
| Infe_subt :
forall (m n : term) (err : type_error),
subt_nobind m n -> inf_error m err -> inf_error n err
| Infe_under :
forall (m n T : term) (err : type_error),
subt_bind T m n -> inf_error m err -> inf_error n (Under T err)
| Infe_topsort : forall s : sort, inf_error (Srt s) (Topsort s)
| Infe_db : forall n : nat, inf_error (Ref n) (Db_error n)
| Infe_lam_topsort :
forall (M T : term) (s : sort),
inf_error (Abs T M) (Lambda_topsort (Abs T M) s)
| Infe_type_abs :
forall m n t : term, inf_error (Abs m n) (Not_a_type m t)
| Infe_fun : forall m n t : term, inf_error (App m n) (Not_a_fun m t)
| Infe_appl_err :
forall m n tf ta : term, inf_error (App m n) (Apply_err m tf n ta)
| Infe_type_prod_l :
forall m n t : term, inf_error (Prod m n) (Not_a_type m t)
| Infe_type_prod_r :
forall m n t : term, inf_error (Prod m n) (Under m (Not_a_type n t)).
Hint Resolve Infe_topsort Infe_db Infe_lam_topsort Infe_type_abs Infe_fun
Infe_appl_err Infe_type_prod_l Infe_type_prod_r: pts.

Lemma inf_no_exp :
forall a b c d : term, ~ inf_error a (Expected_type b c d).