Parma Polyhedra Library requirements
C++ ordinary interval arithmetic

C++ ordinary interval arithmetic

UID:
VERSION:
CLASSIFICATION:
PREFIX:
Type
Level
MID
UID
REFS
Title
Statement
Rationale
Comment
BIBLIOGRAPHY
STATUS
COMPONENT
APPLICABILITY
VERIFICATION_METHODS
VERIFICATION_CRITERIA
SOURCE
LANGUAGE
VISIBILITY
INTERFACE
SW_SPEC
1
PPL-SPEC-000729
PPL-SPEC-000729
Ordinary interval additive inversion

neg_assign(x) shall replace the receiver by an outward interval enclosure of { − a ∣ a ∈ X}, where X is the source entry set. Empty shall give empty. With exact admitted endpoint operations and supported endpoint membership, the result shall be exact: source upper/lower endpoints shall become negated lower/upper endpoints, with their respective membership interchanged. Unbounded lower/upper extents shall exchange sign and side. An inexact conversion or unsupported openness shall enlarge the result without excluding source images.

Operands shall be initialized and valid intervals or admitted finite scalar singletons over the ordinary real carrier. The receiving policy shall admit the result, including empty and unbounded sets where required. Active rational payloads shall be canonical. The selected source/destination numerical combinations shall have well-formed underlying endpoint operations; the generic signatures shall not promise every possible cross-family instantiation. Each selected operation and all its intermediates shall satisfy the boundary type's range, resource, policy, shared-temporary and caller-owned FPU prerequisites. Separate operands shall remain unchanged. The receiver may alias an interval operand or both interval operands; scalar references shall not borrow numerical storage overwritten during the operation. Access shall be synchronized against mutation. No additional library initialization shall be required. Underlying failure shall retain the underlying numerical/allocation guarantees; a general rollback guarantee shall not be implied. Returned I_Result values shall obey the logical shape/status meanings of 🔗 1. Interval result possibilities and status-flag set operations; only established claims shall be reported.

Additive inversion reverses endpoint order and membership while remaining safe when the receiver is the source.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check returned logical shape and definite status claims against the independently calculated image and receiver entry set, including exact operations and receiving aliases. Compare all finite rational endpoint orders/topologies and scalar values with the independent negated endpoint model. Include empty, source/receiver aliasing, rays, universe, same-family integer endpoints and supported directed conversion.

src/Interval_defs.hh; src/Interval_inlines.hh; tests/intervalarithmeticspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalresultsspec1.cc.

CPP
Public

Public header: <ppl.hh>; members of Parma_Polyhedra_Library::Interval<Boundary, Info> and free operators in Parma_Polyhedra_Library:

template <Interval_Source From>
I_Result neg_assign(const From& x);
SW_SPEC
2
PPL-SPEC-000730

add_assign(x,y) shall enclose {a + b ∣ a ∈ X, b ∈ Y}; sub_assign(x,y) shall enclose {a − b ∣ a ∈ X, b ∈ Y}. An empty operand shall give empty. With exact admitted endpoint operations and supported endpoint membership, these interval images shall be exact. For finite nonempty operands, addition shall use the sums of lower endpoints and upper endpoints. Subtraction shall use the first lower minus second upper endpoint, and first upper minus second lower endpoint. An extremum shall be attained exactly when both required source extrema are attained. Ordinary unbounded extents shall propagate according to these set images. Inexact conversion or unsupported openness may enlarge the result.

Operands shall be initialized and valid intervals or admitted finite scalar singletons over the ordinary real carrier. The receiving policy shall admit the result, including empty and unbounded sets where required. Active rational payloads shall be canonical. The selected source/destination numerical combinations shall have well-formed underlying endpoint operations; the generic signatures shall not promise every possible cross-family instantiation. Each selected operation and all its intermediates shall satisfy the boundary type's range, resource, policy, shared-temporary and caller-owned FPU prerequisites. Separate operands shall remain unchanged. The receiver may alias an interval operand or both interval operands; scalar references shall not borrow numerical storage overwritten during the operation. Access shall be synchronized against mutation. No additional library initialization shall be required. Underlying failure shall retain the underlying numerical/allocation guarantees; a general rollback guarantee shall not be implied. Returned I_Result values shall obey the logical shape/status meanings of 🔗 1. Interval result possibilities and status-flag set operations; only established claims shall be reported.

