If a polyhedron implies an equality, then it has only surface points and neither an interior nor a center. There is no way such a polyhedron contains a unit cube and a largest cube has edge length zero and is just a point in the original polyhedron. Equalities are, therefore, a challenge for the applicability of our cube tests.
There even exist systems of inequalities that imply infinitely many equalities. For instance, the system consisting of the inequalities \(-2x_1 +x_2 \le -2\), \(x_1 + 3x_2 \le 8\), and \(x_1 -2x_2 \le -2\) has only one rational solution: the point \((x_1,x_2) = (2,2)\). Therefore, it implies the equalities \(-2x_1 +x_2 = -2\) and \(x_1 + 3x_2 = 8\), and all linear combinations of those two equalities, i.e., \(\lambda _1 \cdot (-2x_1 +x_2) + \lambda _2 \cdot (x_1 + 3x_2) = \lambda _1 \cdot (-2) + \lambda _2 \cdot 8\) for all \(\lambda _1, \lambda _2 \in \mathbb {Q}\). The above example also points us to another fact about equalities: there exists a finite representation of all equalities implied by a system of inequalities—even if the system implies infinitely many equalities.
One such finite representation is the equality basis for a satisfiable system of inequalities \(A x \le b\). An equality basis is a system of equalities \(D' x = c'\) such that all (explicit and implicit equalities) implied by \(A x \le b\) are linear combinations of equalities from \(D' x = c'\). We prefer to represent each equality basis \(D' x = c'\) as an equivalent system of equalities \(y - D z = c\) such that \(y = (y_1, \ldots , y_{n_y})^T\) and \(z = (z_1, \ldots , z_{n_z})^T\) are a partition of the variables in x, \(D \in \mathbb {Q}^{n_y \times n_z}\), and \(c \in \mathbb {Q}^{n_y}\). The existence of such an equivalent system of equalities is guaranteed by Gaussian elimination. Moreover, each variable \(y_i\) appears exactly once in the system \(y - D z = c\), that is to say, \(y_i\) appears only in the row \(y_i - d_i^T z_i = c_i\). We choose to represent our equality bases in this manner because this form also correlates to a distinct substitution \(\sigma ^{D,c}_{y,z}\) that replaces variable \(y_i\) with \(c_i + {d}_i^T z\):
$$\begin{aligned} \sigma ^{D,c}_{y,z} := \{ y_i \mapsto c_i + {d}_i^T z : i \in \{1, \ldots , n_y\} \} . \end{aligned}$$
The substitution \(\sigma ^{D,c}_{y,z}\) is important because it allows us to eliminate all equalities from \(A x \le b\). We simply apply the substitution \(\sigma ^{D,c}_{y,z}\) to \(A x \le b\) and receive a new system \(A' z \le b'\) that neither contains the variables y nor implies any equalities.Footnote 1 And the substitution \(\sigma ^{D,c}_{y,z}\) for the equality basis \(y - D z = c\) has even further applications. For instance, we can directly check whether an equality \(h^T x = g\) is a linear combination of \(y - D z = c\) and, therefore, implied by both \(A x \le b\) and \(y - D z = c\). We simply apply \(\sigma ^{D,c}_{y,z}\) to \(h^T x = g\) and see if it simplifies to \(0 = 0\). We even use \(\sigma ^{D,c}_{y,z}\) for the Nelson–Oppen style combination of theories (see Sect. 7).
Finding equalities
The first step in computing an equality basis for a polyhedron \(A x \le b\) is to detect whether the system contains any equalities. We have already stated a criterion that detects this:
Lemma 5
([8]) Let \(A x \le b\) be a polyhedron. Then exactly one of the following statements is true: (1) \(A x \le b\) implies an equality \(h^T x = g\) with \(h \ne 0^n\), or (2) \(A x \le b\) contains a cube with edge length \(e > 0\).
A cube with positive edge length is enough to prove that there exists no implied equality. The actual edge length e of this cube is not relevant. Therefore, we can assume that the edge length e is arbitrarily small. We can even assume that our edge length is so small that we can ignore the different multiples \(\left\| a_i \right\| _{ 1 }\) and any infinitesimals introduced by strict inequalities. We just have to turn all of our inequalities into strict inequalities.
Lemma 6
Let \(A x \le b\) be a polyhedron, where \(a_i \ne 0^n\), \(b_i = (p_i,q_i)\), \(q_i \le 0\), and \(b^{\delta }_i = (p_i,-1)\) be the strict versions of the bounds \(b_i\) for all \(i \in \{1, \ldots , m\}\). Then the following statements are equivalent: (1) \(A x \le b\) contains a cube with edge length \(e > 0\), and (2) \(A x \le b^{\delta }\) is satisfiable.
Proof
(1) \(\Rightarrow \) (2): If \(A x \le b\) contains a cube of edge length \(e > 0\), then \(A x \le b - a'\) is satisfiable, where \(a'_i = \frac{e}{2}\left\| a_i \right\| _{ 1 }\). By Lemma 1, we know there exists a \(\delta \in \mathbb {Q}\) such that \(A x \le p + q \delta - a'\). Now, let \(\delta ' = \min \{ a'_i - q_i \delta : i = 1, \ldots , m\}\). Since \(a'_i - q_i \delta \ge \delta '\), it holds that \(A x \le p - \delta ' 1^m\). Since \(q_i \le 0\) and \(a'_i = \left\| a_i \right\| _{ 1 } > 0\), it also holds that \(\delta ' > 0\). By Lemma 1, we deduce that \(A x < p\) and, therefore, \(A x \le b^{\delta }\) holds.
(2) \(\Rightarrow \) (1): If \(A x \le b^{\delta }\) is satisfiable, then we know by Lemma 1 that there must exist a \(\delta > 0\) such that \(A x \le p - \delta 1^m\) holds. Let \(a_{\max } = \max \{\left\| a_i \right\| _{ 1 } : i = 1, \ldots , m\}\), \(\delta ' = \frac{\delta }{2}\), and \(e = \frac{\delta }{a_{\max }}\). Then \(p_i - \delta = p_i - \delta ' - \frac{e}{2}a_{\max } \le b_i - \frac{e}{2}\left\| a_i \right\| _{ 1 }\). Thus, \(A x \le b\) contains a cube with edge length \(e > 0\). \(\square \)
In case \(A x \le b^{\delta }\) is unsatisfiable, \(A x \le b\) contains no cube with positive edge length and, therefore by Lemma 5, an equality. In case \(A x \le b^{\delta }\) is unsatisfiable, the algorithm returns an explanation, i.e., a minimal set C of unsatisfiable constraints \(a_i^T x \le b^{\delta }_i\) from \(A x \le b^{\delta }\). If \(A x \le b\) itself is satisfiable, we can extract equalities from this explanation: for every \(a_i^T x \le b^{\delta }_i \in C\), \(A x \le b\) implies the equality \(a_i^T x = b_i\).
Lemma 7
Let \(A x \le b\) be a satisfiable polyhedron, where \(a_i \ne 0^n\), \(b_i = (p_i,q_i)\), \(q_i \le 0\), and \(b^{\delta }_i = (p_i,-1)\) for all \(i \in \{1, \ldots , m\}\). Let \(A x \le b^{\delta }\) be unsatisfiable. Let C be a minimal set of unsatisfiable constraints \(a_i^T x \le b^{\delta }_i\) from \(A x \le b^{\delta }\). Then it holds for every \(a_i^T x \le b^{\delta }_i \in C\) that \(a_i^T x = b_i\) is an equality implied by \(A x \le b\).
Proof
Because of transitivity of the subset and implies relationships, we can assume that \(A x \le b\) and \(A x \le b^{\delta }\) contain only the inequalities associated with the explanation C. Therefore, \(C = \{a_1^T x \le b^{\delta }_1, \ldots , a_{m}^T x \le b^{\delta }_{m}\}\). By Lemma 2 and \(A x \le b^{\delta }\) being unsatisfiable, we know that there exists a \(y \in \mathbb {Q}^m\) with \(y \ge 0\), \(y^T A = 0^n\), and \(y^T b^{\delta } < 0\). By Lemma 2 and \(A x \le b\) being satisfiable, we know that \(y^T b \ge 0\) is also true. By Lemma 3, we know that \(y_k > 0\) for every \(k \in \{1, \ldots , m\}\).
Now, we use \(y^T b^{\delta } < 0\), \(y^T b \ge 0\), and the definitions of < and \(\le \) for \(\mathbb {Q}_{\delta }\) to prove that \(y^T b = 0\) and \(b = p\). Since \(y^T b^{\delta } < 0\), we get that \(y^T p \le 0\). Since \(y^T b \ge 0\), we get that \(y^T p \ge 0\). If we combine \(y^T p \le 0\) and \(y^T p \ge 0\), we get that \(y^T p = 0\). From \(y^T p = 0\) and \(y^T b \ge 0\), we get \(y^T q \ge 0\). Since \(y > 0\) and \(q_i \le 0\), we get that \(y^T q = 0\) and \(q_i = 0\). Since \(q_i = 0\), \(b = p\).
Next, we multiply \(y^T A = 0^n\) with an \(x \in P{^{A}_{ b}}\) to get \(y^T A x = 0\). Since \(y_k > 0\) for every \(k \in \{1, \ldots , m\}\), we can solve \(y^T A x = 0\) for every \(a_k^T x\) and get:
$$\begin{aligned} a_k^T x = -\sum _{i = 1, i \ne k}^{m} \left( \frac{y_i}{y_k} a_i^T x \right) . \end{aligned}$$
Likewise, we solve \(y^T b = 0\) for every \(b_k\) to get: \(b_k = -\sum _{i = 1, i \ne k}^{m} \left( \frac{y_i}{y_k} b_i \right) \) .
Since \(x \in P{^{A}_{ b}}\) satisfies all \(a_i^T x \le b_i\), we can deduce \(b_k\) as the lower bound of \(a_k^T x\):
$$\begin{aligned} a_k^T x = -\sum _{i = 1, i \ne k}^{m} \left( \frac{y_i}{y_k} a_i^T x \right) \ge -\sum _{i = 1, i \ne k}^{m} \left( \frac{y_i}{y_k} b_i \right) = b_k\,, \end{aligned}$$
which proves that \(A x \le b\) implies \(a_k^T x = b_k\). \(\square \)
Lemma 7 justifies simplifications on \(A x \le b^{\delta }\). We can eliminate all inequalities in \(A x \le b^{\delta }\) that cannot appear in the explanation of unsatisfiability, i.e., all inequalities \(a_i^T x \le b^{\delta }_i\) that cannot form an equality \(a_i^T x = b_i\) that is implied by \(A x \le b\). For example, if we have an assignment \(v \in \mathbb {Q}_{\delta }^n\) such that \(A v \le b\) is true, then we can eliminate every inequality \(a_i^T x \le b^{\delta }_i\) for which \(a_i^T v = b_i\) is false. According to this argument, we can also eliminate all inequalities \(a_i^T x \le b^{\delta }_i\) that were already strict inequalities in \(A x \le b\).
Computing an equality basis
We now present the algorithm \({{\mathrm{{\texttt {EqBasis}}}}}(A' x \le b')\) (Fig. 3) that computes an equality basis for a polyhedron \(A' x \le b'\). In a nutshell, \({{\mathrm{{\texttt {EqBasis}}}}}\) iteratively detects and removes equalities from our system of inequalities and collects them in a system of equalities until it has a complete equality basis. To this end, \({{\mathrm{{\texttt {EqBasis}}}}}\) computes in each iteration one system of inequalities \(A z \le b\) and one system of equalities \(y - D z = c\) such that \(A' x \le b'\) is equivalent to \((y - D z = c) \cup (A z \le b)\). While the variables z are completely defined by the inequalities \(A z \le b\), the equalities \(y - D z = c\) extend any assignment from the variables z to the variables y. Initially, z is just x, \(y - D z = c\) is empty, and \(A z \le b\) is just \(A' x \le b'\).
In every iteration l of the while loop, \({{\mathrm{{\texttt {EqBasis}}}}}\) eliminates one equality \(a_i^T z = b_i\) from \(A z \le b\) and adds it to \(y - D z = c\). \({{\mathrm{{\texttt {EqBasis}}}}}\) finds this equality based on the techniques we presented in the Lemmas 6 and 7 (line 3). If the current system of inequalities \(A z \le b\) implies no equality, then \({{\mathrm{{\texttt {EqBasis}}}}}\) is done and returns the current system of equalities \(y - D z = c\). Otherwise, \({{\mathrm{{\texttt {EqBasis}}}}}\) turns the found equality \(a_i^T z = b_i\) into a substitution \(\sigma ' := \{ z_k \mapsto \frac{b_{i}}{a_{ik}} - \sum _{j = 1, j \ne k}^n \frac{a_{ij}}{a_{ik}} z_j \}\) (line 7) and applies it to \(A z \le b\) (line 9). This has the following effects: (1) the new system of inequalities \(A' z' \le b'\) implies no longer the equality \(a_i^T z = b_i\); and (2) it no longer contains the variable \(z_k\). Next, we apply \(\sigma '\) to our system of equalities (line 10) and concatenate the equality \(z_k + \sum _{j = 1, j \ne k}^n \frac{a_{ij}}{a_{ik}} z_j = \frac{b_{i}}{a_{ik}}\) to the end of \((y - D z = c) \sigma '\). This has the following effects: (1) the new system of equalities \(y' - D' z' = c'\) implies \(a_i^T z = b_i\); and (2) the variable \(z_k\) appears exactly once in \(y' - D' z' = c'\). This means that we can now re-partition our variables so that \(z := (z_1, \ldots , z_{k-1}, z_{k+1}, \ldots , z_n)^T\) and \(y_l := z_k\) to get two new systems \(A z \le b\) and \(y - D z = c\) that are equivalent to our original polyhedron (line 11). Finally, we remove all rows \(0 \le 0\) from \(A z \le b\) because those rows are trivially satisfied but would obstruct the detection of equalities with Lemma 6.
To prove the correctness of the algorithm, we first need to prove that moving the equality from our system of inequalities to our system of equalities preserves equivalence, i.e, the systems \((A z \le b) \cup (y - D z = c)\) and \((A' z' \le b') \cup (y' - D' z' = c')\) are equivalent in line 10.
Lemma 8
Let \(A z \le b\) be a system of inequalities. Let \(y - D z = c\) be a system of equalities. Let \(h^T z = g\) be an equality implied by \(A z \le b\) with \(h_k \ne 0\). Let \(\sigma ' := \{ z_k \mapsto \frac{g}{h_{k}} - \sum _{j = 1, j \ne k}^n \frac{h_{j}}{h_{k}} z_j \}\) be a substitution based on this equality. Let \(y' := (y_1, \ldots , y_l, z_k)^T\) and \(z' := (z_1, \ldots , z_{k-1}, z_{k+1}, \ldots , z_n)^T\). Let \((A' z' \le b') := (A z \le b) \sigma '\). Let \((y' - D' z' = c') := (y - D z = c) \sigma ' \cup \{ z_k + \sum _{j = 1, j \ne k}^n \frac{h_{j}}{h_{k}} z_j = \frac{g}{h_{k}}\}\). Let \(u \in \mathbb {Q}_{\delta }^{n_y}\), \(v \in \mathbb {Q}_{\delta }^{n_z}\), \(u' = (u_1, \ldots , u_{n_y}, v_k)^T\), and \(v' = (v_1, \ldots , v_{k-1}, v_{k+1}, \ldots , v_{n_z})^T\). Then \((A v \le b) \cup (u - D v = c)\) is true if and only if \((A' v' \le b') \cup (u' - D' v' = c')\) is true.
Proof
First, we create a new substitution \(\sigma _v := \{ z_k \mapsto \frac{g}{h_{k}} - \sum _{j = 1, j \ne k}^n \frac{h_{j}}{h_{k}} v_j \}\) that is equivalent to \(\sigma '\) except that it directly assigns the variables \(z_i\) to their values \(v_i\). Let us now assume that either \((A v \le b) \cup (u - D v = c)\) or \((A' v' \le b') \cup (u' - D' v' = c')\) is true. This means that \(h^T v = g\) is also true, either by definition of \((A v \le b)\) or \((u' - D' v' = c')\). But \(h^T v = g\) is true also implies that \(v_k = \frac{g}{h_{k}} - \sum _{j = 1, j \ne k}^n \frac{h_{j}}{h_{k}} v_j\) is true. Therefore, \(\sigma _v\) simplifies to the assignment \(z_k \mapsto v_k\). So \((A v \le b) \cup (u - D v = c)\) and \((A' v' \le b') \cup (u' - D' v' = c')\) simplify to the same expressions and if one combined system is true, so is the other. \(\square \)
The algorithm \({{\mathrm{{\texttt {EqBasis}}}}}(A' x \le b')\) decomposes the original system of inequalities \(A' x \le b'\) into a reduced system \(A z \le b\) that implies no equalities, and an equality basis \(y - D z = c\). The algorithm is guaranteed to terminate because the variable vector z decreases by one variable in each iteration. Note that \({{\mathrm{{\texttt {EqBasis}}}}}(A' x \le b')\) constructs \(y - D z = c\) in such a way that the substitution \(\sigma ^{D,c}_{y,z}\) is the concatenation of all substitutions \(\sigma '\) from every previous iteration. Therefore, we also know that \(\sigma ^{D,c}_{y,z}\) applied to \(A' x \le b'\) results in the system of inequalities \(A z \le b\) that implies no equalities. We exploit this fact to prove the correctness of \({{\mathrm{{\texttt {EqBasis}}}}}(A' x \le b')\), but first we need two more auxiliary lemmas.
Lemma 9
Let \(y - D z = c\) be a satisfiable system of equalities. Let \(A x \le b\) and \(A^* x \le b^*\) be two systems of inequalities, both implying the equalities in \(y - D z = c\). Let \(A' z \le b' := (A x \le b) \sigma ^{D,c}_{y,z}\) and \(A^{**} z \le b^{**} := (A^* x \le b^*) \sigma ^{D,c}_{y,z}\). Then \(A' z \le b'\) is equivalent to \(A^{**} z \le b^{**}\) if \(A x \le b\) is equivalent to \(A^* x \le b^*\).
Proof
Let \(A x \le b\) be equivalent to \(A^* x \le b^*\). Suppose to the contrary that \(A' z \le b'\) is not equivalent to \(A^{**} z \le b^{**}\). This means that there exists a \(v \in \mathbb {Q}_{\delta }^{n_z}\) such that either \(A' v \le b'\) is true and \(A^{**} v \le b^{**}\) is false, or \(A' v \le b'\) is false and \(A^{**} v \le b^{**}\) is true. Without loss of generality we select the first case that \(A' v \le b'\) is true and \(A^{**} v \le b^{**}\) is false. We now extend this solution by \(u \in \mathbb {Q}_{\delta }^{n_y}\), where \(u_i := c_i + d_i^T v\), so \((A' v \le b') \cup (u - D v = c)\) is true. Based on the definition of \(\sigma ^{D,c}_{y,z}\) and \(n_y\) recursive applications of Lemma 8, the four systems of constraints \(A x \le b\), \(A^* x \le b^*\), \((A' z \le b') \cup (y - D z = c)\), and \((A^{**} z \le b^{**}) \cup (y - D z = c)\) are equivalent. Therefore, \((A^{**} v \le b^{**}) \cup (u - D v = c)\) is true, which means that \(A^{**} v \le b^{**}\) is also true. The latter contradicts our initial assumptions. \(\square \)
Now we can also prove what we have already explained at the beginning of this section. The equality \(h^T x = g\) is implied by \(A x \le b\) if and only if \(y - D z = c\) is an equality basis and \((h^T x = g) \sigma ^{D,c}_{y,z}\) simplifies to \(0 = 0\). An equality basis is already defined as a set of equalities \(y - D z = c\) that implies exactly those equalities implied by \(A x \le b\). So we only need to prove that \(h^T x = g\) is implied by \(y - D z = c\) if \((h^T x = g) \sigma ^{D,c}_{y,z}\) simplifies to \(0 = 0\).
Lemma 10
Let \(y - D z = c\) be a satisfiable system of equalities. Let \(h^T x = g\) be an equality. Then \(y - D z = c\) implies \(h^T x = g\) iff \((h^T x = g) \sigma ^{D,c}_{y,z}\) simplifies to \(0 = 0\).
Proof
First, let us look at the case where \(h^T x = g\) is an explicit equality \(y_i - d_i^T z = c_i\) in \(y - D z = c\). Then \((y_i - d_i^T z = c_i) \sigma ^{D,c}_{y,z}\) simplifies to \(0 = 0\) because \(\sigma ^{D,c}_{y,z}\) maps \(y_i\) to \(d_i^T z + c_i\) and the variables \(z_j\) are not affected by \(\sigma ^{D,c}_{y,z}\).
Next, let us look at the case where \(h^T x = g\) is an implicit equality in \(y - D z = c\). Since both \(y - D z = c\) and \((y - D z = c) \cup (h^T z = g)\) imply \(h^T z = g\) and the equalities in \(y - D z = c\), both \((y - D z = c) \sigma ^{D,c}_{y,z}\) and \(((y - D z = c) \cup (h^T z = g)) \sigma ^{D,c}_{y,z}\) must be equivalent (see Lemma 9). As we stated at the beginning of this proof, \((y_i - d_i^T z = c_i) \sigma ^{D,c}_{y,z}\) simplifies to \(0 = 0\). An equality \(h'^T c = g'\) that simplifies to \(0 = 0\) is true for all \(v \in \mathbb {Q}_{\delta }^{n_z}\). Moreover, only equalities that simplify to \(0 = 0\) are true for all \(v \in \mathbb {Q}_{\delta }^{n_z}\). This means \((y - D z = c) \sigma ^{D,c}_{y,z}\) is satisfiable for all assignments and, therefore, \((h^T z = g) \sigma ^{D,c}_{y,z}\) must simplify to \(0 = 0\).
Finally, let us look at the case where \(h^T x = g\) is not an equality implied by \(y - D z = c\). Suppose to the contrary that \(((y - D z = c) \cup (h^T z = g)) \sigma ^{D,c}_{y,z}\) is satisfiable for all assignments. We know based on Lemma 8 and transitivity of equivalence that \((y - D z = c) \cup (h^T z = g)\) and \((y - D z = c) \cup \emptyset \) are equivalent. Therefore, \(h^T z = g\) is implied by \(y - D z = c\), which contradicts our initial assumption. \(\square \)
With Lemma 10, we have now all auxiliary lemmas needed to prove that the algorithm \({{\mathrm{{\texttt {EqBasis}}}}}\) is correct:
Lemma 11
Let \(A' x \le b'\) be a satisfiable system of inequalities. Let \(y - D z = c\) be the output of \({{\mathrm{{\texttt {EqBasis}}}}}(A' x \le b')\). Then \(y - D z = c\) is an equality basis of \(A' x \le b'\).
Proof
Let \(A z \le b\) be the result of applying \(\sigma ^{D,c}_{y,z}\) to \(A' x \le b'\). Since \(y - D z = c\) is the output of \({{\mathrm{{\texttt {EqBasis}}}}}(A' x \le b')\), the condition in line 3 of \({{\mathrm{{\texttt {EqBasis}}}}}\) guarantees us that \(A z \le b\) implies no equalities. Let us now suppose to the contrary of our initial assumptions that \(A' x \le b'\) implies an equality \({h'}^T x = g'\) that \(y - D z = c\) does not imply. Since \({h'}^T x = g'\) is not implied by \(y - D z = c\), the output of \(({h'}^T x = g') \sigma ^{D,c}_{y,z}\) is an equality \({h}^T z = g\), where \(h \ne 0^{n_z}\). This also implies that \((A z \le b) \cup ({h}^T z = g)\) is the output of \(((A' x \le b') \cup ({h'}^T x = g')) \sigma ^{D,c}_{y,z}\). By Lemma 9, \(A z \le b\) and \((A z \le b) \cup ({h}^T z = g)\) are equivalent. Therefore, \(A z \le b\) implies the equality \({h}^T z = g\), which contradicts the condition in line 3 of \({{\mathrm{{\texttt {EqBasis}}}}}\) and, therefore, our initial assumptions. \(\square \)