Parma Polyhedra Library requirements
C++ constraints and constraint systems

C++ constraints and constraint systems

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

A Constraint of dimension d shall describe one relation on rational valuations x ∈ ℚd. With its exposed expression E(x) = b + ∑d − 1i = 0aixi, its three types shall mean E(x) = 0, E(x) ≥ 0 and E(x) > 0, respectively. A coefficient belonging to an internal strictness representation shall not be exposed as a coordinate of this relation.

Use shall satisfy 🔗 3. Thread initialization, default state and finalization. The caller shall synchronize any access overlapping modification of the same object. Both DENSE and SPARSE storage shall be supported and default_representation shall be SPARSE. Computed construction, conversion, normalization, dimension transformation and comparison guarantees shall require representability of every evaluated coefficient arithmetic step in the selected coefficient profile. Unchecked completion shall not establish this precondition. Allocation and configured numerical exceptions may propagate. Failed construction shall release resources owned by the incomplete constraint. Distinct, unchanged sources shall survive a reported failure; otherwise a modified destination shall remain destructible, without a universal unchanged-state guarantee.

Constraint meaning concerns the admitted valuations, rather than a particular coefficient scale or hidden strictness column.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Evaluate exposed affine expressions with independent rational arithmetic, testing equality, strict boundaries and nonstrict boundaries. Include zero-dimensional relations and trailing unused coordinates in both representations. Check numerical-profile preconditions separately from relation truth.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public

Public header: <ppl.hh>; names belong to Parma_Polyhedra_Library.

class Constraint;
enum Constraint::Type { EQUALITY, NONSTRICT_INEQUALITY, STRICT_INEQUALITY };
static constexpr Representation Constraint::default_representation = SPARSE;
SW_SPEC
2
PPL-SPEC-000102
PPL-SPEC-000102
Relational construction from affine operands

The relational operators ==, >=, <=, > and < applied to affine operands shall construct constraints denoting those mathematical relations. They shall accept two expressions, two variables, or an expression and a coefficient in either order. Variables shall denote coordinate functions and coefficients shall denote constants. The result dimension shall be the maximum operand dimension, including unused trailing coordinates. Equality shall have type EQUALITY; the ordered operators shall select the corresponding strict or nonstrict inequality type. Operands shall be preserved. Results shall use Constraint::default_representation.

Coefficient normalization may rescale the relation without changing its truth. For equalities and closed nonstrict inequalities produced directly by these operators, coefficients and the constant term shall have common divisor one unless all are zero. Equality's first nonzero homogeneous coefficient shall be positive; inequality orientation shall be preserved. These conventions shall not imply that every later strict constraint has a primitive exposed coefficient vector. The prerequisites of 🔗 1. Constraint relation meaning and numerical prerequisites shall apply.

Relational operators construct geometric descriptors; expression equality here does not return a boolean expression-value comparison.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Compare all overloads with independently evaluated operand relations at rational points on and around boundaries. Include unequal dimensions in both orders, common coefficient factors, equal operands, constants of both signs and unchanged sources. Check relation type, declared dimensions and the stated normalization conventions.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public

For Linear_Expression operands e and f, Variable operands x and y, and Coefficient operand n, the following forms shall be admitted in a C++ function using PPL names:

Constraint ee_equal(e == f), vv_equal(x == y), en_equal(e == n), ne_equal(n == e);
Constraint ee_ge(e >= f), vv_ge(x >= y), en_ge(e >= n), ne_ge(n >= e);
Constraint ee_le(e <= f), vv_le(x <= y), en_le(e <= n), ne_le(n <= e);
Constraint ee_gt(e > f), vv_gt(x > y), en_gt(e > n), ne_gt(n > e);
Constraint ee_lt(e < f), vv_lt(x < y), en_lt(e < n), ne_lt(n < e);
SW_SPEC
3
PPL-SPEC-000103
PPL-SPEC-000103
Default and shared zero-dimensional constraints

Default construction with optional representation shall yield a dimension-zero nonstrict tautology with expression zero. The requested representation shall be used. zero_dim_false() shall return a borrowed dimension-zero inconsistent equality; zero_dim_positivity() shall return a borrowed dimension-zero nonstrict tautology with a positive constant term. Shared objects shall remain usable until their owning initialized thread is finalized. Copying a shared object shall create an independently owned value.

