Skip to content

Commit 75b8386

Browse files
Document union_find_replacet
In particular, the documentation for make_union was outdated.
1 parent f7d2983 commit 75b8386

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/util/union_find_replace.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com
88

99
#include "union_find_replace.h"
1010

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`
1818
exprt union_find_replacet::make_union(const exprt &a, const exprt &b)
1919
{
2020
const exprt &lhs_root = find(a);
@@ -24,8 +24,8 @@ exprt union_find_replacet::make_union(const exprt &a, const exprt &b)
2424
return rhs_root;
2525
}
2626

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.
2929
/// \param expr: an expression, modified in place
3030
/// \return true if expr is left unchanged
3131
bool union_find_replacet::replace_expr(exprt &expr) const
@@ -37,15 +37,14 @@ bool union_find_replacet::replace_expr(exprt &expr) const
3737
}
3838

3939
/// \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
4241
exprt union_find_replacet::find(exprt expr) const
4342
{
4443
replace_expr(expr);
4544
return expr;
4645
}
4746

48-
/// \return pairs of expression composed of expressions and a canonical
47+
/// \return pairs of expression composed of expressions and a representative
4948
/// expression for the set they below to.
5049
std::vector<std::pair<exprt, exprt>> union_find_replacet::to_vector() const
5150
{

0 commit comments

Comments
 (0)