5.334. same

Origin

N. Beldiceanu

Constraint

$\mathrm{𝚜𝚊𝚖𝚎}\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}\right)$

Arguments
 $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛}-\mathrm{𝚍𝚟𝚊𝚛}\right)$ $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛}-\mathrm{𝚍𝚟𝚊𝚛}\right)$
Restrictions
 $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|=|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$ $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1},\mathrm{𝚟𝚊𝚛}\right)$ $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2},\mathrm{𝚟𝚊𝚛}\right)$
Purpose

The variables of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ collection correspond to the variables of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ collection according to a permutation.

Example
$\left(〈1,9,1,5,2,1〉,〈9,1,1,1,2,5〉\right)$

The $\mathrm{𝚜𝚊𝚖𝚎}$ constraint holds since values 1, 2, 5 and 9 have the same number of occurrences within both collections $〈1,9,1,5,2,1〉$ and $〈9,1,1,1,2,5〉$. Figure 5.334.1 illustrates this correspondence.

All solutions

Figure 5.334.2 gives all solutions to the following non ground instance of the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint: ${U}_{1}\in \left[0,2\right]$, ${U}_{2}\in \left[1,2\right]$, ${U}_{3}\in \left[1,2\right]$, ${V}_{1}\in \left[0,1\right]$, ${V}_{2}\in \left[2,4\right]$, ${V}_{3}\in \left[2,3\right]$, $\mathrm{𝚜𝚊𝚖𝚎}$$\left(〈{U}_{1},{U}_{2},{U}_{3}〉,〈{V}_{1},{V}_{2},{V}_{3}〉\right)$.

Typical
 $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|>1$ $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}.\mathrm{𝚟𝚊𝚛}\right)>1$ $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}.\mathrm{𝚟𝚊𝚛}\right)>1$
Symmetries
• Arguments are permutable w.r.t. permutation $\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}\right)$.

• Items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ are permutable.

• Items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ are permutable.

• All occurrences of two distinct values in $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}.\mathrm{𝚟𝚊𝚛}$ or $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}.\mathrm{𝚟𝚊𝚛}$ can be swapped; all occurrences of a value in $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}.\mathrm{𝚟𝚊𝚛}$ or $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}.\mathrm{𝚟𝚊𝚛}$ can be renamed to any unused value.

Arg. properties

Aggregate: $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}\left(\mathrm{𝚞𝚗𝚒𝚘𝚗}\right)$, $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}\left(\mathrm{𝚞𝚗𝚒𝚘𝚗}\right)$.

Usage

The $\mathrm{𝚜𝚊𝚖𝚎}$ constraint can be used in the following contexts:

• Pairing problems taken from [BeldiceanuKatrielThiel04b]. The organisation Doctors Without Borders has a list of doctors and a list of nurses, each of whom volunteered to go on one mission in the next year. Each volunteer specifies a list of possible dates and each mission involves one doctor and one nurse. The task is to produce a list of pairs such that each pair includes a doctor and a nurse who are available at the same date and each volunteer appears in exactly one pair. The problem is modelled by a $\mathrm{𝚜𝚊𝚖𝚎}$$\left(D={d}_{1},{d}_{2},\cdots ,{d}_{m},N={n}_{1},{n}_{2},\cdots ,{n}_{m}\right)$ constraint where each doctor is represented by a domain variable in $D$ and each nurse by a domain variable in $N$. For a given doctor or nurse the corresponding domain variable gives the dates when the person is available. When the number of nurses is different from the number of doctors we replace the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint by a $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint.

