X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fcomponents%2Fng_refiner%2FnCicRefiner.ml;h=550c75e9382c4ec9173f76d1da3d9428f28644d0;hb=446bec03de2d1e48ee612cd8020777aeeb7fbf06;hp=ea502b68592070aad0062c6002c5143059cfd0dc;hpb=83a494ff9e15871231c8338df95f89926f2293ba;p=helm.git diff --git a/matita/components/ng_refiner/nCicRefiner.ml b/matita/components/ng_refiner/nCicRefiner.ml index ea502b685..550c75e93 100644 --- a/matita/components/ng_refiner/nCicRefiner.ml +++ b/matita/components/ng_refiner/nCicRefiner.ml @@ -505,13 +505,14 @@ and try_coercions status (* we try with a coercion *) let rec first exc = function | [] -> - let expty = - match expty with - `Type expty -> status#ppterm ~metasenv ~subst ~context expty - | `Sort -> "[[sort]]" - | `Prod -> "[[prod]]" in pp (lazy "WWW: no more coercions!"); - raise (wrap_exc (lazy (localise orig_t, Printf.sprintf + raise (wrap_exc (lazy + let expty = + match expty with + `Type expty -> status#ppterm ~metasenv ~subst ~context expty + | `Sort -> "[[sort]]" + | `Prod -> "[[prod]]" in + (localise orig_t, Printf.sprintf "The term\n%s\nhas type\n%s\nbut is here used with type\n%s" (status#ppterm ~metasenv ~subst ~context t) (status#ppterm ~metasenv ~subst ~context infty) @@ -909,12 +910,19 @@ and force_to_sort status metasenv subst context t orig_t localise ty = metasenv, subst, t, ty with Failure _ -> + let msg = + (lazy (localise orig_t, + "The type of " ^ status#ppterm ~metasenv ~subst ~context t ^ + " is not a sort: " ^ status#ppterm ~metasenv ~subst ~context ty)) in let ty = NCicReduction.whd status ~subst context ty in + let exn = + if NCicUnification.could_reduce status ~subst context ty then + Uncertain msg + else + RefineFailure msg + in try_coercions status ~localise metasenv subst context - t orig_t ty `Sort - (Uncertain (lazy (localise orig_t, - "The type of " ^ status#ppterm ~metasenv ~subst ~context t ^ - " is not a sort: " ^ status#ppterm ~metasenv ~subst ~context ty))) + t orig_t ty `Sort exn and sort_of_prod status localise metasenv subst context orig_s orig_t (name,s) t (t1, t2)