Parma Polyhedra Library requirements
C++ bounded-difference values and foundational queries

C++ bounded-difference values and foundational queries

PPL-SPEC-001056
1. Bounded-difference values, numerical profiles and valid use
UID: PPL-SPEC-001056
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

BD_Shape<T> shall represent a topologically closed subset of the real coordinate space Rn as a finite conjunction of unary inequalities ±xi ≤ c and difference inequalities xi − xj ≤ c, with distinct empty and universe values in every supported ambient dimension. A coordinate absent from all restrictions shall remain unrestricted. Rational bounds shall not change the coordinate carrier into a rational-only or integer-only set.

The coefficient base T shall select the supported bounded integer, supported native floating, GMP integer or GMP rational profile. The exposed coefficient_type_base shall be T; coefficient_type shall additionally represent positive infinity and provide the declared rounding-aware bound operations. A positive-infinite bound shall impose no inequality. Integer-bound profiles shall still describe real points, rather than only integer points. Finite bounds and all intermediate arithmetic shall obey the selected profile's range and rounding prerequisites; an outwardly rounded bound shall not exclude points satisfying the admitted source constraint.

Objects and supplied descriptors shall be live, well formed and externally synchronized. Coordinate identities and the reserved dimension indication shall follow 🔗 1. Coordinate type and reserved dimension index. Descriptor initialization in 🔗 1. Initialization owners and automatic C++ initialization and 🔗 3. Thread initialization, default state and finalization shall apply where used. Native floating operations shall require their configured support and the initialized rounding environment prescribed by the numerical facilities. Mutation, destruction and operations that may update caches shall not race with another use of the same object.

For profiles whose arithmetic rounds or saturates, shortest-path closure shall preserve the represented set through outward derived bounds without promising canonical, idempotent or maximally precise closure. Guarantees stated for unbounded exact coefficient arithmetic shall remain distinct from allowed rounded approximations.

RATIONALE:

A bounded-difference value is relational over real coordinates even when its stored bound type is integral; numerical representation and closure precision are separate obligations.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

template <typename T> class BD_Shape;
typedef T coefficient_type_base;
typedef N coefficient_type;
VERIFICATION_CRITERIA:

Use independent rational conjunctions to check unary/difference expressiveness, real fractional witnesses in integral-bound profiles, empty/universe and unconstrained coordinates. Inspect supported type/extension definitions and exercise exact rational, integral and configured native profiles under their runtime prerequisites.

BIBLIOGRAPHY:

BagnaraHZ09FMSD | Section 3.1, difference constraints, unary zero-node encoding and transitive closure (PDF page index 5, zero-based).

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc.

PPL-SPEC-001057
2. Dimensioned empty and universe bounded-difference construction
UID: PPL-SPEC-001057
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

BD_Shape(d,kind) shall construct the specified EMPTY or UNIVERSE value with ambient dimension d. Default construction shall give zero-dimensional universe. Zero-dimensional universe shall contain the unique empty tuple; zero-dimensional empty shall contain none.

max_space_dimension() shall return the selected profile's structural dimension limit. A requested dimension above that limit shall throw std::length_error before attempting the corresponding matrix storage, including when adding the internal zero coordinate would overflow the dimension type. A dimension within that limit shall remain subject to actual resource availability; the reported limit shall not promise allocation success.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Mathematical ambient dimension and storage limits must remain distinct, including at the extra zero-coordinate boundary.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

explicit BD_Shape(dimension_type d=0, Degenerate_Element kind=UNIVERSE);
static dimension_type max_space_dimension();
VERIFICATION_CRITERIA:

Check default and explicit empty/universe construction in zero and small positive dimensions. Reject above-limit and unsigned-boundary requests without allocating at the limit; preserve the zero-dimensional meanings.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/fromspacedim1.cc; tests/BD_Shape/maxspacedim1.cc; tests/BD_Shape/dimensionlimits1.cc.

3. Owned bounded-difference copying, assignment and cleanup
UID: PPL-SPEC-001058
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Ordinary copying shall create an independent shape with the source's represented set and ambient dimension. Copy assignment shall replace the target's value and dimension with the source's, including across different dimensions. Source mutation or destruction shall not change an independent copy; target mutation shall not change the source. Self-assignment shall preserve the value. The ordinary copy constructor's complexity argument shall be ignored for the three declared complexity values.

