Module Dnet.Make

Parameters

Signature

type t
type ident = Ident.t

provided identifier type

type meta = Meta.t

provided metavariable type

type 'a structure = 'a T.t

provided parametrized datastructure

module Idset : Stdlib.Set.S with type Idset.elt = ident

returned sets of solutions

type term_pattern =
| Term of term_pattern structure
| Meta of meta

a pattern is a term where each node can be a unification variable

val empty : t
val add : t -> term_pattern -> ident -> t

add t w i adds a new association (w,i) in t.

val find_all : t -> Idset.t

find_all t returns all identifiers contained in t.

val fold_pattern : ('a -> (Idset.t * meta * t) -> 'a) -> 'a -> term_pattern -> t -> Idset.t option * 'a

fold_pattern f acc p dn folds f on each meta of p, passing the meta and the sub-dnet under it. The result includes:

  • Some set if identifiers were gathered on the leafs of the term
  • None if the pattern contains no leaf (only Metas at the leafs).
val find_match : term_pattern -> t -> Idset.t

find_match p t returns identifiers of all terms matching p in t.

val inter : t -> t -> t

set operations on dnets

val union : t -> t -> t
val map : (ident -> ident) -> (unit structure -> unit structure) -> t -> t

apply a function on each identifier and node of terms in a dnet

val map_metas : (meta -> meta) -> t -> t