An empty coordinate space still admits true and false relations, with lifetime distinct from a client-owned copy.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check default type, value and requested representation; classify both shared constants independently; copy them into owned objects and exercise copies during a balanced initialized lifetime.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
explicit Constraint(Representation r = default_representation);
static const Constraint& Constraint::zero_dim_false();
static const Constraint& Constraint::zero_dim_positivity();
SW_SPEC
4
PPL-SPEC-000104
PPL-SPEC-000104
Owned constraint copying, assignment and swapping

Ordinary copy construction shall preserve relation type, exposed coefficients, constant term, dimension and representation. Explicit-representation copying shall use the requested representation. Copy assignment shall replace the target with the source's entry value and representation, preserve a distinct source and return the target reference. Self-assignment shall preserve the constraint. Rvalue arguments shall admit these copy forms without requiring a distinct move operation; the source shall retain its value.

Distinct copies shall remain independent of later mutation and destruction. m_swap and the PPL swap overload shall exchange complete constraint values, including dimensions and representation. Self-swap shall preserve the value. Destruction shall release owned storage. Failure while constructing a replacement for copy assignment shall leave the target unchanged.

Constraint values own their storage even when constructed from borrowed expression views or shared constants.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check all relation types, dense/sparse copy combinations, return identity, self-assignment, rvalue copies, mutation independence, retained copies after source destruction, both swap forms and replacement-copy failures.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
Constraint(const Constraint& c);
Constraint(const Constraint& c, Representation r);
Constraint& Constraint::operator=(const Constraint& c);
Constraint::~Constraint();
void Constraint::m_swap(Constraint& y);
void swap(Constraint& x, Constraint& y);
SW_SPEC
5
PPL-SPEC-000105
PPL-SPEC-000105
Constraint representation conversion

representation() shall report the current coefficient storage. For r equal to DENSE or SPARSE, successful set_representation(r) shall preserve relation type, every exposed coefficient, constant term and dimension, and select r. Repeating the current choice shall preserve the object. A failed replacement allocation shall leave the original representation and value unchanged.

Storage conversion must preserve the complete descriptor rather than only its satisfying set.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Convert equality, nonstrict and strict constraints both ways, including zero-dimensional and trailing-zero cases. Check exact coefficients and independent satisfaction before and after conversion; inject conversion allocation failures.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
Representation Constraint::representation() const;
void Constraint::set_representation(Representation r);
SW_SPEC
6
PPL-SPEC-000106
Constraint dimensions and explicit coordinate transformations

max_space_dimension() shall report the expression dimension limit and space_dimension() shall report the constraint's public ambient dimension. Dimension arguments and resulting dimensions shall not exceed that limit; all referenced existing coordinates shall lie within the current dimension.

Dimensioned copy construction and set_space_dimension(n) shall retain coordinates below the lesser dimension and the constant term, insert zero coefficients on extension, and discard removed trailing coefficients on shrinking. Normalization may rescale retained coefficients without changing the transformed relation. Dimensioned copies without an explicit storage choice shall retain source representation. remove_space_dimensions(vars) shall discard selected coefficients, compact surviving coordinates in their original order, and return true. Removing none or all shall be admitted.

swap_space_dimensions shall exchange the designated coefficients; permute_space_dimensions shall require a cycle of distinct coordinates and move each listed coefficient to the next listed coordinate, wrapping the last to the first. Cycles of fewer than two entries shall preserve the value. shift_space_dimensions(v,n) shall insert n zero coordinate coefficients before v.id(), where v.id() <= space_dimension(), shifting the suffix and increasing the public dimension by n. A zero shift shall preserve value. These operations shall preserve relation type and representation. They shall describe coefficient transformation rather than existential projection of satisfying points. Arithmetic prerequisites in 🔗 1. Constraint relation meaning and numerical prerequisites shall apply.

Descriptor coordinate removal substitutes zero for removed terms before reindexing; it does not eliminate variables existentially.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Transform independent coefficient vectors and compare relation truth at rational valuations. Include strict constraints so hidden strictness storage cannot be exposed or lost; test shrinking, extending, empty/all removals, inverse swaps/cycles and insertion at front/interior/end.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
static dimension_type Constraint::max_space_dimension();
dimension_type Constraint::space_dimension() const;
Constraint(const Constraint& c, dimension_type space_dim);
Constraint(const Constraint& c, dimension_type space_dim, Representation r);
void Constraint::set_space_dimension(dimension_type n);
bool Constraint::remove_space_dimensions(const Variables_Set& vars);
void Constraint::swap_space_dimensions(Variable x, Variable y);
void Constraint::permute_space_dimensions(const std::vector<Variable>& cycle);
void Constraint::shift_space_dimensions(Variable v, dimension_type n);
SW_SPEC
7
PPL-SPEC-000107
PPL-SPEC-000107
Constraint kind, coefficients and borrowed expression access

