Parma Polyhedra Library requirements
Internal finite bit-set rows

Internal finite bit-set rows

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-000441

Bit_Row shall represent a finite set S of nonnegative bit positions, independently of the configured Coefficient type. It shall have no declared matrix width: an unset position beyond the highest stored position shall remain absent. ULONG_MAX shall be reserved as the absence indication for traversal, rather than an inserted member.

Operations shall require live valid objects and sufficient resources, with mutating positions/counts within the supported GMP storage limits and nonoverflowing capacity calculations. Callers shall prevent concurrent access to a row while another operation modifies it. No library or thread initialization object or coefficient-constant stage shall be required. Storage allocation failure shall not be a successful set result. Failed C++ construction shall release resources owned by its incomplete object; ordinary allocation-failure recovery shall not be promised for a fatal GMP allocation failure. Successfully constructed owners shall remain independently destructible.

Incidence and saturation data need exact finite-set meaning without depending on coefficient width or an enclosing matrix shape.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Check literal sets and empty values across limb boundaries, preserve distinct owners, and run without initialization in threaded and non-thread-safe configurations.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

class Bit_Row;
SW_SPEC
2
PPL-SPEC-000442
PPL-SPEC-000442
Empty construction, owned copying and bit-row lifetime

Default construction shall represent the empty set. Copy construction and assignment shall preserve the source set and establish independent owned storage. Assignment shall return its target and admit self-assignment. Copies shall remain usable after source mutation or destruction. Destruction shall release the GMP storage owned by the row. Copying an rvalue through these copy interfaces shall not change its source.

Owned bit storage must not be shared accidentally between matrices or temporary algorithm results.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Check empty/populated copies and assignments, self-assignment, source destruction, rvalue copying and independent high-position mutations.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

Bit_Row();
Bit_Row(const Bit_Row& y);
Bit_Row& operator=(const Bit_Row& y);
~Bit_Row();
SW_SPEC
3
PPL-SPEC-000443
PPL-SPEC-000443
Individual bit membership, insertion and removal

For any admitted position k, set(k) shall replace S by S∪{k} and clear(k) by S⧵{k}. Repeating either operation shall be idempotent and preserve every other membership. operator[](k) shall return true exactly when k ∈ S. Membership queries shall admit every unsigned long argument, including ULONG_MAX, and shall not grow storage merely to inspect an absent high position. Querying shall preserve the row.

Bit-level updates must preserve every unrelated incidence relation.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Compare membership and updates with an independent set, including repeated insertion/removal, first/last positions, sparse high bits and maximum unsigned queries without huge allocations.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

bool operator[](unsigned long k) const;
void set(unsigned long k);
void clear(unsigned long k);
SW_SPEC
4
PPL-SPEC-000444
PPL-SPEC-000444
Bit prefixes, suffix removal and complete clearing

set_until(k) shall replace S by S∪{i ∣ 0 ≤ i < k}, retaining all entry members at or above k. clear_from(k) shall replace S by {i ∈ S ∣ i < k}. clear() shall replace S by the empty set. Setting a zero-length prefix shall do nothing; clearing from zero shall remove every member. Repeating these operations shall be idempotent. Mutation limits and resource conditions shall follow 🔗 1. Finite bit-set row values and valid use.

Prefix operations update a specified index range while preserving the complementary range.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Check zero, exact limb boundaries, adjacent positions and repeated growth/shrink histories against explicit set insertion/removal, retaining distant members outside updated prefixes.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

void set_until(unsigned long k);
void clear_from(unsigned long k);
void clear();
SW_SPEC
5
PPL-SPEC-000445
PPL-SPEC-000445
Set union, intersection and difference with aliased operands

The two-source constructor shall represent Y∪Z. union_assign(x,y), intersection_assign(x,y) and difference_assign(x,y) shall replace the target by X∪Y, X∩Y and X⧵Y, respectively, using both operand sets on entry. Either or both operands may designate the target, including all-three-equal calls. A distinct source shall remain unchanged.

