package kappa-library

  1. Overview
  2. Docs
type t
type message
val receive_message : message -> t -> t
val empty : Kappa_terms.Model.t -> t
val debug_print : Format.formatter -> t -> unit

Updating the roots

val incorporate_extra_pattern : t -> Kappa_terms.Pattern.id -> Kappa_data_structures.IntCollection.t -> unit
val break_apart_cc : t -> Kappa_site_graphs.Edges.t -> ?mod_connectivity_store:Roots.mod_ccs_cache -> (int * int) option -> unit
val merge_cc : t -> ?mod_connectivity_store:Roots.mod_ccs_cache -> (int * int) option -> unit

Checking instances

val is_valid : t -> Kappa_terms.Pattern.id -> int -> bool

Counting instances

val number_of_instances : ?rule_id:int -> t -> Kappa_terms.Pattern.id array -> int

number_of_instances ?rule_id state patterns

val number_of_unary_instances_in_cc : ?rule_id:int -> t -> (Kappa_terms.Pattern.id * Kappa_terms.Pattern.id) -> int -> int

number_of_unary_instances_in_cc ?rule_id state (pat1, pat2) cc

Picking instances

val pick_unary_instance_in_cc : ?rule_id:int -> t -> Random.State.t -> (Kappa_terms.Pattern.id * Kappa_terms.Pattern.id) -> int -> int * int

pick_unary_instance_in_cc state random_state (pat1, pat2) cc Returns a pair of roots corresponding to pat1 and pat2 respectively. Optimized for currying before the cc argument. In case of failure, one of the resulting roots is set to (-1).

val fold_picked_instance : ?rule_id:int -> t -> Random.State.t -> Kappa_terms.Pattern.id array -> init:'a -> (int -> Kappa_terms.Pattern.id -> int -> 'a -> 'a option) -> 'a option

fold_picked_instances state random_state patterns ~init f with f pat_id_in_array pat corresponding_root acc. Monadic fold function that calls f for every root of a random embedding from patterns in the mixture. This function is lazy in the sense it stops to draw roots when the accumulator besomes `None`.

Enumerating instances

val fold_instances : ?rule_id:int -> ?excp:(Kappa_terms.Pattern.id * int) -> t -> Kappa_terms.Pattern.id array -> init:'a -> (int array -> 'a -> 'a) -> 'a

fold_enumerated_instances state patterns ~init f with f roots acc. Folds through every rectangular instance of an array of patterns.

val fold_unary_instances : ?rule_id:int -> t -> (Kappa_terms.Pattern.id * Kappa_terms.Pattern.id) -> init:'a -> ((int * int) -> 'a -> 'a) -> 'a

fold_unary_instances state (pat1, pat2) ~init f with f (root1, root2) acc.

OCaml

Innovation. Community. Security.