Destruction shall release resources owned by that shape exactly once. Assignment shall return a reference to the receiver. Failed construction shall release its acquired resources; failed assignment shall not imply a rollback guarantee.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Value ownership must hold independently of closure/reduction cache state and coordinate count.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

BD_Shape(const BD_Shape& y, Complexity_Class complexity=ANY_COMPLEXITY);
BD_Shape& operator=(const BD_Shape& y);
~BD_Shape();
VERIFICATION_CRITERIA:

Compare independent mathematical values after copy/assignment, self-assignment, source destruction and separate mutations. Exercise fresh/closed/reduced, empty/universe, zero dimensions and allocation failures with cleanup and retry.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/dimensionlimits1.cc.

PPL-SPEC-001059
4. Outward conversion between bounded-difference coefficient profiles
UID: PPL-SPEC-001059
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

BD_Shape<T>(y) for another supported coefficient base shall inherit the source's ambient dimension and contain every source point. Each finite source bound shall be converted outward under the destination profile's declared operations; positive-infinite bounds shall remain unrestricted. Exact representable source bounds shall retain their values; inexact conversion may lose precision. Empty and zero-dimensional source meanings shall be preserved.

The source may undergo logically const closure before conversion; this shall preserve its represented set. The three declared complexity arguments shall not change the conversion. The new shape shall own independent storage. Exact representability of every stored input bound shall not by itself promise stronger subsequent rounded-closure guarantees.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

A source dimension above the destination profile's max_space_dimension() shall throw std::length_error before source normalization or allocation of the corresponding target matrix storage.

RATIONALE:

Coefficient conversion must enclose the source while preserving independent value ownership.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

template <typename U>
explicit BD_Shape(const BD_Shape<U>& y,
                  Complexity_Class complexity=ANY_COMPLEXITY);
VERIFICATION_CRITERIA:

Normalize rational source rows independently; compare rational/integral/native conversions on signed fractional and exactly representable bounds, infinite sides, emptiness, dimensions and source/cache histories. Verify containment and separate source/target mutation.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/dimensionlimits1.cc.

PPL-SPEC-001060
5. Whole bounded-difference value exchange
UID: PPL-SPEC-001060
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

m_swap and free swap shall exchange the two complete represented values and ambient dimensions, including empty/universe and different dimensions. A self-swap shall preserve the value. Exchanged ownership and all cache metadata shall remain associated with the corresponding value; neither operation shall require equal dimensions.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Storage and derived metadata must move together when exchanging whole values.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

void m_swap(BD_Shape& y);
template <typename T> void swap(BD_Shape<T>& x, BD_Shape<T>& y);
VERIFICATION_CRITERIA:

Check literal source/target values before and after both swaps and self-swaps across unequal dimensions, emptiness and fresh/closed/reduced cache histories; mutate and destroy the exchanged owners independently.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc.

PPL-SPEC-001061
6. Bounded-difference construction from supported constraints
UID: PPL-SPEC-001061
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

BD_Shape(cs) shall start from universe in the system's ambient dimension and conjoin every admitted constraint. Nontrivial admitted rows shall be nonstrict unary constraints or two-coordinate differences with equal-magnitude opposite coefficients; equalities shall impose both directions. Constant tautologies shall have no effect and constant falsehood shall produce empty. An empty system shall produce universe.

A nontrivial strict inequality, a row with more than two nonzero variable coefficients, or a two-variable row with unequal-magnitude or same-sign coefficients shall throw std::invalid_argument, including after an earlier contradiction. Supported unary/difference bounds not exactly representable in the selected profile shall be rounded outward to the best admitted bound; with unbounded exact rational arithmetic, the result shall equal the admitted conjunction. The source rows and represented conjunction shall remain unchanged. can_recycle_constraint_systems() shall return false.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

A source dimension above the destination profile's max_space_dimension() shall throw std::length_error before source normalization or allocation of the corresponding target matrix storage.

RATIONALE:

Syntactic bounded-difference admission and outward bound normalization determine the meaning of a directly supplied conjunction.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

explicit BD_Shape(const Constraint_System& cs);
static bool can_recycle_constraint_systems();
VERIFICATION_CRITERIA:

Use independent rational unary/difference conjunctions, negative/fractional scaling, equalities, constants, contradictions, strict/relational rejection and zero dimensions. Check const-source preservation and that can_recycle_constraint_systems returns false.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/dimensionlimits1.cc.

PPL-SPEC-001062
7. Bounded-difference construction from supported congruences
UID: PPL-SPEC-001062
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

BD_Shape(cgs) shall inherit the system's ambient dimension and conjoin its admitted equalities and constant truth values. Nontrivial equality rows shall be expressible as unary or equal-magnitude opposite-coefficient differences. A nontrivial proper congruence or unsupported equality shall throw std::invalid_argument, including after an earlier inconsistency. Constant proper congruences shall retain their tautological or inconsistent meaning. An empty system shall produce universe.

Exact rational coefficient arithmetic shall represent admitted equalities exactly. Other profiles shall retain the declared outward bound conversion on both equality directions. The const source shall retain its rows and value. can_recycle_congruence_systems() shall return false.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

A source dimension above the destination profile's max_space_dimension() shall throw std::length_error before source normalization or allocation of the corresponding target matrix storage.

RATIONALE:

A closed difference domain can retain affine equalities and constant truth values without representing nontrivial periodic residue classes.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

explicit BD_Shape(const Congruence_System& cgs);
static bool can_recycle_congruence_systems();
VERIFICATION_CRITERIA:

Check independently solved rational unary/difference equalities, negative scaling, constants, contradictions, proper-congruence rejection and unsupported equalities, including after falsehood; compare profiles and preserve sources.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/dimensionlimits1.cc.

PPL-SPEC-001063
8. Ambient and affine dimension of bounded-difference values
UID: PPL-SPEC-001063
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

space_dimension() shall return the ambient coordinate count independently of emptiness, boundedness or affine constraints. affine_dimension() shall return zero for empty and otherwise the dimension of the smallest affine subspace containing the represented set. Both zero-dimensional values shall have affine dimension zero. Implicit unary/difference equalities and relationally redundant descriptions shall be included in this determination; stored rounded entries shall not be assumed to certify an equality unless the represented set satisfies it.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Ambient coordinate identity and the dimension of the represented affine hull describe different properties.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

dimension_type space_dimension() const;
dimension_type affine_dimension() const;
VERIFICATION_CRITERIA:

Compute rational affine-hull ranks independently from exact implied equalities. Include fixed coordinates, difference-linked free coordinates, redundant chains, full-dimensional, empty and zero-dimensional values and rounded/native equality histories.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/affinedimension1.cc.

PPL-SPEC-001064
9. Owned constraint and affine-equality exports of bounded-difference values
UID: PPL-SPEC-001064
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

constraints() shall return an owned, dimension-preserving constraint system whose conjunction denotes the receiver. minimized_constraints() shall additionally provide an irredundant defining conjunction: removing any emitted nontrivial row shall enlarge the represented set. No unique row order or unique equality basis shall be required. Exported finite bounds shall have their exact stored mathematical values; no integer-bound profile shall silently change real coordinates into integer coordinates.

congruences() and minimized_congruences() shall return owned equality congruences defining the receiver's affine hull, retaining the same ambient and affine dimensions. They shall not replace the represented inequalities or invent periodic restrictions. Their nonempty equality system shall be a basis of the affine restrictions; empty shall export inconsistency. Zero-dimensional universe shall export a tautological conjunction; zero-dimensional empty shall export an inconsistent one.

Exported descriptors shall remain usable and independent after source mutation or destruction. Source normalization shall preserve its represented value; canonical row order or a particular redundant basis shall not be inferred beyond the declared minimization result.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Geometric defining inequalities and affine-hull equalities convey distinct information and need independent ownership.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

Constraint_System constraints() const;
Constraint_System minimized_constraints() const;
Congruence_System congruences() const;
Congruence_System minimized_congruences() const;
VERIFICATION_CRITERIA:

Compare exported inequality conjunctions with independent rational source sets and equality spans with independently computed affine hulls. Include implicit equalities, redundant rows, empty/zero dimensions, exact native endpoints and lifetime/mutation independence.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/constraints1.cc; tests/BD_Shape/minconstraints1.cc; tests/BD_Shape/congruences1.cc.

PPL-SPEC-001065
10. Ordinary classification of bounded-difference values
UID: PPL-SPEC-001065
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

The ordinary classification calls shall report their named mathematical properties of the represented set: emptiness, universe, discreteness, topological closure, boundedness and existence of an integer point. Every bounded-difference value shall be topologically closed. A nonempty convex value shall be discrete exactly when it is a singleton; empty shall be discrete and bounded. Zero-dimensional universe shall be nonempty, universe, bounded, discrete and contain its integer empty tuple; zero-dimensional empty shall contain no integer point.

constrains(var) shall report whether the represented set imposes a restriction on that coordinate, including relational restrictions; empty shall constrain each valid coordinate. A variable outside the ambient dimension shall throw std::invalid_argument. These decisions shall not confuse stored integer bounds with an integer-only carrier.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Closed convex geometry, lattice witnesses and syntactic bound types must remain separate classifications.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

bool is_empty() const;
bool is_universe() const;
bool is_discrete() const;
bool is_topologically_closed() const;
bool is_bounded() const;
bool contains_integer_point() const;
bool constrains(Variable var) const;
VERIFICATION_CRITERIA:

Use independent rational feasibility, affine dimension, recession directions and integer witness models. Include fractional singletons without integer points, nonempty integral-bound shapes, relational restrictions, free axes, emptiness, zero dimensions and invalid variables.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/empty1.cc; tests/BD_Shape/universe1.cc; tests/BD_Shape/discrete1.cc; tests/BD_Shape/bounded1.cc; tests/BD_Shape/containsintegerpoint1.cc; tests/BD_Shape/constrains1.cc.

PPL-SPEC-001066
11. Bounded-difference set relations, equality and compatible hashes
UID: PPL-SPEC-001066
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

For dimension-compatible operands, contains, strictly_contains and is_disjoint_from shall report mathematical set containment, proper containment and empty intersection. Equal nonempty or empty sets shall not strictly contain each other; every nonempty value shall strictly contain empty. The zero-dimensional values shall obey the same set rules. Dimension-incompatible relation calls shall throw std::invalid_argument.

Equality shall require equal ambient dimensions and equal represented sets; inequality shall be its logical complement. Different redundant/closure descriptions of the same set shall compare equal. Equal values shall have equal hash codes; collisions between unequal values shall be permitted. hash_code shall not modify the represented set.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Set relations and hash compatibility must depend on values rather than redundant matrix descriptions.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

bool contains(const BD_Shape& y) const;
bool strictly_contains(const BD_Shape& y) const;
bool is_disjoint_from(const BD_Shape& y) const;
int32_t hash_code() const;
template <typename T> bool operator==(const BD_Shape<T>& x,const BD_Shape<T>& y);
// Inequality uses C++20 rewriting of operator==.
VERIFICATION_CRITERIA:

Check Boolean inequality expressions in both operand orders through C++20 equality rewriting, retaining the stated equality and mismatch behavior. Determine inclusion and disjointness by independent exact rational implication/feasibility. Cover equivalent redundant systems, strict inclusion, empty/zero dimensions, different dimensions, self relations and equal-value hash compatibility across cache histories.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/contains1.cc; tests/BD_Shape/disjoint1.cc; tests/BD_Shape/equality1.cc; tests/BD_Shape/semanticqueries1.cc.

PPL-SPEC-001067
12. Relations between bounded-difference values and linear constraints
UID: PPL-SPEC-001067
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

relation_with(c) shall return the Poly_Con_Relation flags describing the whole represented set relative to the constraint: inclusion, disjointness, saturation when its affine expression vanishes throughout the set and strict intersection as defined by 🔗 1. Constraint-relation assertion values and named factories. The supplied row need not have bounded-difference syntax. A constraint within the ambient dimension shall not alter the represented set. A descriptor dimension above the receiver's shall throw std::invalid_argument. Empty and constant-row cases shall retain their set-theoretic flag combinations.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