union_assign_and_count(x,y) shall replace the target by the same entry union and return its exact number of set bits, with the same source-alias and capacity-retention guarantees as union_assign.

Union assignment shall retain the target's allocated bit capacity when it is sufficient for the result and shall not shrink that capacity.

Difference shall use a lazily owned unbounded-integer temporary. In a non-thread-safe configuration, calls shall be serialized against other PPL arithmetic sharing that temporary machinery, even on distinct row objects. In a thread-safe configuration the pool shall belong to the calling thread. No explicit initialization shall be required for this temporary ownership.

Algorithms reuse bit rows as operands and targets; storage reuse must preserve entry-value set algebra.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Check union cardinality against an independent finite set across limb boundaries, including empty, aliased, preallocated and recycled targets. Exhaust independent small set masks spread over several limbs for distinct and aliased targets, both source orders, equal operands, empty/nonempty size asymmetry and unchanged distinct sources. Check that union assignment retains sufficient capacity when the result becomes smaller or empty.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc; tests/bitrowreuse1.cc; tests/bitrowunioncount1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

Bit_Row(const Bit_Row& y, const Bit_Row& z);
void union_assign(const Bit_Row& x, const Bit_Row& y);
unsigned long union_assign_and_count(const Bit_Row& x, const Bit_Row& y);
void intersection_assign(const Bit_Row& x, const Bit_Row& y);
void difference_assign(const Bit_Row& x, const Bit_Row& y);
SW_SPEC
6
PPL-SPEC-000446
PPL-SPEC-000446
Ordered bit traversal, cardinality and absence

first() and last() shall return the minimum and maximum members of S, respectively. next(p) shall return the least member strictly greater than p; prev(p) shall return the greatest member strictly less than p. Each shall return ULONG_MAX when no such member exists. The position arguments shall admit the full unsigned long range: next(ULONG_MAX) and prev(0) shall report absence, while prev(ULONG_MAX) shall return the last member of a nonempty row.

count_ones() shall return |S|, and empty() shall be true exactly for the empty set. These queries shall preserve the row and shall not allocate storage merely to inspect high positions.

Strict predecessor/successor semantics and a reserved absence value make sparse incidence enumeration unambiguous.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Compare complete ascending/descending enumerations, cardinality and all local query positions with an independent ordered set; include empty sets, internal zero limbs, exact limb boundaries and maximum unsigned queries.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

unsigned long first() const;
unsigned long last() const;
unsigned long next(unsigned long position) const;
unsigned long prev(unsigned long position) const;
unsigned long count_ones() const;
bool empty() const;
SW_SPEC
7
PPL-SPEC-000447
PPL-SPEC-000447
Bit-set equality and inclusion predicates

operator== shall be true exactly when the operand sets are equal; operator!= shall be its negation. Both subset_or_equal forms shall return true exactly for X ⊆ Y. On a true result, the output strict_subset shall be true exactly for X ⊊ Y; its value after a false result shall be unspecified. The separate strict_subset function shall return true exactly for proper inclusion. All row operands shall remain unchanged, and they may designate the same object.

Set inclusion supplies a different relation from the total ordering used for row sorting.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Exhaust pairs of literal set masks with equal/unequal limb extents, proper inclusion, incomparable sets, both initial strict-output values and self operands; inspect the strict-output value only when inclusion succeeds.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

bool operator==(const Bit_Row& x, const Bit_Row& y);
bool operator!=(const Bit_Row& x, const Bit_Row& y);
bool subset_or_equal(const Bit_Row& x, const Bit_Row& y);
bool subset_or_equal(const Bit_Row& x, const Bit_Row& y, bool& strict_subset);
bool strict_subset(const Bit_Row& x, const Bit_Row& y);
SW_SPEC
8
PPL-SPEC-000448
PPL-SPEC-000448
Least-significant differing-position total order

