| _ -> 0
;;
-module DiscriminationTreeIndexing =
- functor (I:Indexable) ->
- functor (A:Set.S) ->
+module type DiscriminationTree =
+ sig
+
+ type input
+ type data
+ type dataset
+ type constant_name
+ type t
+
+ val iter : t -> (constant_name path -> dataset -> unit) -> unit
+
+ val empty : t
+ val index : t -> input -> data -> t
+ val remove_index : t -> input -> data -> t
+ val in_index : t -> input -> (data -> bool) -> bool
+ val retrieve_generalizations : t -> input -> dataset
+ val retrieve_unifiables : t -> input -> dataset
+ end
+
+module Make (I:Indexable) (A:Set.S) : DiscriminationTree
+with type constant_name = I.constant_name and type input = I.input
+and type data = A.elt and type dataset = A.t =
+
struct
module OrderedPathStringElement = struct
let compare = I.compare
end
+ type constant_name = I.constant_name
+ type data = A.elt
+ type dataset = A.t
+ type input = I.input
+
module PSMap = Map.Make(OrderedPathStringElement);;
type key = PSMap.key
module CicIndexable : Indexable
with type input = Cic.term and type constant_name = UriManager.uri
-module DiscriminationTreeIndexing :
- functor (I: Indexable) ->
- functor (A : Set.S) ->
+module type DiscriminationTree =
sig
- type t
- val iter : t -> (I.constant_name path -> A.t -> unit) -> unit
+ type input
+ type data
+ type dataset
+ type constant_name
+ type t
+
+ val iter : t -> (constant_name path -> dataset -> unit) -> unit
val empty : t
- val index : t -> I.input -> A.elt -> t
- val remove_index : t -> I.input -> A.elt -> t
- val in_index : t -> I.input -> (A.elt -> bool) -> bool
- val retrieve_generalizations : t -> I.input -> A.t
- val retrieve_unifiables : t -> I.input -> A.t
+ val index : t -> input -> data -> t
+ val remove_index : t -> input -> data -> t
+ val in_index : t -> input -> (data -> bool) -> bool
+ val retrieve_generalizations : t -> input -> dataset
+ val retrieve_unifiables : t -> input -> dataset
end
+module Make (I : Indexable) (A : Set.S) : DiscriminationTree
+with type constant_name = I.constant_name and type input = I.input
+and type data = A.elt and type dataset = A.t
+
*)
(* $Id$ *)
-(*
-module NCicIndexable : Discrimination_tree.Indexable
+
+open Discrimination_tree
+
+module TermOT : Set.OrderedType with type t = NCic.term = struct
+ type t = NCic.term
+ let compare = Pervasives.compare
+end
+
+module TermSet = Set.Make(TermOT)
+
+module NCicIndexable : Indexable
with type input = NCic.term and type constant_name = NUri.uri = struct
+type input = NCic.term
+type constant_name = NUri.uri
+
let ppelem = function
| Constant (uri,arity) ->
"("^NUri.name_of_uri uri ^ "," ^ string_of_int arity^")"
end
-module DiscriminationTree =
- Discrimination_tree.DiscriminationTreeIndexing(NCicIndexable)
- *)
+module DiscriminationTree = Make(NCicIndexable)(TermSet)
* http://cs.unibo.it/helm/.
*)
-(*
module NCicIndexable : Discrimination_tree.Indexable
with type input = NCic.term and type constant_name = NUri.uri
-module DiscriminationTree :
- Discrimination_tree.DiscriminationTreeIndexing(NCicIndexable)
-*)
+module TermSet : Set.S with type elt = NCic.term
+
+module DiscriminationTree : Discrimination_tree.DiscriminationTree
+with type constant_name = NCicIndexable.constant_name
+and type input = NCicIndexable.input
+and type data = TermSet.elt and type dataset = TermSet.t
module type EqualityIndex =
sig
module PosEqSet : Set.S with type elt = Utils.pos * Equality.equality
- type t =
- Discrimination_tree.DiscriminationTreeIndexing(Discrimination_tree.CicIndexable)(PosEqSet).t
+ type t = Discrimination_tree.Make(Discrimination_tree.CicIndexable)(PosEqSet).t
val empty : t
val retrieve_generalizations : t -> Cic.term -> PosEqSet.t
val retrieve_unifiables : t -> Cic.term -> PosEqSet.t
module PosEqSet = Set.Make(OrderedPosEquality);;
- include
- Discrimination_tree.DiscriminationTreeIndexing(Discrimination_tree.CicIndexable)(PosEqSet)
+ include Discrimination_tree.Make(Discrimination_tree.CicIndexable)(PosEqSet)
(* DISCRIMINATION TREES *)
module PosEqSet = Set.Make(OrderedPosEquality);;
- include
- Discrimination_tree.DiscriminationTreeIndexing(Discrimination_tree.CicIndexable)(PosEqSet)
+ include Discrimination_tree.Make(Discrimination_tree.CicIndexable)(PosEqSet)
(* DISCRIMINATION TREES *)
module type EqualityIndex =
sig
module PosEqSet : Set.S with type elt = Utils.pos * Equality.equality
- type t = Discrimination_tree.DiscriminationTreeIndexing(Discrimination_tree.CicIndexable)(PosEqSet).t
+ type t = Discrimination_tree.Make(Discrimination_tree.CicIndexable)(PosEqSet).t
val empty : t
val retrieve_generalizations : t -> Cic.term -> PosEqSet.t
val retrieve_unifiables : t -> Cic.term -> PosEqSet.t
with type elt = Utils.pos * Equality.equality
and type t = Equality_indexing.DT.PosEqSet.t
type t =
- Discrimination_tree.DiscriminationTreeIndexing(Discrimination_tree.CicIndexable)(PosEqSet).t
+ Discrimination_tree.Make(Discrimination_tree.CicIndexable)(PosEqSet).t
end
val index : Index.t -> Equality.equality -> Index.t
let compare = Pervasives.compare
end
module S = Set.Make(Codomain)
-module TI = Discrimination_tree.DiscriminationTreeIndexing(Discrimination_tree.CicIndexable)(S)
+module TI = Discrimination_tree.Make(Discrimination_tree.CicIndexable)(S)
type universe = TI.t
let empty = TI.empty