Parma Polyhedra Library requirements
C++ grid generators and grid-generator systems
1. Grid-generator values and integer versus continuous displacement PPL-SPEC-000221

A Grid_Generator shall describe a rational included point, a rational parameter displacement vector, or a continuous line direction, in its public ambient dimension. For a point or parameter with numerators ai and positive divisor d, coordinates shall be ai ⁄ d. Parameters shall retain their exact rational step, including sign and magnitude; integer multiples of that step shall contribute to a generated grid. Lines shall contribute arbitrary real multiples of their direction. Hidden divisor fields shall not be public coordinates.

Both storage representations shall be supported; default_representation shall be SPARSE. Initialization and synchronization shall follow 🔗 3. Thread initialization, default state and finalization. Computed construction, transformation, scaling and comparison guarantees shall require all evaluated coefficient steps/results to be representable in the selected profile; unchecked completion shall not prove that condition. Allocation/numerical exceptions may propagate. Failed construction shall release resources owned by the incomplete grid generator; distinct unchanged sources shall survive failures, while modified targets shall remain destructible without universal rollback.

PPL-SPEC-000222
2. Construction of nonzero grid-line directions PPL-SPEC-000222

grid_line(e,r) shall construct a line from homogeneous coefficients, ignore the constant, retain declared dimension and use requested storage. It shall produce a primitive direction with first nonzero coefficient positive. A zero homogeneous direction, including a nonzero constant expression, shall throw std::invalid_argument without modifying its source. Static and free forms shall agree geometrically. Numerical prerequisites in 🔗 1. Grid-generator values and integer versus continuous displacement shall apply.

PPL-SPEC-000223
3. Exact rational parameter construction including zero steps PPL-SPEC-000223

parameter(e,d,r) shall create the rational displacement with coordinates ai ⁄ d from the homogeneous input coefficients, ignoring the constant, retaining dimension and using requested storage. Nonzero negative divisors shall be accepted by reversing numerator/divisor signs to make stored divisor positive while preserving the exact signed step. The parameter's magnitude shall not be normalized as a line direction. Zero displacement shall be admitted and retain its dimension. Zero divisor shall throw std::invalid_argument and preserve sources.

Defaults shall use dimension-zero zero expression, divisor one and default storage. Representation-only and expression/representation forms shall use divisor one. A divisor borrowed from the unchanged input expression shall be admitted using its entry value. Numerical prerequisites in 🔗 1. Grid-generator values and integer versus continuous displacement shall apply.

PPL-SPEC-000224
4. Rational grid-point construction, defaults and shared origin PPL-SPEC-000224

grid_point(e,d,r) shall construct the rational point with coordinates ai ⁄ d, ignoring the expression constant, retaining dimension and using requested storage. A negative nonzero divisor shall reverse numerator signs and become positive; common factors may be removed while preserving rational coordinates. Zero divisor shall throw std::invalid_argument. A divisor borrowed from the unchanged input expression shall use its entry value.

Omitted expression/divisor arguments shall denote the dimension-zero origin and divisor one. Representation-only and expression/representation forms shall use divisor one. Default construction shall produce that origin using requested storage. zero_dim_point() shall borrow the zero-dimensional origin until owning-thread finalization; owned copies shall be independent.

PPL-SPEC-000225
5. Owned grid-generator copying, assignment and swaps PPL-SPEC-000225

Copy construction shall preserve exact fields, kind, dimension and source representation; explicit-storage copies shall select their argument. Assignment shall copy complete entry value/storage, preserve distinct sources, return the target and admit self-assignment. Rvalue inputs shall admit copy forms retaining source value without requiring a distinct move operation. Copies shall remain independent of source mutation/destruction. Swaps shall exchange complete values, dimension and storage; self-swap shall preserve them. Destruction shall release owned storage. Failure during copy assignment's replacement construction shall preserve the target.

  • PPL-LLR-000015
    5. Distinct meanings of geometric generators PPL-LLR-000015

    Generator descriptors shall preserve the mathematical distinction between included points, closure points, rays, lines and grid parameters: closure points need not be included points, rays admit nonnegative displacement, lines admit arbitrary real displacement, and grid parameters admit integer displacement.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • 1. Coordinate identity and ambient dimension PPL-LLR-000011

    Geometric descriptors shall identify coordinates within a finite-dimensional ambient vector space and shall preserve coordinate identity when their declared dimension is increased without an explicit coordinate transformation.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • 3. Preservation by representation-only changes PPL-LLR-000303

    For valid inputs satisfying the operation's stated computational-arithmetic preconditions, including those governing all intermediate calculations, a successfully completed operation specified to change only the representation of a numerical object shall preserve the object's concrete meaning and space dimension. Any change to its precision or represented set shall instead be governed by an explicitly stated semantic operation.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 3. Failure and resource safety PPL-LLR-000133

    When a supported recoverable failure is reported through a documented error channel, the library shall release temporary resources it owns and leave surviving objects and outputs in the states permitted by the operation's documented failure guarantee. Failure during construction shall release resources acquired for the object whose construction failed. These obligations shall apply whether failure is reported by an exception, error status or host-language error mechanism.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-000226