Borrowed coefficient and expression accessors shall require an lvalue receiver, with corresponding const && overloads deleted in every coefficient profile. Copying a borrowed expression view shall not extend the owning descriptor's lifetime.

type() and the four kind predicates shall identify equality, either inequality, nonstrict inequality and strict inequality exactly. coefficient(v) shall return the corresponding homogeneous coefficient when v.id() < space_dimension() and otherwise throw std::invalid_argument. inhomogeneous_term() shall return the public constant term. A configured reference return shall remain borrowed until modification or destruction of its owning constraint.

expression() shall return a read-only borrowed adapter exposing precisely the affine expression in 🔗 1. Constraint relation meaning and numerical prerequisites, with the same public dimension, homogeneous coefficients and constant term and without a hidden strictness coordinate. The view shall require its owning constraint to remain alive and unchanged for the uses covered here. Materializing it as a Linear_Expression shall produce an independent value. Queries shall preserve their source.

Public affine coefficients have geometric meaning independently of internal representation columns.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check all type/predicate combinations and in-range coefficients for each relation type. Reject the first and a later out-of-range coordinate, including dimension zero. Copy each view to a standalone expression and verify dimensions/coefficients and independence after source mutation.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
Constraint::Type Constraint::type() const;
bool Constraint::is_equality() const;
bool Constraint::is_inequality() const;
bool Constraint::is_nonstrict_inequality() const;
bool Constraint::is_strict_inequality() const;
Coefficient_traits::const_reference Constraint::coefficient(Variable v) const &;
Coefficient_traits::const_reference Constraint::inhomogeneous_term() const &;
typedef Expression_Hide_Last<Linear_Expression> Constraint::expr_type;
Constraint::expr_type Constraint::expression() const &;
SW_SPEC
8
PPL-SPEC-000108
PPL-SPEC-000108
Exact tautology and inconsistency classification

is_tautological() shall hold exactly when every rational valuation in the declared ambient dimension satisfies the constraint. is_inconsistent() shall hold exactly when none does. An expression with a nonzero public homogeneous coefficient shall satisfy neither predicate. For constant b, equality shall be tautological exactly at b = 0 and inconsistent otherwise; nonstrict inequality shall be tautological at b ≥ 0 and inconsistent at b < 0; strict inequality shall be tautological at b > 0 and inconsistent at b ≤ 0. These queries shall preserve the object.

A single affine relation can be classified completely from its coefficients; a system of nontrivial constraints requires separate satisfiability analysis.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Exhaust constant signs for every relation type at zero and positive dimensions. Check nonconstant constraints with independent witnesses satisfying and violating the relation, including strict boundaries and both storage choices.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
bool Constraint::is_tautological() const;
bool Constraint::is_inconsistent() const;
SW_SPEC
9
PPL-SPEC-000109
PPL-SPEC-000109
Semantic equivalence and exact descriptor identity

is_equivalent_to(y) and constraint operator== shall report equality of the satisfying sets when the public dimensions agree, independently of storage and internal strictness topology. Different public dimensions shall compare nonequivalent. Tautologies of the same dimension shall be equivalent even if their types or constant forms differ; the same shall hold for inconsistent constraints. Nontrivial equivalence shall respect relation type, positive rescaling of inequalities, and arbitrary nonzero rescaling of equalities. Inequality expressions shall negate semantic equivalence.

is_equal_to(y) shall report complete identity of the stored normalized descriptor, including internal topology, relation kind, coefficient sequence and dimension, independently of dense/sparse storage. A positive identity result shall imply semantic equivalence; a negative result shall not establish nonequivalence. Queries shall preserve operands. Numerical prerequisites in 🔗 1. Constraint relation meaning and numerical prerequisites shall apply.

Mathematical equivalence and stored identity support different client decisions, especially for strict constraints and constant relations.

