Parma Polyhedra Library requirements
C++ interval linear forms
1. Interval-linear-form meaning and numerical prerequisites PPL-SPEC-000921

For a selected interval type C, a live Linear_Form<C> of dimension d, with coefficient intervals Ai and constant interval B, shall represent the interval-affine expression B + ∑d − 1i = 0Aixi. At each real valuation x, it shall denote the set of sums obtained by choosing each coefficient and the constant independently from their intervals. Repeated use of an interval object shall not establish correlations between those choices. The constant shall occupy no variable coordinate. The declared dimension shall retain trailing zero coefficients.

C shall provide the interval construction, copying, predicates and arithmetic required by the selected operation. Stored values shall satisfy its initialization, canonical-value and metadata prerequisites. Each successful arithmetic operation shall retain the interval operations' enclosure guarantees and selected numerical-profile conditions; no common optimality or finite-bound guarantee shall be inferred. Native floating-point arithmetic shall require the selected supported boundary format and its rounding-state prerequisites. Storage access shall add no numerical rounding requirement. Shared-facility initialization shall be required where the selected coefficient operation, expression conversion or output formatter requires it; unrelated storage shall add no initialization owner.

Callers shall synchronize access against overlapping modification and obey shared-temporary restrictions in the selected configuration. Allocation and coefficient exceptions may propagate. Failed construction shall release resources owned by the incomplete form. Unchanged operands shall remain unchanged; modified destinations shall remain destructible, with no universal rollback guarantee.

PPL-SPEC-000922
2. Zero and interval-constant construction PPL-SPEC-000922

Default construction shall produce dimension zero and the singleton-zero constant. Construction from an initialized interval n shall produce dimension zero and an independent copy of that interval as the constant. Both forms shall report zero coefficients at every valid queried variable. The constant constructor shall preserve empty, bounded, open, singleton and unbounded values admitted by C.

PPL-SPEC-000923
3. Variable and variable-difference construction PPL-SPEC-000923

Construction from Variable v shall produce dimension v.space_dimension(), singleton coefficient one at v.id(), singleton zero at every other coordinate and a singleton-zero constant. The explicitly selected interval-type overload for v-w shall produce dimension max(v.space_dimension(), w.space_dimension()). Distinct variables shall have singleton coefficients one and minus one, respectively; equal variables shall produce all singleton-zero coefficients while retaining that dimension. The selected interval representation shall enclose the signed unit values even when its boundary type is unsigned.

A variable dimension exceeding max_space_dimension() shall cause std::length_error before a coefficient vector of that dimension is constructed.

PPL-SPEC-000924
4. Conversion from integral affine expressions PPL-SPEC-000924

Construction from Linear_Expression e shall preserve its declared dimension and enclose each integer coefficient and constant in the corresponding interval of C. Exactly representable integer values shall be singleton intervals; other supported conversions shall retain their coefficient-conversion enclosure guarantees. Source representation shall not alter the mathematical result, and the source shall remain unchanged. A source dimension greater than max_space_dimension() shall cause std::length_error. Reading e shall retain its configured coefficient profile and initialization prerequisites.

PPL-SPEC-000925
5. Independent copying, assignment and owned lifetimes PPL-SPEC-000925

Copy construction and copy assignment shall preserve the dimension and all coefficient intervals, including their admitted endpoint metadata. Copies shall own independent coefficient storage. Subsequent mutation or destruction of one form shall not change the other. Assignment shall return the destination reference, including same-object assignment, which shall preserve its value and dimension. Destruction shall release the form's owned vector and constructed coefficient objects. Copying shall not promise to preserve allocation capacity or introduce a move interface beyond the declared C++ operations.

6. Dimensions and borrowed coefficient access PPL-SPEC-000926

Coefficient accessors shall require an lvalue receiver, with the corresponding const && overloads deleted. References shall not outlive the owning form.

max_space_dimension() shall report the maximum ambient dimension admitted by the form's coefficient-vector representation. This limit shall not promise that allocating every admitted dimension will succeed. space_dimension() shall return the declared ambient dimension. inhomogeneous_term() shall return a const reference to the owned constant. For a valid variable inside that dimension, coefficient(v) shall return a const reference to its owned coefficient. A valid variable outside the declared dimension shall return a const reference to a singleton zero, without extending the form or allocating a coefficient for that variable.

Owned coefficient references shall be usable until destruction or an operation that may replace/reallocate or transfer the owning vector. The shared zero shall remain usable during its owning type/context lifetime; callers shall not destroy or modify it through a cast.

