Section Fixpoint_Body.
(* Useful for the mutual recursion  type inference <-> type checking *)
Hypothesis
fix_inference : forall (t : term) (e : env), wf e -> infer_ppal_type e t.
(*Realizer [e:env][t,T:term]Cases (fix_inference t e) of (inl T')  => if (pa_le_type_dec the_algos e T' T) then Chk_ok else (Chk_fail (Expected_type t T' T)) | (inr err) => (Chk_fail err) end. *)
intros.
case (fix_inference t e); trivial;
[ intros (T', ppty_t) | intros (err, expl, is_err) ].
case (pa_le_type_dec the_algos e T' T); trivial.
apply type_correctness with (1 := pp_ok ppty_t).
intros le_ty.
apply Chk_ok.
apply typ_conv_wf with T'; trivial.
apply (pp_ok ppty_t).
intros not_le.
apply Chk_fail with (Expected_type t T' T); auto with pts.
constructor; auto with pts.
red in |- *; intros; apply not_le.
apply (pp_least ppty_t) with (1 := H1).
apply Chk_fail with err; auto with pts.
Defined.

Theorem fix_add_typ :
forall (e : env) (t : term), wf e -> decl_dec e (Ax t).