Parma Polyhedra Library requirements
Internal augmented scalar products
1. Augmented coefficient products and numerical prerequisites UID: PPL-SPEC-000561 STATUS: APPROVED COMPONENT: GEOMETRIC_DESCRIPTORS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT:

The internal Scalar_Products operations shall pair stored coefficient rows, without dividing generator coordinates by a point or parameter divisor. A stored expression row shall place the constant in slot zero and coordinate i in slot i + 1. A necessarily closed constraint or generator shall use this visible row. A not necessarily closed descriptor shall also have its final epsilon slot. A grid generator shall have a final hidden parameter-divisor slot after its visible row; a congruence modulus shall not be a coefficient-row slot.

An operation shall use exactly the coefficient positions in its individual contract. Its output coefficient shall be live, assignable and separate from all operand-owned storage. The operands shall be live valid objects with the stated dimension/topology conditions. Read-only operands may alias where their types permit it. Dense and sparse representations shall give the same result. Distinct sources, dimensions, representations and topology shall be preserved.

Products and accumulated sums shall be evaluated exactly. A bounded coefficient profile shall admit the final sum when assigning it to a coefficient; individual products and partial sums need not fit that profile. Sign-only operations shall not require the exact sum to fit a stored coefficient. Unrepresentable final assignments shall follow 🔗 1. Affine value, numerical prerequisites and shared zero. Callers shall provide sufficient resources and initialization for the participating descriptor/constant lifetimes, including the initialized-thread rules in 🔗 3. Thread initialization, default state and finalization. Shared scratch-coefficient pools in a non-thread-safe configuration shall be serialized; thread-safe configurations shall use calling-thread scratch pools. Object access shall be synchronized against mutation. Arithmetic or resource failure shall not constitute a successful product, and no unchanged-output promise shall apply after such failure.

RATIONALE:

Augmented rows carry numerical representation columns whose products differ from evaluation at normalized geometric coordinates.

INTERFACE:

Internal source header: Scalar_Products_defs.hh, with Scalar_Products_inlines.hh after descriptor definitions. Names belong to Parma_Polyhedra_Library; static member signatures apply to Scalar_Products.

class Scalar_Products;
class Topology_Adjusted_Scalar_Product_Sign;
VERIFICATION_CRITERIA:

Use literal coefficient-vector oracles across dense/sparse combinations, positive/zero/negative sums, hidden columns and supported aliases. Include cancellation of products beyond the stored range and the working machine-word range, signs of unrepresentable sums, rejected final assignments and unchanged distinct sources.

SOURCE:

src/Exact_Arithmetic.hh; src/Scalar_Products_defs.hh; src/Scalar_Products_inlines.hh; src/Scalar_Products.cc; src/Linear_Expression_inlines.hh; src/Linear_Expression_Impl_templates.hh; tests/scalarproductsspec1.cc.

2. Full expression and polyhedral descriptor products UID: PPL-SPEC-000562 STATUS: APPROVED COMPONENT: GEOMETRIC_DESCRIPTORS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT:

For expression coefficient rows X = (x0, …, xn) and Y = (y0, …, ym) with n ≤ m, full assignment shall set z = ∑ni = 0xiyi. The Constraint, Generator and Generator, Constraint overloads shall apply the same formula to their stored augmented rows in argument order. The first row shall not be longer than the second; an epsilon slot present in the first row shall be included. The second row's trailing slots shall not contribute. This positionwise product shall not implicitly align epsilon slots at different positions.

sign with expression, constraint/generator or generator/constraint operands shall return -1, 0 or 1 according as that same exact full product is negative, zero or positive. It shall not return a sign inferred from an inexact or overflowed coefficient. Prerequisites and source preservation shall follow 🔗 1. Augmented coefficient products and numerical prerequisites.

RATIONALE:

The full stored-row product supplies exact incidence calculations, including epsilon when requested, without changing either descriptor.

INTERFACE:

Internal source header: Scalar_Products_defs.hh, with Scalar_Products_inlines.hh after descriptor definitions. Names belong to Parma_Polyhedra_Library; static member signatures apply to Scalar_Products.

static void assign(Coefficient& z, const Linear_Expression& x,
                   const Linear_Expression& y);
static void assign(Coefficient& z, const Constraint& c, const Generator& g);
static void assign(Coefficient& z, const Generator& g, const Constraint& c);
static int sign(const Linear_Expression& x, const Linear_Expression& y);
static int sign(const Constraint& c, const Generator& g);
static int sign(const Generator& g, const Constraint& c);
VERIFICATION_CRITERIA:

