X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=matita%2Fcomponents%2Fng_refiner%2FnCicRefiner.ml;h=563fe392858b4f09ca26158bbcdd1c87e1290085;hb=2cc1435cba8bd6c7cefd9e34d22080574a8a6890;hp=bb90cf7215ec0ed2bc85d94e6c22de69e65a4075;hpb=7aeec317f639936095e10f88cc0b2710262082d0;p=helm.git diff --git a/matita/components/ng_refiner/nCicRefiner.ml b/matita/components/ng_refiner/nCicRefiner.ml index bb90cf721..563fe3928 100644 --- a/matita/components/ng_refiner/nCicRefiner.ml +++ b/matita/components/ng_refiner/nCicRefiner.ml @@ -143,11 +143,14 @@ let check_allowed_sort_elimination status localise r orig = let mk_fresh_name context name = try let rex = Str.regexp "[0-9']*$" in + let rex2 = Str.regexp "'*$" in let basename = Str.global_replace rex "" in let suffix name = ignore (Str.search_forward rex name 0); let n = Str.matched_string name in - if n = "" then 0 else int_of_string n in + let n = Str.global_replace rex2 "" n in + if n = "" then 0 else int_of_string n +in let name' = basename name in let name' = if name' = "_" then "H" else name' in let last = @@ -906,12 +909,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)