compare(x,y) shall return zero for equal sets. Otherwise, let k = min(X△Y) be the smallest position whose membership differs. It shall return 1 when k ∈ X and  − 1 when k ∈ Y. The result shall define a total order in which a proper subset precedes its superset. It shall compare membership starting at the least significant differing position, including when that order differs from comparing the sets' binary integers numerically. Both operands shall remain unchanged and may designate the same row.

A precise row ordering supports deterministic sorting while retaining the inclusion-order extension property.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Use an independent ascending symmetric-difference oracle, exact return codes, all small mask pairs and triples for order properties, high-limb differences and a low-bit-versus-higher-bit example that distinguishes integer ordering.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

int compare(const Bit_Row& x, const Bit_Row& y);
SW_SPEC
9
PPL-SPEC-000449
PPL-SPEC-000449
Bit-row owner exchange and vector element exchange

Member/free swaps shall exchange the complete represented sets and their owned storage without changing either owner object's identity. Self-swap shall preserve its value. iter_swap shall exchange the rows at two valid iterators into live std::vector<Bit_Row> objects, including equal iterators, and shall preserve all other vector elements and vector shape. The vector iterators shall remain valid when they were valid on entry. Subsequent mutation and destruction of an exchanged row shall remain independent of every other row.

Row permutation must transfer owners rather than leave shared or dangling bit storage.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Check empty/nonempty/differently allocated swaps, self swaps, vector exchanges and cross-vector exchanges, then mutate exchanged owners and verify unrelated rows and vector positions.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

void Bit_Row::m_swap(Bit_Row& y);
void swap(Bit_Row& x, Bit_Row& y);
void iter_swap(std::vector<Bit_Row>::iterator x,
               std::vector<Bit_Row>::iterator y);
SW_SPEC
10
PPL-SPEC-000450
PPL-SPEC-000450
Bit-row validity and allocated-memory accounting

For a valid row, OK() shall return true. The validity condition shall require nonnegative used-limb count no greater than allocated-limb count, and a nonzero highest used limb whenever any limb is used. external_memory_in_bytes() shall report the allocated GMP limb payload in bytes, including spare allocated limbs. total_memory_in_bytes() shall return sizeof(Bit_Row) + external_memory_in_bytes(). These queries shall preserve the row and its represented set. An empty set shall not require its owned allocation to have been released.

Logical emptiness and allocated capacity are distinct properties of an owned bit row.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Check empty/populated/cleared/copied/swapped rows, exact total/external relation, a bit-position-based information-storage lower bound and invariants after every mutation history.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; src/Bit_Row.cc; tests/bitrowprefix1.cc; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Bit_Row.

bool OK() const;
memory_size_type external_memory_in_bytes() const;
memory_size_type total_memory_in_bytes() const;
SW_SPEC
11
PPL-SPEC-001648
PPL-SPEC-001648
Translation of bit-row member positions

shift_left(count) shall replace the entry set S by {k + count ∣ k ∈ S}. Every resulting member shall be less than ULONG_MAX; the caller shall ensure this bound before the call. A zero shift shall preserve the set. An empty set shall remain empty for every unsigned long count, including ULONG_MAX, without growing its owned storage. Translation shall preserve the number of members and shall not change independently owned copies.

Valid use and resource conditions shall follow 🔗 1. Finite bit-set row values and valid use.

Prepending unconstrained generator directions adds zero leading columns to a saturation matrix. Translating stored bit positions preserves the existing incidences in their new columns.

APPROVED
CORE_DATA_STRUCTURES
IF_CPP
Test, Analysis, Inspection

Compare literal finite-set translations and composed shifts across GMP limb boundaries. Check zero shifts, independent retained copies, cardinality, traversal and empty shifts by the maximum count without storage growth.

src/Bit_Row_defs.hh; src/Bit_Row_inlines.hh; tests/bitrowspec1.cc.

CPP
Internal

Internal source header: Bit_Row_defs.hh; namespace Parma_Polyhedra_Library. The signature belongs to Bit_Row.

void shift_left(unsigned long count);