6. Grid-generator storage conversion PPL-SPEC-000226

representation() shall report storage. Successful conversion to dense or sparse representation shall select requested storage and preserve exact coefficients, divisor when applicable, kind and dimension. Repeating the current choice shall preserve the object. Failed replacement allocation shall leave its original value and storage unchanged.

PPL-SPEC-000227
7. Grid-generator dimensions and coordinate removal PPL-SPEC-000227

max_space_dimension() shall equal the linear-expression limit minus one, reserving the internal divisor coordinate. space_dimension() shall report public dimension. Dimensioned copies and resizing shall require admitted result dimensions, retain lower-index coordinates and zero-extend or discard trailing coordinates. Explicit-storage copies shall use their argument; other copies shall retain source storage.

remove_space_dimensions(vars) shall require in-dimension selected indices, discard those coordinate coefficients, compact retained coordinates in their original order and return true. Removing none/all shall be admitted. Kind, storage and applicable rational remaining coordinates shall be retained. A transformed zero parameter or zero line direction shall contribute no displacement, without supplying a supporting point.

PPL-SPEC-000228
8. Grid-generator coordinate permutation and zero insertion PPL-SPEC-000228

Swapping in-dimension variables shall exchange their coordinate coefficients. A cycle shall require distinct in-dimension variables and move each listed coefficient to the following listed position, wrapping last to first. Empty and singleton cycles shall preserve the object. Inserting zero coordinates before v.id() <= space_dimension() shall shift the suffix and increase dimension by the requested admitted amount; a zero shift shall preserve value. Kinds, storage and applicable rational point/parameter values shall follow that coordinate correspondence. A line may be reoriented by equivalent sign normalization; a parameter's sign and exact step shall be preserved.

PPL-SPEC-000229
9. Grid-generator kind, coefficient, divisor and expression queries PPL-SPEC-000229

Borrowed coefficient and expression accessors shall require an lvalue receiver, with corresponding const && overloads deleted in every coefficient profile. Copying a borrowed expression view shall not extend the owning descriptor's lifetime.

Kind predicates and type() shall identify line, parameter and point; is_line_or_parameter() and is_parameter_or_point() shall identify their named unions. coefficient(v) shall expose a public coordinate numerator or direction coefficient, rejecting v.id() >= space_dimension() with std::invalid_argument. divisor() shall return a positive divisor for parameters/points and reject lines with std::invalid_argument. all_homogeneous_terms_are_zero() shall inspect only public homogeneous coordinates, excluding divisor fields.

expression() shall borrow a read-only view of the public homogeneous coefficients, with public dimension and constant zero, hiding divisor fields. The owner shall remain alive and unchanged for covered view uses. Materializing the view shall yield an independent Linear_Expression. Configured returned references shall borrow until owner mutation/destruction. Queries shall preserve source values.

PPL-SPEC-000230
10. Explicit replacement of a rational generator divisor PPL-SPEC-000230

For a point or parameter and positive input d, set_divisor(d) shall replace only its divisor using the input entry value, preserving coordinate numerators, dimension, kind and storage. It shall therefore change the rational vector when the divisor changes. A divisor borrowed from the same object shall be admitted. Calling it on a line shall throw std::invalid_argument without changing that line.

PPL-SPEC-000231
11. Value-preserving scaling to a common positive divisor PPL-SPEC-000231

For a point or parameter, scale_to_divisor(d) shall require a positive d that is an exact multiple of the current positive divisor. It shall set the divisor to d and multiply all public numerators by the same positive ratio, preserving exact rational vector, kind, dimension and storage. Reusing the current divisor shall preserve exact fields. Borrowed inputs from the same object shall use their entry values. For a line and any admitted positive d it shall do nothing. Numerical prerequisites in 🔗 1. Grid-generator values and integer versus continuous displacement shall apply.

