Parma Polyhedra Library requirements
C++ rational-grid text, memory and invariants
PPL-SPEC-001260
1. Human-readable rational-grid presentation PPL-SPEC-001260

IO_Operators::operator<<(s, grid) shall write false for empty, true for universe, and a readable congruence description otherwise. Nontrivial output shall denote the same set and coordinate identities as the grid, using the installed variable formatter and descriptor output conventions. It shall return s by reference. Representation normalization shall be permitted, preserving set and ambient dimension. This display shall not promise an ascii_load input format or a fixed order of equivalent rows. Stream failure shall follow the stream's configured state/exception behavior. print() shall send the same readable presentation to std::cerr without adding a newline; it shall have the same source and arithmetic prerequisites.

The initialization, selected arithmetic-profile, lifetime and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including temporary calculations. Source descriptions and output streams shall remain live for their respective uses. Resource and numerical failures shall not imply a stronger surviving-object guarantee than the operation states.

2. Reloadable rational-grid record export PPL-SPEC-001261

ascii_dump(s) shall export a complete record of ambient dimension, distinguished-value/status information, stored congruence and generator systems with their current-description indicators, and dimension-kind data required by the encoded reduced descriptions. The no-argument overload shall write the same record to std::cerr. Export shall preserve the source value, dimension, stored descriptions, status and ownership.

A compatible complete record shall support the loading contract in 🔗 3. Compatible rational-grid record loading and failure state. The scope shall be the corresponding supported producer/consumer format and representable selected coefficient profile; cross-version compatibility, fixed bytes across equivalent cache histories and compatibility with human-readable presentation shall not be implied. Stream failures and enabled stream exceptions shall propagate through the standard stream mechanism; incomplete output shall not be a complete record.

The initialization, selected arithmetic-profile, lifetime and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including temporary calculations. Source descriptions and output streams shall remain live for their respective uses. Resource and numerical failures shall not imply a stronger surviving-object guarantee than the operation states.

The internal status contract shall follow 🔗 4. Grid internal status signed-keyword export.

3. Compatible rational-grid record loading and failure state PPL-SPEC-001262

ascii_load(s) shall return true on a trusted, compatible complete record produced by 🔗 2. Reloadable rational-grid record export, replacing the receiver's set and ambient dimension. Encoded storage shall be retained for the loaded descriptor systems. Cached normal forms may be invalidated and rebuilt under the current reduction rules; cache reconstruction shall preserve mathematical meaning. Trailing input shall remain available after the complete record.

Malformed or truncated fields, unsupported ambient dimensions, invalid status/descriptor structures, incompatible current-description dimensions and nonempty-state generator descriptions lacking a point shall return false, with and without enabled assertions. For a successful load of a trusted record written by 🔗 2. Reloadable rational-grid record export, the receiver shall meet 🔗 5. Rational-grid representation invariant query. Its current descriptions shall define the same set, and an empty grid shall retain empty congruence and generator views. Structural checks can accept altered records whose descriptions contradict one another or disagree with the status. Further operations require a valid representation.

Stream, allocation and selected numerical exceptions may propagate. After false or an exception, the receiver shall retain ownership sufficient for destruction; rollback and subsequent queries shall not be assumed.

The initialization, selected arithmetic-profile, lifetime and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including temporary calculations. Source descriptions and output streams shall remain live for their respective uses. Resource and numerical failures shall not imply a stronger surviving-object guarantee than the operation states.

Storage for serialized dimension kinds shall grow with the accepted entries rather than the declared dimension alone.

The internal status contract shall follow 🔗 5. Grid internal status signed-keyword loading and rejection.

PPL-SPEC-001263
4. Owned rational-grid memory accounting PPL-SPEC-001263

external_memory_in_bytes() shall report the owned external storage of the congruence system, generator system and dimension-kind vector. Descriptor system counts shall follow their component contracts; the vector count shall include its retained allocated capacity rather than only its live entries. Inactive or logically empty cached data shall remain counted while owned. Other objects, runtime scratch pools and allocator bookkeeping shall be excluded.

total_memory_in_bytes() shall equal sizeof(Grid) plus that external count. The sums shall fit memory_size_type and use the selected build's sizes. Both queries shall preserve set, ambient dimension, caches, capacity, ownership and lifetimes; the observed storage shall remain unchanged during the query.

The initialization, selected arithmetic-profile, lifetime and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including temporary calculations. Source descriptions and output streams shall remain live for their respective uses. Resource and numerical failures shall not imply a stronger surviving-object guarantee than the operation states.

5. Rational-grid representation invariant query PPL-SPEC-001264

OK(false) shall return true for an admitted grid whose distinguished state, ambient dimension, status and current descriptions satisfy the representation invariants. OK(true) shall additionally require the grid to be nonempty. The ambient dimension shall be supported and every current system shall be structurally valid and have that dimension.

An empty grid shall have empty generator views and a contradictory congruence view. Zero-dimensional universe shall have no defining congruences and one zero-dimensional point. A nonempty-state current generator system shall contain a point. If both descriptions are current, they shall define the same set, including affine restrictions and discrete periods. A congruence-only description may be inconsistent without already having the empty flag; in that case OK(false) shall be true and OK(true) false.

The query shall preserve the receiver and may use independent temporary normalization to check consistency. It may allocate and propagate supported resource or numerical failures. On an invalid state it may emit diagnostic text; diagnostic wording shall not be a stable interface. The query shall operate only on live, destructible owned structures, not arbitrary invalid addresses or corrupted object representations.

The initialization, selected arithmetic-profile, lifetime and synchronization conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including temporary calculations. Source descriptions and output streams shall remain live for their respective uses. Resource and numerical failures shall not imply a stronger surviving-object guarantee than the operation states.

The internal status contract shall follow 🔗 3. Grid internal status consistency predicate.