Parma Polyhedra Library requirements
Core data structure low-level requirements
  • PPL-HLR-000009
    9. Semantics-preserving support for variable-size problems PPL-HLR-000009

    PPL shall support the representation and manipulation of finite-dimensional numerical data at variable problem sizes, preserving the association between coordinates and values when data are resized, reordered or transformed, subject to documented dimension and resource limits.

PPL-LLR-000141
1. Injective partial coordinate maps PPL-LLR-000141

Within the documented insertion preconditions, a partial coordinate map shall represent an injective mapping from selected dimension indices to dimension indices. Lookup of a mapped coordinate shall return its associated image; lookup of an unmapped coordinate shall report absence without changing the caller's output value. Empty-codomain and maximum-image queries shall distinguish the empty map from a nonempty map.

  • PPL-SPEC-001202
    5. Injective partial remapping of octagonal coordinates PPL-SPEC-001202

    map_space_dimensions(mapping) shall existentially discard entry coordinates outside the mapping domain and place each retained coordinate i at target index f(i). For a positive-dimensional receiver, the admitted mapping shall be a partial injection from {0, …, n − 1} with image exactly {0, …, m − 1} for some m ≤ n. The concrete result shall be

    {(xf − 1(0), …, xf − 1(m − 1)) ∣ x ∈ X}.

    The result shall have dimension m. An empty mapping shall project to the zero-dimensional value. A permutation shall retain all renamed relationships; an identity mapping shall preserve the value. The exactness, rounded enclosure and empty-set guarantees of 🔗 3. Existential removal of selected octagonal coordinates shall apply to the projection part.

    The mapping type shall supply logically const has_empty_codomain(), max_in_codomain() and maps(i,j) queries with the meanings of [LINK: PPL-SPEC-000004], 🔗 5. Exact empty-codomain query and 🔗 6. Largest image and defined empty-map failure. Queries shall describe one stable mapping throughout the call. A zero-dimensional receiver shall remain unchanged without querying the mapping. Otherwise has_empty_codomain() shall be queried first; when it returns true, neither remaining query shall be called. For a nonempty image the maximum query shall precede individual mapping queries. No fixed count or order of maps queries shall be required. The mapping's value shall remain unchanged apart from effects explicitly permitted by its query contract.

    Violating injectivity, source bounds, the contiguous-image condition or query consistency shall be outside admitted use. In particular, output-index holes shall not denote newly introduced free coordinates. Exceptions from mapping queries shall propagate; no rollback of the receiver shall be inferred after such an exception.

    The supported coefficient profiles, real-set interpretation, initialization, numerical-intermediate, native floating-point runtime and synchronization conditions of 🔗 1. Octagonal values, numerical profiles and valid use shall apply. Supplied coordinate objects shall satisfy their own valid-use contracts. Declared numerical, allocation and cooperative-abandonment exceptions may propagate. Temporary resources acquired by the operation shall be released on exceptional return; the receiver shall remain safely destructible, but preservation of its entry represented set shall not be inferred unless stated above.

  • 1. Public partial coordinate-map type and valid use PPL-SPEC-000001

    The public C++ interface shall expose Partial_Function as a value type representing a finite injective partial map M from dimension indices to dimension indices. Each mapped source shall have exactly one image, and distinct mapped sources shall have distinct images. Neither a stored source nor a stored image shall equal the reserved value not_a_dimension(), the maximum value of dimension_type. An unmapped index shall have no image.

    The map shall impose no implicit ambient dimension, contiguity of mapped indices, or requirement that its images cover a contiguous range. Limits on achievable storage shall remain distinct from the index type's value range and from the coordinate limits of numerical objects consuming a map. In particular, the insertion range shall not be narrowed to the smaller range accepted by Variable formatting.

    Operations on existing objects shall require live, valid maps. Successful moves between distinct objects shall leave the source as a valid empty map, as defined by 🔗 9. Move construction and empty source and 🔗 10. Move assignment and empty source. Within the library's supported thread-use contexts, callers shall prevent unsynchronized mutation of an instance while another call observes, copies or prints it, and shall serialize mutations of that instance. No additional concurrent-use regime shall be inferred from the type being a value type.

  • PPL-SPEC-000002
    2. Empty partial-map construction PPL-SPEC-000002

    Successful default construction shall create a valid Partial_Function whose domain and image are empty, with the meaning and use conditions of 🔗 1. Public partial coordinate-map type and valid use. No index shall initially be mapped. If construction fails through a supported C++ exception, resources acquired for the incomplete object shall be released and no constructed map shall be returned.

  • 3. Injective insertion and failure atomicity PPL-SPEC-000003

    For a valid map as defined by 🔗 1. Public partial coordinate-map type and valid use, insertion shall require both indices to differ from not_a_dimension(), the source index to be absent from the current domain, and the proposed image to be absent from the current image set. A successfully completed insertion of i and j shall add exactly the pair M(i) = j, preserve every existing pair and leave every other absent source unmapped. Gaps introduced by storage growth shall not become mappings. The operation shall permit image zero and noncontiguous source and image sets.

    Storage-capacity or allocation failure shall be reported through the corresponding C++ exception, including std::length_error or std::bad_alloc where applicable. Such a failed insertion shall leave the represented map unchanged and valid for subsequent queries, insertion, assignment and destruction.

    Violation of the insertion preconditions shall be outside the supported contract. Assertion diagnostics shall not be required in every configuration, and no defined success or failure outcome shall be promised for such a call.

  • PPL-SPEC-000004
    4. Exact partial-map lookup and unchanged absent output PPL-SPEC-000004

    For a valid map under 🔗 1. Public partial coordinate-map type and valid use, lookup of i shall return true exactly when i ∈ dom(M). On true, it shall assign M(i) to j. On false, it shall leave j unchanged. The represented map shall remain unchanged. Every dimension_type value shall be admissible as a lookup index; in particular, lookup of not_a_dimension() shall return false without changing j. The same caller variable may supply the index value and receive the image; the index used for lookup shall be its value on entry to the call.

  • 5. Exact empty-codomain query PPL-SPEC-000005

    For a valid map under 🔗 1. Public partial coordinate-map type and valid use, has_empty_codomain shall return true exactly when the represented partial map has no pairs, and shall leave the map unchanged. A nonempty map whose largest image is zero shall return false. Stored capacity or unused source positions shall not determine the mathematical answer.

  • 6. Largest image and defined empty-map failure PPL-SPEC-000006

    For a nonempty valid map under 🔗 1. Public partial coordinate-map type and valid use, max_in_codomain shall return the largest image value, independently of insertion order and of the largest source index. If the valid map is empty, the call shall throw std::runtime_error rather than return a maximum value. The map shall remain unchanged on either outcome. The empty call shall be a defined failure case, not an excluded precondition. Exact exception-message text is not prescribed; ordinary C++ runtime/resource conditions for reporting the exception apply.

  • PPL-SPEC-000007
    7. Independent copies, assignment and owned-storage cleanup PPL-SPEC-000007

    Copy construction shall require a live, valid source map under 🔗 1. Public partial coordinate-map type and valid use. Successful copy construction shall create a distinct value with exactly the source's mapping. Copy assignment shall require live, valid source and target maps and, on success, shall replace the target's old map with exactly the source's mapping. Subsequent valid insertion into either distinct value shall not change the other's mapping. Successful self-copy-assignment shall preserve the map. Successful copy assignment shall return a reference to its target, including self-copy-assignment.

    Failed copy construction shall release resources acquired for the incomplete target and shall leave the source unchanged. Failed copy assignment shall leave both source and target unchanged and valid for subsequent use. Destruction of a live map shall release its owned storage without releasing another map's storage. The caller shall not access an object after its lifetime ends.

  • 8. Coordinate-map diagnostic printing and output failures PPL-SPEC-000008

    Printing shall observe a valid map under 🔗 1. Public partial coordinate-map type and valid use without changing its represented mapping. Calls shall require the library and calling thread's applicable initialization protocol to have established a valid active Variable output function under 🔗 7. Active Variable formatter and initialized thread state and 🔗 3. Thread initialization, default state and finalization. Callers shall obey the supported thread regime and synchronize changes to the active formatter and access to a shared stream; the formatter shall not mutate the printed map during the call.

    When the map is empty and output succeeds, print shall write the literal text "empty", a newline and a flush. For a nonempty map whose source and image indices are all constructible as Variable objects, successful output shall process pairs in increasing source order. For each pair it shall write the source Variable using the Variable formatter active for that write, the literal separator " --> ", the image Variable using the formatter active for its write, and a trailing newline. Each Variable write shall use the formatter then active in the calling thread where formatting state is thread-specific; names shall not be fixed independently of it. A callback's permitted change to that formatting state may therefore affect subsequent Variable writes. Text insertions shall honor the stream's current formatting state. Specified literals identify the inserted character sequences, not a canonical byte layout independent of that state. Printing shall not promise restoration of formatting state changed by a formatter.

    A map index outside Variable's accepted identifier range shall be permitted to cause std::length_error during printing, without changing the map. Stream, formatter and resource failures may also propagate their C++ exceptions. Stream failure without an enabled exception shall be observable through the stream state; a normal void return shall not alone establish complete output. After any such failure the output may be partial, but the map shall remain valid and unchanged. Exact diagnostic messages are not prescribed.

  • PPL-SPEC-000009
    9. Move construction and empty source PPL-SPEC-000009

    Move construction from a valid map under 🔗 1. Public partial coordinate-map type and valid use shall create a distinct valid map with exactly the source's mapping on entry and shall leave the source as a valid empty map. The source shall support the same queries, insertions, assignments and destruction as any other empty map. Subsequent valid changes to either object shall not change the other's map.

    If construction of the destination's empty storage fails, resources acquired for the incomplete destination shall be released and the source shall remain unchanged and valid. After the empty storage has been constructed, transferring the represented map shall not allocate storage or throw.

    The move constructor's exception specification shall be nonthrowing exactly when default construction of its configured storage containers is nonthrowing, as expressed by the declaration below. The debug codomain container shall contribute to that condition only when present.

  • PPL-SPEC-000010
    10. Move assignment and empty source PPL-SPEC-000010

    Move assignment between distinct valid maps under 🔗 1. Public partial coordinate-map type and valid use shall replace the target's mapping with exactly the source's mapping on entry and leave the source as a valid empty map. Both maps shall support subsequent queries, insertions, assignments and destruction. Subsequent changes to either map shall not change the other's represented value.

    Self-move-assignment shall leave the map unchanged. Move assignment shall return a reference to its target, including self-move-assignment. It shall not allocate storage or throw. Storage retained by an empty map shall remain owned by that map and shall not imply the presence of any mapped pair.

  • PPL-HLR-000009
    9. Semantics-preserving support for variable-size problems PPL-HLR-000009

    PPL shall support the representation and manipulation of finite-dimensional numerical data at variable problem sizes, preserving the association between coordinates and values when data are resized, reordered or transformed, subject to documented dimension and resource limits.