APPROVED
GEOMETRIC_DESCRIPTORS
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 equivalent positive/negative equality scales, positive inequality scales, different relations and dimensions, cross-representation copies, all tautology/inconsistency forms and public nonstrict constraints obtained through NNC systems. Validate equivalence expectations with independent rational truth conditions, rather than using the query as its own oracle.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
bool Constraint::is_equivalent_to(const Constraint& y) const;
bool Constraint::is_equal_to(const Constraint& y) const;
bool operator==(const Constraint& x, const Constraint& y);
// Inequality uses C++20 rewriting of operator==.
SW_SPEC
10
PPL-SPEC-000110
Conversion of equality congruences to constraints

Construction from a zero-modulus Congruence shall yield an equality constraint with the same public dimension and satisfying valuations, using the requested representation. Normalization may rescale its coefficients. The source shall remain unchanged. A proper congruence with nonzero modulus shall be rejected with std::invalid_argument and shall not yield a constraint. Numerical prerequisites in 🔗 1. Constraint relation meaning and numerical prerequisites shall apply.

A congruence with nonzero modulus denotes a periodic condition and cannot be silently reinterpreted as equality.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Convert zero-modulus congruences with both coefficient signs, constants and trailing zeros in both representations. Compare rational equality truth independently. Reject positive-modulus proper congruences and check source preservation.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
explicit Constraint(const Congruence& cg,
                    Representation r = default_representation);
SW_SPEC
11
PPL-SPEC-000111
PPL-SPEC-000111
Reloadable constraint representation

ascii_dump(s) shall export all fields needed to reload the constraint: its full stored coefficient expression, relation token and topology token. ascii_dump() shall use std::cerr. Export shall preserve its source. For compatible complete exported data with representable coefficients, ascii_load(s) shall return true and replace the destination's stored relation, dimension and coefficients, retaining the destination storage choice. It shall preserve the source relation's satisfying set and public kind.

Malformed expression, relation or topology tokens, missing coefficient slots, truncated input, violations of the checked row invariants and inconsistent encoded relation/type combinations shall return false. The expression slot count shall include the constant and any required internal strictness slot; invalid counts shall not be accepted as valid relations. If expression loading fails, ascii_load(s) shall return false without reading the relation or topology suffix. Trailing input shall remain available to the caller. A failed load may change the destination; it shall remain destructible and admit replacement by a subsequent complete valid load. No rollback or cross-version format stability is promised. Allocation and configured numerical exceptions may propagate.

A reloadable constraint must retain strictness and public dimensions rather than merely a printed inequality.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Round-trip every relation type, constants, sparse gaps and trailing dimensions through both producer/destination representations. Compare exposed coefficients, kind and rational truth. Test malformed/truncated expressions and relation/topology fields, invalid counts, trailing-input preservation and complete replacement after reported failure. Reject invalid expression prefixes followed by otherwise valid relation/topology suffixes, checking that those suffixes remain unread. Reject missing NNC epsilon storage and nonzero equality epsilon across source/destination representations. Preserve the exported internal epsilon bounds, including positive epsilon inequalities. Exercise both inequality strictness signs, trailing input and complete valid replacement after false.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
void Constraint::ascii_dump(std::ostream& s) const;
void Constraint::ascii_dump() const;
bool Constraint::ascii_load(std::istream& s);
SW_SPEC
12
PPL-SPEC-000112
PPL-SPEC-000112
Readable constraint and system output

Constraint output shall print nonzero homogeneous terms in increasing coordinate order, followed by " = ", " >= " or " > " according to public type, and the negated inhomogeneous term. A zero homogeneous part shall print 0. Unit coefficient magnitudes shall omit the numeral and *; other magnitudes shall use *. Signs shall use a leading minus or the separators " + " and " - ". Coordinates shall use the active formatter in 🔗 7. Active Variable formatter and initialized thread state. Type output shall print EQUALITY, NONSTRICT_INEQUALITY or STRICT_INEQUALITY for the corresponding Constraint::Type value.

System output shall print its publicly iterated constraints separated by ", ", or true when that range is empty. Output operators shall return the supplied stream, add no newline and preserve their objects. Each type's print() shall use that output on std::cerr. Formatting arithmetic shall require representability of all evaluated coefficient negations.