A restricted representation can still answer semantic queries about arbitrary linear halfspaces and hyperplanes.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

Poly_Con_Relation relation_with(const Constraint& c) const;
VERIFICATION_CRITERIA:

Project arbitrary rational affine forms independently and derive every relation flag from the attained range. Include unary, difference and general correlated forms, weak/strict/equality relations, constants, empty/zero dimensions and incompatible descriptors.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/relations1.cc; tests/BD_Shape/relations2.cc; tests/BD_Shape/relations3.cc; tests/BD_Shape/relations4.cc.

PPL-SPEC-001068
13. Relations between bounded-difference values and linear congruences
UID: PPL-SPEC-001068
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

relation_with(cg) shall classify the represented set relative to the congruence using the declared Poly_Con_Relation semantics. Modulus zero shall mean equality. For a proper modulus, inclusion shall require every source point to satisfy the residue condition; disjointness shall mean no source point does. For a nonempty receiver, saturation shall mean that the affine image consists of one value belonging to the eligible modulus lattice; the value need not be zero. These tests shall use the real convex source set rather than treating integer bounds as integer coordinates. Arbitrary admitted affine congruence syntax shall be queryable even when it is not representable by a bounded-difference value. Descriptor dimension above the receiver's shall throw std::invalid_argument.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

A query can test periodic conditions without adding their nonconvex solution set to the representation.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

Poly_Con_Relation relation_with(const Congruence& cg) const;
VERIFICATION_CRITERIA:

Combine independent rational affine ranges with exact integer-multiple tests. Check constant satisfied/unsatisfied residues, equality modulus, ranges meeting or avoiding residue levels, continuous nonconstant ranges, empty/zero dimensions and dimension rejection.

SOURCE:

src/Shape_Congruence_Queries.hh; tests/shapeconstantqueryspec1.cc; src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/relations1.cc; tests/BD_Shape/relations2.cc; tests/BD_Shape/relations3.cc; tests/BD_Shape/relations4.cc; tests/BD_Shape/semanticqueries1.cc; tests/shapequerycertificatespec1.cc.

PPL-SPEC-001069
14. Subsumption of geometric generators by bounded-difference values
UID: PPL-SPEC-001069
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

relation_with(g) shall return Poly_Gen_Relation::subsumes() exactly when the represented set subsumes the generator under 🔗 6. Generator-relation assertion values and named factories. An ordinary point or closure point shall use its rational coordinates; closure points shall obey the same membership test because this domain is closed. A ray shall satisfy every represented homogeneous direction inequality, and a line shall satisfy each corresponding homogeneous equality. Empty shall subsume no generator. A generator dimension above the receiver's shall throw std::invalid_argument; a lower-dimensional generator shall have zero additional coordinates.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Point membership and recession directions require different homogeneous tests; closedness identifies point and closure-point membership.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

Poly_Gen_Relation relation_with(const Generator& g) const;
VERIFICATION_CRITERIA:

Check independent rational point substitution and homogeneous ray/line evaluation against source inequalities. Include divisor signs/canonical values, relational restrictions, zero trailing coordinates, empty/zero dimensions and incompatible descriptors. Exercise pairs with two infinite bounds, either one-sided finite bound, two finite bounds and equalities, for all four generator kinds and both descriptor representations against literal substitution.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/relations1.cc; tests/BD_Shape/relations2.cc; tests/BD_Shape/relations3.cc; tests/BD_Shape/relations4.cc.

PPL-SPEC-001070
15. Affine boundedness, extrema and witnesses on bounded-difference values
UID: PPL-SPEC-001070
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

bounds_from_above and bounds_from_below shall decide whether the supplied affine form has a finite corresponding bound on the receiver, and shall return true in both directions for empty, including zero-dimensional empty. Zero-dimensional universe shall likewise bound every admitted constant form. The form's dimension shall not exceed the receiver's; otherwise these calls and extrema overloads shall throw std::invalid_argument.