PPL-LLR-000142
2. Finite bit-set row semantics PPL-LLR-000142

A bit row shall represent a finite set of nonnegative positions and preserve ordinary set semantics for membership, insertion, removal, union, intersection, difference, and inclusion. Ordered traversal shall return exactly the represented positions in the requested direction, with the documented absence indication when no qualifying position exists. Prefix updates shall preserve positions outside their specified update range.

  • PPL-SPEC-000461
    1. Rectangular Boolean values and valid internal use PPL-SPEC-000461

    Bit_Matrix shall own a rectangular Boolean array B with r rows and c columns. Its stored row i shall represent exactly {j ∣ 0 ≤ j < c∧Bij} under 🔗 1. Finite bit-set row values and valid use. Set bits outside the declared column range shall violate the matrix invariant, even though the corresponding Bit_Row value alone is valid.

    Operations shall require live valid objects and indices, counts and capacity calculations within their supported representable and storage limits, with sufficient resources. Callers shall prevent concurrent access conflicting with mutation. No library or thread initialization object or coefficient-constant stage shall be required. Allocation or interruption failure shall not constitute a successful matrix result. Failed C++ construction shall release resources owned by its incomplete object. Surviving owners shall remain destructible; rollback shall apply only where the individual contract promises it. Ordinary allocation-failure recovery shall not be promised for fatal GMP allocation failure.

  • PPL-SPEC-000468
    8. Row sorting and duplicate elimination PPL-SPEC-000468

    A successful sort_rows() shall preserve the column count and replace the row sequence by its distinct row values in increasing Bit_Row comparison order, as defined by 🔗 8. Least-significant differing-position total order. At the least position where two row values differ, the row without that bit shall precede the row with it. Sorting shall preserve each retained row's complete bit set, admit zero or one row, and be idempotent. Sorting shall not preserve former row-index associations.

  • PPL-SPEC-000469
    9. Membership in a sorted row sequence PPL-SPEC-000469

    Given a matrix whose row sequence is actually nondecreasing under the order in 🔗 8. Row sorting and duplicate elimination, sorted_contains(row) shall return true exactly when one stored row has the same finite set of true positions as the query. It shall preserve the matrix and query and admit a query borrowed from the matrix. A query may contain positions beyond the matrix width, in which case it cannot equal a valid stored row. An empty matrix shall report absence.

  • PPL-SPEC-000470
    10. Recycled row insertion transfers ownership PPL-SPEC-000470

    A successful recycled-row insertion shall append the donor's previous bit set and preserve all earlier rows and the column count. The donor shall be a separate live row, not borrowed from the target matrix, with all set positions below the matrix width. The resulting row count shall fit the row-storage limit. After successful return the donor shall be empty and reusable; the appended row shall own its storage independently of subsequent assignment to or destruction of the donor.

  • 1. Finite bit-set row values and valid use PPL-SPEC-000441

    Bit_Row shall represent a finite set S of nonnegative bit positions, independently of the configured Coefficient type. It shall have no declared matrix width: an unset position beyond the highest stored position shall remain absent. ULONG_MAX shall be reserved as the absence indication for traversal, rather than an inserted member.

    Operations shall require live valid objects and sufficient resources, with mutating positions/counts within the supported GMP storage limits and nonoverflowing capacity calculations. Callers shall prevent concurrent access to a row while another operation modifies it. No library or thread initialization object or coefficient-constant stage shall be required. Storage allocation failure shall not be a successful set result. Failed C++ construction shall release resources owned by its incomplete object; ordinary allocation-failure recovery shall not be promised for a fatal GMP allocation failure. Successfully constructed owners shall remain independently destructible.

  • PPL-SPEC-000442
    2. Empty construction, owned copying and bit-row lifetime PPL-SPEC-000442

    Default construction shall represent the empty set. Copy construction and assignment shall preserve the source set and establish independent owned storage. Assignment shall return its target and admit self-assignment. Copies shall remain usable after source mutation or destruction. Destruction shall release the GMP storage owned by the row. Copying an rvalue through these copy interfaces shall not change its source.

  • PPL-SPEC-000443
    3. Individual bit membership, insertion and removal PPL-SPEC-000443

    For any admitted position k, set(k) shall replace S by S∪{k} and clear(k) by S⧵{k}. Repeating either operation shall be idempotent and preserve every other membership. operator[](k) shall return true exactly when k ∈ S. Membership queries shall admit every unsigned long argument, including ULONG_MAX, and shall not grow storage merely to inspect an absent high position. Querying shall preserve the row.

  • PPL-SPEC-000444
    4. Bit prefixes, suffix removal and complete clearing PPL-SPEC-000444

    set_until(k) shall replace S by S∪{i ∣ 0 ≤ i < k}, retaining all entry members at or above k. clear_from(k) shall replace S by {i ∈ S ∣ i < k}. clear() shall replace S by the empty set. Setting a zero-length prefix shall do nothing; clearing from zero shall remove every member. Repeating these operations shall be idempotent. Mutation limits and resource conditions shall follow 🔗 1. Finite bit-set row values and valid use.

  • PPL-SPEC-000445
    5. Set union, intersection and difference with aliased operands PPL-SPEC-000445

    The two-source constructor shall represent Y∪Z. union_assign(x,y), intersection_assign(x,y) and difference_assign(x,y) shall replace the target by X∪Y, X∩Y and X⧵Y, respectively, using both operand sets on entry. Either or both operands may designate the target, including all-three-equal calls. A distinct source shall remain unchanged.

    union_assign_and_count(x,y) shall replace the target by the same entry union and return its exact number of set bits, with the same source-alias and capacity-retention guarantees as union_assign.

    Union assignment shall retain the target's allocated bit capacity when it is sufficient for the result and shall not shrink that capacity.

    Difference shall use a lazily owned unbounded-integer temporary. In a non-thread-safe configuration, calls shall be serialized against other PPL arithmetic sharing that temporary machinery, even on distinct row objects. In a thread-safe configuration the pool shall belong to the calling thread. No explicit initialization shall be required for this temporary ownership.

  • PPL-SPEC-000446
    6. Ordered bit traversal, cardinality and absence PPL-SPEC-000446

    first() and last() shall return the minimum and maximum members of S, respectively. next(p) shall return the least member strictly greater than p; prev(p) shall return the greatest member strictly less than p. Each shall return ULONG_MAX when no such member exists. The position arguments shall admit the full unsigned long range: next(ULONG_MAX) and prev(0) shall report absence, while prev(ULONG_MAX) shall return the last member of a nonempty row.

    count_ones() shall return |S|, and empty() shall be true exactly for the empty set. These queries shall preserve the row and shall not allocate storage merely to inspect high positions.

  • PPL-SPEC-000447
    7. Bit-set equality and inclusion predicates PPL-SPEC-000447

    operator== shall be true exactly when the operand sets are equal; operator!= shall be its negation. Both subset_or_equal forms shall return true exactly for X ⊆ Y. On a true result, the output strict_subset shall be true exactly for X ⊊ Y; its value after a false result shall be unspecified. The separate strict_subset function shall return true exactly for proper inclusion. All row operands shall remain unchanged, and they may designate the same object.

  • PPL-SPEC-000448
    8. Least-significant differing-position total order PPL-SPEC-000448

    compare(x,y) shall return zero for equal sets. Otherwise, let k = min(X△Y) be the smallest position whose membership differs. It shall return 1 when k ∈ X and  − 1 when k ∈ Y. The result shall define a total order in which a proper subset precedes its superset. It shall compare membership starting at the least significant differing position, including when that order differs from comparing the sets' binary integers numerically. Both operands shall remain unchanged and may designate the same row.

  • PPL-SPEC-000449
    9. Bit-row owner exchange and vector element exchange PPL-SPEC-000449

    Member/free swaps shall exchange the complete represented sets and their owned storage without changing either owner object's identity. Self-swap shall preserve its value. iter_swap shall exchange the rows at two valid iterators into live std::vector<Bit_Row> objects, including equal iterators, and shall preserve all other vector elements and vector shape. The vector iterators shall remain valid when they were valid on entry. Subsequent mutation and destruction of an exchanged row shall remain independent of every other row.

  • PPL-SPEC-000450
    10. Bit-row validity and allocated-memory accounting PPL-SPEC-000450

    For a valid row, OK() shall return true. The validity condition shall require nonnegative used-limb count no greater than allocated-limb count, and a nonzero highest used limb whenever any limb is used. external_memory_in_bytes() shall report the allocated GMP limb payload in bytes, including spare allocated limbs. total_memory_in_bytes() shall return sizeof(Bit_Row) + external_memory_in_bytes(). These queries shall preserve the row and its represented set. An empty set shall not require its owned allocation to have been released.

  • PPL-SPEC-001648
    11. Translation of bit-row member positions PPL-SPEC-001648

    shift_left(count) shall replace the entry set S by {k + count ∣ k ∈ S}. Every resulting member shall be less than ULONG_MAX; the caller shall ensure this bound before the call. A zero shift shall preserve the set. An empty set shall remain empty for every unsigned long count, including ULONG_MAX, without growing its owned storage. Translation shall preserve the number of members and shall not change independently owned copies.

    Valid use and resource conditions shall follow 🔗 1. Finite bit-set row values and valid use.

  • PPL-HLR-000009
    9. Semantics-preserving support for variable-size problems PPL-HLR-000009

    PPL shall support the representation and manipulation of finite-dimensional numerical data at variable problem sizes, preserving the association between coordinates and values when data are resized, reordered or transformed, subject to documented dimension and resource limits.

