intros.
elim fix_inference with A e; intros.
inversion_clear a.
elim (pa_least_sort the_algos) with e x; intros.
inversion_clear a.
cut (wf (Ax A :: e)); intros.
elim fix_inference with B (Ax A :: e); intros.
inversion_clear a.
elim (pa_least_sort the_algos) with (Ax A :: e) x1; intros.
inversion_clear a.
left.
elim (pa_infer_rule the_algos) with x0 x2; intros.
split with (Srt x3); split; intros.
apply type_prod_sat with x0 x2; auto with pts.
apply typ_conv_wf with x; auto with pts.
apply (pp_ok H0).
apply (pp_ok H1).
apply typ_conv_wf with x1; auto with pts.
apply (pp_ok H3).
apply (pp_ok H4).
apply (pp_ok p).
Inversion_typ H5.
apply le_type_trans with (2 := H9).
unfold le_sort in p.
apply (pp_least p).
split with s1.
apply (pp_least H1).
apply (pp_least H0); trivial with pts.
split with s2; trivial with pts.
apply (pp_least H4).
apply (pp_least H3); trivial with pts.
right.
split with (Under A (Not_a_type B x1)).
constructor.
constructor.
apply (pp_ok H3).
red in |- *; intros.
elim b with s.
apply (pp_least H3) with (1 := H4).
constructor.
apply type_correctness with (1 := pp_ok H3).
right.
inversion_clear b.
split with (Under A x1).
constructor; trivial.
apply Infe_under with B; trivial with pts.
trivial.
apply wf_var with x0.
apply type_conv_srt with x; auto.
apply (pp_ok H0).
apply (pp_ok H1).
right.
split with (Not_a_type A x).
constructor.
apply (pp_ok H0).
red in |- *; intros.
elim b with s.
apply (pp_least H0).
trivial.
constructor.
apply type_correctness with (1 := pp_ok H0).
right.
inversion_clear b.
split with x.
trivial.
apply Infe_subt with A; trivial with pts.
trivial.
Defined.
End Fixpoint_Body.
Section Infer_Full_PTS.
Fixpoint full_ppal_type (t : term) :
forall e : env, wf e -> infer_ppal_type e t :=
fun e H =>
match t return (infer_ppal_type e t) with
| Srt s => infer_sort e s H
| Ref n => infer_ref e n H
| Abs A M => infer_abs full_ppal_type e A M H
| App u v => infer_app full_ppal_type e u v H
| Prod A B => infer_prod full_ppal_type e A B H
end.

(* Specifications: *)
Lemma tmp_add_typ : forall (e : env) (t : term), wf e -> decl_dec e (Ax t).
Proof fix_add_typ full_ppal_type.
Lemma tmp_check_typ_when_wf :
forall (e : env) (t T : term), wf e -> wf_type e T -> check_dec e t T.