Parma Polyhedra Library requirements
C++ interval values, endpoints and set queries
1. Interval types, initial storage and independent value copies PPL-SPEC-000701

Interval<Boundary, Info> shall own two boundary objects and one metadata object, expose their types as boundary_type and info_type, and use Info to select endpoint openness, special boundary representations and admitted empty/extended values. A metadata-based special-boundary encoding shall not be combined with a boundary type whose numerical limits already provide infinity. Rational_Interval shall use canonical mpq_class boundaries with open endpoints available. Integer_Interval shall use mpz_class boundaries with closed endpoints. Both presets shall admit empty intervals and represent unbounded endpoints through metadata; their concrete intervals shall exclude infinity as an element.

Default construction shall default-construct the owned boundary and metadata objects. It shall not establish a common empty or universe value across all boundary types. Callers shall initialize an interval with a supported construction, assignment or build operation before using its numerical value. Construction from a supported scalar, interval or degenerate element shall have the value meaning of the corresponding assignment operation.

Interval_Singleton<T> and Interval_Like<T> shall have the truth values of Is_Singleton<T>::value and Is_Interval<T>::value. Interval_Source<T> shall classify their union, preserving existing trait specializations and qualifier rules. The default interval classification shall retain implicit const-reference conversions to Interval_Base and exclude inaccessible, ambiguous and explicit-only conversions. These classifications shall not impose Boolean regularity on symbolic types. The forwarding constructor shall participate when overload resolution makes the receiver's existing assign(source) operation available. Sources without an admitted assignment overload shall be excluded. This admission check shall not instantiate the assignment body or extend the underlying endpoint operations' supported combinations. The separate scalar-text constructor shall remain available.

Copy construction and same-type copy assignment of initialized valid intervals shall preserve the represented interval, active boundary values and metadata. Their owned storage shall be independent; changing or destroying one object shall not change the other's value. Same-object assignment shall preserve the value and return that object's reference. Distinct-object copy assignment shall return the destination reference. Destruction shall release the owned boundary and metadata objects. Copying shall require the resources and failure guarantees of their ordinary scalar/metadata copies; no strong rollback guarantee shall be inferred when an underlying copy throws.

Boundary values and metadata shall satisfy their numerical and representation contracts. Source/destination objects shall be live and initialized for any operation that reads their values. Callers shall synchronize overlapping modifications and respect the scalar operations' shared-temporary and FPU prerequisites. Storage construction and same-type copying shall add no library-initialization or numerical-rounding prerequisite.

PPL-SPEC-000702
2. Interval endpoint and metadata references PPL-SPEC-000702

For a live interval, mutable lower(), upper() and info() shall return references to its owned lower boundary, upper boundary and metadata objects. Their const overloads shall return const references to those same objects, without copying or changing them. The references shall retain their owner storage identities across value assignments and swaps and shall remain valid until the owner is destroyed.

Callers that read an endpoint shall ensure that its payload is initialized and meaningful for the current representation. A metadata-encoded unbounded endpoint shall not imply a readable numerical payload. Callers that mutate an endpoint or metadata directly shall establish a valid complete representation, including canonical rational values and consistent openness and special-boundary flags, before another interval operation reads it. Direct mutation shall not automatically perform numerical conversion, normalize the interval or repair other fields.

Access itself shall require no library initialization or FPU setup. Reads shall be synchronized with overlapping owner modification; numerical writes shall obey the written scalar's prerequisites.

3. Interval shape and endpoint classification PPL-SPEC-000703

For an initialized valid interval, is_empty() shall report whether its lower/upper endpoint predicates admit no common value; is_singleton() shall report a single admitted value. Openness at equal finite endpoints shall distinguish an empty interval from a closed singleton.

lower_is_open() and upper_is_open() shall report whether the respective endpoint value is excluded under the boundary/metadata policy. The boundary-infinity queries shall identify outward unbounded endpoints. The domain-infimum/supremum queries shall identify the selected numerical domain's least/greatest extent, which may be a finite native limit in a bounded domain. is_bounded() shall return true exactly when neither endpoint is an outward boundary infinity. is_universe() shall return true exactly when the represented interval contains every value of the configured number carrier. Its endpoints shall reach the domain's infimum and supremum, and shall include those extent values whenever they belong to the carrier. Opening a finite domain-limit endpoint, or excluding an infinite endpoint admitted as an element of an extended carrier, shall therefore prevent the universe classification. A bounded numerical domain can have a bounded universe representation.

For policies admitting actual extended infinity values, infinity_sign() shall return 1 when the lower endpoint is reverse positive infinity, -1 when the upper endpoint is reverse negative infinity, and 0 otherwise, checking the lower case first. Ordinary finite intervals and the real-unbounded universe shall return zero.

These queries shall preserve endpoint and metadata values. They shall require initialized valid representations, sufficient comparison resources, synchronization against modification, and the comparisons' scalar/FPU and shared-temporary prerequisites. They shall add no initialization requirement.

PPL-SPEC-000704
4. Exact interval set comparisons PPL-SPEC-000704

For initialized valid intervals and admitted scalar singleton operands, contains(y) shall report set inclusion of the argument in the receiving interval. strictly_contains(y) shall report inclusion with unequal represented sets. is_disjoint_from(y) shall report that the two sets have empty intersection. The interval comparison operators == and != shall report represented-set equality and its complement. These operators shall apply when at least one operand is an interval; they shall not change the raw scalar operators' contracts.