PPL-LLR-000143
3. Bit-matrix coordinate preservation PPL-LLR-000143

A bit matrix shall preserve the association between row and column positions when it is resized or transposed within supported dimensions. Resizing shall retain entries in the common old and new coordinate range, discard removed entries, and initialize newly introduced entries to false. Transposition shall exchange row and column positions and their dimensions without changing entry values.

  • PPL-SPEC-000461
    1. Rectangular Boolean values and valid internal use PPL-SPEC-000461

    Bit_Matrix shall own a rectangular Boolean array B with r rows and c columns. Its stored row i shall represent exactly {j ∣ 0 ≤ j < c∧Bij} under 🔗 1. Finite bit-set row values and valid use. Set bits outside the declared column range shall violate the matrix invariant, even though the corresponding Bit_Row value alone is valid.

    Operations shall require live valid objects and indices, counts and capacity calculations within their supported representable and storage limits, with sufficient resources. Callers shall prevent concurrent access conflicting with mutation. No library or thread initialization object or coefficient-constant stage shall be required. Allocation or interruption failure shall not constitute a successful matrix result. Failed C++ construction shall release resources owned by its incomplete object. Surviving owners shall remain destructible; rollback shall apply only where the individual contract promises it. Ordinary allocation-failure recovery shall not be promised for fatal GMP allocation failure.

  • PPL-SPEC-000462
    2. Empty and explicitly shaped construction and extent queries PPL-SPEC-000462

    Default construction shall produce shape 0×0. Construction with row and column counts shall produce that exact shape with every entry false, including shapes with zero rows or zero columns. num_rows() and num_columns() shall return the corresponding extents without mutation. max_num_rows() shall report the row-vector storage limit; it shall not promise that every shape up to that row count is practically allocatable or impose an independent column bound.

  • PPL-SPEC-000463
    3. Owned copies, assignment, exchange and lifetime PPL-SPEC-000463

    Copy construction and assignment shall preserve both source extents and all entries while establishing independent storage. Assignment shall return its target and admit self-assignment. A copy shall remain usable after source mutation or destruction. Copying an rvalue through these copy interfaces shall preserve its source. Destruction shall release the row-vector storage and the bit storage owned by its rows.

    Member and free swaps shall exchange complete shapes and row contents, including storage ownership, and admit self-swap. The resulting owners shall remain independent.

  • PPL-SPEC-000464
    4. Borrowed indexed row access PPL-SPEC-000464

    For 0 ≤ i < r, indexed access shall return a borrowed reference to stored row i, with a const reference for a const matrix. Mutating that row shall affect exactly its represented entries. Callers shall retain no reference across owner destruction or a matrix operation that can replace, reallocate, remove or reorder its row storage. Before using other matrix operations, callers shall ensure that every set position in a mutated row is below the current column count; the validity query may inspect a live row that violates this width condition.

    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-000465
    5. General resizing preserves the common rectangle PPL-SPEC-000465

    A successful resize(r2, c2) shall establish shape r2×c2. For each coordinate retained in both the old and new rectangles it shall preserve the previous entry. Every newly introduced entry shall be false. Removed rows and columns shall be discarded, so later growth shall not restore their former true values. The operation shall admit unchanged extents and all combinations of zero extents.

  • PPL-SPEC-000466
    6. Trailing removal and clearing PPL-SPEC-000466

    With a count no greater than the row count, trailing-row removal shall discard exactly that suffix and preserve all retained entries and the column count. With a count no greater than the column count, trailing-column removal shall decrease the width by that count and preserve the row count and remaining entries. This column operation shall require all removed columns to be false; it shall not replace the bit-clearing semantics of general resizing. Both removals shall admit a zero count.

    clear() shall release row-vector and owned bit storage and establish shape 0×0, from which ordinary construction by mutation shall remain possible.

  • PPL-SPEC-000467
    7. Transposition and transposed assignment PPL-SPEC-000467

    Transposition of a shape r×c shall produce shape c×r and satisfy B’ji = Bij at every original coordinate. Transposed assignment shall replace its target with the transpose of the source, preserving a distinct source. It shall also admit the source being its target. A recoverable failure before the replacement is installed shall preserve the target. Zero extents shall be exchanged exactly, and transposing twice shall restore the original shape and entries.

  • PPL-SPEC-000468
    8. Row sorting and duplicate elimination PPL-SPEC-000468

    A successful sort_rows() shall preserve the column count and replace the row sequence by its distinct row values in increasing Bit_Row comparison order, as defined by 🔗 8. Least-significant differing-position total order. At the least position where two row values differ, the row without that bit shall precede the row with it. Sorting shall preserve each retained row's complete bit set, admit zero or one row, and be idempotent. Sorting shall not preserve former row-index associations.

  • PPL-SPEC-000469
    9. Membership in a sorted row sequence PPL-SPEC-000469

    Given a matrix whose row sequence is actually nondecreasing under the order in 🔗 8. Row sorting and duplicate elimination, sorted_contains(row) shall return true exactly when one stored row has the same finite set of true positions as the query. It shall preserve the matrix and query and admit a query borrowed from the matrix. A query may contain positions beyond the matrix width, in which case it cannot equal a valid stored row. An empty matrix shall report absence.

  • PPL-SPEC-000470
    10. Recycled row insertion transfers ownership PPL-SPEC-000470

    A successful recycled-row insertion shall append the donor's previous bit set and preserve all earlier rows and the column count. The donor shall be a separate live row, not borrowed from the target matrix, with all set positions below the matrix width. The resulting row count shall fit the row-storage limit. After successful return the donor shall be empty and reusable; the appended row shall own its storage independently of subsequent assignment to or destruction of the donor.

  • PPL-SPEC-000471
    11. Matrix equality includes both extents and all entries PPL-SPEC-000471

    Equality shall return true exactly when both row and column counts agree and every corresponding entry agrees. Inequality shall be its logical negation. The result shall ignore unused allocated capacity and admit aliases. Distinct zero-row widths and distinct zero-column row counts shall remain unequal.

  • PPL-SPEC-000472
    12. ASCII representation and loading PPL-SPEC-000472

    With decimal numeric formatting and numeric Boolean output selected on the stream, ASCII output shall emit the decimal row count, x and decimal column count, followed in row-major order by each entry as 0 or 1. Whitespace shall separate these tokens; each row shall have its own output line. No-argument output shall use the library diagnostic-output destination std::cerr. print() shall emit a diagnostic to std::cerr identifying that no user-level output operator is defined for Bit_Matrix.

    With decimal numeric input formatting, admissible dimensions and resources, loading shall read the shape header and exactly that many integer entry tokens, replace the target's complete shape and entries, and return true. Zero entry tokens shall denote false and nonzero integer tokens true. Invalid header tokens, invalid integer tokens or premature end of input shall return false; the target shall remain a live valid matrix, without a promise to preserve its preceding shape or entries. Tokens following a complete representation shall remain available to the caller. Successful dump/load round trips shall preserve both extents and every entry.

  • PPL-SPEC-000473
    13. Invariant, ordering and allocated-memory queries PPL-SPEC-000473

    For live rows with valid bit-row storage, OK() shall return true exactly when every row is valid and no row has a set position at or beyond the declared column count. In builds with assertions enabled, check_sorted() shall return true exactly when the stored rows are nondecreasing under their comparison order; duplicates shall be allowed.

    External memory shall equal the allocated row-vector capacity in bytes plus the external memory owned by each live bit row. Total memory shall add sizeof(Bit_Matrix). These queries shall describe allocated storage, including unused capacity retained after shrinkage, and shall preserve the matrix.

  • PPL-HLR-000009
    9. Semantics-preserving support for variable-size problems PPL-HLR-000009

    PPL shall support the representation and manipulation of finite-dimensional numerical data at variable problem sizes, preserving the association between coordinates and values when data are resized, reordered or transformed, subject to documented dimension and resource limits.