Addition and subtraction use different endpoint pairings; subtraction must preserve the source entry endpoints under either operand alias.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check returned logical shape and definite status claims against the independently calculated image and receiver entry set, including exact operations and receiving aliases. Compare exact rational endpoint/cell models with every finite topology and endpoint order, both operand orders, scalar forms, empty cases and each receiver alias. Check ordinary rays/universe and same-family integral arithmetic and directed integral division.

src/Interval_defs.hh; src/Interval_inlines.hh; tests/intervalarithmeticspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalresultsspec1.cc.

CPP
Public

Public header: <ppl.hh>; members of Parma_Polyhedra_Library::Interval<Boundary, Info> and free operators in Parma_Polyhedra_Library:

template <Interval_Source From1, Interval_Source From2>
I_Result add_assign(const From1& x,const From2& y);
template <Interval_Source From1, Interval_Source From2>
I_Result sub_assign(const From1& x,const From2& y);
SW_SPEC
3
PPL-SPEC-000731

mul_assign(x,y) shall enclose {ab ∣ a ∈ X, b ∈ Y}. An empty operand shall give empty. With exact admitted endpoint operations and supported endpoint membership, the result shall be the exact interval image. For finite nonempty operands its extrema shall be the least and greatest of the four endpoint products. Endpoint membership shall account for every tied extremizer and for an attained zero in either operand; it shall not infer that zero is excluded merely because one nonzero factor approaches an excluded endpoint. Ordinary unbounded endpoints shall retain their limiting meaning, including a singleton zero multiplied by an unbounded interval. Inexact conversion or unsupported openness may enlarge the result.

Operands shall be initialized and valid intervals or admitted finite scalar singletons over the ordinary real carrier. The receiving policy shall admit the result, including empty and unbounded sets where required. Active rational payloads shall be canonical. The selected source/destination numerical combinations shall have well-formed underlying endpoint operations; the generic signatures shall not promise every possible cross-family instantiation. Each selected operation and all its intermediates shall satisfy the boundary type's range, resource, policy, shared-temporary and caller-owned FPU prerequisites. Separate operands shall remain unchanged. The receiver may alias an interval operand or both interval operands; scalar references shall not borrow numerical storage overwritten during the operation. Access shall be synchronized against mutation. No additional library initialization shall be required. Underlying failure shall retain the underlying numerical/allocation guarantees; a general rollback guarantee shall not be implied. Returned I_Result values shall obey the logical shape/status meanings of 🔗 1. Interval result possibilities and status-flag set operations; only established claims shall be reported.

Multiplication needs sign-sensitive extrema and zero-attainment rules in addition to numerical endpoint products.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check returned logical shape and definite status claims against the independently calculated image and receiver entry set, including exact operations and receiving aliases. Independently evaluate all four exact finite endpoint products and tied/zero attainment for every source topology/sign combination. Include both operand orders, scalar forms, empty and zero singletons, each receiver alias and the dedicated ordinary unbounded-zero/ray regressions.

src/Interval_defs.hh; src/Interval_inlines.hh; tests/intervalarithmeticspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalresultsspec1.cc.

CPP
Public

Public header: <ppl.hh>; members of Parma_Polyhedra_Library::Interval<Boundary, Info> and free operators in Parma_Polyhedra_Library:

template <Interval_Source From1, Interval_Source From2>
I_Result mul_assign(const From1& x,const From2& y);
SW_SPEC
4
PPL-SPEC-000732

div_assign(x,y) shall enclose {a ⁄ b ∣ a ∈ X, b ∈ Y, b ≠ 0}. An empty operand or a divisor consisting only of zero shall give empty. A divisor with negative and positive values shall give universe as the specified conservative interval abstraction, including when a tighter interval image could be representable. A divisor with only one nonzero sign, possibly with zero as an endpoint, shall retain every defined quotient; zero-denominator pairs shall not become mathematical results. The negative-and-positive divisor branch shall return I_UNIVERSE | I_SINGULARITIES. It shall not infer exactness of the quotient image from exact assignment of the universe representation.

For finite nonempty operands whose divisor has finite endpoints strictly on one side of zero, exact admitted endpoint operations and supported membership shall give the exact interval image. Its extrema shall be the least/greatest of the four endpoint quotients; attainment shall account for all ties and an attained zero numerator. A one-sided divisor approaching zero may require an unbounded endpoint. Inexact conversion or unsupported openness may enlarge the result.

