Parma Polyhedra Library requirements
C++ interval assignment and set operations

C++ interval assignment and set operations

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-000711
PPL-SPEC-000711
Interval assignment and directed enclosure

assign(x) shall replace the receiving interval by an outward enclosure of the source singleton or interval, using the receiving boundary and information policies. An empty source shall produce an empty interval. When both endpoints and their membership distinctions are representable exactly, assignment shall preserve the represented set. Otherwise its converted lower endpoint shall not exclude source values below it and its converted upper endpoint shall not exclude source values above it; unsupported strictness may be relaxed. Source infinity membership shall remain distinct from an unbounded finite range under policies that admit that distinction. Self-assignment shall preserve the represented set. A separate source shall remain unchanged.

assign(EMPTY) shall establish empty denotation; assign(UNIVERSE) shall establish the entire declared carrier. Assignment from admitted MINUS_INFINITY or PLUS_INFINITY shall establish the corresponding singleton. set_infinities() shall establish the interval from included negative infinity to included positive infinity; these operations shall require a policy that admits those included values. The templated assignment operator shall perform the corresponding assignment and return the receiving object. Constructors delegating to these assignments shall establish the same set.

Returned I_Result values shall obey the logical shape and status meanings of ๐Ÿ”— 1. Interval result possibilities and status-flag set operations; only established claims shall be reported.

The receiving interval shall have a policy that admits the result, including empty values where possible. Operands shall be initialized and valid; scalar operands shall denote admitted singleton values. Active numerical payloads shall be initialized and rational payloads canonical. The selected scalar operations shall meet their finite-range, policy, resource, shared-temporary and caller-owned FPU prerequisites. Inactive metadata-encoded endpoints shall not require evaluation as numerical values. Access shall be synchronized with modification. No additional library initialization shall be required. Underlying numerical or allocation failure shall propagate with the underlying operation's guarantees; there shall be no universal rollback guarantee.

Assignment must distinguish mathematical set preservation from outward endpoint conversion when source and destination policies differ.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check empty, universe, finite singleton, all finite endpoint topologies, rays and self-assignment. Compare exact same-profile results with an independent real-set model. Check inexact rational-to-integer enclosure, separate-source preservation and admitted included-infinity assignments. For scalar two, self-assignment, copied intervals, both included infinities and rounded conversions, check every returned definite claim against the independently known resulting set and entry-to-result change. Check each configured binding alias with finite rational range crossings, outward enclosure, independent equal-box intersection and empty-box join.

src/Interval_defs.hh; src/Interval_inlines.hh; tests/intervalsetsspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalresultsspec1.cc. tests/interfacedboxpolicies1.cc: Check each configured binding alias with finite rational range crossings, outward enclosure, independent equal-box intersection and empty-box join.

CPP
Public

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

I_Result assign(Degenerate_Element e);
template <Special_Marker From>
I_Result
assign(const From& value);
I_Result set_infinities();
template <Interval_Source From>
I_Result assign(const From& x);
template <Interval_Source T>
Interval& operator=(const T& x);
SW_SPEC
2
PPL-SPEC-000712
PPL-SPEC-000712
Interval hull assignment

For entry sets X,โ€‰Y, join_assign(x,y) shall produce an outward enclosure of their interval hull hull(XโˆชY). join_assign(x) shall use the receiving interval's entry set as X and the argument's set as Y. Empty operands shall be neutral. Under exact endpoint conversion with supported membership conditions, the result shall be the least interval of the receiving profile that contains both input sets. Equal limiting endpoints shall be included when either input includes that endpoint. A gap between the sets may be filled by the hull.

The receiver may alias either or both interval arguments. Results shall use their entry values, and distinct sources shall remain unchanged. Returned I_Result claims shall have the meanings of ๐Ÿ”— 1. Interval result possibilities and status-flag set operations; a conversion result shall not falsely establish exactness or a particular shape.

The receiving interval shall have a policy that admits the result, including empty values where possible. Operands shall be initialized and valid; scalar operands shall denote admitted singleton values. Active numerical payloads shall be initialized and rational payloads canonical. The selected scalar operations shall meet their finite-range, policy, resource, shared-temporary and caller-owned FPU prerequisites. Inactive metadata-encoded endpoints shall not require evaluation as numerical values. Access shall be synchronized with modification. No additional library initialization shall be required. Underlying numerical or allocation failure shall propagate with the underlying operation's guarantees; there shall be no universal rollback guarantee.

The interval join is the least enclosing interval when representable; it need not equal a disconnected union.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check disconnected unions with exact endpoints without inferring exactness of the literal union. Check returned claims for changed results, receiver aliases and empty-source no-ops. Compare the hull of literal endpoint-and-open-cell unions against both overloads, with empty, universe, disjoint, nested and touching sets, every endpoint topology, rays and each receiver alias. Check source preservation and mixed scalar operands. Check directed enclosure when endpoint conversion is inexact.

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

CPP
Public

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

template <Interval_Source From>
I_Result join_assign(const From& x);
template <Interval_Source From1, Interval_Source From2>
I_Result join_assign(const From1& x, const From2& y);
SW_SPEC
3
PPL-SPEC-000713
PPL-SPEC-000713
Geometric interval union gap decision

can_be_exactly_joined_to(x) shall return true exactly when the union of the receiving interval and the argument is itself an interval: there shall be no omitted point or gap between their represented sets. Touching finite limits shall join without a gap when at least one touching endpoint is included. Two open limits at that same finite value shall leave a gap. Neither operand shall be changed.