PPL-LLR-000144
4. Ordered coefficient-map semantics PPL-LLR-000144

Within supported key and capacity limits, the ordered coefficient map shall retain one coefficient value per stored dimension key and enumerate stored entries in increasing key order. Insertion of an existing key with an explicit value shall replace that value without creating a duplicate key; removal shall preserve all unrelated key-value associations. Stored values shall remain independent of the lifetime of the insertion argument.

  • PPL-SPEC-000616
    1. Default-value insertion retains an existing coefficient PPL-SPEC-000616

    Under 🔗 1. Ordered coefficient-map values and valid tree use, insertion of a valid key without an explicit value shall preserve an existing entry's coefficient and return its exact position. If the key is absent, it shall add one explicitly stored zero coefficient and return the new entry. Every other association shall be preserved. A new entry shall require the resulting count to be within max_size(). The library coefficient-zero constant shall be available where this form uses it. Ordinary entry iterators shall be reacquired after the call, except for its returned position; cached end references shall retain 🔗 9. Begin positions and owner-stable cached end references.

    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-000617
    2. Explicit insertion and replacement capture the argument value PPL-SPEC-000617

    Insertion with an explicit coefficient shall set the requested key to the argument's value on entry, creating the entry if absent or replacing its prior coefficient if present. The returned iterator shall denote that exact key and stored value. Every other association shall be preserved; zero shall remain an explicitly stored entry. A new entry shall require its resulting count to fit max_size().

    The argument may be an independent coefficient or a live coefficient borrowed from this tree, including the replaced entry. Its entry value shall be retained across rebalancing and backing-array relocation. No argument reference shall be retained by the stored coefficient. Clients shall reacquire ordinary iterators after insertion and shall not reuse old coefficient borrows after a new entry can invalidate them. Cached end references shall retain 🔗 9. Begin positions and owner-stable cached end references.

    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-000618
    3. Hinted insertion preserves the unhinted map result PPL-SPEC-000618

    Both hinted insertion forms shall admit any current valid iterator of the same tree, including end, as their hint. The hint shall not affect whether an entry is created or replaced, the returned key, or any resulting key/coefficient association. The default form shall satisfy 🔗 1. Default-value insertion retains an existing coefficient and the explicit-value form 🔗 2. Explicit insertion and replacement capture the argument value, including borrowed coefficient arguments. The hint shall be used only while valid within the call; clients shall reacquire ordinary iterators after return.

    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-000619
    4. Erasure by key returns the strict successor PPL-SPEC-000619

    Erasure by a valid key shall remove exactly that entry when present and otherwise preserve the map. It shall return the least remaining stored key strictly greater than the argument, or end if none exists. An empty tree shall return end. The reserved key value shall remain outside this mutation's key precondition even though it is an admitted absent lookup query. All surviving key/coefficient associations shall be preserved, including explicitly stored zeros. Ordinary iterators shall be reacquired after the call; cached end references shall remain valid.

    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-000620
    5. Erasure by occupied iterator removes exactly its entry PPL-SPEC-000620

    Iterator erasure shall require a live occupied iterator from its target tree, rather than end. It shall remove exactly that iterator's entry and return the least remaining stored key greater than the removed key, or end if none exists. Every surviving association shall be preserved. Other ordinary iterators and coefficient references shall be reacquired after this structural mutation; the returned position and cached end references shall remain usable.

    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-000621
    6. Coordinate removal and order-preserving reindexing PPL-SPEC-000621

    Coordinate removal shall admit a valid key k, remove its entry if present, and map every stored key q > k to q − 1 without changing its coefficient. Every key below k shall retain its key and value. This shall also apply when k is absent and to an empty map. The result shall contain exactly the transformed ordered map, including all surviving explicitly stored zeros. Ordinary iterators and coefficient references shall be reacquired; cached ends shall retain 🔗 9. Begin positions and owner-stable cached end references.

    erase_and_reindex(index_map) shall require a map covering every stored key. A value of not_a_dimension() shall select erasure; all other images of stored keys shall be valid and strictly increasing. The operation shall produce exactly those surviving entries with the mapped keys and unchanged coefficients, including explicitly stored zeroes. All erasures shall precede key renumbering. If an erasure allocation fails, the tree shall remain valid, possibly with some selected entries erased, and surviving keys shall retain their original numbering. Completed reindexing shall preserve cached-end behavior; ordinary iterators and coefficient references shall be reacquired.

  • PPL-SPEC-000622
    7. Positive coordinate insertion shifts the complete selected suffix PPL-SPEC-000622

    For threshold k and nonnegative amount n, the operation shall map each stored key q ≥ k to q + n and preserve its coefficient; all keys below k shall remain unchanged. Every actually transformed key shall remain a valid representable key, excluding the reserved value. If no key is affected, any representable threshold and amount shall be admitted without evaluating an overflowing key sum. Amount zero shall preserve the map.

    The operation shall retain the entry count, coefficient ownership, physical positions and current entry iterators. Existing iterators shall observe the transformed keys and unchanged coefficients. Cached ends shall remain valid.

  • PPL-SPEC-000623
    8. Fast leftward key replacement preserves occupied positions PPL-SPEC-000623

    Fast shifting shall require an occupied iterator at key q, a valid key i ≤ q, and no other stored key in [i, q). It shall replace exactly q by i, retaining its coefficient and every unrelated association. Choosing i = q shall be admitted. All current entry iterators and coefficient references shall remain valid; the selected iterator shall observe its new key at the same physical position. The map shall retain its entry count and owned storage, with no coefficient copying or allocation needed for the key replacement.

  • PPL-SPEC-000624
    9. Backing-array allocation failure preserves the prior map PPL-SPEC-000624

    When insertion or erasure requires replacement backing arrays, a recoverable failure allocating either replacement array shall preserve the prior complete map and its coefficient ownership, release incomplete replacement storage and retain valid cached ends. No insertion, removal or coordinate transformation shall be reported as a successful result when its required backing allocation fails. A retry with sufficient resources shall remain possible.

    This guarantee shall cover ordinary and hinted insertion, occupied/key erasure and erase-and-shift operations when they trigger a backing replacement. It shall not promise ordinary recovery after a fatal GMP allocation failure or after violation of a member's valid-input preconditions.

  • 1. Ordered coefficient-map values and valid tree use PPL-SPEC-000601

    CO_Tree shall own a finite map from distinct dimension_type keys to Coefficient values. Stored keys shall be strictly ordered and shall exclude not_a_dimension(). A stored zero coefficient shall remain a stored map entry. Physical array positions and holes shall not change the map's key/value associations.

    Calls shall require live valid owners, admitted keys/counts and supported nonoverflowing capacity calculations, with sufficient resources. Selected coefficient values and operations shall satisfy the configured arithmetic profile's prerequisites. Library initialization shall be active where coefficient constants or scratch storage are used, and synchronization shall follow 🔗 3. Thread initialization, default state and finalization. Recoverable failures shall not be successful map results. Failed construction shall release resources of the incomplete owner; failure-state guarantees shall follow the selected member, without a universal rollback promise.

  • PPL-SPEC-000602
    2. Empty construction, entry counts and supported count limit PPL-SPEC-000602

    Default construction shall produce an empty map with zero managed storage and equal begin/end positions. empty() shall report exactly whether no entries are stored, and size() their number, including stored zeros. max_size() shall report the supported element-count limit accounting for complete-tree capacities, density calculations and representable backing allocations; it shall not limit key magnitude to that count or promise that allocating the maximum is feasible.

  • PPL-SPEC-000603
    3. Independent copying, assignment and destruction PPL-SPEC-000603

    Copy construction and assignment shall preserve the source map and produce independently owned coefficient objects and backing arrays. Copies shall remain usable after source mutation or destruction. Assignment shall admit self-assignment and return its target. Copying a const rvalue through these copy interfaces shall preserve its source. Destruction shall release all live coefficients and both backing arrays.

    Recoverable copy-construction failure shall preserve the source and release the incomplete copy's resources. A recoverable assignment failure may discard the target's preceding contents, but shall leave a valid empty reusable target and preserve the source.

    Transfer construction from a non-const rvalue shall acquire the complete owned storage without allocating or throwing and leave its source empty and reusable. Move assignment shall exchange complete storage owners without allocation or exceptions, return its target and leave its source holding the preceding target value. Self-move shall preserve both value and storage. References to elements shall follow their storage; distinct-owner transfers shall invalidate element iterators. References to cached ends shall remain bound to their original tree owners and shall be refreshed after transfer. Explicitly stored zeroes and physical layout metadata shall be transferred with their arrays.

  • PPL-SPEC-000604
    4. Construction from a counted increasing-key input sequence PPL-SPEC-000604

    For a count not exceeding max_size(), sequence construction shall consume exactly that many entries from the input position. The sequence shall provide coefficient values by dereference and their keys through index(); keys shall be valid and strictly increasing. The new map shall contain exactly those key/value pairs, including zero values, as independently owned coefficient copies. No following input position shall be dereferenced or have its key requested. Count zero shall produce an empty map without dereferencing or advancing the input.

    If allocation, key access, dereference, coefficient construction or input advancement reports a recoverable exception, the incomplete tree shall release both backing arrays and every coefficient already constructed. The caller's input state shall follow its iterator's own copy and failure semantics; restoring a consumed input position shall not be promised.

  • PPL-SPEC-000605
    5. Clearing and swapping complete tree owners PPL-SPEC-000605

    Clearing shall destroy all entries and release backing storage, producing an empty reusable tree. Member and free swaps shall exchange complete maps and owned allocations and admit self-swap. Both resulting owners shall remain valid and independently usable. Their cached end-iterator objects shall retain their owner identities and be refreshed for their new maps; ordinary entry iterators and coefficient borrows shall be reacquired after an ownership exchange.

  • PPL-SPEC-000606
    6. Iterator ownership, copying, const conversion and equality PPL-SPEC-000606

    Tree iterators shall borrow positions in their owner. Copies and assignments shall preserve the borrowed position; assignment shall return its target and admit self-assignment. Mutable iterators shall convert or assign to const iterators without changing the position or entry. Member and free iterator swaps shall exchange their complete borrowed positions and admit self-swap, including positions in distinct live owners.

    Within one owner, equality shall report the same position and inequality its negation. Comparisons shall require live compatible positions; copied end values shall remain subject to ordinary structural invalidation. Default construction shall create an unbound iterator usable for copying, assignment, swapping and destruction, but not entry access or navigation before a live position is assigned. Iterators and coefficient references shall not outlive their owner or be used after a structural operation that invalidates them.

  • PPL-SPEC-000607
    7. Iterator key and coefficient access PPL-SPEC-000607

    At a dereferenceable occupied position, index() shall return the stored key and dereference shall return its associated coefficient value. A mutable iterator shall provide a mutable coefficient reference even when the cursor object itself is const; constness shall constrain the position rather than the referenced coefficient. Read-only access shall use const_iterator and Coefficient_traits::const_reference. Both iterator types shall meet C++20 bidirectional iterator requirements. These operations shall require an occupied entry, rather than an end or unbound iterator.

    Changing the coefficient through a live mutable reference shall update exactly that key's mapped value without changing keys, count, other entries or iterator positions. Assigning zero shall retain the entry. The new coefficient shall satisfy the configured profile's value and arithmetic prerequisites.

  • PPL-SPEC-000608
    8. Bidirectional iterator movement follows stored-key order PPL-SPEC-000608

    Increment of a dereferenceable iterator shall reach the next greater stored key or the owner's end after the last entry. Decrement shall require a preceding occupied entry and reach the next smaller stored key; decrementing end shall be admitted exactly for a nonempty owner. Physical holes shall be skipped. Prefix forms shall return the updated iterator by reference; postfix forms shall return its preceding value while advancing the original. These rules shall apply to mutable and const iterators, with no increment of end or decrement before begin.

  • 9. Begin positions and owner-stable cached end references PPL-SPEC-000609

    Mutable and const begin construction and access shall point to the least stored key, or the corresponding end for an empty map. cbegin() shall equal const begin(). End access shall return references to owner-resident cached end objects; const end() and cend() shall refer to the same const cached object.

    References to these cached end objects shall remain valid throughout the owner's lifetime and observe updated end positions after structural changes, assignment, clearing and member/free owner swaps. This special reference guarantee shall not extend to copies of an end iterator or to ordinary entry iterators.

    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. Direct iterator construction shall also reject a temporary tree owner.

  • 10. Whole-tree bisection returns an exact key or an adjacent entry PPL-SPEC-000610

    Whole-tree bisection shall return end for an empty map. For a nonempty map it shall return the exact requested key when present. For an absent key it shall return either the immediate stored predecessor or the immediate stored successor, choosing the available extreme when the query lies outside stored keys. It shall not return end for a nonempty map or promise the lower_bound choice. Every dimension_type query shall be admitted, including the reserved value as an absent query. Mutable and const overloads shall preserve all entries and return positions with the corresponding mutability.

    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-000611
    11. Closed-window bisection confines its candidate to that window PPL-SPEC-000611

    Window bisection shall require an ordered nonempty closed iterator range [first, last] in the same live tree, with both endpoints occupied. It shall search only that window. A present key in the window shall be returned exactly; an absent key shall yield an immediate predecessor or successor within that window, using its available endpoint when the query lies outside the window's key interval. A singleton window shall always return its sole entry. The map and both endpoints shall be preserved.

    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-000612
    12. Hinted bisection retains whole-tree lookup meaning PPL-SPEC-000612

    Hinted bisection shall admit any current valid iterator of its tree as hint, including end. It shall satisfy the exact-key, adjacent-absent-key and empty-map guarantees of 🔗 10. Whole-tree bisection returns an exact key or an adjacent entry over the whole tree, regardless of the hint's location. It shall preserve the map and hint. The hint may affect search strategy and the permitted choice between two adjacent absent-key candidates; it shall not restrict the search window.

    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-000613
    13. Managed storage counts backing arrays and live coefficient payloads PPL-SPEC-000613

    External-memory accounting shall return zero for a tree with no backing arrays. Otherwise it shall count the complete reserved key-array payload, including its two sentinel slots, the coefficient-array payload, including its unused leading slot, and the external storage of every live coefficient. Unoccupied coefficient slots shall not add coefficient payload. This shall describe owned allocated payload, excluding allocator bookkeeping, and preserve the map and all current iterators.

  • PPL-SPEC-000614
    14. Diagnostic tree output reflects current stored pairs PPL-SPEC-000614

    dump_tree() shall write a diagnostic representation to std::cout without changing the tree. For an empty map it shall emit (empty tree) followed by a newline. For a nonempty tree the output shall identify all current stored key/coefficient pairs and may include physical-layout information and holes. A removed key/value pair shall not be reported as a live entry. This diagnostic representation shall not establish a reloadable serialization format.

  • PPL-SPEC-000615
    15. Physical-slot iterator construction preserves the selected live position PPL-SPEC-000615

    Iterator construction from a tree and physical slot shall require a currently occupied slot or that tree's designated past-the-end slot. The argument shall denote a physical array slot, not a map key or an ordinal in the logical traversal. The resulting iterator shall borrow that same live position, with mutable/const access as selected.

    The tree's internal conversion from its live private node iterator to an ordinary mutable iterator, by construction or assignment, shall preserve the occupied node's key/value position. Such conversions shall require a valid occupied private node and shall not extend private node-layout access to clients without the corresponding access rights.

    Borrowing iterator constructors shall reject temporary backing owners. Copying temporary iterator values shall remain admitted when their backing storage remains alive.

  • PPL-SPEC-000283
    3. Sparse zero construction and storage limits PPL-SPEC-000283

    Sparse construction shall retain the requested logical size, initially with no stored entries. The compatibility capacity argument shall be ignored. size() shall report logical size and num_stored_elements() shall count stored positions, including explicitly stored zeroes. max_size() shall return CO_Tree::max_size(), the supported number of stored elements; logical extent and admissible dimension keys shall remain distinct from that storage count. The type shall opt out of the C++20 sized-range customization so that standard range distances count iterated entries, including explicitly stored zeroes, rather than the logical extent.

  • PPL-SPEC-000284
    4. Owning row copies, sized copies and storage conversion PPL-SPEC-000284

    Ordinary row copies shall preserve size and every coefficient, own independent storage and survive source mutation/destruction. Dense copies shall retain source capacity unless supplied another admitted capacity. A copy with specified size/capacity shall retain the common source prefix, discard removed positions and zero-extend added positions. Explicit dense capacity shall be at least result size; sparse compatibility capacity shall be ignored. Cross-storage construction shall preserve that same complete coefficient vector. Dense-to-sparse construction may omit zero entries; sparse-to-dense construction shall materialize implicit zeroes. Const-rvalue forms selecting copy constructors shall retain the source value.

  • PPL-SPEC-000285
    5. Row assignment, whole-row swaps and destruction PPL-SPEC-000285

    Successful copy assignment shall replace the complete vector, return the target, preserve its distinct source and admit self-assignment. Cross-storage assignment shall preserve values while retaining the target's row type. Copies shall remain independently mutable. Whole-row swaps shall exchange full vectors, including their sizes and owned storage; mixed dense/sparse swaps shall convert storage while exchanging vector values. Self-swaps shall retain value. iter_swap for two vector positions shall swap the owning dense rows. Destruction shall release owned coefficient and backing storage.

    Replacement allocation failure shall preserve the source; target-state guarantees shall follow 🔗 1. Internal coefficient-row values and valid use.

    For trivially destructible coefficient types, Dense_Row transfer construction from a non-const rvalue shall acquire the complete owned storage without allocating or throwing and leave its source empty and reusable. References to dense elements shall follow their storage; distinct-owner transfers shall invalidate element iterators.

    For other coefficient types, dense construction from rvalues shall retain independent, source-preserving copy behavior. Dense assignment from rvalues shall retain independent, source-preserving copy behavior for every coefficient type; self-assignment shall preserve the value.

    Sparse_Row construction and assignment from rvalues shall retain independent, source-preserving copy behavior, including logical extent and explicit stored zeroes. Its copy declarations shall prevent new backing-tree transfer operations from implicitly changing the row-level interface.

  • PPL-SPEC-000287
    7. Sparse resizing and removal of trailing stored positions PPL-SPEC-000287

    Sparse resizing shall retain the common coefficient prefix, erase stored entries outside a shortened extent and zero-extend an enlarged extent without materializing the new zeroes. shrink(n) shall require n <= size(); expand_within_capacity(n) shall require size() <= n and need no reserved-capacity argument. Size zero shall erase all stored entries. Changing logical extent shall not change values at retained coordinates.

  • PPL-SPEC-000288
    8. Indexed coefficient access and borrowed values PPL-SPEC-000288

    Indexed access and get(i) shall require i < size() and return the coefficient at that position. Const access shall not materialize missing sparse entries. Mutable dense access shall borrow the owned coefficient; mutable sparse access shall retain an existing stored coefficient or insert a stored zero and return its mutable reference. Mutating that reference shall update only its indexed value. A reference to an absent sparse value shall borrow the library zero constant and require its lifetime.

    Borrowed references shall not outlive their owners or the documented storage invalidation of an operation. Sparse insertion/removal or reorganization may invalidate previously borrowed entries and iterators. Values must be copied before an operation that can invalidate their reference, except where entry argument capture is explicitly specified.

    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. Const coefficient queries whose declared result type is an independent value shall also remain admitted for temporary owners.

  • PPL-SPEC-000290
    10. Sparse stored-entry traversal and cached end references PPL-SPEC-000290

    stored_entries() shall return a borrowed view bound to a live lvalue row. The view shall visit exactly the stored positions, including explicit zeroes, and expose their count through constant-time size() and empty() independently of logical width. Mutable and read-only views shall be sized bidirectional ranges; mutable cursors shall permit value updates without changing stored keys or count. A const view object shall retain its bound row's mutability. Temporary row owners shall be rejected.

    The view shall store the row binding without allocating or owning storage. Copies and queries shall follow the current row object through valid mutations and swaps; iterators already obtained retain the row's existing invalidation conditions. Iterators shall not depend on the view object's lifetime. The view need not have an unbound default state.

    Sparse iterators shall enumerate exactly stored entries in increasing index order, including explicitly stored zeroes. Implicit zeroes shall not appear. Dereference and index() shall report the stored coefficient and its key; mutable dereference shall permit replacement without changing the key. Bidirectional traversal and const conversion shall follow CO_Tree iterator contracts. A referenced end()/cend() sentinel shall belong to its live row and remain updated by mutations, while copied iterator values shall obey operation-specific invalidation. Swapping rows shall not transfer ownership of a cached reference to an end sentinel. Cached end references shall be available only from lvalue rows; mutable and const temporary owners shall be rejected. No sentinel shall be dereferenced.

    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.

  • 11. Indexed row search, lower bounds and hint independence PPL-SPEC-000291

    find(i) shall require an in-size index. Dense rows shall return its position even when zero; sparse rows shall return the stored entry if present and end() otherwise. lower_bound(i) shall admit i <= size() and return the first dense/stored sparse position with index at least i, or end() if none. A hint shall be a valid position or end sentinel for the same unchanged row and shall not affect the result. Const and mutable forms shall agree; searches shall not materialize sparse zeroes.

    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-000292
    12. Insertion and replacement with argument-value independence PPL-SPEC-000292

    Insertion shall require i < size() and return the indexed position. An explicit value shall replace that coefficient using its entry value, including when borrowed from another entry of the same row. No duplicate key shall be created. A value-free insertion shall retain an existing value, or create a stored zero in a missing sparse position. Dense value-free insertion shall return the existing logical slot unchanged. Hints shall have the validity and result-independence specified by 🔗 11. Indexed row search, lower bounds and hint independence. Sparse insertions may reorganize storage and invalidate earlier borrowed positions.

    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-000293
    13. Reset and clear preserve logical size PPL-SPEC-000293

    clear() shall set every logical coefficient to zero while retaining size; sparse clear shall remove every stored entry. Indexed reset shall zero the chosen in-size coefficient, removing its sparse entry if any. Dense range reset shall require first <= last <= size() and change exactly that half-open range. Dense iterator reset shall zero its live slot and return the following logical slot. Sparse iterator reset shall erase its stored slot and return the following stored slot; an iterator range shall erase exactly its stored half-open interval and return the first retained successor. Sparse_Row::reset_after(i) shall require i < size() and remove every stored position at or after i. Empty ranges shall be admitted.

    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-000295
    15. Coefficient swaps and constrained sparse key relocation PPL-SPEC-000295

    Indexed swaps shall require two in-size indices and exchange exactly their coefficient values, including implicit sparse zeroes. Iterator swaps shall require two live dereferenceable positions of the same row and exchange their values without exchanging their keys. Self-swaps shall retain value. Sparse fast_swap(i,pos) shall require an in-size index and lower_bound(i) == pos != end(); it shall move that stored entry to i, leaving its previous position implicitly zero. Its iterator shall remain valid and report the new index, and unrelated entries shall be retained.

  • PPL-SPEC-000300
    20. Row equality compares complete logical vectors PPL-SPEC-000300

    Equality shall return true exactly when logical sizes and all corresponding coefficient values agree. Dense/sparse pairing, allocation capacity and explicit versus implicit sparse zeroes shall not affect equality. Inequality shall be its Boolean negation. Equality shall preserve both operands and shall not equate rows merely because one has additional trailing zeroes.

  • PPL-SPEC-000302
    22. Sparse-row ASCII export, stored entries and validation PPL-SPEC-000302

    Sparse ASCII export shall report logical size, stored-element count and ascending indexed coefficients, including explicitly stored zeroes, in size n elements k [ i ]= a ... syntax with a terminating newline. Loading a complete compatible representation shall replace logical extent and stored entries and return true. Size zero with zero stored entries shall be valid. Malformed or missing keywords, counts, indices and coefficients, counts greater than the logical extent, and repeated, out-of-order or out-of-extent indices shall report false rather than successful construction of an invalid row. Trailing input shall remain available. No rollback shall be promised on failure; target ownership shall follow 🔗 1. Internal coefficient-row values and valid use. Diagnostic dump/print forms shall use this reloadable representation.

  • PPL-SPEC-000303
    23. Row invariants and memory-accounting queries PPL-SPEC-000303

    OK() shall report satisfaction of row structural invariants without changing values. Dense invariants shall include size <= capacity <= max_size() and backing-storage consistency; OK(n) shall additionally compare logical size with n. Sparse invariants shall require every stored index below logical size; its compatibility OK(capacity) shall ignore that argument.

    Memory queries shall return nonnegative accounting estimates without changing values. For both row types, total shall equal sizeof(row) + external. Dense external accounting shall include actual reserved coefficient slots and external storage owned by live coefficients. Sparse external accounting shall follow its coefficient tree. Compatibility capacity arguments shall not change the reported current storage; neither query shall promise exact allocator bookkeeping or available memory.

  • PPL-HLR-000009
    9. Semantics-preserving support for variable-size problems PPL-HLR-000009

    PPL shall support the representation and manipulation of finite-dimensional numerical data at variable problem sizes, preserving the association between coordinates and values when data are resized, reordered or transformed, subject to documented dimension and resource limits.