Check both typed argument orders, expression aliases, unequal compatible row lengths, empty visible dimensions and all dense/sparse pairs. Include full NNC products with a nonzero epsilon contribution, plus arbitrary-precision products and negative/zero/positive signs.

SOURCE:

src/Scalar_Products_defs.hh; src/Scalar_Products_inlines.hh; src/Scalar_Products.cc; src/Linear_Expression_inlines.hh; src/Linear_Expression_Impl_templates.hh; tests/scalarproductsspec1.cc.

PPL-SPEC-000563
3. Grid products exclude the hidden parameter divisor UID: PPL-SPEC-000563 STATUS: APPROVED COMPONENT: GEOMETRIC_DESCRIPTORS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT:

For assign(z, gg, cg) and reduced_assign(z, gg, cg), let d be the visible grid-generator dimension and G and C the stored grid-generator and congruence rows. The congruence shall have visible dimension at least d; both operations shall assign z = ∑di = 0GiiC. They shall exclude the grid generator's hidden parameter-divisor slot and every congruence coordinate beyond d.

For assign(z, cg, gg), the congruence's visible dimension e shall not exceed the generator's visible dimension, and the result shall be z = ∑ei = 0CiiG. No modulus shall participate in either order. For assign(z, c, gg) and sign(c, gg), full stored-row pairing in 🔗 2. Full expression and polyhedral descriptor products shall apply, with the constraint row no longer than the grid-generator row; any participating final slot shall retain its stored positionwise meaning. The sign shall be -1, 0 or 1 for the exact product. Prerequisites and preservation shall follow 🔗 1. Augmented coefficient products and numerical prerequisites.

RATIONALE:

A parameter divisor is storage metadata for a different numerical role; multiplying it by a later visible congruence coordinate would change the intended grid incidence product.

INTERFACE:

Internal source header: Scalar_Products_defs.hh, with Scalar_Products_inlines.hh after descriptor definitions. Names belong to Parma_Polyhedra_Library; static member signatures apply to Scalar_Products.

static void assign(Coefficient& z, const Grid_Generator& gg,
                   const Congruence& cg);
static void assign(Coefficient& z, const Congruence& cg,
                   const Grid_Generator& gg);
static void reduced_assign(Coefficient& z, const Grid_Generator& gg,
                           const Congruence& cg);
static void assign(Coefficient& z, const Constraint& c,
                   const Grid_Generator& gg);
static int sign(const Constraint& c, const Grid_Generator& gg);
VERIFICATION_CRITERIA:

Check point, parameter and line rows, zero-dimensional constants, nonzero hidden divisors, larger second operands and both congruence/generator orders. Change only an excluded trailing coordinate or modulus and verify no product change. Include constraint/grid products and exact signs.

SOURCE:

src/Scalar_Products_defs.hh; src/Scalar_Products_inlines.hh; src/Scalar_Products.cc; src/Linear_Expression_inlines.hh; src/Linear_Expression_Impl_templates.hh; tests/scalarproductsspec1.cc.

PPL-SPEC-000564
4. Reduced products omit the first epsilon slot UID: PPL-SPEC-000564 STATUS: APPROVED COMPONENT: GEOMETRIC_DESCRIPTORS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT:

For expression rows X = (x0, …, xn) and Y = (y0, …, ym), reduced assignment shall require n ≥ 1 and n − 1 ≤ m, and assign z = ∑n − 1i = 0xiyi. The final first-row slot shall not contribute, whether or not the second row has a corresponding slot.

For typed Constraint, Generator and Generator, Constraint overloads, the first descriptor shall have not necessarily closed topology, so the omitted slot shall be its epsilon slot. The second stored row shall contain all retained positions. reduced_sign with expression or either typed argument order shall return -1, 0 or 1 according to that exact reduced sum. The second typed descriptor may have either topology. The distinct grid reduced_assign overload shall instead follow 🔗 3. Grid products exclude the hidden parameter divisor. Other prerequisites and preservation shall follow 🔗 1. Augmented coefficient products and numerical prerequisites.

RATIONALE:

Epsilon is needed in some stored-row calculations and deliberately excluded from topology-adjusted geometric incidence calculations.

INTERFACE:

Internal source header: Scalar_Products_defs.hh, with Scalar_Products_inlines.hh after descriptor definitions. Names belong to Parma_Polyhedra_Library; static member signatures apply to Scalar_Products.

static void reduced_assign(Coefficient& z, const Linear_Expression& x,
                           const Linear_Expression& y);
static void reduced_assign(Coefficient& z, const Constraint& c,
                           const Generator& g);
static void reduced_assign(Coefficient& z, const Generator& g,
                           const Constraint& c);
static int reduced_sign(const Linear_Expression& x,
                        const Linear_Expression& y);
static int reduced_sign(const Constraint& c, const Generator& g);
static int reduced_sign(const Generator& g, const Constraint& c);
VERIFICATION_CRITERIA:

Use a nonzero omitted product to distinguish full and reduced results. Cross first-NNC/second-closed and first-NNC/second-NNC cases in both typed orders, raw expression aliases and unequal retained lengths. Check exact negative, zero and positive sums.

SOURCE:

src/Scalar_Products_defs.hh; src/Scalar_Products_inlines.hh; src/Scalar_Products.cc; src/Linear_Expression_inlines.hh; src/Linear_Expression_Impl_templates.hh; tests/scalarproductsspec1.cc.

PPL-SPEC-000565
5. Homogeneous products omit constants and grid metadata UID: PPL-SPEC-000565 STATUS: APPROVED COMPONENT: GEOMETRIC_DESCRIPTORS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT:

For expression rows X = (x0, …, xn) and Y = (y0, …, ym) with n ≤ m, homogeneous assignment shall set z = ∑ni = 1xiyi, including a final slot when it belongs to the first expression. A zero-dimensional expression shall therefore give zero. For expression/generator and expression/grid-generator overloads, the second row shall be the descriptor's complete stored row, long enough for all first-expression positions.

For grid-generator/congruence and grid-generator/constraint overloads, the second descriptor's visible dimension shall be at least the grid generator's visible dimension d. The sum shall be z = ∑di = 1GiiC, excluding both the constant and the hidden parameter-divisor slot. Constants and any trailing second-operand coordinates shall not contribute. Each supported homogeneous_sign overload shall return -1, 0 or 1 for its corresponding exact sum. Other prerequisites and preservation shall follow 🔗 1. Augmented coefficient products and numerical prerequisites.

RATIONALE:

Homogeneous products isolate displacement coefficients from affine offsets and generator normalization metadata.

INTERFACE:

Internal source header: Scalar_Products_defs.hh, with Scalar_Products_inlines.hh after descriptor definitions. Names belong to Parma_Polyhedra_Library; static member signatures apply to Scalar_Products.

static void homogeneous_assign(Coefficient& z, const Linear_Expression& x,
                               const Linear_Expression& y);
static void homogeneous_assign(Coefficient& z, const Linear_Expression& e,
                               const Generator& g);
static void homogeneous_assign(Coefficient& z, const Linear_Expression& e,
                               const Grid_Generator& gg);
static void homogeneous_assign(Coefficient& z, const Grid_Generator& gg,
                               const Constraint& c);
static void homogeneous_assign(Coefficient& z, const Grid_Generator& gg,
                               const Congruence& cg);
static int homogeneous_sign(const Linear_Expression& x,
                            const Linear_Expression& y);
static int homogeneous_sign(const Linear_Expression& e, const Generator& g);
static int homogeneous_sign(const Linear_Expression& e,
                            const Grid_Generator& gg);
static int homogeneous_sign(const Grid_Generator& gg, const Constraint& c);
VERIFICATION_CRITERIA:

Vary nonzero constants and hidden grid divisors while retaining visible coordinates. Include zero-dimensional rows, expression aliases, unequal compatible dimensions, all descriptor overloads and all exact signs under dense/sparse combinations.

SOURCE:

src/Scalar_Products_defs.hh; src/Scalar_Products_inlines.hh; src/Scalar_Products.cc; src/Linear_Expression_inlines.hh; src/Linear_Expression_Impl_templates.hh; tests/scalarproductsspec1.cc.

PPL-SPEC-000566
6. Topology-selected scalar-product sign objects UID: PPL-SPEC-000566 STATUS: APPROVED COMPONENT: GEOMETRIC_DESCRIPTORS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT:

Construction of Topology_Adjusted_Scalar_Product_Sign from a constraint or generator shall retain the choice of full product for necessarily closed topology and reduced product for not necessarily closed topology. It shall retain no borrowed descriptor reference; the source object's later lifetime shall not be required. Copying the function object shall preserve that choice.

