@@ -8,13 +8,13 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com
8
8
9
9
#include " union_find_replace.h"
10
10
11
- // / Keeps a map of symbols to expressions, such as none of the mapped values
12
- // / exist as a key
13
- // / \param a: an expression of type char array
14
- // / \param b: an expression to map it to, which should be either a symbol
15
- // / a string_exprt, an array_exprt, an array_of_exprt or an
16
- // / if_exprt with branches of the previous kind
17
- // / \return the new mapped value
11
+ // / Merge the set containing `a` and the set containing `b`.
12
+ // / It is guaranteed that if `b` never appears as the first argument of a
13
+ // / `make_union` call, then it is the representative element of the set it
14
+ // / belongs to.
15
+ // / \param a: an expression
16
+ // / \param b: an expression
17
+ // / \return current representative element of the set containing `a` and `b`
18
18
exprt union_find_replacet::make_union (const exprt &a, const exprt &b)
19
19
{
20
20
const exprt &lhs_root = find (a);
@@ -24,8 +24,8 @@ exprt union_find_replacet::make_union(const exprt &a, const exprt &b)
24
24
return rhs_root;
25
25
}
26
26
27
- // / Replace subexpressions of `expr` by a canonical element of the set they
28
- // / belong to.
27
+ // / Replace subexpressions of `expr` by the representative element of the set
28
+ // / they belong to.
29
29
// / \param expr: an expression, modified in place
30
30
// / \return true if expr is left unchanged
31
31
bool union_find_replacet::replace_expr (exprt &expr) const
@@ -37,15 +37,14 @@ bool union_find_replacet::replace_expr(exprt &expr) const
37
37
}
38
38
39
39
// / \param expr: an expression
40
- // / \return canonical representation for expressions which belong to the same
41
- // / set
40
+ // / \return representative element of the set `expr` belongs to
42
41
exprt union_find_replacet::find (exprt expr) const
43
42
{
44
43
replace_expr (expr);
45
44
return expr;
46
45
}
47
46
48
- // / \return pairs of expression composed of expressions and a canonical
47
+ // / \return pairs of expression composed of expressions and a representative
49
48
// / expression for the set they below to.
50
49
std::vector<std::pair<exprt, exprt>> union_find_replacet::to_vector () const
51
50
{
0 commit comments