PPL-LLR-000145
5. Coordinate shifts preserve coefficient associations PPL-LLR-000145

For valid dimension-shift operations on the ordered coefficient map, each surviving coefficient shall remain associated with the coordinate obtained by the specified key transformation. Removing a coordinate and shifting later coordinates down shall remove only that coordinate's entry; inserting coordinate positions shall shift affected keys without altering their coefficient values or relative order.

  • PPL-SPEC-000621
    6. Coordinate removal and order-preserving reindexing PPL-SPEC-000621

    Coordinate removal shall admit a valid key k, remove its entry if present, and map every stored key q > k to q − 1 without changing its coefficient. Every key below k shall retain its key and value. This shall also apply when k is absent and to an empty map. The result shall contain exactly the transformed ordered map, including all surviving explicitly stored zeros. Ordinary iterators and coefficient references shall be reacquired; cached ends shall retain 🔗 9. Begin positions and owner-stable cached end references.

    erase_and_reindex(index_map) shall require a map covering every stored key. A value of not_a_dimension() shall select erasure; all other images of stored keys shall be valid and strictly increasing. The operation shall produce exactly those surviving entries with the mapped keys and unchanged coefficients, including explicitly stored zeroes. All erasures shall precede key renumbering. If an erasure allocation fails, the tree shall remain valid, possibly with some selected entries erased, and surviving keys shall retain their original numbering. Completed reindexing shall preserve cached-end behavior; ordinary iterators and coefficient references shall be reacquired.

  • PPL-SPEC-000622
    7. Positive coordinate insertion shifts the complete selected suffix PPL-SPEC-000622

    For threshold k and nonnegative amount n, the operation shall map each stored key q ≥ k to q + n and preserve its coefficient; all keys below k shall remain unchanged. Every actually transformed key shall remain a valid representable key, excluding the reserved value. If no key is affected, any representable threshold and amount shall be admitted without evaluating an overflowing key sum. Amount zero shall preserve the map.

    The operation shall retain the entry count, coefficient ownership, physical positions and current entry iterators. Existing iterators shall observe the transformed keys and unchanged coefficients. Cached ends shall remain valid.

  • PPL-SPEC-000623
    8. Fast leftward key replacement preserves occupied positions PPL-SPEC-000623

    Fast shifting shall require an occupied iterator at key q, a valid key i ≤ q, and no other stored key in [i, q). It shall replace exactly q by i, retaining its coefficient and every unrelated association. Choosing i = q shall be admitted. All current entry iterators and coefficient references shall remain valid; the selected iterator shall observe its new key at the same physical position. The map shall retain its entry count and owned storage, with no coefficient copying or allocation needed for the key replacement.

  • PPL-SPEC-000624
    9. Backing-array allocation failure preserves the prior map PPL-SPEC-000624

    When insertion or erasure requires replacement backing arrays, a recoverable failure allocating either replacement array shall preserve the prior complete map and its coefficient ownership, release incomplete replacement storage and retain valid cached ends. No insertion, removal or coordinate transformation shall be reported as a successful result when its required backing allocation fails. A retry with sufficient resources shall remain possible.

    This guarantee shall cover ordinary and hinted insertion, occupied/key erasure and erase-and-shift operations when they trigger a backing replacement. It shall not promise ordinary recovery after a fatal GMP allocation failure or after violation of a member's valid-input preconditions.

  • PPL-SPEC-000414
    14. System dimension changes and coordinate removal PPL-SPEC-000414

    Dimension setting shall require an admitted result dimension preserving every retained row kind's validity. It shall resize every row consistently, retaining low-index public coefficients and correctly relocating hidden fields. It shall zero-extend or truncate trailing public coordinates. Removing selected in-dimension variables shall apply each row's coordinate-removal operation, compact survivors in coordinate order and drop rows whose row-type transformation reports invalidity. No selected variables shall be a no-op. Removed rows shall update the pending partition as in 🔗 12. Removing individual, trailing and same-status row ranges.

    Both operations shall preserve common metadata consistency and retain only truthful sorted-prefix certificates, clearing them when needed. Dimension removal shall clear the certificate after a nonempty selection. Raw row normalization and geometric interpretation shall follow the row capability; no existential-elimination interpretation shall be added by this container.

  • PPL-SPEC-000415
    15. Shared coordinate swaps, cycles and zero insertion PPL-SPEC-000415

    In-dimension swaps and cycles shall apply the same coordinate correspondence to every row. Cycles shall require distinct valid variables and admit empty or singleton cycles. Shifting shall require v.id() <= space_dimension() and admitted result size, insert n zero coordinates before that position and update system dimension. Zero shifting shall retain the represented row sequence. Row kinds, hidden fields and transformed coordinate meaning shall follow each row's contract. Pending status shall be retained. Coordinate changes shall retain only truthful processed-prefix certificates.

  • PPL-SPEC-000370
    10. Inserting and removing matrix columns PPL-SPEC-000370

    add_zero_columns(n,i) shall require i <= num_columns() and an admitted nonoverflowing result shape. It shall insert n zero columns before i and shift all old columns at or after i up by n; zero insertion shall preserve the array. remove_column(i) shall require an in-width column, erase it from every row and shift later indices down by one. Trailing-column removal shall require n <= num_columns() and remove just the last n columns. Row count shall be retained, including zero rows. These transformations shall preserve every surviving coefficient association.

  • PPL-SPEC-000371
    11. Column swaps and encoded nonzero-index permutation cycles PPL-SPEC-000371

    Column swaps shall require two in-width indices and exchange their entries in every row; index zero and self-swaps shall be admitted. Encoded permutation cycles shall require a nonempty vector containing complete disjoint cycles of length at least two, each terminated by zero. Every listed index shall be nonzero and strictly below column count. The final element shall be a zero terminator. For each cycle, the old coefficient at each listed column shall move to the following listed column, with the last wrapping to the first. Unlisted columns, especially column zero, shall remain unchanged. Both operations shall retain shape; row-level borrowed positions may be invalidated.

  • PPL-SPEC-000294
    14. Coordinate insertion and deletion preserve coefficient association PPL-SPEC-000294

    add_zeroes_and_shift(n,i) shall require i <= size() and admitted nonoverflowing result size/keys. It shall insert n zero positions before i and shift every old position at or after i upward by n. Zero insertion shall preserve the vector. delete_element_and_shift(i) shall require i < size(), remove just that coefficient and shift all later indices down by one. Dense deletion shall retain capacity. Implicit sparse zeroes shall stay implicit unless already explicitly represented. Dense shifts/deletions and sparse deletions shall invalidate prior iterators. Sparse insertion of zero positions shall preserve stored-entry iterator values and update affected indices, retaining their coefficient association.

    For erase_and_reindex(index_map,new_size), index_map shall contain size() entries. Selected coordinates shall be marked not_a_dimension(); the remaining images shall enumerate [0,new_size) in order. The result shall be the stable subsequence of retained coefficients with the specified size. Dense rows shall retain capacity. Sparse rows shall retain surviving explicit stored zeroes without materializing implicit zeroes. The operation shall invalidate ordinary iterators and coefficient references. If a sparse erasure allocation fails, the row shall remain valid at its old size and numbering, with possibly some selected stored entries already erased.

  • PPL-SPEC-000295
    15. Coefficient swaps and constrained sparse key relocation PPL-SPEC-000295

    Indexed swaps shall require two in-size indices and exchange exactly their coefficient values, including implicit sparse zeroes. Iterator swaps shall require two live dereferenceable positions of the same row and exchange their values without exchanging their keys. Self-swaps shall retain value. Sparse fast_swap(i,pos) shall require an in-size index and lower_bound(i) == pos != end(); it shall move that stored entry to i, leaving its previous position implicitly zero. Its iterator shall remain valid and report the new index, and unrelated entries shall be retained.