Human output describes public relations and hides internal strictness machinery, while each system uses its public iterator range.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check literal equality/nonstrict/strict displays with unit and nonunit coefficients, signs, zero homogeneous parts and custom coordinate names. Check exact type names, empty and multirow system separators, stream identity and redirected standard-error print output.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
namespace IO_Operators {
  std::ostream& operator<<(std::ostream& s, const Constraint& c);
  std::ostream& operator<<(std::ostream& s, const Constraint::Type& t);
  std::ostream& operator<<(std::ostream& s, const Constraint_System& cs);
}
void Constraint::print() const;
void Constraint_System::print() const;
SW_SPEC
13
PPL-SPEC-000113
PPL-SPEC-000113
Constraint and system invariants and memory accounting

OK() on a constraint or system shall report the checked representation invariants. Values produced by successful operations under their preconditions shall satisfy those invariants. For each type, total_memory_in_bytes() shall equal sizeof that object's type plus external_memory_in_bytes(). Memory queries shall preserve relation meaning, dimensions and representation. Their counts shall not promise allocator overhead, process resident memory or a fixed ordering between sparse and dense storage.

Representation diagnostics and owned-storage accounting are available independently of geometric satisfiability.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check invariants and accounting identities for constants, every relation kind, empty/singleton/mixed systems, copies and representation conversions. Confirm all semantic observations remain unchanged without imposing target-specific memory totals.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
bool Constraint::OK() const;
memory_size_type Constraint::total_memory_in_bytes() const;
memory_size_type Constraint::external_memory_in_bytes() const;
bool Constraint_System::OK() const;
memory_size_type Constraint_System::total_memory_in_bytes() const;
memory_size_type Constraint_System::external_memory_in_bytes() const;
SW_SPEC
14
PPL-SPEC-000114
Constraint-system conjunction, construction and shared contradiction

A Constraint_System shall denote the conjunction of its constraints over its declared rational coordinate space. An empty conjunction shall be true. An empty public range shall not mean an inconsistent set. Conversely, zero_dim_empty() shall return a borrowed, dimension-zero system containing an inconsistent equality and denoting the empty set of valuations. That shared system shall remain alive until its owning initialized thread is finalized.

Default construction shall create a dimension-zero system with no constraints. Construction from one constraint shall create its singleton conjunction and use that constraint's public dimension. Both shall use the requested representation; default_representation shall be SPARSE. Construction shall own its stored values independently of the source. Use shall satisfy 🔗 1. Constraint relation meaning and numerical prerequisites's initialization, synchronization, arithmetic and failure prerequisites.

The empty constraint list denotes the universe, whereas an inconsistent singleton denotes no points; the word empty has distinct container and geometric uses.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Evaluate default, singleton and shared inconsistent systems independently at rational points. Check dimensions, requested representations, source independence and the distinction between no constraints and no satisfying valuation.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
class Constraint_System;
static constexpr Representation Constraint_System::default_representation = SPARSE;
explicit Constraint_System(Representation r = default_representation);
explicit Constraint_System(const Constraint& c,
                           Representation r = default_representation);
static const Constraint_System& Constraint_System::zero_dim_empty();
SW_SPEC
15
PPL-SPEC-000115
PPL-SPEC-000115
Constraint-system owned values and representation conversion

System copy construction shall preserve the conjunction, dimension and representation; the explicit-representation overload shall use its requested storage. Copy assignment shall replace the target with an independent copy of the source's entry value and representation, preserve a distinct source and return the target reference. Self-assignment shall preserve the system. Rvalue arguments shall admit the copy forms without requiring a distinct move operation, retaining source value. Copies shall survive later source modification or destruction.

m_swap and the PPL swap overload shall exchange entire system values, dimensions and representations. Self-swap shall preserve the system. representation() shall report current storage. Successful set_representation(r) for DENSE or SPARSE shall select that storage for the system and its rows while preserving conjunction and dimension. Destruction shall release owned storage. Copy-assignment replacement failure shall preserve the target. Other failure guarantees shall follow 🔗 1. Constraint relation meaning and numerical prerequisites.

Systems are owning values whose storage may change without altering the conjunction they denote.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check both storage choices and conversions for empty, equality, inequality and mixed strict systems. Check copy independence, retained copies after destruction, assignment return identity, self/rvalue use, swaps and unchanged conjunction under conversion using independent rational evaluation.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
Constraint_System(const Constraint_System& cs);
Constraint_System(const Constraint_System& cs, Representation r);
Constraint_System& Constraint_System::operator=(const Constraint_System& y);
Constraint_System::~Constraint_System();
Representation Constraint_System::representation() const;
void Constraint_System::set_representation(Representation r);
void Constraint_System::m_swap(Constraint_System& y);
void swap(Constraint_System& x, Constraint_System& y);
SW_SPEC
16
PPL-SPEC-000116
PPL-SPEC-000116
System insertion, dimension adjustment and clearing

