From: Claudio Sacerdoti Coen Date: Mon, 20 Jul 2009 09:57:32 +0000 (+0000) Subject: 1) ppmetasenv and ppcontext to reduce the amount of printed information during X-Git-Tag: make_still_working~3657 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=00d66d5ac17cc72d525d8b2cd089a963e1fef3bf;p=helm.git 1) ppmetasenv and ppcontext to reduce the amount of printed information during debugging 2) BUG FIXED: boxes (in particular out_scope ones) could happear in the substitution after unification. In particular, this happened when the goal had the form H: False |- C and we tried to "nelim H". After the unification, some meta ?1 was instantiated with ?os where ?os := C. This triggered a unification C =?= ?1 before the end of the tactic (hence before the apply_subst). As a result, the ad-hoc unification case for in_scope/out_scope was triggered on inputs of the bad shape and an assert false was raised. --- diff --git a/helm/software/components/ng_refiner/nCicUnification.ml b/helm/software/components/ng_refiner/nCicUnification.ml index bfa1388a9..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