• Timetabling problems where we wish to produce fair schedules for different persons is a second use of the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint. Assume we need to generate a plan over a period of $D$ consecutive days for $P$ persons. For each day $d$ and each person $p$ we need to decide whether person $p$ works in the morning shift, in the afternoon shift, in the night shift or does not work at all on day $d$. In a fair schedule, the number of morning shifts should be the same for all the persons. The same condition holds for the afternoon and the night shifts as well as for the days off. We create for each person $p$ the sequence of variables ${v}_{p,1},{v}_{p,2},\cdots ,{v}_{p,D}$. ${v}_{p,D}$ is equal to one of $0,1,2$ and 3, depending on whether person $p$ does not work, works in the morning, in the afternoon or during the night on day $d$. We can use $P-1$ $\mathrm{𝚜𝚊𝚖𝚎}$ constraints to express the fact that ${v}_{1,1},{v}_{1,2},\cdots ,{v}_{1,D}$ should be a permutation of ${v}_{p,1},{v}_{p,2},\cdots ,{v}_{p,D}$ for each $\left(1.

• The $\mathrm{𝚜𝚊𝚖𝚎}$ constraint can also be used as a channelling constraint for modelling the following recurring pattern: given the number of 1s in each line and each column of a 0-1 matrix $ℳ$ with $n$ rows and $m$ columns, reconstruct the matrix. This pattern usually occurs with additional constraints about compatible positions of the 1s, or about the overall shape reconstructed from all the 1's (e.g., convexity, connectivity). If we restrict ourselves to the basic pattern there is an $O\left(mn\right)$ algorithm for reconstructing a $m·n$ matrix from its horizontal and vertical directions [Gale57]. We show how to model this pattern with the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint. Let ${l}_{i}$ $\left(1\le i\le n\right)$ and ${c}_{j}$ $\left(1\le j\le m\right)$ denote respectively, the required number of 1s in the ${i}^{th}$ row and the ${j}^{th}$ column of $ℳ$. We number the entries of the matrix as shown in the left-hand side of 5.334.3. For row $i$ we create ${l}_{i}$ domain variables ${v}_{ik}$ where $k\in \left[1,{l}_{i}\right]$. Similarly, for each column $j$ we create ${c}_{j}$ domain variables ${u}_{jk}$ where $k\in \left[1,{c}_{i}\right]$. The domain of each variable contains the set of entries that belong to the row or column that the variable corresponds to. Thus, each domain variable represents a 1 that appears in the designated row or column. Let $𝒱$ be the set of variables corresponding to rows and $𝒰$ be the set of variables corresponding to columns. To make sure that each 1 is placed in a different entry, we impose the constraint $\mathrm{𝚊𝚕𝚕𝚍𝚒𝚏𝚏𝚎𝚛𝚎𝚗𝚝}$$\left(𝒰\right)$. In addition, the constraint $\mathrm{𝚜𝚊𝚖𝚎}$$\left(𝒰,𝒱\right)$ enforces that the 1s exactly coincide on the rows and the columns. A solution is shown on the right-hand side of 5.334.3. Note that the $\mathrm{𝚜𝚊𝚖𝚎}_\mathrm{𝚊𝚗𝚍}_\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraint allows to model the matrix reconstruction problem without the additional $\mathrm{𝚊𝚕𝚕𝚍𝚒𝚏𝚏𝚎𝚛𝚎𝚗𝚝}$ constraint.

Remark

The $\mathrm{𝚜𝚊𝚖𝚎}$ constraint is a relaxed version of the $\mathrm{𝚜𝚘𝚛𝚝}$ constraint introduced in [OlderSwinkelsEmden95]. We do not enforce the second collection of variables to be sorted in increasing order.

If we interpret the collections $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ and $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ as two multisets variables [KiziltanWalsh02], the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint can be considered as an equality constraint between two multisets variables.

The $\mathrm{𝚜𝚊𝚖𝚎}$ constraint can be modelled by two $\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraints. For instance, the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint

$\mathrm{𝚜𝚊𝚖𝚎}\left(\begin{array}{c}〈\begin{array}{c}\mathrm{𝚟𝚊𝚛}-{x}_{1},\mathrm{𝚟𝚊𝚛}-{x}_{2}\hfill \end{array}〉,\hfill \\ 〈\begin{array}{c}\mathrm{𝚟𝚊𝚛}-{y}_{1},\mathrm{𝚟𝚊𝚛}-{y}_{2}\hfill \end{array}〉,\hfill \end{array}\right)$

where the union of the domains of the different variables is $\left\{1,2,3,4\right\}$ corresponds to the conjunction of the following two $\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraints:

$\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}\left(\begin{array}{c}〈\begin{array}{c}\mathrm{𝚟𝚊𝚛}-{x}_{1},\mathrm{𝚟𝚊𝚛}-{x}_{2}\hfill \end{array}〉,\hfill \\ 〈\begin{array}{cc}\mathrm{𝚟𝚊𝚕}-1\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{1},\hfill \\ \mathrm{𝚟𝚊𝚕}-2\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{2},\hfill \\ \mathrm{𝚟𝚊𝚕}-3\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{3},\hfill \\ \mathrm{𝚟𝚊𝚕}-4\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{4}\hfill \end{array}〉\hfill \end{array}\right)$
$\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}\left(\begin{array}{c}〈\begin{array}{c}\mathrm{𝚟𝚊𝚛}-{y}_{1},\mathrm{𝚟𝚊𝚛}-{y}_{2}\hfill \end{array}〉,\hfill \\ 〈\begin{array}{cc}\mathrm{𝚟𝚊𝚕}-1\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{1},\hfill \\ \mathrm{𝚟𝚊𝚕}-2\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{2},\hfill \\ \mathrm{𝚟𝚊𝚕}-3\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{3},\hfill \\ \mathrm{𝚟𝚊𝚕}-4\hfill & \mathrm{𝚗𝚘𝚌𝚌𝚞𝚛𝚛𝚎𝚗𝚌𝚎}-{c}_{4}\hfill \end{array}〉\hfill \end{array}\right)$