For an invocation with Constraint, Generator operands, the constraint's visible dimension shall not exceed the generator's visible dimension; for Generator, Constraint operands, the first generator's visible dimension shall not exceed the constraint's visible dimension. The first operand's current topology shall agree with the stored choice, and the corresponding full or reduced row-length prerequisites shall hold. The call shall return the exact sign defined by 🔗 2. Full expression and polyhedral descriptor products or 🔗 4. Reduced products omit the first epsilon slot, respectively, and preserve the function object and both operands. It may be reused on different valid pairs satisfying the same topology choice. Other prerequisites shall follow 🔗 1. Augmented coefficient products and numerical prerequisites.

RATIONALE:

Topology selection depends on the first operand kind and topology, while a reusable function object needs no ownership of the descriptor used to select it.

INTERFACE:

Internal source header: Scalar_Products_defs.hh, with Scalar_Products_inlines.hh after descriptor definitions. Names belong to Parma_Polyhedra_Library; member signatures apply to Topology_Adjusted_Scalar_Product_Sign.

Topology_Adjusted_Scalar_Product_Sign(const Constraint& c);
Topology_Adjusted_Scalar_Product_Sign(const Generator& g);
int operator()(const Constraint& c, const Generator& g) const;
int operator()(const Generator& g, const Constraint& c) const;
VERIFICATION_CRITERIA:

Cross both constructor kinds and call orders with closed/NNC topology, copied selectors, different later operands and selector-source destruction. Include products whose full and reduced signs differ, nonzero epsilon, and compatible unequal visible dimensions.

SOURCE:

src/Scalar_Products_defs.hh; src/Scalar_Products_inlines.hh; src/Scalar_Products.cc; src/Linear_Expression_inlines.hh; src/Linear_Expression_Impl_templates.hh; tests/scalarproductsspec1.cc.

PPL-SPEC-000567
7. Expression coefficient-range scalar products UID: PPL-SPEC-000567 STATUS: APPROVED COMPONENT: GEOMETRIC_DESCRIPTORS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT:

For coefficient rows X and Y with the slot conventions in 🔗 1. Augmented coefficient products and numerical prerequisites, a range product shall accept 0 ≤ s ≤ t ≤ min(|X|, |Y|) and assign z = ∑t − 1i = sXiiY. An empty range shall assign zero. The full expression overload shall use s = 0, t = |X| and require |X| ≤ |Y|. A backend interface's range sign query shall return -1, 0 or 1 for that same exact range sum.

The result shall include a constant, visible coordinate or extra stored coordinate exactly when its slot is in the range, and shall treat omitted sparse coefficients as zero. Both operand representations and permitted read-only aliases shall give the same sum. The result shall not borrow operand storage. Exact-arithmetic, initialization, output-separation and preservation prerequisites shall follow 🔗 1. Augmented coefficient products and numerical prerequisites.

RATIONALE:

A precise half-open coefficient range supports full, homogeneous and reduced products through one consistent numerical operation.

INTERFACE:

Private helper methods of Linear_Expression and public methods of its internal Linear_Expression_Interface in Parma_Polyhedra_Library:

void Linear_Expression::scalar_product_assign(Coefficient& result,
  const Linear_Expression& y) const;
void Linear_Expression::scalar_product_assign(Coefficient& result,
  const Linear_Expression& y, dimension_type start, dimension_type end) const;
void Linear_Expression_Interface::scalar_product_assign(Coefficient& result,
  const Linear_Expression_Interface& y,
  dimension_type start, dimension_type end) const;
int Linear_Expression_Interface::scalar_product_sign(
  const Linear_Expression_Interface& y,
  dimension_type start, dimension_type end) const;
VERIFICATION_CRITERIA:

Check every range in literal coefficient arrays, including empty ranges at both ends, constants, skipped zero coordinates and sparse disjoint support. Cross dense/sparse backends and interface dispatch, exact signs, read-only aliases and unchanged sources.

SOURCE:

src/Linear_Expression_defs.hh; src/Linear_Expression_inlines.hh; src/Linear_Expression_Interface_defs.hh; src/Linear_Expression_Impl_defs.hh; src/Linear_Expression_Impl_templates.hh; tests/scalarproductsspec1.cc; tests/linearexpression1.cc.