PPL-SPEC-000232
12. Grid-generator equivalence and stored identity PPL-SPEC-000232

is_equivalent_to and equality shall compare equal-kind, equal-dimension generators independently of storage. Points and parameters shall compare their exact rational vectors, including parameter sign and magnitude. Opposite parameter vectors may generate the same integer span but shall remain distinct parameter values. Lines shall compare their real direction spans, admitting opposite nonzero scales. Different dimensions/kinds shall compare unequal. Inequality shall negate equivalence.

is_equal_to shall compare complete stored fields and kind independently of storage. Positive identity shall imply equivalence; a negative identity shall not prove different geometric values. Queries shall preserve sources. Numerical prerequisites in 🔗 1. Grid-generator values and integer versus continuous displacement shall apply.

PPL-SPEC-000233
13. Reloadable grid-generator representation PPL-SPEC-000233

ascii_dump(s) shall export all stored coefficient/divisor fields and the public kind token; the no-argument form shall use std::cerr. Export shall preserve the source. Compatible complete exported data with representable coefficients shall load with true, replacing the generator's fields and public dimension while retaining destination storage.

Malformed/truncated expression or kind fields, missing internal divisor slots, nonpositive point/parameter divisors and encoded kind/field mismatches shall return false rather than be accepted as valid generators. Trailing input shall remain available. A failed target shall remain destructible and admit complete valid replacement, without rollback or cross-version format promises. Allocation and numerical exceptions may propagate.

  • PPL-LLR-000015
    5. Distinct meanings of geometric generators PPL-LLR-000015

    Generator descriptors shall preserve the mathematical distinction between included points, closure points, rays, lines and grid parameters: closure points need not be included points, rays admit nonnegative displacement, lines admit arbitrary real displacement, and grid parameters admit integer displacement.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-000234
14. Readable grid-generator, kind and system output PPL-SPEC-000234

Grid-generator output shall use l(...), q(...) or p(...) for line, parameter or point, printing public homogeneous coefficients with the active formatter and sign/unit conventions of 🔗 14. Human-readable affine output and formatter dispatch. Zero tuples shall print 0. A nonunit point/parameter divisor shall be printed after /, with parentheses around a nonzero numerator expression. Kind output shall print LINE, PARAMETER or POINT.

System output shall print its public generators separated by ", ", or false for an empty range. Output shall return the supplied stream, add no newline and preserve source values. Each type's print() shall use that output on std::cerr. Evaluated coefficient negations shall be representable.

PPL-SPEC-000235
15. Grid-generator-system integer-affine span and construction PPL-SPEC-000235

For lines L, parameters Q and included points P, a Grid_Generator_System shall generate the real vectors

 ∑l ∈ Lτll +  ∑q ∈ Qkqq +  ∑p ∈ Pzpp,   τl ∈ ℝ,  kq, zp ∈ ℤ,   ∑p ∈ Pzp = 1.

Without a point the generated grid shall be empty, even with stored nonzero lines/parameters. Integer affine combinations of multiple points shall not be replaced by convex combinations. Default construction shall make a zero-dimensional system with no rows; an explicit dimension constructor shall retain its supplied admitted dimension. Singleton construction shall copy its generator and dimension, including a zero parameter. Ordinary insertion shall separately follow 🔗 17. Grid-generator insertion, zero steps and ownership transfer. Requested storage shall be used, with default SPARSE. zero_dim_univ() shall borrow the singleton zero-dimensional origin until owning-thread finalization. Numerical/use/failure prerequisites shall follow 🔗 1. Grid-generator values and integer versus continuous displacement.

PPL-SPEC-000236
16. Owned grid-generator systems and representation comparison PPL-SPEC-000236

Copies/assignment shall preserve generated grid, declared dimension and retained row sequence. Ordinary copies and assignment shall retain source storage, while explicit-storage copies shall use their argument. Assignment shall return the target, preserve distinct sources, admit self-assignment and retain source value under rvalue copy forms. Copies shall survive source mutation/destruction. Swaps shall exchange full values, dimensions and storage, including self-swap. Successful representation conversion shall select dense or sparse row storage and preserve the generated grid and dimension. Copy-assignment replacement failure shall preserve the target; other failures shall follow 🔗 1. Grid-generator values and integer versus continuous displacement.

