module Bitpath_cover:sig..end
Bitpath_cover.t models sets of infinitely long bit-strings which can be
described by a finite set of prefixes common to the members. These sets
can also be considered subsets of unit interval [0, 1] in which case
prefixes are the leading decimals of the binary representation of
members.
In the following we use · to represent concatenation of bit-strings
along with regular set operations to describe modelled sets.
typeprefix =Bitpath.t
Bitpath.type t
val equal : t -> t -> boolequal sA sB is true iff sA and sB contain the same members.val disjoint : t -> t -> booldisjoint sA sB is true iff sA ∩ sB is the empty set.val empty : tval is_empty : t -> boolval universe : tval is_universe : t -> boolis_universe s is true iff equal s universe.val of_prefix : prefix -> tof_prefix p is the set of all strings starting with p.val is_prefix : t -> bools such that equal s (of_prefix p) for some p.val to_prefix : t -> prefixis_prefix s, then to_prefix s returns the p such that equal s
(of_prefix p), otherwise it raises Invalid_argument.val pick_first : t -> prefixpick_first s returns the lexicographically lowest prefix describing a
cover in s.val pick_random : t -> prefixpick_random s returns a random prefix of s, using the PRNG from the
Random module.val appose : t -> t -> tappose sA sB is the set whose lower and upper halves are sA and sB
shrunk to half their size by prefixing their elements by 0 and 1,
respectively.val lower_half : t -> tlower_half s is the set {p | 0·p ∈ s}.val upper_half : t -> tupper_half s is the set {p | 1·p ∈ s}.val unzoom : prefix -> t -> tunzoom p s is the set {p·p' | p' ∈ s}.val zoom : prefix -> t -> tzoom p s is the set {p' | p·p' ∈ s}.val cover_find : prefix -> t -> prefixcover_find p s returns the cover of p in s or raises Not_found is no
such cover exist in s.val add : prefix -> t -> tadd p s is the union s ∪ of_prefix p.val remove : prefix -> t -> tremove p s is the relative complement s ∖ of_prefix p.val intersect : prefix -> t -> tintersect p s is the intersection s ∩ of_prefix p.val modify : prefix ->
(t -> t) -> t -> tmodify f p s is the set s ∖ of_prefix p ∪ unzoom (f (zoom s)).val fold : (prefix -> 'a -> 'a) -> t -> 'a -> 'afold f s is the function f p_(n-1) ∘ ⋯ ∘ f p_0 where {p_i} is the
minimal set of prefixes which cover s.val iter : (prefix -> unit) -> t -> unititer f s calls f for each prefix in the minimal cover for s.val cover_card : t -> intcover_card s is the cardinality of the minimal set of prefixes which
cover of s.val isecn : t -> t -> tisecn sA sB is the intersection sA ∩ sB.val union : t -> t -> tunion sA sB is the union sA ∪ sB.val rel_compl : t -> t -> trel_compl sC sA is the relative complement sA ∖ sC.val abs_compl : t -> tabs_compl s is the absolute complement ∁ s.val compl_decomp : t -> t * tcompl_decomp s returns a pair (sC, sA) such that s equals sA ∖ sC.
The two returned sets will generally have a simler representation than the
original set.