Module UnionFind.Make

Parameters

Signature

type t
val pp : pp_empty:(F.formatter -> unit) -> (F.formatter -> X.t -> unit) -> F.formatter -> t -> unit
type repr = private X.t
val empty : t
val union : t -> X.t -> X.t -> t * (X.t * repr) option

return the optional new equality added between the old representatives of the two items in the form of "old representative = new representative", None if they were already in the same congruence class

val find : t -> X.t -> repr

return the element given if it wasn't found in the relation

val fold_congruences : (trepr * XSet.t, 'acc) IStdlib.IStd.Container.fold

fold over the equivalence classes of the relation, singling out the representative for each class

val filter_not_in_closed_set : keep:XSet.t -> t -> t

only keep items in keep, assuming that keep is closed under the relation, i.e. that if an item x is in keep then so are all the y such that x=y according to the relation