Both operands shall be nonempty, and neither shall be a singleton at an included infinity. They shall have compatible ordered carriers for their comparison operations. The decision shall concern their geometric union; it shall not certify that an endpoint of a different scalar or information policy can be represented exactly by the receiving interval's policy.

The receiving interval shall have a policy that admits the result, including empty values where possible. Operands shall be initialized and valid; scalar operands shall denote admitted singleton values. Active numerical payloads shall be initialized and rational payloads canonical. The selected scalar operations shall meet their finite-range, policy, resource, shared-temporary and caller-owned FPU prerequisites. Inactive metadata-encoded endpoints shall not require evaluation as numerical values. Access shall be synchronized with modification. No additional library initialization shall be required. Underlying numerical or allocation failure shall propagate with the underlying operation's guarantees; there shall be no universal rollback guarantee.

Gap detection and endpoint representability are different properties. Conflating them could incorrectly certify a rounded hull as an exact union.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Compare with literal unions of independent endpoint-and-cell sets. Cover finite and unbounded overlapping, separated, contained and touching intervals, all four touching endpoint topologies and source preservation. Include a gap-free mixed-boundary union whose limiting endpoint is not exactly representable by the receiver.

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

CPP
Public

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

template <Interval_Source Type>
bool can_be_exactly_joined_to(const Type& x) const;
SW_SPEC
4
PPL-SPEC-000714
PPL-SPEC-000714
Interval intersection assignment

For entry sets X,โ€‰Y, intersect_assign(x,y) shall produce an outward enclosure of XโˆฉY under destination endpoint conversion. intersect_assign(x) shall use the receiving interval's entry set as X. For exactly representable endpoints and supported membership conditions, the result shall denote the exact intersection. Equal limiting endpoints shall be included only when both operands include them. Disjoint sets and any empty operand shall produce an empty interval when that result is admitted.

The receiver may alias either or both interval arguments; the result shall use their entry values and preserve distinct sources. On success the return shall be I_EMPTY exactly when the represented result is empty and I_NOT_EMPTY otherwise. This shape indication shall not assert that a cross-policy rounded enclosure equals the mathematical intersection.

The receiving interval shall have a policy that admits the result, including empty values where possible. Operands shall be initialized and valid; scalar operands shall denote admitted singleton values. Active numerical payloads shall be initialized and rational payloads canonical. The selected scalar operations shall meet their finite-range, policy, resource, shared-temporary and caller-owned FPU prerequisites. Inactive metadata-encoded endpoints shall not require evaluation as numerical values. Access shall be synchronized with modification. No additional library initialization shall be required. Underlying numerical or allocation failure shall propagate with the underlying operation's guarantees; there shall be no universal rollback guarantee.

Intersection requires both endpoint membership conditions and an explicit emptiness outcome, including when the receiver aliases an input.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Compare both overloads with literal endpoint-and-cell intersection. Include empty and universe operands, all relative endpoint orders and topologies, rays, singleton intersections, source preservation and each receiver alias. Check the returned shape and mixed-boundary outward enclosure.

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

CPP
Public

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

template <Interval_Source From>
I_Result intersect_assign(const From& x);
template <Interval_Source From1, Interval_Source From2>
I_Result intersect_assign(const From1& x, const From2& y);
SW_SPEC
5
PPL-SPEC-000715
PPL-SPEC-000715
Interval enclosure of set difference

For entry sets X,โ€‰Y, difference_assign(x,y) shall produce an outward enclosure of hull(XโงตY). difference_assign(y) shall use the receiving interval's entry set as X. For exact endpoints with supported complementary openness, the result shall be the least interval containing the literal set difference. Removing all of X shall yield empty; removing nothing shall preserve X. Removing an interior interval while leaving nonempty portions on both sides shall preserve the hull across the removed interior. A removed included endpoint shall become excluded, and a removed open limit shall remain included when it belongs to X. Endpoint conversion or unsupported openness may enlarge that exact hull under the receiving policy; it shall not exclude a surviving value.

The receiver may alias either or both interval arguments. Results shall use entry values and distinct sources shall remain unchanged. Returned I_Result claims shall have the meanings of ๐Ÿ”— 1. Interval result possibilities and status-flag set operations; no shape or exactness claim shall be inferred from unestablished endpoint conversion information.

The receiving interval shall have a policy that admits the result, including empty values where possible. Operands shall be initialized and valid; scalar operands shall denote admitted singleton values. Active numerical payloads shall be initialized and rational payloads canonical. The selected scalar operations shall meet their finite-range, policy, resource, shared-temporary and caller-owned FPU prerequisites. Inactive metadata-encoded endpoints shall not require evaluation as numerical values. Access shall be synchronized with modification. No additional library initialization shall be required. Underlying numerical or allocation failure shall propagate with the underlying operation's guarantees; there shall be no universal rollback guarantee.

A literal difference can be disconnected. Its interval abstraction must preserve surviving values and use complementary membership at a newly exposed limit.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Compare both overloads with the hull of literal endpoint-and-cell difference. Include empty operands, containment, equality, disjointness, left/right truncation, interior holes, all touching topologies, rays, universe, singleton removal and each receiver alias. Check distinct sources remain unchanged and mixed-policy results enclose surviving values. Check returned shape, exactness and change claims for interior holes, removed-all cases and no-op differences against the literal difference and receiving entry set.

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

CPP
Public

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

template <Interval_Source From>
I_Result difference_assign(const From& x);
template <Interval_Source From1, Interval_Source From2>
I_Result difference_assign(const From1& x, const From2& y);