PPL-SPEC-000927
7. Unary copying and coefficient-wise negation PPL-SPEC-000927

Unary plus shall return an independent value copy with the same dimension. Unary minus shall return an independent form whose coefficient intervals, including the constant, enclose their entry-value negations. negate() shall apply the same interval negation to the current form and preserve its dimension. Negation shall exchange lower/upper roles and endpoint openness according to C. It shall not cancel an uncertain interval to zero.

PPL-SPEC-000928
8. Addition of interval linear forms PPL-SPEC-000928

For a+b and a+=b, the result dimension shall be the maximum of the entry dimensions. Each common coefficient interval and the constant shall enclose the sum of the corresponding entry intervals. Coefficients belonging only to the larger form shall be preserved. Compound assignment shall return a by reference; noncompound addition shall return an independent form and preserve both operands. Same-object addition shall use the entry coefficient intervals and their independent-choice interval meaning.

PPL-SPEC-000929
9. Subtraction of interval linear forms PPL-SPEC-000929

For a-b and a-=b, the result dimension shall be the maximum of the entry dimensions. Each coefficient interval and constant shall enclose the corresponding entry interval difference. A coordinate present only in a shall be preserved; one present only in b shall be negated. Compound assignment shall return a by reference; the independent result shall preserve both operands. Same-object subtraction shall retain independent interval-choice semantics: subtracting an uncertain interval from itself shall not imply a singleton-zero coefficient.

PPL-SPEC-000930
10. Variable addition, subtraction and dimension extension PPL-SPEC-000930

Adding or subtracting a valid variable shall add or subtract singleton one at its coordinate, preserve every other entry coefficient and constant, and set dimension to the maximum of the form's entry dimension and the variable dimension. The reflected v-f shall negate every coefficient of f then add singleton one at v.id(). Compound operations shall return the modified form by reference. Returning operations shall preserve their operands. Exact cancellation shall not shrink the declared dimension. A variable dimension above max_space_dimension() shall cause std::length_error and leave the existing form unchanged.

PPL-SPEC-000931
11. Interval scalar translation and reflected subtraction PPL-SPEC-000931

Adding or subtracting an interval scalar shall change only the constant interval, by the corresponding interval sum or difference, and retain the form's dimension and homogeneous coefficients. n-f shall negate the homogeneous coefficients and produce the interval difference of entry scalar n and the entry constant. Returning operations shall preserve all inputs. Compound operations shall return the destination reference and use the scalar's entry value when it is borrowed from that form, including its constant.

PPL-SPEC-000932
12. Interval scalar multiplication PPL-SPEC-000932

Multiplying a form by interval scalar n shall preserve its declared dimension and produce coefficient intervals, including the constant, that enclose every product of the corresponding entry coefficient and the entry scalar. Both returning orders shall preserve their operands and return an independent form. Compound multiplication shall return the modified form reference. A scalar borrowed from the destination shall denote its entry interval for every coefficient update; changing an earlier coefficient shall not change that scalar's meaning for later updates.

PPL-SPEC-000933
13. Division by an admitted nonzero interval scalar PPL-SPEC-000933

For a supported interval divisor that excludes zero, compound division shall preserve the dimension and enclose, at every coefficient and constant, all quotients of the entry coefficient interval by the entry divisor interval. It shall return the destination reference. The divisor's entry interval shall apply to every coefficient even when borrowed from the destination. Callers shall satisfy the selected interval division's domain, representability and rounding prerequisites; this interface shall not imply that division by zero is admitted.

PPL-SPEC-000934
14. Coefficient equality with implicit trailing zeros PPL-SPEC-000934

Equality shall return true exactly when the constants compare equal under C and every homogeneous coefficient compares equal after padding the shorter form with singleton-zero intervals. Different declared dimensions alone shall not imply inequality. Inequality shall be the logical complement of equality. Neither operation shall modify its inputs or dimensions. This comparison shall compare interval coefficients; it shall not assert relational equivalence after correlating uncertain coefficient choices.

PPL-SPEC-000935
15. Ownership-preserving swap PPL-SPEC-000935

Member and free swap shall exchange the complete owned coefficient values and declared dimensions of two forms without numerical conversion. Future mutation of either form shall affect its received value independently. Same-object swap shall preserve its value and dimension. Swap shall not require copying or re-evaluating every interval coefficient.

PPL-SPEC-000936
16. Coefficient integrity and finite-bound classification PPL-SPEC-000936

