Parma Polyhedra Library requirements
C++ powerset foundations

C++ powerset foundations

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-001380
PPL-SPEC-001380
Generic powerset construction and ownership

Default construction shall create the empty collection. Construction from d shall store one copy of d; bottom may remain stored until reduction. Copying and assignment shall preserve the stored base-domain values and permit independent later mutations. Assignment shall return the receiver and support self-assignment. Exchange shall swap the entire collection and reduction state; self-exchange shall preserve the value. Destruction shall release owned storage.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation.

Collection ownership must preserve the meaning of base elements independently of storage sharing within the base domain.

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Exercise default/singleton, bottom, copies, self-assignment, exchanges and independent mutations.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/disjunct1.cc; tests/Powerset/powerset1.cc; tests/determinatehistories1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

Powerset();
explicit Powerset(const D&);
Powerset(const Powerset&);
~Powerset();
Powerset& operator=(const Powerset&);
void m_swap(Powerset&);
template <typename D> void swap(Powerset<D>&, Powerset<D>&);
SW_SPEC
2
PPL-SPEC-001381
PPL-SPEC-001381
Generic powerset entailment and equality

definitely_entails(y) shall return true exactly when every stored receiver element entails some stored element of y. is_bottom shall reduce and test whether no disjunct remains. is_top shall reduce and test for the singleton top element. Equality shall compare the reduced collections up to order and base equality; inequality shall negate equality. This is powerset-domain equality, which may distinguish collections with equal unions. These operations may perform lazy reduction and invalidate removed-element iterators.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation.

The Hoare ordering and reduced collection equality differ from geometric equality of unions.

BagnaraHZ06STTT | Section 3, Definitions 4–5 (Hoare ordering and semantic equivalence).

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Check Boolean inequality expressions in both operand orders through C++20 equality rewriting, retaining the stated equality and mismatch behavior. Check permuted, redundant and empty collections, entailment direction and equal unions with different decompositions.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/entails1.cc; tests/Powerset/equals1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

bool definitely_entails(const Powerset&) const;
bool is_top() const;
bool is_bottom() const;
template <typename D> bool operator==(const Powerset<D>&, const Powerset<D>&);
// Inequality uses C++20 rewriting of operator==.
SW_SPEC
3
PPL-SPEC-001382
PPL-SPEC-001382
Generic powerset traversal and erasure

size and empty shall report stored collection cardinality without requiring semantic reduction. Forward and reverse iterators shall visit the stored disjuncts in list order and reverse list order, respectively. Iterator dereference shall expose a const base element. drop_disjunct shall erase a valid dereferenceable iterator and return its successor. drop_disjuncts shall erase a valid half-open range; clear shall erase all elements. Erasure shall invalidate erased-element iterators; operations that replace or reduce the collection may invalidate additional iterators. End iterators shall not be dereferenced or passed as single-element erasure positions.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation. The iterator adapter protocols in 🔗 1. Read-only iterator types, borrowed positions and value operations, 🔗 2. Read-only iterator element identity and const access and 🔗 3. Read-only iterator traversal and interoperable equality shall apply.

Stored cardinality can include redundant or empty disjuncts and must remain distinct from semantic emptiness.

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Check forward/reverse and const traversal, erase successors, empty/full ranges and retained unrelated iterators.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/disjunct1.cc; tests/Powerset/size1.cc; tests/determinatehistories1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

typedef typename std::list<D>::size_type size_type;
typedef D value_type;
typedef iterator_to_const<std::list<D>> iterator;
typedef const_iterator_to_const<std::list<D>> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
size_type size() const;
bool empty() const;
iterator begin(); iterator end();
const_iterator begin() const; const_iterator end() const;
reverse_iterator rbegin(); reverse_iterator rend();
const_reverse_iterator rbegin() const; const_reverse_iterator rend() const;
iterator drop_disjunct(iterator);
void drop_disjuncts(iterator, iterator);
void clear();
SW_SPEC
4
PPL-SPEC-001383
PPL-SPEC-001383
Omega reduction of generic powersets

omega_reduce shall remove bottom disjuncts and base-entailment redundancies, preserving the represented union and leaving no distinct pair related by base entailment. Equal disjuncts shall retain one representative. Repeated reduction shall preserve the value. is_omega_reduced shall report or establish whether that nonredundancy condition holds, without removing elements. Reduction shall not promise a unique geometric decomposition.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation.

Removing an included disjunct preserves union, whereas replacing several disjuncts by their upper bound can enlarge it.