As shown by the next example, the consistency for all variables of the two $\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraints does not implies consistency for the corresponding $\mathrm{𝚜𝚊𝚖𝚎}$ constraint. This is for instance the case when the domains of ${x}_{1}$, ${x}_{2}$, ${y}_{1}$ and ${y}_{2}$ is respectively equal to $\left\{1,2\right\}$, $\left\{3,4\right\}$, $\left\{1,2,3,4\right\}$ and $\left\{3,4\right\}$. The conjunction of the two $\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraints does not remove values 3 and 4 from ${y}_{1}$.

In his PhD thesis, W.-J. van Hoeve introduces a soft version of the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint where the cost is the minimum number of variables to assign differently in order to get back to a solution [vanHoeve05]. In the context of the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint this violation cost corresponds to the difference between the number of variables in $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ and the number of values that both occur in $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ and in $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ (provided that one value of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ matches at most one value of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$).

Algorithm

In [BeldiceanuKatrielThiel04a], [BeldiceanuKatrielThiel04b], [BeldiceanuKatrielThiel05], [Katriel05], it is shown how to model this constraint by a flow network that enables to compute arc-consistency and bound-consistency. The rightmost part of Figure 3.7.30 illustrates this flow model. Unlike the networks used for $\mathrm{𝚊𝚕𝚕𝚍𝚒𝚏𝚏𝚎𝚛𝚎𝚗𝚝}$ and $\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$, the network now has three sets of nodes, so the algorithms are more complex, in particular the efficient bound-consistency algorithm.

More recently [Cymer12], [CymerPhD13] presents a second filtering algorithm also achieving arc-consistency based on a mapping of the solutions to the $\mathrm{𝚜𝚊𝚖𝚎}$ constraint to perfect matchings in a bipartite intersection graph derived from the domain of the variables of the constraint in the following way. To each variable of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ and $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ collection corresponds a vertex of the intersection graph. There is an edge between a vertex associated with a variable of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ collection and a vertex associated with a variable of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ collection if and only if the corresponding variables have at least one value in common in their domains.

Reformulation

The $\mathrm{𝚜𝚊𝚖𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}\right)$ constraint can be reformulated as the conjunction $\mathrm{𝚜𝚘𝚛𝚝}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1},\mathrm{𝚂𝙾𝚁𝚃𝙴𝙳}_\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\right)\wedge$ $\mathrm{𝚜𝚘𝚛𝚝}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2},\mathrm{𝚂𝙾𝚁𝚃𝙴𝙳}_\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\right)$.

Used in

