Parma Polyhedra Library requirements
C++ interval integer-point decisions and normalization

C++ interval integer-point decisions and normalization

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-000709
PPL-SPEC-000709
Exact interval integer-point existence

For an initialized valid interval with represented set I, contains_integer_point() shall return true exactly when I∩ℤ ≠ ⌀. Empty intervals shall return false; ordinary real-unbounded nonempty intervals shall return true. A singleton at positive or negative infinity shall return false: an admitted extended infinite value shall not be classified as an integer.

For finite bounds l, u, the least admitted integer shall be ⌈l⌉ for a closed lower endpoint and ⌊l⌋ + 1 for an open lower endpoint. The greatest admitted integer shall be ⌊u⌋ for a closed upper endpoint and ⌈u⌉ − 1 for an open upper endpoint. The query shall report whether that least integer exceeds the greatest integer, returning false exactly in that case. It shall preserve boundary values and metadata.

The finite ceil/floor values and unit adjustments used to establish this exact decision shall be representable exactly by the boundary scalar, and their numerical operations shall satisfy the scalar's policy, resource, shared-temporary and caller-owned FPU prerequisites. Rational values shall be canonical. Inspection shall be synchronized with modification of the interval. The query shall require no additional library initialization.

A complete integer-point decision must account for strict endpoint membership and distinguish an included infinite value from an unbounded range of finite numbers.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Compare open/closed rational endpoint pairs with independent arbitrary- precision floor/ceiling integer bounds. Cover empty intervals, finite singletons, intervals between consecutive integers, positive/negative fractions, closed-only and integer-bound presets, rays, universe and admitted signed infinity singletons. Exercise supported native floating boundaries within the exact arithmetic range and confirm source preservation.

src/Interval_defs.hh; tests/intervalintegerspec1.cc.

CPP
Public

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

bool contains_integer_point() const;
SW_SPEC
2
PPL-SPEC-000710
Interval endpoint normalization around integer points

drop_some_non_integer_points() shall preserve every integer point of the receiving interval while replacing effective finite endpoints by closed integral endpoints. Empty intervals shall remain unchanged. A finite closed lower bound l shall become ⌈l⌉; a finite open lower bound shall become ⌊l⌋ + 1. A finite closed upper bound u shall become ⌊u⌋; a finite open upper bound shall become ⌈u⌉ − 1.

For an ordinary real interval, these replacements shall yield the interval hull of its integer points, becoming empty when no integer point remains. Unbounded endpoints shall retain their unbounded meaning without requiring evaluation of an inactive numerical payload. Normalization shall be idempotent and may retain noninteger interior values between distinct integer endpoints. For a policy admitting infinity as an element, the operation shall preserve the extended endpoint values; it shall not establish that every retained element is an integer or that its result is the least interval hull of the finite integer points.

The interval shall be initialized and valid, and its policy shall admit any resulting empty value. Active finite numerical payloads shall be initialized. The relevant rounded integers and unit adjustments shall be representable exactly for the stated exact endpoint guarantee. Numerical policy, resources, shared-temporary serialization and caller-owned FPU state shall satisfy the scalar floor/ceiling and unit-arithmetic contracts. Callers shall synchronize modification. The operation shall require no additional library initialization; underlying numerical failure shall retain the scalar operation's guarantees.

Rounding the effective endpoints removes finite boundary portions that cannot contain an integer while retaining all integer solutions. A convex interval can still contain noninteger interior values.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check independent exact floor/ceiling endpoint formulas on exhaustive quarter-grid rational intervals with all endpoint topologies. Confirm preserved integer membership, closed effective endpoints, empty results and idempotence. Include rays, universe, integer-bound and closed-only presets, supported native floating formats within the exact range, and the stated retention of admitted extended endpoints.

src/Interval_defs.hh; tests/intervalintegerspec1.cc.

CPP
Public

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

void drop_some_non_integer_points();