Parma Polyhedra Library requirements
Internal extended-number row storage
1. Extended-number row meaning and construction states PPL-SPEC-000651

DB_Row<T> shall own an indexed finite sequence of extended-number values. The selected T and checked-number operations shall support positive infinity initialization, the requested copying/conversion, validity and memory hooks, and nonthrowing destruction. Numerical operations shall satisfy their configured policy, representability and rounding prerequisites; initialization and synchronization shall follow 🔗 3. Thread initialization, default state and finalization where the selected element operations require them.

Default construction shall produce a preconstructed owner with no row storage. This state shall admit destruction, ordinary copying/assignment, complete-owner swapping and first allocation/construction. Size, element, iterator, memory and validity queries shall require a constructed row. A constructed zero-length row shall be distinct from a preconstructed owner and shall admit ordinary constructed-row queries. Calls shall use live valid owners, nonoverflowing supported sizes/capacities and sufficient resources; failures shall not be successful numerical results.

PPL-SPEC-000652
2. Allocation and positive-infinity row construction PPL-SPEC-000652

On a preconstructed owner, allocate(capacity) shall acquire storage for at least the requested capacity and produce a constructed row of logical size zero. construct(size,capacity) and the corresponding sizing constructor shall construct exactly size logical entries, each initialized to positive infinity, with at least capacity storage. The one-size forms shall use the requested size as their capacity request.

Calls shall require 0 ≤ size ≤ capacity ≤ max_size(). Zero logical size and zero capacity request shall be admitted; a configured one-element-tail representation may reserve one physical slot for that request without creating a logical entry. Postconstruction/allocation shall not be repeated on an already allocated owner. Element lifetimes and failure states shall obey 🔗 10. Row construction cleanup and recoverable failure states.

PPL-SPEC-000653
3. Independent row copies and enlarged copies PPL-SPEC-000653

Ordinary copy construction shall preserve a source's construction state. A constructed source shall yield an independently owned sequence of the same size and values; a preconstructed source shall yield a preconstructed target. The explicit-capacity copy shall require a constructed source and capacity at least its size. The size/capacity copy shall additionally require the new size to be at least the source size and at most capacity; it shall preserve source entries and initialize every additional entry to positive infinity.

Successful copying shall not alter the source. Later changes or destruction of either owner shall not change the other's values. A source supplied through an rvalue shall use ordinary copy construction; no distinct move operation shall be required. Each capacity shall satisfy 🔗 2. Allocation and positive-infinity row construction; failed construction shall follow 🔗 10. Row construction cleanup and recoverable failure states.

4. Row assignment and ownership-preserving swaps PPL-SPEC-000654

Assignment shall replace the target with an independent ordinary copy of the source's values and construction state and return the target wrapper. It shall admit distinct owners and self-assignment. A recoverable failure preparing the replacement shall preserve the prior complete target and source. Assignment from a preconstructed source shall release old target storage and leave the target preconstructed.

Member/free swap shall exchange complete owned implementations and their construction states without coefficient copying or allocation, admitting preconstructed, constructed, empty and self-swapped rows. Existing element references/iterators shall retain the same live objects, now owned by the other row. Row iter_swap shall perform that whole-owner exchange at two valid vector positions. Old target borrows after replacement assignment shall not be reused. 🔗 1. Extended-number row meaning and construction states shall apply.

5. Row sizes, supported limits, coefficient ranges and equality PPL-SPEC-000655

size() shall return the logical entry count of a constructed row. max_size() shall report an element-count bound compatible with the representable allocation extent including implementation metadata; available memory may impose a lower limit. At 0 ≤ i < size(), subscript access shall return the exact mutable or const stored entry reference.

Mutable and const begin/end shall span those same logical entries in order, with equal endpoints for a constructed empty row. Their random-access pointer adapters shall retain 🔗 1. Pointer-adapter types and borrowed storage through 🔗 6. Pointer-adapter compatible comparisons and mixed distance. Equality of two constructed rows shall mean equal sizes and pairwise equal element values under the selected T equality; inequality shall negate it. Equality shall not depend on spare capacity or ownership addresses. Queries shall not change entries or ownership.