Operands shall be initialized and valid intervals or admitted finite scalar singletons over the ordinary real carrier. The receiving policy shall admit the result, including empty and unbounded sets where required. Active rational payloads shall be canonical. The selected source/destination numerical combinations shall have well-formed underlying endpoint operations; the generic signatures shall not promise every possible cross-family instantiation. Each selected operation and all its intermediates shall satisfy the boundary type's range, resource, policy, shared-temporary and caller-owned FPU prerequisites. Separate operands shall remain unchanged. The receiver may alias an interval operand or both interval operands; scalar references shall not borrow numerical storage overwritten during the operation. Access shall be synchronized against mutation. No additional library initialization shall be required. Underlying failure shall retain the underlying numerical/allocation guarantees; a general rollback guarantee shall not be implied. Returned I_Result values shall obey the logical shape/status meanings of 🔗 1. Interval result possibilities and status-flag set operations; only established claims shall be reported.

Excluding undefined zero-denominator pairs differs from choosing a conservative universe. A zero numerator has only zero defined quotients, while a numerator and divisor both crossing zero can have every real quotient, so the same conservative branch cannot uniformly certify either exactness or inexactness.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Compare four-corner rational quotient extrema and tied/zero attainment for all finite topologies with a divisor bounded away from zero. Check empty/zero divisors, negative/positive divisor signs, strict crossing with a zero numerator, one-sided zero limits, scalar forms and each receiver alias. Check directed integral quotient enclosures. Check result claims for zero, one-sided and crossing numerators over a divisor crossing zero, including both exact and inexact universe images and each receiver alias. Distinguish zero-only and empty divisors from the crossing singularity branch.

src/Interval_defs.hh; src/Interval_inlines.hh; tests/intervalarithmeticspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalresultsspec1.cc.

CPP
Public

Public header: <ppl.hh>; members of Parma_Polyhedra_Library::Interval<Boundary, Info> and free operators in Parma_Polyhedra_Library:

template <Interval_Source From1, Interval_Source From2>
I_Result div_assign(const From1& x,const From2& y);
SW_SPEC
5
PPL-SPEC-000733
PPL-SPEC-000733
Ordinary interval arithmetic value operators

The free binary +, -, * and / operators shall return an independent interval value of the interval operand's boundary/information type, with the corresponding semantics of 🔗 2. Ordinary interval addition and subtraction, 🔗 3. Ordinary interval multiplication and 🔗 4. Ordinary interval division and zero-divisor abstraction. They shall support two intervals of that type, an interval followed by an admitted scalar singleton, and a scalar followed by an interval. Operand order shall be preserved for subtraction and division. Separate returned values shall not share mutable owned endpoint storage with their operands.

Operands shall satisfy the corresponding assignment operation's numerical, policy and runtime prerequisites. Operand values shall remain unchanged on successful return. Access shall be synchronized with mutation. Allocation or numerical exceptions shall propagate with the corresponding operation's guarantees. No additional library initialization shall be required.

Value operators must retain directed assignment semantics, operand order and independent ownership.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Exercise all twelve overload forms against independent literal rational results, including asymmetric subtraction/division, empty and zero-divisor cases. Mutate/destroy operands and returned values independently to check storage ownership; retain no-initialization and numerical configuration controls.

src/Interval_defs.hh; src/Interval_inlines.hh; tests/intervalarithmeticspec1.cc; tests/Box/intervalcontracts1.cc.

CPP
Public

Public header: <ppl.hh>; members of Parma_Polyhedra_Library::Interval<Boundary, Info> and free operators in Parma_Polyhedra_Library:

template <typename B,typename Info>
Interval<B,Info> operator+(const Interval<B,Info>& x,
                            const Interval<B,Info>& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator+(const Interval<B,Info>& x,const T& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator+(const T& x,const Interval<B,Info>& y);
template <typename B,typename Info>
Interval<B,Info> operator-(const Interval<B,Info>& x,
                            const Interval<B,Info>& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator-(const Interval<B,Info>& x,const T& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator-(const T& x,const Interval<B,Info>& y);
template <typename B,typename Info>
Interval<B,Info> operator*(const Interval<B,Info>& x,
                            const Interval<B,Info>& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator*(const Interval<B,Info>& x,const T& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator*(const T& x,const Interval<B,Info>& y);
template <typename B,typename Info>
Interval<B,Info> operator/(const Interval<B,Info>& x,
                            const Interval<B,Info>& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator/(const Interval<B,Info>& x,const T& y);
template <typename B, typename Info, Interval_Singleton T>
Interval<B,Info>
operator/(const T& x,const Interval<B,Info>& y);