OK() shall return true when every owned interval coefficient satisfies its interval invariant predicate, and false when any such predicate returns false. overflows() shall return false exactly when the constant and every stored homogeneous coefficient satisfy C::is_bounded(); otherwise it shall return true. The latter shall classify the current coefficient bounds, not certify past arithmetic exactness or the absence of modeled floating-point rounding error. Both queries shall preserve the form and its dimension.

PPL-SPEC-000937
17. Reloadable interval-coefficient ASCII representation PPL-SPEC-000937

ascii_dump() shall write the dimension followed by the constant and homogeneous intervals in coordinate order, each in C's reloadable ascii_dump() format. Successful loading shall replace the complete form with that declared dimension and those intervals, including endpoint metadata and inactive payloads required by C's format. A dump shall round-trip under a compatible coefficient representation. The overload without a stream argument shall write that same frame on standard error. Dumping shall preserve the source and may propagate stream exceptions.

ascii_load() shall return false when no valid dimension can be read, when it exceeds max_space_dimension(), or when a required interval record cannot be loaded. Success shall return true after consuming the required record; trailing input shall remain available. A failed load shall leave the form destructible and reusable by complete assignment/loading, with no unchanged-state guarantee. Earlier display-based coefficient encodings shall not be accepted as equivalent machine records.

PPL-SPEC-000938
18. Human-readable affine composition PPL-SPEC-000938

Stream insertion shall return the supplied stream and preserve the form. It shall display nonzero homogeneous coefficients in increasing variable index order using the current variable formatter. A first singleton-minus-one coefficient shall display a leading minus; singleton-one factors shall omit the coefficient/product marker. A later minus-one coefficient shall use the separator " - "; every other later nonzero coefficient shall use " + ", displaying its interval and "*" when it is not singleton one. The nonzero constant shall follow existing variable terms with " + " and use C's display. If all coefficients are zero, the zero interval shall be displayed. A negative nonunit coefficient or constant shall retain its coefficient display rather than being rewritten into a subtraction. Coefficient display shall use the stream locale/format settings and retain the variable formatter's prerequisites. It shall not serve as the reloadable machine format. print() shall display the same form on standard error without adding a newline.

PPL-SPEC-000939
19. Owned vector and interval memory accounting PPL-SPEC-000939

external_memory_in_bytes() shall count allocated vector capacity in bytes and the external memory reported by every constructed coefficient interval. It shall not charge the form for shared zero storage borrowed by out-of-dimension queries. total_memory_in_bytes() shall equal the external count plus sizeof(*this). Counts shall retain the selected coefficient memory-reporting contracts and require representable aggregate byte counts; allocator bookkeeping outside those reports shall not be inferred.

PPL-SPEC-000940
20. Oracle-based interval enclosure and explicit refusal PPL-SPEC-000940

For a live form with supported initialized interval coefficients, intervalize() shall ask the oracle for intervals of its declared variable coordinates. When the oracle supplies valid enclosures for every requested coordinate, a true result shall set result to an interval enclosing all entry-form affine values at independently admitted coefficient and coordinate choices. A dimension-zero form shall need no coordinate query and shall return its constant interval. The form shall remain unchanged.

If a required oracle query returns false, the method shall return false and shall not claim that result establishes a complete enclosure; no prior result-value preservation shall be promised. Exceptions from the oracle or coefficient operations may propagate. The oracle shall supply initialized intervals and remain valid for the call; overlapping mutation shall follow the operation's numerical/runtime prerequisites. Rational coefficient intervals shall not require native floating-point availability.

PPL-SPEC-000941
21. Format-specific relative-error linear form PPL-SPEC-000941

For a form with nonempty bounded supported floating-point intervals, relative_error(format, result) shall preserve the entry dimension and replace result by a form whose coefficient at each coordinate and constant encloses the corresponding magnitude bound multiplied by [ − u, u]. The magnitude bound shall be the maximum absolute value of that entry interval's endpoints. The relative-error unit u shall be 2 − 10, 2 − 23, 2 − 52, 2 − 112 and 2 − 63 for IEEE754_HALF, IEEE754_SINGLE, IEEE754_DOUBLE, IEEE754_QUAD and INTEL_DOUBLE_EXTENDED, respectively. It shall be 2 − 20 for IBM_SINGLE and 2 − 52 for IBM_DOUBLE.

The source shall remain unchanged unless it is also result; in that case the complete result shall still use the source's entry intervals and dimension. This operation shall construct the relative-error component; it shall not alone establish a complete floating-point linearization or supply a separate absolute error term for underflow. All evaluated boundary and interval operations shall satisfy their supported-format, rounding and representability prerequisites.