Parma Polyhedra Library requirements
Internal interval endpoint interpretation and comparison

Internal interval endpoint interpretation and comparison

1. Boundary infinity and scalar-domain extremum interpretation
UID: PPL-SPEC-001077
STATUS: APPROVED
COMPONENT: INTERVALS_BOXES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

A boundary shall comprise its named side, a scalar object and an information object. Under the representation rules of 🔗 1. Interval types, initial storage and independent value copies, a stored SPECIAL flag shall denote negative infinity on LOWER and positive infinity on UPPER; its numerical payload shall be inactive. A normal boundary shall instead use the initialized scalar value. Canonical GMP values and admitted checked scalar policies shall retain their own scalar contracts. NaN shall remain outside this boundary domain. An information policy storing special endpoints shall not be combined with a scalar type whose numerical limits already provide infinity.

is_boundary_infinity shall recognize the side's natural infinity, using SPECIAL when it is stored and otherwise the scalar's actual infinity. normal_is_boundary_infinity shall recognize only the latter encoding on an admitted normal boundary. Reverse infinity shall mean positive infinity on LOWER or negative infinity on UPPER and shall be admitted only when the information policy permits infinity as an element; normal_is_reverse_infinity and is_reverse_infinity shall recognize that scalar encoding. is_minus_infinity and is_plus_infinity shall recognize the corresponding sign of the admitted boundary. infinity_sign shall return -1, +1 or zero according as the boundary is negative-infinite, positive-infinite or finite. These queries shall not change either object.

On LOWER, is_domain_inf shall recognize the minimum of the declared boundary domain: metadata negative infinity when available, otherwise actual scalar negative infinity when available, otherwise the native bounded scalar minimum. On UPPER, is_domain_sup shall analogously recognize the maximum. For unbounded finite-only scalar domains these extrema shall not exist. These two domain-extremum uses shall retain their natural sides; a finite scalar limit shall not thereby become an infinite endpoint.

Objects and borrowed storage shall remain live, and queries shall be synchronized against modification. An inactive payload shall not require a numerical read by a metadata-based query. Queries of a normal payload shall require a valid initialized scalar. Numerical classification and mixed-scalar comparison shall retain their admitted types and configured availability. No additional library initialization shall be required.

RATIONALE:

Infinity encodings and finite carrier limits are different mathematical states; interpreting metadata must not depend on an inactive scalar payload.

INTERFACE:

Internal header: Boundary_defs.hh; free functions in Parma_Polyhedra_Library::Boundary_NS. Scalar and information template parameters denote the admitted representation profiles described above.