Every interval shall contain the empty interval. The empty interval shall strictly contain no interval; a nonempty interval shall strictly contain the empty interval. Empty operands shall be disjoint from all operands. Equal closed endpoints shall have the same singleton meaning regardless of the admitted endpoint storage type. Open/closed contact shall determine whether touching intervals intersect. An interval with integer endpoints shall not thereby discard noninteger interior points.

Mixed representations shall compare their endpoint meanings without changing the operands or narrowing an exact value merely to the other's storage width. Source values shall be canonical and admissible to their policies; comparison resources, shared-temporary serialization, synchronization and any required caller-owned FPU state shall follow the scalar comparison contracts. No additional library initialization shall be required.

PPL-SPEC-000705
5. Interval closure and endpoint exclusion PPL-SPEC-000705

is_always_topologically_closed() shall return true exactly when the metadata policy cannot store open endpoints. is_topologically_closed() shall return true for that policy, for an empty interval, or when every finite endpoint is closed. An outward infinite endpoint shall not prevent this real-topology closure classification.

topological_closure_assign() shall retain empty intervals and clear openness at each finite endpoint of a nonempty interval when openness is supported. It shall preserve numerical endpoints and outward unbounded endpoints. For ordinary real intervals excluding infinity as an element, the represented result shall be their real topological closure under the admitted endpoint policy. Closure shall be idempotent.

For a nonempty interval with openness support, remove_inf() shall mark its lower endpoint open and remove_sup() its upper endpoint open. These operations shall exclude a currently included finite infimum/supremum; they shall not move the numerical endpoints. Opening an endpoint of a singleton may make it empty. For a policy without openness support both calls shall leave the interval unchanged.

Objects shall be live, initialized and valid, and permit any resulting empty value. Callers shall synchronize modification. The flag operations shall perform no scalar arithmetic or result-handler dispatch; queries shall retain their underlying endpoint-comparison prerequisites.

PPL-SPEC-000706
6. Interval swap and owned boundary memory PPL-SPEC-000706

For two initialized valid intervals of the same type, member m_swap and related swap shall exchange both owned boundary values and the metadata as one successful interval value exchange. Same-object swap shall preserve the represented interval. Retained endpoint and metadata references shall remain attached to their original owner storage and observe the exchanged contents. Swap shall require the underlying scalar and metadata swap resources; it shall not promise rollback if one of those operations throws.

For PPL's nonallocating interval metadata policies, external_memory_in_bytes() shall equal the sum of the owned lower and upper scalar external-memory metrics. total_memory_in_bytes() shall equal sizeof(*this) plus that external size. GMP endpoint metrics shall include retained allocated limbs according to their scalar memory contracts; native scalar endpoints shall add no external allocation. These queries shall preserve numerical values, metadata and borrowed storage identities. Their sums shall fit memory_size_type. A user-defined metadata extension that owns additional external allocation shall require its own accounting contract.

Objects shall be live and represent initialized valid intervals. Swap shall support valid metadata-encoded unbounded endpoints without reading an indeterminate inactive native payload as a numerical value. Callers shall synchronize mutation and inspection. Swaps and memory queries shall add no numerical-rounding or library-initialization requirement.

PPL-SPEC-000707
7. Interval endpoint constraint views PPL-SPEC-000707

For a nonempty initialized valid interval, lower_constraint() shall return an interval-constraint object with the lower endpoint's relation and cutoff; upper_constraint() shall do the corresponding upper endpoint. A finite open lower endpoint shall use V_GT and a closed lower endpoint V_GE; finite open/closed upper endpoints shall use V_LT/V_LE. A metadata-encoded special unbounded endpoint shall produce an unconstrained V_LGE constraint with no initialized cutoff required.

For an effective numerical cutoff, the returned object shall use the default storage criterion of 🔗 4. Interval constraints retain relation and cutoff ownership. A borrowed cutoff shall refer to that same owned boundary and reflect its later valid numerical changes; an owned cutoff shall retain an independent snapshot. In both cases the returned relation shall be a snapshot of the relation at construction and shall not change when the interval's metadata changes later. Borrowed constraints shall not outlive their interval owner.

These queries shall preserve the interval. The interval shall be nonempty, and callers shall not read an unconstrained returned object's unbound cutoff. Lifetimes, canonical numerical representation, sufficient copy resources, synchronization and comparison prerequisites shall follow 🔗 4. Interval constraints retain relation and cutoff ownership and the interval classification contracts.

PPL-SPEC-000708
8. Interpreting logical interval emptiness flags PPL-SPEC-000708

check_empty(result) shall interpret the logical shape possibilities of 🔗 1. Interval result possibilities and status-flag set operations. An explicit I_EMPTY shape field shall return true without needing an endpoint emptiness calculation. An explicit I_NOT_EMPTY shape field shall return false. For every other shape field, the query shall report the receiving interval's actual endpoint emptiness. Other status bits shall not change this interpretation.

The input shall use the logical I_Result bit protocol. It shall not be an unrelated scalar Result or an unconverted packing of endpoint result codes. Explicit shape claims shall be supplied consistently with the operation whose result they describe when the caller uses this return value to decide that operation's actual emptiness. This helper shall not validate those claims against the interval's geometry.

The receiving object shall have an initialized valid representation whenever an endpoint calculation is required. The query shall preserve it and retain the scalar comparison, synchronization and resource prerequisites of is_empty(). It shall require no additional initialization.