Parma Polyhedra Library requirements
C++ octagonal records and representation invariants
1. Reloadable octagonal record export PPL-SPEC-001227

For a valid admitted source of ambient dimension n, ascii_dump(stream) shall write the literal "space_dim ", the ambient dimension and a newline. It shall then write the three stored status fields in ZE, EM, SC order, with each keyword prefixed by + or -. One space shall separate the first two fields, two spaces shall separate the last two fields, and one space and a newline shall follow the last field.

The following payload shall be the pseudo-triangular matrix record of 🔗 1. Pseudo-triangular mathematical-value records, with matrix space dimension n. It shall contain its dimension line followed by its physical rows in their stored order, including diagonal positive-infinity sentinels. A zero-dimensional matrix shall have no coefficient rows. The status fields shall retain the stored zero-dimension, emptiness and strong-closure conventions; export shall not require first classifying emptiness or computing strong closure.

Coefficient output shall retain the selected mathematical-value formatting of 🔗 5. Mathematical numeric output and stream delivery status and 🔗 6. Checked numeric stream policy integration, including exact finite native values independently of caller precision. Under compatible record, numeric-profile, locale and version conventions, the complete record shall retain enough information for 🔗 2. Compatible octagonal record loading and failure state to restore the same mathematical set and ambient dimension. Native object bytes and a floating zero sign shall not be part of this mathematical round-trip guarantee.

Export shall preserve the source set, dimension, stored status, matrix and ownership. The no-argument ascii_dump() shall send the same record to the current std::cerr. Output failure shall follow the stream's selected state and exception behavior, retaining partial output without certifying successful delivery.

The representation, numerical-runtime, lifetime and synchronization prerequisites of 🔗 1. Octagonal values, numerical profiles and valid use shall apply. The borrowed stream and its output callback environment shall remain live throughout the call. Recoverable resource exceptions may propagate; discarded owned temporaries shall be released.

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

2. Compatible octagonal record loading and failure state PPL-SPEC-001228

For a complete valid record of 🔗 1. Reloadable octagonal record export under compatible representation, numeric formatting, profile, locale and resource conditions, ascii_load(stream) shall return true and replace any live valid receiver by the recorded ambient dimension and mathematical set. Previous receiver dimensions, emptiness and strong-closure status shall not affect successful restoration. The recorded status fields shall replace their previous conditions. One complete record shall be consumed while a following record or suffix remains available after permitted separating whitespace.

The decoded ambient dimension shall not exceed max_space_dimension(), including for empty records. A greater value shall return false before the matrix payload is processed.

A missing or incorrect space_dim keyword, rejected ambient dimension, missing or malformed required status word, or truncated or rejected matrix payload shall return false when the component extractions return normally. Each status word shall have its expected keyword and a + or - prefix. The loaded matrix space dimension shall equal the recorded ambient dimension; a mismatch shall return false even for empty or zero-dimensional records. Independently of the ambient dimension, an unsupported nested matrix dimension shall return false before matrix resizing or storage-size arithmetic, as specified by 🔗 2. Exact value-record loading and rejection states. Exact scalar acceptance and numerical-payload rejection shall retain that contract. Stream masks, numerical policies and recoverable resource failures shall retain their own exception channels.

Successful restoration assumes a trusted, complete and dump-compatible record. After repair of any legacy rounded cache, the loaded representation shall satisfy the shape invariant. A detected inconsistency shall return false in every build. Semantic queries or further shape operations require a complete valid representation.

For rounded or bounded coefficient profiles, a loaded nonempty status that certifies strong closure may have its feasibility rechecked against the stored bounds. An inconsistent bound system may then be classified empty; otherwise its closure certification may be restored. This compatibility repair shall preserve the stored matrix's exact represented set and ambient dimension; it shall not promise canonical or maximally precise rounded closure.

A false return or exception may leave replaced dimension or status fields and a partially loaded matrix. It shall not promise rollback or a complete mathematical value. The receiver shall retain safely destructible ownership and may be replaced by a complete valid assignment before semantic queries or operations requiring a valid shape. Consumed input shall not be restored, and the library shall not take ownership of the stream.

The representation, numerical-runtime, lifetime and synchronization prerequisites of 🔗 1. Octagonal values, numerical profiles and valid use shall apply. The borrowed stream and its callback environment shall remain live throughout the call. Discarded owned temporaries shall be released on reported failure.

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

PPL-SPEC-001229
3. Octagonal representation invariant query PPL-SPEC-001229

For a live, well-owned and safely indexable representation whose selected scalar operations are admitted, OK() shall check the pseudo-triangular matrix's storage and coefficient validity and the status-condition compatibility. The matrix space dimension shall equal the ambient dimension, including empty and zero-dimensional values. A violation of these checked conditions shall return false.

Once those conditions hold, certified empty representations shall retain their inactive-geometric-data admission, and zero-dimensional representations shall require no coefficient-geometry checks. A positive-dimensional nonempty representation shall reject a stored negative-infinite bound or a diagonal entry other than positive infinity.

For an unbounded coefficient base whose numeric traits declare exact arithmetic, certified strong closure shall be checked against matrix recomputation. For every exact coefficient base, including bounded integer storage, certified strong closure shall satisfy the native strong-coherence inequalities. The selected extended arithmetic, including its rounding and saturation, shall retain the prerequisites of 🔗 1. Octagonal values, numerical profiles and valid use. Bounded saturating closure shall not be required to pass an exact fixed-point test. Floating coefficient bases shall not be required to pass an exact fixed-point or exact strong-coherence test merely because their rounded closure is certified. Passing the applicable checks shall return true.

The query shall preserve the receiver's represented set, ambient dimension, stored status, matrix and ownership. It may copy matrices and recompute derived data in temporary objects; resource and numerical exceptions may propagate through their selected channels. Debug builds may emit invariant-failure diagnostics to std::cerr without a fixed wording. Discarded owned temporaries shall be released.

A true result shall not be an emptiness, semantic equality or minimal-storage answer. This query shall not be a corruption scanner for arbitrary pointers, broken object lifetimes or non-indexable fabricated storage. The numerical runtime, lifetime and synchronization prerequisites of 🔗 1. Octagonal values, numerical profiles and valid use shall apply.

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