+ let mk_hint (u1,_,_) (u2,_,_) =
+ let l = OCic2NCic.convert_obj u1
+ (fst (CicEnvironment.get_obj CicUniv.oblivion_ugraph u1)) in
+ let r = OCic2NCic.convert_obj u2
+ (fst (CicEnvironment.get_obj CicUniv.oblivion_ugraph u2)) in
+ match List.hd l,List.hd r with
+ | (_,h1,_,_,NCic.Constant (_,_,Some l,_,_)),
+ (_,h2,_,_,NCic.Constant (_,_,Some r,_,_)) ->
+ let rec aux ctx t1 t2 =
+ match t1, t2 with
+ | NCic.Lambda (n1,s1,b1), NCic.Lambda(_,s2,b2) ->
+ if NCicReduction.are_convertible ~subst:[] ~metasenv:[] ctx s1 s2
+ then aux ((n1, NCic.Decl s1) :: ctx) b1 b2
+ else []
+ | b1,b2 ->
+ if NCicReduction.are_convertible ~subst:[] ~metasenv:[] ctx b1 b2
+ then begin
+(*
+ prerr_endline ("hint: " ^ NCicPp.ppterm ~metasenv:[] ~subst:[]
+ ~context:ctx b1 ^ " === " ^ NCicPp.ppterm ~metasenv:[]
+ ~subst:[] ~context:ctx b2);
+*)
+ let rec mk_rels =
+ function 0 -> [] | n -> NCic.Rel n :: mk_rels (n-1)
+ in
+ let n1 =
+ NCic.Appl (NCic.Const(OCic2NCic.reference_of_ouri
+ u1 (NReference.Def h1)) :: mk_rels (List.length ctx))
+ in
+ let n2 =
+ NCic.Appl (NCic.Const(OCic2NCic.reference_of_ouri
+ u2 (NReference.Def h2)) :: mk_rels (List.length ctx))
+ in
+ [ctx,b1,b2; ctx,b1,n2; ctx,n1,b2; ctx,n1,n2]
+ end else []
+ in
+ aux [] l r
+ | _ -> []
+ in
+ let hints =
+ List.fold_left
+ (fun acc (_,_,l) ->
+ acc @
+ if List.length l > 1 then
+ combine mk_hint l
+ else [])
+ [] (CoercDb.to_list (CoercDb.dump ()))