Parma Polyhedra Library requirements
C++ rational-grid comparisons and relations
PPL-SPEC-001251
1. Exact grid equality and inequality PPL-SPEC-001251

operator== shall return true exactly when both ambient dimensions and represented sets agree. Different dimensions shall compare unequal, including empty grids in different dimensions. Inequality expressions shall be the logical negation of equality. Equal-dimensional empty grids shall compare equal, including when inconsistency has not previously been detected. Self comparison shall have the ordinary reflexive result for every admitted value.

The result shall be independent of constructor choice, generator order, redundant descriptors and the current dual-description caches.

The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001252
2. Equality-compatible grid hashing PPL-SPEC-001252

hash_code() shall return a value of type int32_t. Equal grid values under 🔗 1. Exact grid equality and inequality shall have equal hashes. Normalization, query history and equivalent descriptions shall not change the hash of an unchanged grid. Hash collisions shall be permitted, including between unequal values of the same dimension. The numerical hash shall not be a persistent identifier or promise a value stable across library versions or configurations.

The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001253
3. Exact grid containment PPL-SPEC-001253

For equal-dimensional grids, left.contains(right) shall return true exactly when γ(right) ⊆ γ(left). Every grid shall contain the empty grid; empty shall contain no nonempty grid; universe shall contain every equal-dimensional grid. Self containment shall hold. Different ambient dimensions shall throw std::invalid_argument before empty, universe or identity shortcuts. Previously undetected inconsistency shall retain the same set meaning.

The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001254
4. Exact strict grid containment PPL-SPEC-001254

For equal-dimensional grids, left.strictly_contains(right) shall return true exactly when γ(right) ⊊ γ(left). It shall be false for self comparison and equal sets; a nonempty grid shall strictly contain empty. Different ambient dimensions shall throw std::invalid_argument even when either operand is empty.

The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001255
5. Exact grid disjointness PPL-SPEC-001255

For equal-dimensional grids, left.is_disjoint_from(right) shall return true exactly when γ(left)∩γ(right) = ⌀. The result shall be symmetric. Empty shall be disjoint from every grid, including itself; no nonempty grid shall be disjoint from itself. Different ambient dimensions shall throw std::invalid_argument before shortcuts. Success shall preserve both operands even when detecting inconsistent input or incompatible periodic residues.

The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001256
6. Exact grid relation with a congruence PPL-SPEC-001256

relation_with(cg) shall classify the grid relative to the solution set of cg. For nonempty grids it shall report exactly one of is_included(), is_disjoint() and strictly_intersects(): respectively all points satisfy cg, no point does, or both satisfying and nonsatisfying points exist. Empty shall report is_included() && is_disjoint() && saturates(). An equality congruence shall additionally report saturates() exactly when the grid is included in its equality hyperplane. For a nonempty positive-dimensional grid and a proper congruence, the returned relation shall consist of the inclusion/disjointness/intersection assertion alone. Zero-dimensional universe shall report is_included() && saturates() for a true constant congruence and is_disjoint() for a false one.

For a nonempty generator description, let S = {a⋅x − b : x ∈ γ(G)}. If a real line has nonzero scalar image, S = R. Otherwise S = s + dZ, where s = a⋅p − b and d ≥ 0 generates the rational subgroup of parameter images and supporting-point differences. This scalar image shall determine equality and periodic intersection without depending on generator order or rational divisor representation.

A congruence dimension greater than the grid dimension shall throw std::invalid_argument before distinguished-value shortcuts. Smaller descriptors shall have zero coefficients in the remaining coordinates.

Scalar products, rational point differences and modulus/divisor products used solely for relation classification shall be exact even when their intermediates exceed the configured coefficient range. The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply; cached descriptor conversion and normalization remain subject to the configured arithmetic profile. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001257
7. Exact grid relation with a linear constraint PPL-SPEC-001257

relation_with(c) shall classify all points, no points or a proper nonempty subset of grid points satisfying c using is_included(), is_disjoint() or strictly_intersects(). Empty shall report is_included() && is_disjoint() && saturates(). In every case, saturates() shall be present exactly when every grid point lies on the equality hyperplane obtained from c by replacing its relation with equality. Thus a grid on the boundary of a strict inequality shall report is_disjoint() && saturates().

For nonempty grids, a nonconstant scalar image along any line, parameter or supporting-point displacement shall take values on both sides of every finite halfspace threshold. Otherwise the scalar image shall be constant and its sign shall determine strict/nonstrict satisfaction and saturation. Equality constraints shall use the exact equality-congruence meaning in 🔗 6. Exact grid relation with a congruence.

A constraint dimension greater than the grid dimension shall throw std::invalid_argument before shortcuts; omitted coefficients shall be zero. Strict boundary behavior shall apply also to constant constraints and zero dimensions.

Strict constraints extracted from NNC polyhedra shall retain their mathematical relation when queried against a larger-dimensional grid.

Scalar products, rational point differences and modulus/divisor products used solely for relation classification shall be exact even when their intermediates exceed the configured coefficient range. The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply; cached descriptor conversion and normalization remain subject to the configured arithmetic profile. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001258
8. Exact grid subsumption of grid generators PPL-SPEC-001258

relation_with(g) for a Grid_Generator shall return Poly_Gen_Relation::subsumes() exactly under the following conditions:

  • a point denotes a member of the grid;
  • for a parameter q, the grid is nonempty and every integer translate x + zq, for x ∈ γ(G) and z ∈ Z, remains in the grid;
  • for a line â„“, the grid is nonempty and every real translate x + tâ„“, for t ∈ R, remains in the grid.

In all other cases it shall return Poly_Gen_Relation::nothing(). In particular, empty shall subsume no generator, including a zero parameter; this shall hold before any earlier query has detected the emptiness. Parameter steps shall use their rational divisors and shall not be confused with arbitrary real line displacements. Zero-dimensional universe shall subsume every admitted zero-dimensional grid generator. A descriptor dimension greater than the grid dimension shall throw std::invalid_argument before empty/universe shortcuts; omitted coordinates shall be zero.

The scalar-product and modulus-times-divisor calculations used solely for satisfaction tests shall be exact without a configured-coefficient range prerequisite. The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply; cached conversion and normalization intermediates remain subject to the configured arithmetic profile. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.

PPL-SPEC-001259
9. Exact grid subsumption of polyhedral generators PPL-SPEC-001259

relation_with(g) for a polyhedral Generator shall return Poly_Gen_Relation::subsumes() exactly when the grid is nonempty and the following corresponding condition holds. Points and closure points shall be tested as rational point members, with the same result for identical coordinates. Lines shall be tested as arbitrary real displacements. A ray shall be subsumed exactly when its direction is an admitted real line direction of the grid; an integer parameter in that direction alone shall not suffice.

It shall return Poly_Gen_Relation::nothing() otherwise, including every empty grid before or after inconsistency detection. Zero-dimensional universe shall subsume every admitted zero-dimensional polyhedral generator. Descriptors of greater dimension than the grid shall throw std::invalid_argument before shortcuts; omitted coordinates shall be zero.

The scalar-product and modulus-times-divisor calculations used solely for satisfaction tests shall be exact without a configured-coefficient range prerequisite. The valid-use, initialization, arithmetic-profile and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply; cached conversion and normalization intermediates remain subject to the configured arithmetic profile. Logically const queries may normalize cached descriptions; success shall preserve all operands' mathematical values and ambient dimensions. Borrowed views shall follow 🔗 10. Borrowed congruence and generator views of grid values. Supported failures may propagate; surviving ownership shall permit destruction without a general rollback or subsequent-query guarantee.