Functional.GenericRelationalValued
Functional union find
('a, 'b) Relation.t
on edges between terms and representativesThis is functional and immutable
module Term : Parameters.GENERIC_TERM
module Relation : Parameters.GENERIC_GROUP
module Value : Parameters.GENERIC_VALUE with type ('a, 'b) relation = ('a, 'b) Relation.t
module TermSet :
PatriciaTree.HeterogeneousSet_S with type 'a BaseMap.key = 'a Term.t
Set of 'a Term.t
val pretty : Stdlib.Format.formatter -> t -> unit
Prints equivalence classes
val pretty_debug : Stdlib.Format.formatter -> t -> unit
Prints whole data structure
val empty : t
type 'a term_through_relation =
| TermThroughRel : 'b Term.t * ('a, 'b) Relation.t -> 'a term_through_relation
type 'a value_through_relation =
| ValueThroughRelation : 'b Value.t option
* ('a, 'b) Relation.t -> 'a value_through_relation
type 'a all_through_relation =
| AllThroughRelation : 'b Term.t
* 'b Value.t option
* TermSet.t
* ('a, 'b) Relation.t -> 'a all_through_relation
val find_representative : t -> 'a Term.t -> 'a term_through_relation
Returns the representative of the given terms, along with the relation between the given term and its representative. O(1) complexity
val find_value : t -> 'a Term.t -> 'a value_through_relation
Returns the value of the given term's representative (None
for top), along with the relation between the given term and its representative. O(1) complexity
val find : t -> 'a Term.t -> 'a all_through_relation
Returns the given term's representative, associated value (None
for top), along with the relation between the given term and its representative. O(1) complexity
check_related uf a b
returns the relation between a
and b
if they are in the same class.
add_value uf a v
is uf
with the value v
added to a
(Or more precisely, the value is added to the representative of a
, via the relation between a
and its representative). Intersects with previous value via Value.meet
if one is present
val union : t -> 'a Term.t -> 'b Term.t -> ('a, 'b) Relation.t -> t
union uf a b r
adds the r a b
relation in uf
. Does nothing if a
and b
are already related