insert(const Constraint&) shall conjoin a copy of its source with the system's existing meaning, preserve the source constraint and retain system representation. The resulting dimension shall be the maximum of old system and inserted constraint dimensions. Rows with fewer coordinates shall be extended with zero coefficients. Inserting duplicates or tautologies shall preserve the corresponding conjunction; insertion of an inconsistent constraint shall make it unsatisfiable. Retrievable rows need only describe an equivalent conjunction and need not preserve insertion order or duplicate multiplicity.

Rvalue insertion shall have the same mathematical, coordinate and topology semantics while permitting reuse of source storage. The source shall not borrow a row of the receiving system and shall remain destructible and assignable, with no unchanged-value guarantee. Const sources, including const rvalues, shall use preserving insertion.

max_space_dimension() shall return the constraint dimension limit. space_dimension() shall return the declared system dimension. set_space_dimension(n) shall require an admitted result dimension and apply the constraint coordinate-resizing semantics in 🔗 6. Constraint dimensions and explicit coordinate transformations to its rows; an empty system may retain a positive dimension. clear() shall remove all constraints and reset dimension zero, retaining representation. These are descriptor transformations and do not promise existential projection when nonzero coefficients are discarded. Successful rvalue row insertion shall leave its source a valid descriptor with an unspecified value.

Insertion must align coordinates and distinguish preserving inputs from explicitly consumed sources. Declared dimensions also matter for empty systems.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Insert different-dimension equality, nonstrict and strict constraints in multiple orders, duplicates, tautologies and contradictions. Compare conjunction truth over independent valuations. Check source preservation, empty-system extension, nonzero coefficient truncation, clear and reuse. Check const and borrowed row insertion into both representations, matching and differing topology, and smaller/equal/larger declared row dimensions; verify NNC epsilon placement, independent conjunction and source preservation.

src/Row_Transfers.cc; tests/consuminginsertions1.cc; src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
void Constraint_System::insert(const Constraint& c);
void Constraint_System::insert(Constraint&& c);
static dimension_type Constraint_System::max_space_dimension();
dimension_type Constraint_System::space_dimension() const;
void Constraint_System::set_space_dimension(dimension_type n);
void Constraint_System::clear();
SW_SPEC
17
PPL-SPEC-000117
PPL-SPEC-000117
System emptiness and retained constraint-kind queries

empty() shall return whether the public iterator range has no nontrivial constraints. Tautological stored rows shall be omitted from that range, so a system containing only tautologies shall be empty under this query. The query shall not determine whether a nonempty conjunction is satisfiable.

has_equalities() shall report whether a retained stored row is an equality, including a tautological equality omitted by public iteration. has_strict_inequalities() shall report whether a retained row is a nontautological strict inequality; tautological strict rows and internal strictness bounds shall not make it true. These properties shall concern the retained descriptor representation and shall not claim a minimal equivalent system. Queries shall preserve conjunction and dimensions.

Container emptiness and stored relation kinds differ from the satisfiability of a conjunction, and public iteration deliberately omits tautologies.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check truly empty and tautology-only systems, tautological equality rows, strict tautologies, nontrivial strict rows and inconsistent rows. Use a contradictory pair of individually nontrivial inequalities to establish that nonempty is not a satisfiability decision.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
bool Constraint_System::empty() const;
bool Constraint_System::has_equalities() const;
bool Constraint_System::has_strict_inequalities() const;
SW_SPEC
18
PPL-SPEC-000118
PPL-SPEC-000118
Read-only forward iteration over nontrivial constraints

begin() and end() shall delimit the system's retained, non-tautological constraints. Each exposed row shall have the system's declared public dimension. Iteration order shall not be a semantic ordering guarantee. Dereference and member selection at a non-end position shall borrow its constraint. Prefix increment shall advance and return the iterator; postfix increment shall return an independent copy of its entry position.

Iterator copy construction and assignment shall preserve the borrowed system and position while allowing subsequent navigation of independent copies. Iterators shall be compared only within the same unchanged system. Default iterators shall admit copying, assignment and destruction; they shall not be dereferenced or advanced until assigned a valid position. Modification or destruction of the system shall invalidate its iterators and borrowed row references.

