]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_paramodulation/index.ml
parameter sintax added to axiom statement
[helm.git] / helm / software / components / ng_paramodulation / index.ml
index 9ec7fa4cbb89f8b590c8a31fe78c2db97d5bed19..36c9dd75e693ec51cf5e168995563113c2b92f66 100644 (file)
 
 (* $Id$ *)
 
-module Index(B : Terms.Blob) = struct
-  module U = Terms.Utils(B)
+module Index(B : Orderings.Blob) = struct
+  module U = FoUtils.Utils(B)
+  module Unif = FoUnif.Founif(B)
+  module Pp = Pp.Pp(B)
 
   module ClauseOT =
     struct 
@@ -42,10 +44,10 @@ module Index(B : Terms.Blob) = struct
       let path_string_of =
         let rec aux arity = function
           | Terms.Leaf a -> [Constant (a, arity)]
-          | Terms.Var i -> assert (arity = 0); [Variable]
+          | Terms.Var i -> (* assert (arity = 0); *) [Variable]
+         (* FIXME : should this be allowed or not ? 
           | Terms.Node (Terms.Var _::_) ->
-             (* FIXME : should this be allowed or not ? *)
-             assert false
+             assert false *)
           | Terms.Node ([] | [ _ ] ) -> assert false
           | Terms.Node (Terms.Node _::_) -> assert false             
           | Terms.Node (hd::tl) ->
@@ -78,5 +80,34 @@ module Index(B : Terms.Blob) = struct
       type data = ClauseSet.elt and 
       type dataset = ClauseSet.t
     = Make(FotermIndexable)(ClauseSet)
+  
+  let process op t = function
+    | (_,Terms.Equation (l,_,_,Terms.Gt),_,_) as c -> 
+        op t l (Terms.Left2Right, c)
+    | (_,Terms.Equation (_,r,_,Terms.Lt),_,_) as c -> 
+        op t r (Terms.Right2Left, c)
+    | (_,Terms.Equation (l,r,_,Terms.Incomparable),vl,_) as c ->
+        op (op t l (Terms.Left2Right, c))
+          r (Terms.Right2Left, c)
+    | (_,Terms.Equation (l,r,_,Terms.Invertible),vl,_) as c ->
+       op t l (Terms.Left2Right, c)
+    | (_,Terms.Equation (_,r,_,Terms.Eq),_,_)  -> assert false
+    | (_,Terms.Predicate p,_,_) as c ->
+        op t p (Terms.Nodir, c)
+  ;;
+
+  let index_unit_clause = 
+    process DT.index 
+  let remove_unit_clause =
+    process DT.remove_index 
+
+  let fold = DT.fold 
+
+  let elems index =
+    DT.fold index (fun _ dataset acc -> ClauseSet.union dataset acc)
+      ClauseSet.empty
+    
+  type active_set = B.t Terms.unit_clause list * DT.t
 
 end