Member overloads that return references, iterators or nonowning views into the owner shall require an lvalue owner. Matching rvalue calls that would produce such borrows shall be rejected during overload resolution. Temporary iterator and row-view values shall remain usable while their backing owner remains alive.

PPL-SPEC-000656
6. Within-capacity expansion and suffix destruction PPL-SPEC-000656

Expansion shall require a constructed row and a new size between its current size and actual capacity. It shall retain all existing entries and construct each added logical position as positive infinity. Shrinking shall require a new size no greater than the current size, retain the prefix and destroy the removed suffix in reverse construction order. Re-expanding previously removed positions shall create fresh infinity entries, without restoring their former values.

Both operations shall retain backing capacity and all surviving prefix objects/addresses. Borrows of destroyed suffix entries shall become invalid. Zero/no-op sizes shall be admitted. If a recoverable element construction failure interrupts expansion, the row shall retain its old prefix plus exactly the successfully constructed new prefix and record that logical size; it shall remain destructible and reusable under 🔗 10. Row construction cleanup and recoverable failure states.

7. Pointwise upward conversion of extended-number rows PPL-SPEC-000657

Upward-approximation construction shall require a preconstructed target, a constructed source, and an admitted capacity at least the source size. It shall produce the same logical size, independently owning a converted value at each source coordinate. Each successfully converted finite value shall be an upper bound on its exact source value under the selected conversion's supported ROUND_UP semantics; exactly representable conversions shall preserve that value. Admitted signed infinities shall retain their extended-number meaning.

Conversion shall preserve the source. Selected source/target policies shall support all requested values and rounding directions, with every arithmetic/resource precondition active. Empty constructed sources shall produce constructed empty targets. Recoverable failures shall follow 🔗 10. Row construction cleanup and recoverable failure states and shall not be reported as successful bounds.

8. Row storage and live-payload memory accounting PPL-SPEC-000658

For a constructed row and its actual physical capacity, the explicit- capacity external-memory query shall account for the complete allocated implementation, coefficient-slot storage and owned external payload of every physically live coefficient object, including a configured fallback's live first object at logical size zero. Total memory shall additionally include the row wrapper itself. Capacity supplied to these exact queries shall describe the actual allocation, including a one-slot minimum imposed by the configured tail representation.

Queries without supplied capacity shall return lower bounds consistent with known logical size and available capacity metadata. Their total- minus-external difference shall equal the wrapper size. Memory arithmetic shall be representable in memory_size_type and element memory hooks shall accurately describe their owned payload. Queries shall not change row values, element lifetimes or ownership.

9. Constructed-row validity checks and diagnostic metadata PPL-SPEC-000659

On a constructed row with valid storage and an admitted actual capacity, OK(expected_size,expected_capacity) shall return false for a mismatched logical size or for an entry that fails its own OK() hook or represents NaN. A row with matching size and valid non-NaN entries shall pass these checks. The configured extra-debug representation shall additionally compare its stored capacity with supplied capacity metadata and ensure logical size fits that stored capacity, treating the configured one-slot minimum for zero request consistently.

Ordinary configurations shall not be required to retain/check capacity metadata. This query shall not repair entries or validate unconstructed storage. An exception from an element hook shall propagate with the hook's own state guarantee; node ownership shall remain with the row.

10. Row construction cleanup and recoverable failure states PPL-SPEC-000660

A recoverable backing-allocation failure shall release incomplete storage; failed first allocation shall leave a postconstruction receiver preconstructed. Failure of a sizing/copy constructor shall destroy every completed coefficient and release all storage of the incomplete owner, preserving the source. Failed replacement assignment shall retain 🔗 4. Row assignment and ownership-preserving swaps.

If a postconstruction or within-capacity expansion call fails after acquiring storage, its receiver shall remain constructed with the successfully completed coefficient prefix recorded in its logical size. It shall retain owned storage and admit destruction, valid shrinkage, copying and a valid expansion retry. It shall not require a repeat of first allocation on the already allocated receiver. No completed element shall be leaked or destroyed twice. A configured fallback's already-live first physical element shall retain its correct lifetime even at logical size zero. These guarantees shall apply to supported recoverable C++ exceptions rather than fatal GMP allocation failure or violated inputs.