Read-only iteration exposes an equivalent conjunction while preserving ownership in the system and filtering tautologies.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Check empty and tautology-filtered ranges and mixed relation kinds; compare the iterated conjunction with an independent oracle. Check copied/default-assigned positions, prefix return identity, postfix entry position, pointer/reference identity and row dimensions.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
typedef Constraint_System_const_iterator Constraint_System::const_iterator;
Constraint_System::const_iterator Constraint_System::begin() const;
Constraint_System::const_iterator Constraint_System::end() const;
Constraint_System_const_iterator();
Constraint_System_const_iterator(const Constraint_System_const_iterator& y);
Constraint_System_const_iterator::~Constraint_System_const_iterator();
Constraint_System_const_iterator&
Constraint_System_const_iterator::operator=(const Constraint_System_const_iterator& y);
const Constraint& Constraint_System_const_iterator::operator*() const;
const Constraint* Constraint_System_const_iterator::operator->() const;
Constraint_System_const_iterator& Constraint_System_const_iterator::operator++();
Constraint_System_const_iterator Constraint_System_const_iterator::operator++(int);
bool Constraint_System_const_iterator::operator==(const Constraint_System_const_iterator& y) const;
bool Constraint_System_const_iterator::operator!=(const Constraint_System_const_iterator& y) const;
SW_SPEC
19
PPL-SPEC-000119
PPL-SPEC-000119
Reloadable constraint-system representation

ascii_dump(s) shall export the system's complete stored coefficient rows, public dimension, topology, representation choice and row-state fields needed for compatible reloading. ascii_dump() shall use std::cerr. Export shall preserve the source.

Loading a complete compatible export with representable coefficients shall return true and replace the destination with the encoded system, retaining its conjunction, public dimension and encoded representation choice. Malformed or truncated headers, row data, relation/topology fields and inconsistent encoded dimensions or row-state fields shall be reported by false rather than accepted as a valid system. Trailing input after the representation shall remain available. Failure may change the destination; it shall remain destructible and admit complete valid replacement. No rollback or cross-version format stability is promised. Allocation and configured numerical exceptions may propagate. The decoded header dimension shall not exceed max_space_dimension(), including when the record contains no rows; not_a_dimension() shall be rejected as an unsupported extent.

System reload preserves its conjunction and coordinate context, including fields that a human-readable list does not encode.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Round-trip empty positive-dimension, singleton, duplicate/tautology-containing and mixed strict systems across initial destination choices. Compare dimensions, encoded representation and independent rational conjunction truth. Check malformed/truncated headers and rows, inconsistent counts/dimensions/state and replacement after failure. Check zero, positive and maximum admitted header dimensions, maximum plus one and the reserved non-dimension, even for empty row sequences. Exercise both storage choices, preserved trailing input and complete valid replacement after rejection.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
void Constraint_System::ascii_dump(std::ostream& s) const;
void Constraint_System::ascii_dump() const;
bool Constraint_System::ascii_load(std::istream& s);
SW_SPEC
20
PPL-SPEC-000120
PPL-SPEC-000120
Extracting equality constraints from a congruence system

Construction from a Congruence_System shall produce the conjunction of its zero-modulus equality rows converted according to 🔗 10. Conversion of equality congruences to constraints. Proper congruences shall be omitted rather than converted to equalities or used as periodic constraints. The result shall retain the congruence system's declared public dimension even when no equality survives, use the requested representation, and preserve its source. Arithmetic prerequisites in 🔗 1. Constraint relation meaning and numerical prerequisites shall apply.

The conversion extracts only the affine equality part of a congruence system; the result is not a representation of its periodic conditions.

APPROVED
GEOMETRIC_DESCRIPTORS
IF_CPP
Test, Analysis, Inspection

Use mixed equality/proper-congruence systems, proper-only systems and empty systems with positive dimension. Compare the resulting equality conjunction independently over rational points, verify retained dimension/representation and unchanged source.

src/Constraint_defs.hh; src/Constraint_inlines.hh; src/Constraint.cc; src/Constraint_System_defs.hh; src/Constraint_System_inlines.hh; src/Constraint_System.cc; tests/constraintspec1.cc.

CPP
Public
explicit Constraint_System(const Congruence_System& cgs,
                           Representation r = default_representation);