For nonempty shapes and unbounded exact bound arithmetic, extrema calls shall return true exactly when the requested extremum is finite, and shall return its exact rational value with positive canonical denominator. Every finite extremum of this closed polyhedral set shall be attained. On false, supplied outputs shall retain their entry values.

For bound profiles whose closure arithmetic rounds or overflows, the overload without a witness may use an outward closure bound for bounded-difference objectives: its returned maximum value shall be an upper approximation of the true supremum and its returned minimum a lower approximation of the true infimum. Overflow may prevent detecting a finite bound. General affine objectives and witness overloads shall use the represented constraint set's exact optimization contract. The attainment flag shall concern the actual extremum, rather than certify attainment of an approximate numerical bound.

On successful witness calls, g shall identify an ordinary point in the represented set attaining the returned exact extremum. Constant affine forms and zero-dimensional values shall retain their exact meanings. Numerator/denominator output objects shall be distinct; the witness and scalar outputs shall obey their ordinary ownership and range prerequisites.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

Exact extrema of a represented set differ from inexpensive rounded closure estimates, and an approximate bound is not an optimizing witness.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

bool bounds_from_above(const Linear_Expression& expr) const;
bool bounds_from_below(const Linear_Expression& expr) const;
bool maximize(const Linear_Expression& expr,Coefficient& n,Coefficient& d,bool& maximum) const;
bool maximize(const Linear_Expression& expr,Coefficient& n,Coefficient& d,bool& maximum,Generator& g) const;
bool minimize(const Linear_Expression& expr,Coefficient& n,Coefficient& d,bool& minimum) const;
bool minimize(const Linear_Expression& expr,Coefficient& n,Coefficient& d,bool& minimum,Generator& g) const;
VERIFICATION_CRITERIA:

Use independent rational projection of an added affine-result coordinate to derive extrema/unboundedness. Verify witness membership and objective value separately; include correlated general forms, difference fast paths, constants, empty/zero dimensions, unchanged false outputs, denominator normalization and rounded/native profile enclosures.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/max_min1.cc.

PPL-SPEC-001071
16. Constant affine values and zero frequency on bounded-difference sets
UID: PPL-SPEC-001071
STATUS: APPROVED
COMPONENT: BOUNDED_DIFFERENCES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

frequency(expr,fn,fd,vn,vd) shall return true exactly when the nonempty receiver assigns one unique real value to the affine expression. On true, fn/fd shall be 0/1 and vn/vd shall be that exact constant with positive canonical denominator. Nonconstant and empty cases shall return false and leave all four outputs unchanged. Constant expressions and zero-dimensional universe shall follow the same rule. An expression dimension above the receiver's shall throw std::invalid_argument. The four scalar output objects shall be pairwise distinct.

The validity, lifetime, arithmetic, range, rounding and synchronization prerequisites in 🔗 1. Bounded-difference values, numerical profiles and valid use shall apply. Logically const normalization may update caches but shall preserve the represented set and ambient dimension. Underlying supported numerical or allocation failures may propagate through their declared channels. Failure during construction shall release resources owned by the incomplete shape. Failure of a mutating operation shall retain the ownership needed for safe destruction; a general rollback guarantee shall not be inferred.

RATIONALE:

A convex real set supports a single affine value or a continuum, rather than a nonzero lattice frequency.

INTERFACE:

Public header: <ppl.hh>; excerpts for BD_Shape<T> and related free functions in Parma_Polyhedra_Library:

bool frequency(const Linear_Expression& expr,Coefficient& fn,Coefficient& fd,
               Coefficient& vn,Coefficient& vd) const;
VERIFICATION_CRITERIA:

Determine constancy by independent rational affine ranges/equality spans. Include correlated fixed differences on unbounded sets, fractional constants, free directions, empty/zero dimensions, negative/zero values, canonical outputs, unchanged sentinels and dimension rejection. Include sparse expressions with zero gaps, cancellations caused by successive substitutions, both expression representations and expressions with fewer declared dimensions than the receiver.

SOURCE:

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; tests/bdshapevaluesspec1.cc; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/boxallocationfixture.hh; tests/bdshapevaluespublic1.cc; tests/BD_Shape/frequency1.cc; tests/BD_Shape/sparsefrequency1.cc.