template <typename T, typename Info>
bool normal_is_boundary_infinity(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_boundary_infinity(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool normal_is_reverse_infinity(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_reverse_infinity(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_minus_infinity(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_plus_infinity(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
int infinity_sign(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_domain_inf(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_domain_sup(Boundary_Type side, const T&, const Info&);
VERIFICATION_CRITERIA:

Check both sides, finite values, metadata infinities, actual numerical infinities and admitted reverse infinities against independent signed extended-value cases. Check native finite extrema separately from infinity, unbounded GMP finite domains, preserved source representations and meaningful pure calls without Init.

SOURCE:

src/Boundary_defs.hh; tests/intervalboundariesspec1.cc; tests/intervalboundaryoracle.hh.

PPL-SPEC-001078
2. Boundary openness and infinity membership interpretation
UID: PPL-SPEC-001078
STATUS: APPROVED
COMPONENT: INTERVALS_BOXES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

For the boundary representation and lifetimes of 🔗 1. Boundary infinity and scalar-domain extremum interpretation, is_open shall return the stored OPEN value when the information policy stores it. Otherwise it shall identify a natural infinite endpoint as open exactly when infinity is excluded from the carrier; finite endpoints shall be closed. A metadata policy without stored openness shall report an unsupported OPEN property as false under 🔗 3. Stateless interval metadata reports unsupported properties.

special_is_open shall report whether infinity is excluded from the carrier for an admitted metadata special endpoint. normal_is_open shall use the stored openness when supported; otherwise it shall infer openness only for a normal scalar natural infinity when infinity is excluded. is_boundary_infinity_closed shall hold exactly for a natural infinite endpoint, an infinity-admitting carrier and a false stored OPEN query. boundary_infinity_is_open shall report exclusion of infinity from the carrier or a true OPEN query, without inspecting a scalar payload.

A valid complete representation shall satisfy the selected carrier and information policy's consistency rules; unsupported openness shall not invent a stored bit. All queries shall preserve scalar and metadata state, including the opposite side and cached interval claims. They shall require no additional initialization, coefficient constants or FPU state change.

RATIONALE:

Endpoint exclusion and infinity membership depend on the information policy as well as the endpoint value.

INTERFACE:

Internal header: Boundary_defs.hh; free functions in Parma_Polyhedra_Library::Boundary_NS. Scalar and information template parameters denote the admitted representation profiles described above.

template <typename T, typename Info>
bool special_is_open(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool normal_is_open(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_open(Boundary_Type side, const T&, const Info&);
template <typename T, typename Info>
bool is_boundary_infinity_closed(Boundary_Type side, const T&, const Info&);
template <typename Info>
bool boundary_infinity_is_open(Boundary_Type side, const Info&);
VERIFICATION_CRITERIA:

Enumerate supported open/closed finite endpoints, ordinary unbounded endpoints, included infinities and stateless metadata. Check both sides and preserve unrelated/opposite metadata. Distinguish special and normal helper admission and check pure calls across caller hardware rounding modes.

SOURCE:

src/Boundary_defs.hh; tests/intervalboundariesspec1.cc; tests/intervalboundaryoracle.hh.

3. Unbounded and signed-infinity boundary assignment
UID: PPL-SPEC-001079
STATUS: APPROVED
COMPONENT: INTERVALS_BOXES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

With the live storage and representation capabilities of 🔗 1. Boundary infinity and scalar-domain extremum interpretation, special_set_boundary_infinity shall require stored special endpoints, set the selected side's SPECIAL property, leave the scalar payload unchanged and return V_EQ.

set_unbounded shall select the side's outward domain extremum. A metadata encoding shall use the preceding special-endpoint operation. Otherwise LOWER shall assign negative infinity with ROUND_UP and UPPER positive infinity with ROUND_DOWN, retaining the scalar assignment's returned Result. A bounded scalar without an infinity encoding may consequently hold its finite domain minimum or maximum; this shall not relabel that finite value as an actual scalar infinity. An exactly assigned infinite endpoint shall set OPEN when infinity is excluded from the carrier.

set_minus_infinity and set_plus_infinity shall assign their stated infinity using either the admitted metadata encoding or the scalar assignment with the selected side's direction. A true open request shall require the natural side for that infinity; a false request shall require an infinity-admitting carrier. Stored special endpoints shall require the natural side. Their OPEN update shall be true when requested or when the numerical assignment is inexact. The numerical result shall be representable under the selected scalar policy.

set_boundary_infinity shall assign the natural infinity of the selected side through metadata or the scalar assignment with that side's direction. It shall require a true open request or an infinity-admitting carrier, and a representable scalar result. It shall set OPEN when requested.

These operations shall retain existing OPEN state when no rule above sets it; a false request shall not clear an existing true property. They shall preserve all other boundary/interval properties, the opposite side and cached interval claims. A caller requiring replacement of such retained properties shall clear them separately before assignment. Setting a stored special endpoint shall not require an initialized readable numerical payload. Scalar writes shall retain the marker-assignment meanings of 🔗 1. Typed special-marker assignment to native integer storage and 🔗 2. Typed special-marker assignment to GMP integer and rational storage where applicable, and meet their own type, resource, policy and caller-owned FPU prerequisites; failures shall retain those operations' permitted partial state, without an additional rollback promise. No extra library initialization shall be required.

RATIONALE:

Internal endpoint setters update selected representation properties and intentionally retain unrelated metadata; callers can compose those updates without losing other claims.

INTERFACE:

Internal header: Boundary_defs.hh; free functions in Parma_Polyhedra_Library::Boundary_NS. Scalar and information template parameters denote the admitted representation profiles described above.

template <typename T, typename Info>
Result special_set_boundary_infinity(Boundary_Type side, T&, Info&);
template <typename T, typename Info>
Result set_unbounded(Boundary_Type side, T&, Info&);
template <typename T, typename Info>
Result set_minus_infinity(Boundary_Type side, T&, Info&, bool open = false);
template <typename T, typename Info>
Result set_plus_infinity(Boundary_Type side, T&, Info&, bool open = false);
template <typename T, typename Info>
Result set_boundary_infinity(Boundary_Type side, T&, Info&, bool open = false);
VERIFICATION_CRITERIA:

Check metadata encodings with preserved scalar payloads, native scalar/checked infinity assignments, finite bounded-domain fallback, returned classification, both sides, admitted signed/reverse choices and explicit retained OPEN cases. Observe every unrelated and opposite property independently. Exercise valid storage without Init and preserve caller rounding state.

SOURCE:

src/Boundary_defs.hh; tests/intervalboundariesspec1.cc; tests/intervalboundaryoracle.hh.

PPL-SPEC-001080
4. Numerical sign of an interval boundary
UID: PPL-SPEC-001080
STATUS: APPROVED
COMPONENT: INTERVALS_BOXES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

For the representation of 🔗 1. Boundary infinity and scalar-domain extremum interpretation, sgn_b shall return -1, zero or +1 according as the active boundary value is negative, zero or positive. A metadata natural infinity shall have the sign of its side, without reading its inactive payload. An admitted normal scalar infinity shall have its own sign. Endpoint openness shall not affect this numerical sign, including for positive and negative scalar zero.

The boundary scalar and metadata shall remain unchanged. Finite scalar payloads shall satisfy their ordinary numerical validity conditions and source lifetimes. Queries shall require no additional library initialization or FPU state change. The side and property keys shall retain 🔗 1. Boundary sides and interval metadata property keys.

RATIONALE:

Interval arithmetic needs the sign of the endpoint value separately from endpoint inclusion and ordering of strict cutoffs.

INTERFACE:

Internal header: Boundary_defs.hh; free functions in Parma_Polyhedra_Library::Boundary_NS. Scalar and information template parameters denote the admitted representation profiles described above.

template <typename T, typename Info>
int sgn_b(Boundary_Type side, const T&, const Info&);
VERIFICATION_CRITERIA:

Check literal negative/zero/positive signs, both sides, every admitted openness, native extrema, GMP finite values, metadata infinities, normal included infinities and floating signed zeros. Preserve complete source representations and caller hardware state.

SOURCE:

src/Boundary_defs.hh; tests/intervalboundariesspec1.cc; tests/intervalboundaryoracle.hh.

5. Ordering of interval boundary cuts
UID: PPL-SPEC-001081
STATUS: APPROVED
COMPONENT: INTERVALS_BOXES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

For admitted boundaries of 🔗 1. Boundary infinity and scalar-domain extremum interpretation, eq, lt, gt, le and ge shall compare endpoint cuts. Finite numerical values shall have their exact scalar ordering, with negative infinity before all finite values and positive infinity after them. At an equal numerical value the cut order shall be

(v, UPPER, open) < (v, closed) < (v, LOWER, open).

Closed lower and upper boundaries at that value shall denote the same cut. Two cuts shall be equal exactly when their numerical values and positions in this order agree. The same comparison of inclusion positions shall apply to admitted infinity encodings; infinity signs shall not be inferred from an inactive metadata payload. gt shall be the converse of lt; le and ge shall include equality. Mixed scalar/information types shall be admitted when their numerical comparison and representation contracts support the operands.

All operands shall retain their values and metadata. Same-object operands and overlapping read-only references shall be admitted. Access shall be synchronized against mutation; scalar comparisons shall retain their configured availability and numerical prerequisites. No additional library initialization or FPU state change shall be required.

RATIONALE:

Ordering lower and upper strict cuts requires a different tie rule from ordinary scalar comparison; that distinction determines interval emptiness and set inclusion.

INTERFACE:

Internal header: Boundary_defs.hh; free functions in Parma_Polyhedra_Library::Boundary_NS. Scalar and information template parameters denote the admitted representation profiles described above.

template <typename T1, typename Info1, typename T2, typename Info2>
bool eq(Boundary_Type side1, const T1&, const Info1&,
        Boundary_Type side2, const T2&, const Info2&);
template <typename T1, typename Info1, typename T2, typename Info2>
bool lt(Boundary_Type side1, const T1&, const Info1&,
        Boundary_Type side2, const T2&, const Info2&);
template <typename T1, typename Info1, typename T2, typename Info2>
bool gt(Boundary_Type side1, const T1&, const Info1&,
        Boundary_Type side2, const T2&, const Info2&);
template <typename T1, typename Info1, typename T2, typename Info2>
bool le(Boundary_Type side1, const T1&, const Info1&,
        Boundary_Type side2, const T2&, const Info2&);
template <typename T1, typename Info1, typename T2, typename Info2>
bool ge(Boundary_Type side1, const T1&, const Info1&,
        Boundary_Type side2, const T2&, const Info2&);
VERIFICATION_CRITERIA:

Enumerate independent extended-value/cut-rank pairs across both sides, finite ties and strict order, openness, natural and admitted reverse infinities, identical owners and mixed scalar/information types. Check all five predicates, symmetry/converse identities, equal closed cuts and preservation of scalar representations and all metadata.

SOURCE:

src/Boundary_defs.hh; tests/intervalboundariesspec1.cc; tests/intervalboundaryoracle.hh.