### 3.7.5. Aggregate

Denotes that, given two instances of a constraint, we can combine (i.e., aggregate) these two instances in order to obtain a third constraint, which has the same name as the first two constraints. The first two constraints are called the source constraints, while the implied constraint is called the target constraint. The ${i}^{\mathrm{𝑡ℎ}}$ argument of the target constraint is obtained by combining the ${i}^{\mathrm{𝑡ℎ}}$ arguments of the two source constraints. This is specified for each argument by one of the following options.

• $\mathrm{𝚒𝚍}$: check that the corresponding arguments of the two source constraints are identical and take it as the argument of the target constraint; this option if often used for specifying that an argument corresponding to a parameter has to be the same in the two source constraints, as well as in the target constraint (i.e., the source and the target constraints share the same parameter).

• $+$: add the corresponding arguments of the two source constraints.

• $*$: multiply the corresponding arguments of the two source constraints.

• $\wedge$: make an and between the corresponding 0-1 arguments of the two source constraints.

• $\vee$: make an or between the corresponding 0-1 arguments of the two source constraints.

• $min$: take the minimum of the corresponding arguments of the two source constraints.

• $max$: take the maximum of the corresponding arguments of the two source constraints.

• $\mathrm{𝚞𝚗𝚒𝚘𝚗}$: take the union, without removing duplicates, of the collections items of the corresponding arguments of the two source constraints.

• $\mathrm{𝚜𝚞𝚗𝚒𝚘𝚗}$: take the union, and remove duplicates, of the collections items of the corresponding arguments of the two source constraints, where collections correspond to collection of ground values (i.e., parameters).

Finally, the aggregation may me be conditioned by a list of restrictions, each restriction corresponding to one of the restrictions described in Section 2.2.3. We call this conditional aggregation.

Most constraints for which aggregation applies correspond to constraints where one of the arguments is functionally determined by the other arguments. This is for instance the case for the $\mathrm{𝚖𝚊𝚡𝚒𝚖𝚞𝚖}$$\left(\mathrm{𝙼𝙰𝚇},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\right)$ constraint which forces $\mathrm{𝙼𝙰𝚇}$ to be equal to the maximum value assigned to the variables of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$. However some constraints, like the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint, for which aggregation applies, do not have any argument that is functionally determined by the other arguments.

We now present three examples of deductions that can be obtained by aggregating two source constraints.

• $\mathrm{𝚊𝚖𝚘𝚗𝚐}$$\left(1,〈4,5,5,4,1〉,〈0,1〉\right)\wedge$ $\mathrm{𝚊𝚖𝚘𝚗𝚐}$$\left(3,〈1,1,9,0〉,〈0,1〉\right)⇒$ $\mathrm{𝚊𝚖𝚘𝚗𝚐}$$\left(4,〈4,5,5,4,1,1,1,9,0〉,〈0,1〉\right)$, where:

1. The first argument of the target constraint, i.e., 4, is equal to the sum of the first arguments of the two source constraints, i.e., $1+3$.

2. The second argument of the target constraint, $〈4,5,5,4,1,1,1,9,0〉$, is equal to the union (without removing duplicates) of the second arguments $〈4,5,5,4,1〉$ and $〈1,1,9,0〉$ of the two source constraints.

3. The third arguments of the two source constraints are identical, i.e., $〈0,1〉$, and the third argument of the target constraint.

• $\mathrm{𝚖𝚊𝚡𝚒𝚖𝚞𝚖}$$\left(5,〈3,0,5,2,5〉\right)\wedge$ $\mathrm{𝚖𝚊𝚡𝚒𝚖𝚞𝚖}$$\left(9,〈1,1,9,0〉\right)⇒$ $\mathrm{𝚖𝚊𝚡𝚒𝚖𝚞𝚖}$$\left(9,〈3,0,5,2,5,1,1,9,0〉\right)$, where:

1. The first argument of the target constraint, i.e., 9, is equal to the maximum value of the first arguments of the two source constraints, i.e., $max\left(5,9\right)$.

2. The second argument of the target constraint, $〈3,0,5,2,5,1,1,9,0〉$, is equal to the union (without removing duplicates) of the second arguments $〈3,0,5,2,5〉$ and $〈1,1,9,0〉$ of the two source constraints.

• $\mathrm{𝚜𝚊𝚖𝚎}$$\left(〈3,3,1〉,〈3,1,3〉\right)\wedge$ $\mathrm{𝚜𝚊𝚖𝚎}$$\left(〈1,9,1,5,5〉,〈5,5,1,1,9〉\right)⇒$ $\mathrm{𝚜𝚊𝚖𝚎}$$\left(〈3,3,1,1,9,1,5,5〉,〈3,1,3,5,5,1,1,9〉\right)$, where:

1. The first argument of the target constraint, $〈3,3,1,1,9,1,5,5〉$, is equal to the union (without removing duplicates) of the first arguments $〈3,3,1〉$ and $〈1,9,1,5,5〉$ of the two source constraints.

2. The second argument of the target constraint, $〈3,1,3,5,5,1,1,9〉$, is equal to the union (without removing duplicates) of the second arguments $〈3,1,3〉$ and $〈5,5,1,1,9〉$ of the two source constraints.