From 1eae83d9c648acdea55d333aba67fcc252b54bea Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Wed, 11 Mar 2009 09:48:31 +0000 Subject: [PATCH] unification hints with recursive calls do work! --- .../components/ng_refiner/nCicUnifHint.ml | 20 ++++++++++-------- .../components/ng_refiner/nCicUnification.ml | 21 +++++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/helm/software/components/ng_refiner/nCicUnifHint.ml b/helm/software/components/ng_refiner/nCicUnifHint.ml index ae186cc63..3b6d163f4 100644 --- a/helm/software/components/ng_refiner/nCicUnifHint.ml +++ b/helm/software/components/ng_refiner/nCicUnifHint.ml @@ -208,8 +208,8 @@ let look_for_hint hdb metasenv subst context t1 t2 = let rc = List.map (function - | (prec,true,(NCic.Appl [_; t1; t2],metasenv,l))-> prec,metasenv, (t1,t2),l - | (prec,false,(NCic.Appl [_; t1; t2],metasenv,l))-> prec,metasenv, (t2,t1),l + | (prec,true,(NCic.Appl [_; t1; t2],metasenv,l))-> prec,metasenv,(t1,t2),l + | (prec,false,(NCic.Appl [_; t1; t2],metasenv,l))-> prec,metasenv,(t2,t1),l | _ -> assert false) rc in @@ -218,17 +218,19 @@ let look_for_hint hdb metasenv subst context t1 t2 = in let rc = List.map (fun (_,x,y,z) -> x,y,z) rc in (* + prerr_endline "Hints:"; List.iter (fun (metasenv, (t1, t2), premises) -> prerr_endline - (String.concat "\n" - (List.map (fun (a,b) -> - NCicPp.ppterm ~metasenv ~subst ~context a ^ - " =?= "^NCicPp.ppterm ~metasenv ~subst ~context b) + ("\t" ^ String.concat "; " + (List.map (fun (a,b) -> + NCicPp.ppterm ~margin:max_int ~metasenv ~subst ~context a ^ + " =?= "^ + NCicPp.ppterm ~margin:max_int ~metasenv ~subst ~context b) premises) ^ - "\n--------------------------------------------------"^ - "\n"^NCicPp.ppterm ~metasenv ~subst ~context t1 ^ - " = "^NCicPp.ppterm ~metasenv ~subst ~context t2 ^ "\n\n")) + " ==> "^ + NCicPp.ppterm ~margin:max_int ~metasenv ~subst ~context t1 ^ + " = "^NCicPp.ppterm ~margin:max_int ~metasenv ~subst ~context t2)) rc; *) rc diff --git a/helm/software/components/ng_refiner/nCicUnification.ml b/helm/software/components/ng_refiner/nCicUnification.ml index a0cda6861..55ccca12a 100644 --- a/helm/software/components/ng_refiner/nCicUnification.ml +++ b/helm/software/components/ng_refiner/nCicUnification.ml @@ -443,9 +443,9 @@ and unify hdb test_eq_only metasenv subst context t1 t2 = in let try_hints metasenv subst t1 t2 (* exc*) = (* - prerr_endline ("\n\n\n looking for hints for : " ^ - NCicPp.ppterm ~metasenv ~subst ~context t1 ^ " ==?== " ^ - NCicPp.ppterm ~metasenv ~subst ~context t2); + prerr_endline ("\nProblema:\n" ^ + NCicPp.ppterm ~metasenv ~subst ~context t1 ^ " =?= " ^ + NCicPp.ppterm ~metasenv ~subst ~context t2); *) let candidates = NCicUnifHint.look_for_hint hdb metasenv subst context t1 t2 @@ -454,11 +454,15 @@ and unify hdb test_eq_only metasenv subst context t1 t2 = | [] -> None (* raise exc *) | (metasenv,(c1,c2),premises)::tl -> (* - prerr_endline ("\n attempt: " ^ - NCicPp.ppterm ~metasenv ~subst ~context t1 ^ " ==?== " ^ - NCicPp.ppterm ~metasenv ~subst ~context c1 ^ " AND " ^ - NCicPp.ppterm ~metasenv ~subst ~context c2 ^ " ==?== " ^ - NCicPp.ppterm ~metasenv ~subst ~context t2); + prerr_endline ("\nProvo il candidato:\n" ^ + String.concat "\n" + (List.map + (fun (a,b) -> + NCicPp.ppterm ~metasenv ~subst ~context a ^ " =?= " ^ + NCicPp.ppterm ~metasenv ~subst ~context b) premises) ^ + "\n-------------------------------------------\n"^ + NCicPp.ppterm ~metasenv ~subst ~context c1 ^ " = " ^ + NCicPp.ppterm ~metasenv ~subst ~context c2); *) try let metasenv,subst = @@ -474,7 +478,6 @@ and unify hdb test_eq_only metasenv subst context t1 t2 = Some (metasenv, subst) with UnificationFailure _ | Uncertain _ -> - prerr_endline ("