Internal::AssociativeOp#
-
struct AssociativeOp#
Represent the equivalent associative op of an update definition.
For example, the following associative Expr, min(f(x), g(r.x) + 2), where f(x) is the self-recurrence term, is represented as:
AssociativeOp assoc( AssociativePattern(min(x, y), +inf, true), {Replacement("x", f(x))}, {Replacement("y", g(r.x) + 2)}, true );
‘pattern’ contains the list of equivalent binary/unary operators (+ identities) for each Tuple element in the update definition. ‘pattern’ also contains a boolean that indicates if the op is also commutative. ‘xs’ and ‘ys’ contain the corresponding definition of each variable in the list of binary operators.
For unary operator, ‘xs’ is not set, i.e. it will be a pair of empty string and undefined Expr: {“”, Expr()}. ‘pattern’ will only contain the ‘y’ term in this case. For example, min(g(r.x), 4), will be represented as:
AssociativeOp assoc( AssociativePattern(y, 0, false), {Replacement("", Expr())}, {Replacement("y", min(g(r.x), 4))}, true );
Self-assignment, f(x) = f(x), will be represented as:
For both unary operator and self-assignment cases, the identity does not matter. It can be anything.AssociativeOp assoc( AssociativePattern(x, 0, true), {Replacement("x", f(x))}, {Replacement("", Expr())}, true );
Public Members
-
AssociativePattern pattern#
List of pairs of binary associative op and its identity.
-
AssociativePattern pattern#