generalisation: $\mathrm{𝚌𝚘𝚛𝚛𝚎𝚜𝚙𝚘𝚗𝚍𝚎𝚗𝚌𝚎}$ ($\mathrm{𝙿𝙴𝚁𝙼𝚄𝚃𝙰𝚃𝙸𝙾𝙽}$ parameter added), $\mathrm{𝚜𝚊𝚖𝚎}_\mathrm{𝚒𝚗𝚝𝚎𝚛𝚟𝚊𝚕}$ ($\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$ replaced by $\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}/\mathrm{𝚌𝚘𝚗𝚜𝚝𝚊𝚗𝚝}$), $\mathrm{𝚜𝚊𝚖𝚎}_\mathrm{𝚖𝚘𝚍𝚞𝚕𝚘}$ ($\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$ replaced by $\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}\mathrm{mod}\mathrm{𝚌𝚘𝚗𝚜𝚝𝚊𝚗𝚝}$), $\mathrm{𝚜𝚊𝚖𝚎}_\mathrm{𝚙𝚊𝚛𝚝𝚒𝚝𝚒𝚘𝚗}$ ($\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$ replaced by $\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}\in \mathrm{𝚙𝚊𝚛𝚝𝚒𝚝𝚒𝚘𝚗}$).

related to a common problem: $\mathrm{𝚌𝚘𝚕𝚘𝚛𝚎𝚍}_\mathrm{𝚖𝚊𝚝𝚛𝚒𝚡}$ (matrix reconstruction problem).

Keywords
Arc input(s)

$\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$

Arc generator
$\mathrm{𝑃𝑅𝑂𝐷𝑈𝐶𝑇}$$↦\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{1},\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{2}\right)$

Arc arity
Arc constraint(s)
$\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{1}.\mathrm{𝚟𝚊𝚛}=\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{2}.\mathrm{𝚟𝚊𝚛}$
Graph property(ies)
 $•\text{for}\text{all}\text{connected}\text{components:}$$\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}$$=$$\mathrm{𝐍𝐒𝐈𝐍𝐊}$ $•$$\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}$$=|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|$ $•$$\mathrm{𝐍𝐒𝐈𝐍𝐊}$$=|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$

Graph model

Parts (A) and (B) of Figure 5.334.4 respectively show the initial and final graph associated with the Example slot. Since we use the $\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}$ and $\mathrm{𝐍𝐒𝐈𝐍𝐊}$ graph properties, the source and sink vertices of the final graph are stressed with a double circle. Since there is a constraint on each connected component of the final graph we also show the different connected components. Each of them corresponds to an equivalence class according to the arc constraint. The $\mathrm{𝚜𝚊𝚖𝚎}$ constraint holds since:

• Each connected component of the final graph has the same number of sources and of sinks.

• The number of sources of the final graph is equal to $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|$.

• The number of sinks of the final graph is equal to $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$.

Signature

Since the initial graph contains only sources and sinks, and since isolated vertices are eliminated from the final graph, we make the following observations:

• Sources of the initial graph cannot become sinks of the final graph,

• Sinks of the initial graph cannot become sources of the final graph.

From the previous observations and since we use the $\mathrm{𝑃𝑅𝑂𝐷𝑈𝐶𝑇}$ arc generator on the collections $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ and $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$, we have that the maximum number of sources and sinks of the final graph is respectively equal to $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|$ and $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$. Therefore we can rewrite $\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}=|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|$ to $\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}\ge |\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|$ and simplify $\underline{\overline{\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}}}$ to $\overline{\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}}$. In a similar way, we can rewrite $\mathrm{𝐍𝐒𝐈𝐍𝐊}=|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$ to $\mathrm{𝐍𝐒𝐈𝐍𝐊}\ge |\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$ and simplify $\underline{\overline{\mathrm{𝐍𝐒𝐈𝐍𝐊}}}$ to $\overline{\mathrm{𝐍𝐒𝐈𝐍𝐊}}$.

Automaton

To each item of the collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ corresponds a signature variable ${S}_{i}$ that is equal to 0. To each item of the collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ corresponds a signature variable ${S}_{i+|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|}$ that is equal to 1.