From 9b6600b6ebde837548d46c6c1879ff9d37f56194 Mon Sep 17 00:00:00 2001 From: Andrea Asperti Date: Mon, 11 Jan 2010 11:21:58 +0000 Subject: [PATCH] Added is_equation --- .../ng_paramodulation/nCicParamod.ml | 35 ++++++++++++++++++- .../ng_paramodulation/nCicParamod.mli | 8 +++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/helm/software/components/ng_paramodulation/nCicParamod.ml b/helm/software/components/ng_paramodulation/nCicParamod.ml index fad1aa411..739e76f05 100644 --- a/helm/software/components/ng_paramodulation/nCicParamod.ml +++ b/helm/software/components/ng_paramodulation/nCicParamod.ml @@ -95,6 +95,7 @@ module EmptyC = let context = [] end +module CB = NCicBlob.NCicBlob(EmptyC) module P = NCicParamod(EmptyC) type state = P.state @@ -105,7 +106,7 @@ let forward_infer_step s t ty = let bag,clause = P.mk_passive bag (t,ty) in if Terms.is_eq_clause clause then P.forward_infer_step (P.replace_bag s bag) clause 0 - else s + else (prerr_endline "not eq"; s) ;; let index_obj s uri = @@ -117,6 +118,17 @@ let index_obj s uri = | _ -> s ;; +let paramod rdb metasenv subst context s goal = + (* let stamp = Unix.gettimeofday () in *) + match P.nparamod ~useage:true ~max_steps:max_int + ~timeout:(Unix.gettimeofday () +. 300.0) s goal with + | P.Error _ | P.GaveUp | P.Timeout _ -> [] + | P.Unsatisfiable solutions -> + (* print (lazy (Printf.sprintf "Got solutions in %fs" + (Unix.gettimeofday() -. stamp))); *) + List.map (readback rdb metasenv subst context) solutions +;; + let fast_eq_check rdb metasenv subst context s goal = (* let stamp = Unix.gettimeofday () in *) match P.fast_eq_check s goal with @@ -127,3 +139,24 @@ let fast_eq_check rdb metasenv subst context s goal = List.map (readback rdb metasenv subst context) solutions ;; +let is_equation metasenv subst context ty = + let hty, _, _ = + NCicMetaSubst.saturate ~delta:0 metasenv subst context + ty 0 + in match hty with + | NCic.Appl (eq ::tl) when eq = CB.eqP -> true + | _ -> false +;; + + +(* +let demodulate rdb metasenv subst context s goal = + (* let stamp = Unix.gettimeofday () in *) + match P.fast_eq_check s goal with + | P.Error _ | P.GaveUp | P.Timeout _ -> [] + | P.Unsatisfiable solutions -> + (* print (lazy (Printf.sprintf "Got solutions in %fs" + (Unix.gettimeofday() -. stamp))); *) + List.map (readback rdb metasenv subst context) solutions +;; +*) diff --git a/helm/software/components/ng_paramodulation/nCicParamod.mli b/helm/software/components/ng_paramodulation/nCicParamod.mli index a0f5265ee..3c813a075 100644 --- a/helm/software/components/ng_paramodulation/nCicParamod.mli +++ b/helm/software/components/ng_paramodulation/nCicParamod.mli @@ -21,6 +21,14 @@ type state val empty_state: state val forward_infer_step: state -> NCic.term -> NCic.term -> state val index_obj: state -> NUri.uri -> state +val is_equation: NCic.metasenv -> + NCic.substitution -> NCic.context -> NCic.term -> bool +val paramod : + #NRstatus.status -> + NCic.metasenv -> NCic.substitution -> NCic.context -> + state -> + (NCic.term * NCic.term) -> + (NCic.term * NCic.term * NCic.metasenv * NCic.substitution) list val fast_eq_check : #NRstatus.status -> NCic.metasenv -> NCic.substitution -> NCic.context -> -- 2.39.2