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)).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)).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)).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)).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)).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)).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)).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)).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)).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)).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)).

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