is_equal_to and system equality shall compare declared dimensions and retained row sequence using equivalent corresponding generators, not decide equality of arbitrarily reordered or redundant generated grids. Comparison shall ignore dense/sparse choice. Destruction shall release owned storage.

17. Grid-generator insertion, zero steps and ownership transfer PPL-SPEC-000237

Const-reference insertion shall add a copy of a grid generator to the generating collection, preserve its source and retain target storage. Result dimension shall be the maximum input dimension, zero-extending shorter rows. A zero parameter shall add no row but shall still extend ambient dimension as needed; it shall not supply a supporting point. Copy insertion of a borrowed target row shall use its entry value. Duplicates/redundant generators may be removed or reordered while preserving the generated grid.

Rvalue row insertion shall transfer a source not borrowed from the target, with the same generated-grid effect as copying; the source shall remain destructible. Consuming-system insertion shall require distinct systems, combine their generating collections in aligned dimensions, and clear the source to a dimension-zero empty system on success. No unchanged-value guarantee shall apply to transferred inputs. Numerical/failure prerequisites in 🔗 1. Grid-generator values and integer versus continuous displacement shall apply.

Const row sources, including const rvalues, shall use preserving insertion. Successful rvalue row insertion shall leave its source a valid descriptor with an unspecified value.

  • PPL-LLR-000015
    5. Distinct meanings of geometric generators PPL-LLR-000015

    Generator descriptors shall preserve the mathematical distinction between included points, closure points, rays, lines and grid parameters: closure points need not be included points, rays admit nonnegative displacement, lines admit arbitrary real displacement, and grid parameters admit integer displacement.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • 1. Coordinate identity and ambient dimension PPL-LLR-000011

    Geometric descriptors shall identify coordinates within a finite-dimensional ambient vector space and shall preserve coordinate identity when their declared dimension is increased without an explicit coordinate transformation.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-000238
18. System dimensions, row-kind counts and read-only iteration PPL-SPEC-000238

max_space_dimension() shall return Grid_Generator::max_space_dimension() - 1 and space_dimension() the public ambient dimension. empty() shall mean no stored rows, independently of whether the generated grid lacks a supporting point. num_rows(), num_parameters() and num_lines() shall count retained stored generators of their named scope; has_points() shall report a retained point. clear() shall remove all rows and reset dimension zero while retaining storage.

begin()/end() shall expose retained generators sharing system dimension, without promising geometric sorted order or duplicate multiplicity. Forward iterators shall borrow rows, support independent copied/assigned positions, return the advanced iterator from prefix increment and entry-position copy from postfix increment. Comparison shall require one unchanged system. Defaults shall admit copying/assignment/destruction before valid-position assignment. System mutation/destruction shall invalidate iterators and rows.

  • PPL-LLR-000015
    5. Distinct meanings of geometric generators PPL-LLR-000015

    Generator descriptors shall preserve the mathematical distinction between included points, closure points, rays, lines and grid parameters: closure points need not be included points, rays admit nonnegative displacement, lines admit arbitrary real displacement, and grid parameters admit integer displacement.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-000239
19. Grid-generator and system invariants and memory queries PPL-SPEC-000239

OK() shall report checked storage invariants, without promising canonical normalization of every valid parameter representation. Successful operations under their preconditions shall produce values satisfying those invariants. Each type's total memory count shall equal its sizeof plus external memory count. Queries shall preserve geometric fields, kind, dimension and storage. Counts shall not promise allocator overhead, process memory or a dense/sparse size ordering.

PPL-SPEC-000240
20. Reloadable grid-generator-system representation PPL-SPEC-000240

ascii_dump(s) shall export stored rows, public dimension, storage and required system-state fields; the no-argument form shall use std::cerr. Export shall preserve source value. Compatible complete exports with representable coefficients shall load with true, replacing the target's generated grid, dimension, retained rows and encoded storage.

Malformed/truncated headers/rows, invalid divisor or kind structure, and inconsistent encoded dimensions/state fields shall return false rather than be accepted as valid systems. Trailing input shall remain available. Failed targets shall remain destructible and admit complete valid replacement, without rollback or cross-version format promises. Allocation/numerical exceptions may propagate. The decoded header dimension shall not exceed max_space_dimension(), including when the record contains no rows; not_a_dimension() shall be rejected as an unsupported extent.