BagnaraHZ06STTT | Section 3, Definition 4 (nonredundancy and Omega reduction).

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Check duplicate, bottom, containment chains, incomparable disjuncts and repeated reductions against an independent union.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/cancellation1.cc; tests/powersetinterruptedproducts1.cc; tests/Powerset/reduce1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

void omega_reduce() const;
bool is_omega_reduced() const;
SW_SPEC
5
PPL-SPEC-001384
PPL-SPEC-001384
Disjunctive insertion and exact powerset union

add_disjunct(d) shall append a value copy and denote union with d. least_upper_bound_assign and upper_bound_assign shall compute exact disjunctive union, with redundant elements removable. Self-union shall preserve the value. upper_bound_assign_if_exact shall perform that same operation and return true. No convexification shall be implicit in these union members.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation.

The finite collection already represents disjunction exactly, without joining base elements.

BagnaraHZ06STTT | Section 3, Definition 5 (finite powerset join).

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Check disjoint/overlapping union, bottom, top, duplicate input, independent source ownership and self-union.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/disjunct1.cc; tests/Powerset/upperbound1.cc; tests/determinatehistories1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

void add_disjunct(const D&);
void least_upper_bound_assign(const Powerset&);
void upper_bound_assign(const Powerset&);
bool upper_bound_assign_if_exact(const Powerset&);
SW_SPEC
6
PPL-SPEC-001385
PPL-SPEC-001385
Pairwise lifting and generic powerset meet

pairwise_apply_assign(y,f) shall apply f to each ordered pair of reduced receiver and y elements, using an independent receiver copy for each pair, and collect the non-bottom results. meet_assign shall use the base meet in that lifting. If base meet represents intersection exactly, the result shall denote exact intersection of the input unions; otherwise its soundness and precision shall follow that base operation. Empty collections shall give empty and self-meet shall be supported.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation.

Intersection distributes over finite unions, requiring all ordered pairs rather than matching positions.

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Independently enumerate cross-pair intersections, empty inputs, discarded bottoms and self-aliasing.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/intersection1.cc; tests/Powerset/meet1.cc; tests/determinatehistories1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

template <typename Binary_Operator_Assign>
void pairwise_apply_assign(const Powerset&, Binary_Operator_Assign);
void meet_assign(const Powerset&);
SW_SPEC
7
PPL-SPEC-001386
PPL-SPEC-001386
Explicit powerset collapse

collapse() shall replace a nonempty collection by an iterated base-domain upper bound, leaving at most one disjunct. Empty shall remain empty. collapse(k) shall require k > 0, reduce first, and leave at most k disjuncts by joining the suffix into the last retained element when necessary. The resulting union shall contain the input union; exactness shall hold only when the selected base joins are exact. No minimal decomposition or optimal choice of merged elements shall be promised.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation.

Cardinality control deliberately trades disjunctive precision for storage and computation.

BagnaraHZ06STTT | Section 5, Definition 10 (collapsors).

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Check k equal to one, below/equal/above cardinality, empty input and a gap filled by convex collapse.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/collapse1.cc; tests/powersetlatticehistories1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

void collapse();
void collapse(unsigned max_disjuncts);
SW_SPEC
8
PPL-SPEC-001387
PPL-SPEC-001387
Generic powerset diagnostics and memory accounting

OK(disallow_bottom) shall check base invariants and any asserted reduction condition; when requested it shall also reject stored bottom members. Memory queries shall return lower bounds on managed and total bytes; total shall equal sizeof(*this) plus external bytes. Shared base storage may be counted more than once. Stream output shall return its stream and display false for bottom, true for top or a sequence of braced disjuncts. Display and invariant checks may trigger base queries or reduction.

The valid-use conditions in 🔗 1. Compound-domain values and valid use shall apply. Unless dimension-changing behavior is specified, ambient dimension shall be preserved. Deferred reduction and representation changes shall preserve the stated mathematical result. Borrowed views shall not be retained across an operation that can invalidate their underlying representation.

Memory estimates and human-readable display do not define a serialization or a canonical mathematical representation.

APPROVED
DOMAIN_COMBINATIONS
IF_CPP
Test, Analysis, Inspection

Check distinguished and multi-element output, stream identity, byte relationships and diagnostics on valid values.

src/Powerset_defs.hh; src/Powerset_inlines.hh; src/Powerset_templates.hh; src/Powerset_types.hh; tests/Powerset/membytes1.cc; tests/Powerset/powerset1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Members of Powerset unless qualified otherwise.

bool OK(bool disallow_bottom=false) const;
memory_size_type external_memory_in_bytes() const;
memory_size_type total_memory_in_bytes() const;
template <typename D>
std::ostream& IO_Operators::operator<<(std::ostream&, const Powerset<D>&);