X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_refiner%2FnCicUnification.ml;h=13ddac96d9be7e7995ae4ddc1b1aa105e6d701c6;hb=00d66d5ac17cc72d525d8b2cd089a963e1fef3bf;hp=9ee056aed4f6a6911ea11c658bafe4873c019494;hpb=dcdbb979433a61e2ef2842d96604098728824416;p=helm.git diff --git a/helm/software/components/ng_refiner/nCicUnification.ml b/helm/software/components/ng_refiner/nCicUnification.ml index 9ee056aed..13ddac96d 100644 --- a/helm/software/components/ng_refiner/nCicUnification.ml +++ b/helm/software/components/ng_refiner/nCicUnification.ml @@ -84,7 +84,13 @@ let outside () = indent := String.sub !indent 0 (String.length !indent -1);; let pp s = prerr_endline (Printf.sprintf "%-20s" !indent ^ " " ^ Lazy.force s) -;; +;; + +let ppcontext = NCicPp.ppcontext;; +let ppmetasenv = NCicPp.ppmetasenv;; + +(*let ppcontext ~metasenv ~subst context = "...";; +let ppmetasenv ~subst metasenv = "...";;*) let pp _ = ();; @@ -151,8 +157,8 @@ and instantiate rdb test_eq_only metasenv subst context n lc t swap = | _ -> pp (lazy ( "typeof: " ^ NCicPp.ppterm ~metasenv ~subst ~context t ^ "\nctx:\n"^ - NCicPp.ppcontext ~metasenv ~subst context ^ "\nmenv:\n"^ - NCicPp.ppmetasenv ~subst metasenv)); + ppcontext ~metasenv ~subst context ^ "\nmenv:\n"^ + ppmetasenv ~subst metasenv)); let t, ty_t = try t, NCicTypeChecker.typeof ~subst ~metasenv context t with @@ -163,8 +169,8 @@ and instantiate rdb test_eq_only metasenv subst context n lc t swap = (prerr_endline ( ("ILLTYPED: " ^ NCicPp.ppterm ~metasenv ~subst ~context t ^ "\nBECAUSE:" ^ Lazy.force msg ^ "\nCONTEXT:\n" ^ - NCicPp.ppcontext ~metasenv ~subst context ^ "\nMENV:\n" ^ - NCicPp.ppmetasenv ~subst metasenv + ppcontext ~metasenv ~subst context ^ "\nMENV:\n" ^ + ppmetasenv ~subst metasenv )); assert false) else @@ -214,7 +220,7 @@ and instantiate rdb test_eq_only metasenv subst context n lc t swap = in pp (lazy(string_of_int n ^ " := 222 = "^ NCicPp.ppterm ~metasenv ~subst ~context:ctx t - ^ "\n" ^ NCicPp.ppmetasenv ~subst metasenv)); + ^ "\n" ^ ppmetasenv ~subst metasenv)); (* Unifying the types may have already instantiated n. *) try let _, _,oldt,_ = NCicUtils.lookup_subst n subst in @@ -239,7 +245,7 @@ and unify rdb test_eq_only metasenv subst context t1 t2 = let fo_unif test_eq_only metasenv subst t1 t2 = (*D*) inside 'F'; try let rc = pp (lazy(" " ^ NCicPp.ppterm ~metasenv ~subst ~context t1 ^ " ==?== " ^ - NCicPp.ppterm ~metasenv ~subst ~context t2 ^ "\n" ^ NCicPp.ppmetasenv + NCicPp.ppterm ~metasenv ~subst ~context t2 ^ "\n" ^ ppmetasenv ~subst metasenv)); if t1 === t2 then metasenv, subst @@ -324,6 +330,20 @@ and unify rdb test_eq_only metasenv subst context t1 t2 = let metasenv, subst = instantiate rdb test_eq_only metasenv subst context j lj t2 true in + (* We need to remove the out_scope_tags to avoid propagation of + them that triggers again the ad-hoc case *) + let subst = + List.map (fun (i,(tag,ctx,bo,ty)) -> + let tag = + match tag with + Some tag when + tag = NCicMetaSubst.in_scope_tag + || NCicMetaSubst.is_out_scope_tag tag -> None + | _ -> tag + in + i,(tag,ctx,bo,ty) + ) subst + in (try let name, ctx, term, ty = NCicUtils.lookup_subst i subst in let term = eta_reduce subst term in @@ -490,8 +510,7 @@ and unify rdb test_eq_only metasenv subst context t1 t2 = NCicPp.ppterm ~metasenv ~subst ~context t2); *) let candidates = - NCicUnifHint.look_for_hint - rdb.NRstatus.uhint_db metasenv subst context t1 t2 + NCicUnifHint.look_for_hint rdb metasenv subst context t1 t2 in let rec cand_iter = function | [] -> None (* raise exc *)