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 _ = ();;
| _ ->
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
(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
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
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
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