C++ congruences and congruence systems
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000438 Thread entry and shared-facility use (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
For dimension d, integer coefficient expression E(x) = b + ∑d − 1i = 0aixi and nonnegative modulus m, a Congruence shall denote the rational valuations satisfying E(x) = 0 when m = 0, and E(x) ⁄ m ∈ ℤ when m > 0. Coordinates themselves need not be integral. is_equality() and is_proper_congruence() shall distinguish these cases exactly. is_tautological() shall report whether all rational valuations satisfy the relation; is_inconsistent() shall report whether none do. With a nonzero homogeneous coefficient neither predicate shall hold. For a constant expression, the first shall equal its equality/divisibility truth and the second its negation.
Use shall satisfy 🔗 3. Thread initialization, default state and finalization; the caller shall synchronize access overlapping modification of an object. Both dense and sparse storage shall be supported, with default_representation equal to SPARSE. Computed construction, arithmetic, normalization, comparison and transformation guarantees shall require every evaluated coefficient step and result to be representable in the selected numerical profile. Unchecked completion shall not prove this precondition. Allocation and configured numerical exceptions may propagate. Failed construction shall release its owned resources; distinct unchanged sources shall survive failures, while modified destinations shall remain destructible without a universal rollback guarantee.
Congruence divisibility applies to the affine result, including rational coordinate values, rather than forcing each coordinate to be an integer.
Public header: <ppl.hh>; names belong to Parma_Polyhedra_Library.
class Congruence; static constexpr Representation Congruence::default_representation = SPARSE; bool Congruence::is_equality() const; bool Congruence::is_proper_congruence() const; bool Congruence::is_tautological() const; bool Congruence::is_inconsistent() const;
Evaluate exact rational affine results and test equality or integral quotient independently. Include fractional satisfying and nonsatisfying coordinates, zero dimension, constants and trailing unused coordinates in both storage choices.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000438 Thread entry and shared-facility use (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
Default construction shall produce a dimension-zero equality with expression zero and use the requested representation. zero_dim_false() shall return a borrowed dimension-zero inconsistent equality. zero_dim_integrality() shall return a borrowed dimension-zero tautological proper congruence with modulus one. Shared constants shall remain usable until their initialized owning thread is finalized; owned copies shall be independent values.
Zero coordinates still admit true and false modular conditions. The shared integrality constant is a proper congruence even though it is tautological.
explicit Congruence(Representation r = default_representation); static const Congruence& Congruence::zero_dim_false(); static const Congruence& Congruence::zero_dim_integrality();
Check zero expression/modulus, requested storage, shared classifications and dimensions, and owned copies within balanced initialization.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
create and operator%= shall construct modulus-one congruences relating their operand expressions. The satisfying condition shall be E(x) − F(x) ∈ ℤ; a scalar operand shall denote a constant. The result dimension shall be the maximum operand dimension, including trailing zero coordinates. Sources shall be preserved. create shall use the requested representation; operator%= shall use default_representation. Reversing operands shall preserve the satisfying set, without requiring the same coefficient signs. The recycle-input constructor shall transfer an expression's coefficient value and representation, use its nonnegative modulus argument's entry value, and leave the transferred expression valid and independently destructible. A modulus borrowed from that expression shall be admitted. Numerical prerequisites in 🔗 1. Affine congruence meaning and valid numerical use shall apply.
The congruence construction symbol creates a descriptor rather than assigning to the affine operand.
static Congruence Congruence::create(const Linear_Expression& e1, const Linear_Expression& e2, Representation r = default_representation); static Congruence Congruence::create(const Linear_Expression& e, Coefficient_traits::const_reference n, Representation r = default_representation); static Congruence Congruence::create(Coefficient_traits::const_reference n, const Linear_Expression& e, Representation r = default_representation); Congruence operator%=(const Linear_Expression& e1, const Linear_Expression& e2); Congruence operator%=(const Linear_Expression& e, Coefficient_traits::const_reference n); Congruence(Linear_Expression& le, Coefficient_traits::const_reference m, Recycle_Input);
Compare all create/operator forms with independent rational operand differences, unequal dimensions, constants and variable conversions. Check modulus one, selected/default representation and unchanged sources.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000013 Meaning of linear constraints (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
Construction from an equality Constraint shall produce a modulus-zero congruence with the same satisfying valuations and dimension, using requested storage. A dimensioned overload shall apply coefficient truncation or zero extension as specified by 🔗 6. Congruence dimensions and coefficient-coordinate transformations. Inequality constraints shall be rejected with std::invalid_argument.
operator/(c,m) for an equality constraint and nonnegative modulus m shall construct the congruence formed from that equality expression with modulus m. In particular a positive supplied modulus shall produce a proper congruence, while zero shall preserve equality. It shall preserve its source and use the default representation. Numerical prerequisites in 🔗 1. Affine congruence meaning and valid numerical use shall apply.
An equality can be viewed modulo zero or used as the coefficient source for a periodic condition with an explicitly selected modulus.
explicit Congruence(const Constraint& c, Representation r = default_representation); Congruence(const Constraint& c, dimension_type new_space_dimension, Representation r = default_representation); Congruence operator/(const Constraint& c, Coefficient_traits::const_reference m);
Convert equalities in both representations, compare rational truth, resize during conversion and reject each inequality kind. Check explicit modulus zero and positive moduli independently, ensuring a positive modulus is not silently retained as equality.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000303 Preservation by representation-only changes (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
Copy construction shall preserve expression, modulus, dimension and source representation; the explicit-storage overload shall select its requested storage. Assignment shall copy the source's entry value and representation, return the target reference, preserve a distinct source and support self-assignment. Rvalue inputs shall admit those copy forms and preserve source value without requiring a distinct move operation. Distinct copies shall survive later source mutation or destruction.
m_swap and PPL swap shall exchange complete values, dimensions and storage; self-swap shall preserve the value. representation() shall report current storage. Successful set_representation(r) shall change only storage, preserving exact exposed coefficients, modulus and dimension. Destruction shall release owned storage. Copy assignment or representation conversion failing while constructing a replacement shall preserve the target.
Modulus and expression form one owning value; changing coefficient storage does not normalize or reinterpret the relation.
Congruence(const Congruence& cg); Congruence(const Congruence& cg, Representation r); Congruence& Congruence::operator=(const Congruence& y); Congruence::~Congruence(); Representation Congruence::representation() const; void Congruence::set_representation(Representation r); void Congruence::m_swap(Congruence& y); void swap(Congruence& x, Congruence& y);
Check owned copies, return identity, self/rvalue assignment, destruction independence, cross-storage conversions and swaps, exact field preservation and replacement-copy/conversion failures.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
max_space_dimension() shall return the expression dimension limit and space_dimension() the public ambient dimension. Dimension arguments and results shall lie within the limit. Dimensioned copies and set_space_dimension(n) shall retain the constant and lower-index coefficients, zero-extend new coordinates or discard removed trailing coefficients, while preserving modulus. Copies without explicit storage shall retain source storage.
swap_space_dimensions shall exchange two in-dimension coefficients. permute_space_dimensions shall require distinct in-dimension variables and move each cycle coefficient to the following coordinate, wrapping the last to the first. Empty/singleton cycles shall preserve the value. shift_space_dimensions(v,n) shall require v.id() <= space_dimension(), insert n zero coefficients before that position and increase dimension by n. These transformations shall retain modulus, constant term and representation. Discarding coefficients shall not mean existential projection of the original solution set.
Descriptor coordinates transform coefficient positions, independently of the arithmetic progression selected by the modulus.
static dimension_type Congruence::max_space_dimension(); dimension_type Congruence::space_dimension() const; Congruence(const Congruence& cg, dimension_type new_space_dimension); Congruence(const Congruence& cg, dimension_type new_space_dimension, Representation r); void Congruence::set_space_dimension(dimension_type n); void Congruence::swap_space_dimensions(Variable x, Variable y); void Congruence::permute_space_dimensions(const std::vector<Variable>& cycle); void Congruence::shift_space_dimensions(Variable v, dimension_type n);
Transform independent coefficient vectors and compare rational divisibility, including zero dimension, shrink/extend, nonzero discarded coefficients and front/interior/end insertion. Check constant, modulus and representation preservation.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
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.
coefficient(v) shall return the indicated homogeneous coefficient when v.id() < space_dimension() and otherwise throw std::invalid_argument. inhomogeneous_term() and modulus() shall return the current constant and modulus. Configured reference returns shall borrow their owner until modification or destruction.
expression() shall return a read-only borrowed adapter exposing the public affine expression with the same dimension, coefficients and constant. Uses covered here shall require the owner to remain alive and unchanged. Materializing the view as a Linear_Expression shall make an independent value. Queries shall preserve the congruence.
A congruence separates its affine expression from its modulus; neither returned view transfers ownership.
Coefficient_traits::const_reference Congruence::coefficient(Variable v) const &; Coefficient_traits::const_reference Congruence::inhomogeneous_term() const &; Coefficient_traits::const_reference Congruence::modulus() const; typedef Expression_Adapter_Transparent<Linear_Expression> Congruence::expr_type; Congruence::expr_type Congruence::expression() const &;
Check every exposed term, first/later rejected coordinates including dimension zero, copied borrowed values and independent materialized views after source mutation.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
For nonnegative m, set_modulus(m) shall replace only the modulus with its input entry value, admitting a borrowed coefficient from the same congruence. Zero shall select equality. It shall preserve dimension and representation.
For coefficient factor k, operator/=(k) shall multiply the entry modulus by |k|, preserving all affine coefficients and return the target reference. The factor may reference the modulus or a coefficient in the same object; its entry value shall be used. Nonmutating operator/ shall apply that operation to an independent copy, preserving the source. Multiplication by zero shall yield modulus zero; an existing zero modulus shall remain zero for any factor. These operations shall not divide the coefficients. Every computed absolute value/product shall satisfy 🔗 1. Affine congruence meaning and valid numerical use's arithmetic prerequisites.
The slash notation selects or multiplies a modulus, rather than performing affine division. Entry-value rules make borrowed scalar inputs unambiguous.
void Congruence::set_modulus(Coefficient_traits::const_reference m); Congruence& Congruence::operator/=(Coefficient_traits::const_reference k); Congruence operator/(const Congruence& cg, Coefficient_traits::const_reference k);
Check zero/positive modulus replacement, positive/negative/zero factors, chained factors, equality preservation, source independence and return identity. Exercise modulus self-alias, expression-coefficient factors and borrowed constant replacement within representable ranges.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000303 Preservation by representation-only changes (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
For a nonnegative factor k, scale(k) shall multiply every homogeneous coefficient, the constant and modulus by the factor's entry value. Positive factors shall preserve the satisfying set. A zero factor shall produce the tautological equality with the same dimension. Dimension and representation shall be preserved.
The factor shall not borrow a coefficient of the affine expression being modified. Borrowing the modulus shall be admitted and shall use its entry value consistently for expression and modulus. Arithmetic prerequisites in 🔗 1. Affine congruence meaning and valid numerical use shall apply.
Positive common scaling is a representation change; zero scaling deliberately collapses the condition to a tautology.
void Congruence::scale(Coefficient_traits::const_reference factor);
Compare all coefficient and modulus products independently for zero, one and larger positive factors. Check rational satisfaction preservation for positive factors, dimension retention for zero and self-modulus borrowing.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000303 Preservation by representation-only changes (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
sign_normalize() shall negate the affine expression exactly when its first nonzero homogeneous coefficient is negative, preserving modulus. An expression without nonzero homogeneous coefficients shall retain its sign. normalize() shall apply that sign rule, then, for positive modulus m, replace the constant with its unique residue in [0, m). Zero-modulus normalization shall not reduce the constant by a modulus.
strong_normalize() shall additionally divide the expression and modulus by their nonnegative common greatest divisor when that divisor exceeds one. The zero expression with positive modulus shall reduce to modulus one. Each operation shall preserve the satisfying set, dimension and representation and shall be idempotent. They may change the affine expression value while preserving the modular relation. Arithmetic prerequisites in 🔗 1. Affine congruence meaning and valid numerical use shall apply.
Canonical residue and scale conventions concern congruence meaning, not preservation of the unqualified affine expression value.
void Congruence::sign_normalize(); void Congruence::normalize(); void Congruence::strong_normalize();
Check first-nonzero signs, constant-only inputs, negative constants, zero modulus, common factors and zero expressions. Derive residues/GCDs independently and compare rational satisfaction before/after each normalization, with repeated application.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
Congruence operator== shall report whether equal-dimension operands admit the same rational valuations, independently of storage and equivalent common scales, signs or constant residues. Different public dimensions shall compare unequal. Tautologies of the same dimension shall compare equivalent, including zero-modulus and positive-modulus forms. The same shall hold for inconsistent congruences even when their moduli differ. operator!= shall negate that result. Both shall preserve operands. Arithmetic prerequisites in 🔗 1. Affine congruence meaning and valid numerical use shall apply.
Canonical coefficient comparison must still account for relations that denote the entire space or the empty set.
bool operator==(const Congruence& x, const Congruence& y); bool operator!=(const Congruence& x, const Congruence& y);
Check positive/common and negative expression scales, added modulus multiples in constants, non-equivalent periodic spacings, different dimensions and representations, and all constant tautology/inconsistency classes against independent rational predicates.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
For an in-dimension variable v, an independent affine expression e of dimension at most the target dimension, and positive denominator q, affine_preimage(v,e,q) shall replace the congruence by the condition obtained by substituting xv = e(x) ⁄ q into its entry relation. The result shall retain the original public dimension and representation. If the entry coefficient of v is zero the congruence shall be unchanged. Otherwise its new modulus shall be qm; the new affine expression shall be q(E(x) − avvx) + ave(x). A bounded profile shall retain this storage formula whenever its completed values fit. If they do not fit, it may store an equivalent primitive row using a proper constant residue and positive common-factor cancellation, admitting only completed reduced values. The source expression shall be preserved. The denominator shall not borrow from the target's affine expression; borrowing its modulus shall be admitted using entry values. Arithmetic prerequisites in 🔗 1. Affine congruence meaning and valid numerical use shall apply.
Multiplying both substituted expression and modulus by the positive denominator represents rational substitution using integer coefficients.
void Congruence::affine_preimage(Variable v, const Linear_Expression& e, Coefficient_traits::const_reference denominator);
Evaluate the original congruence at independently substituted rational points and compare the result. Include zero/nonzero selected coefficients, source dimensions below/equal to target, constant/noninvertible substitutions, negative coefficients, equality/proper moduli and borrowed modulus denominator. Check the literal stored scale and signed constant for an admitted result with a nontrivial common factor, in both representations.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000446 Reloadable textual representations (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
ascii_dump(s) shall write the full affine coefficient expression followed by the token m and its nonnegative modulus; ascii_dump() shall use std::cerr. Export shall preserve its source. For a complete compatible export with representable coefficients, ascii_load(s) shall return true and replace the target with those coefficients, dimension and modulus, retaining destination storage.
Malformed or truncated expressions, missing/invalid modulus tokens, negative moduli and structurally invalid coefficient counts shall return false. If expression loading fails, ascii_load(s) shall return false without reading the modulus marker or value. Trailing input shall remain available. A failed load may modify the target; it shall remain destructible and admit complete valid replacement. No rollback or cross-version wire-format stability is promised. Allocation and configured numerical exceptions may propagate.
Expression syntax and modulus both need validation before a loaded object can be interpreted as a congruence.
void Congruence::ascii_dump(std::ostream& s) const; void Congruence::ascii_dump() const; bool Congruence::ascii_load(std::istream& s);
Round-trip equality/proper, constant, gapped and trailing-zero forms across storage choices. Check exact coefficient/modulus preservation, rational meaning and trailing input; reject malformed/truncated expressions, negative modulus and invalid counts, and replace destinations after failures. Reject invalid expression prefixes followed by otherwise valid modulus suffixes, checking that those suffixes remain unread. Reject representable negative moduli through false with assertions enabled or disabled. Replace failed targets completely across storage representations, retaining modulus-zero equality and trailing input.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
Congruence output shall print homogeneous terms in increasing variable order, using the active formatter in 🔗 7. Active Variable formatter and initialized thread state, followed by " = " and the negated constant. A zero homogeneous part shall print 0. A proper congruence shall append " (mod ", its positive modulus and ")"; an equality shall omit that suffix. Coefficient signs, unit magnitudes and * separators shall follow the affine output conventions in 🔗 14. Human-readable affine output and formatter dispatch.
System output shall print its publicly iterated nontrivial rows after strong normalization of copies, separated by ", ", or true for an empty range. Operators shall return the supplied stream, add no newline and preserve their objects. print() shall use that output on std::cerr. Evaluated coefficient negations shall be representable in the selected profile.
Human-readable modular conditions use public coordinates and may normalize system-row copies without changing stored values.
namespace IO_Operators { std::ostream& operator<<(std::ostream& s, const Congruence& cg); std::ostream& operator<<(std::ostream& s, const Congruence_System& cgs); } void Congruence::print() const; void Congruence_System::print() const;
Check literal equality/proper displays, unit/nonunit signs, constants, custom variable formatting, system separators and empty output. Check stream identity, standard-error printing and unchanged source fields.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
OK() shall report the checked representation invariants of its congruence or system. Values produced by successful operations under the stated valid input and arithmetic conditions shall satisfy those invariants. For each type, total_memory_in_bytes() shall equal sizeof that type plus external_memory_in_bytes(). Queries shall preserve dimensions, coefficients, moduli and representation. Counts shall not promise allocator overhead, process memory consumption or a dense/sparse size ordering.
Storage diagnostics and ownership accounting do not determine satisfiability or process memory consumption.
bool Congruence::OK() const; memory_size_type Congruence::total_memory_in_bytes() const; memory_size_type Congruence::external_memory_in_bytes() const; bool Congruence_System::OK() const; memory_size_type Congruence_System::total_memory_in_bytes() const; memory_size_type Congruence_System::external_memory_in_bytes() const;
Check valid constants, all modulus forms, copies/conversions and empty/mixed systems. Verify accounting identities and unchanged semantic fields without architecture-specific byte expectations.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000013 Meaning of linear constraints (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000438 Thread entry and shared-facility use (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
A Congruence_System shall denote the conjunction of its retained congruences over rational coordinates. An empty conjunction shall be true. Default construction shall have dimension zero and no rows; the dimensioned empty constructor shall retain its supplied admitted dimension. A singleton constructor from a congruence shall copy that relation and its dimension. Construction from an equality constraint shall make its modulus-zero singleton; inequalities shall throw std::invalid_argument. Construction from a constraint system shall extract its equality rows and retain its ambient dimension, omitting inequalities.
All constructors shall use requested storage, with default_representation equal to SPARSE. zero_dim_empty() shall borrow a dimension-zero inconsistent singleton, not an empty conjunction, until owning-thread finalization. Initialization, synchronization and numerical/failure preconditions shall follow 🔗 1. Affine congruence meaning and valid numerical use.
A system's conjunction and ambient space remain meaningful even without nontrivial rows. Equality extraction deliberately omits ordered inequalities.
class Congruence_System; static constexpr Representation Congruence_System::default_representation = SPARSE; explicit Congruence_System(Representation r = default_representation); explicit Congruence_System(dimension_type d, Representation r = default_representation); explicit Congruence_System(const Congruence& cg, Representation r = default_representation); explicit Congruence_System(const Constraint& c, Representation r = default_representation); explicit Congruence_System(const Constraint_System& cs, Representation r = default_representation); static const Congruence_System& Congruence_System::zero_dim_empty();
Check empty/singleton/shared inconsistent systems, positive-dimensional empty construction, equality/inequality conversion and extraction from mixed constraint systems using independent rational conjunctions.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000303 Preservation by representation-only changes (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
Copy construction and assignment shall preserve the system's row sequence, conjunction and declared dimension; ordinary copies and assignment shall retain source representation, while an explicit-storage copy shall use its argument. Assignment shall return the target, preserve a distinct source, support self-assignment and retain the source when using rvalue copy forms. Copies shall remain independent after source modification or destruction. Swaps shall exchange complete values, dimensions and storage, including self-swap. Successful representation conversion shall select requested dense or sparse storage for all rows without changing their conjunction or dimension. Copy-assignment replacement failure shall preserve the target; other failures shall follow 🔗 1. Affine congruence meaning and valid numerical use.
is_equal_to and system operator== shall test equal declared dimensions and matching retained row counts/order, comparing corresponding congruences semantically. They shall not decide whether differently ordered or redundant systems denote the same conjunction. Storage choice shall not change this comparison. Destruction shall release owned rows.
Owned row-sequence comparison is distinct from semantic equality of conjunctions, but ambient dimension remains part of an exact descriptor comparison.
Congruence_System(const Congruence_System& cgs); Congruence_System(const Congruence_System& cgs, Representation r); Congruence_System& Congruence_System::operator=(const Congruence_System& y); Congruence_System::~Congruence_System(); Representation Congruence_System::representation() const; void Congruence_System::set_representation(Representation r); void Congruence_System::m_swap(Congruence_System& y); void swap(Congruence_System& x, Congruence_System& y); bool Congruence_System::is_equal_to(const Congruence_System& y) const; bool operator==(const Congruence_System& x, const Congruence_System& y);
Check copy/self/rvalue operations, swaps, storage conversion and independence. Compare matching sequences across storage, changed/reordered rows, different row counts, and empty systems whose declared dimensions differ.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000013 Meaning of linear constraints (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
Const-reference insertion of a congruence, equality constraint or congruence system shall conjoin copies, preserving sources and target representation. Inequality constraints shall throw std::invalid_argument. Single congruence and constraint insertion shall strongly normalize the inserted copy. Result dimension shall be the maximum input dimension, zero-extending shorter rows. Ordinary self-system insertion and insertion of a borrowed row from the target shall be admitted using entry values.
Rvalue insertion shall conjoin transferred relations, requiring a source distinct from the target system and not borrowing one of its rows. Transferred inputs shall remain destructible. Successful recycled-system insertion shall clear the source to a dimension-zero empty system. clear() shall likewise remove all rows and reset dimension zero while retaining storage.
space_dimension() shall report ambient dimension, and max_space_dimension() the congruence limit. Successful set_space_dimension(n) shall resize all row coefficients by truncation or zero extension and retain moduli. Swapping/permuting system coordinates shall apply 🔗 6. Congruence dimensions and coefficient-coordinate transformations to every row. Dimension and variable arguments shall satisfy that contract's bounds. These are coefficient transformations rather than existential projection.
Const row sources, including const rvalues, shall use preserving insertion. Const system sources shall likewise use preserving insertion. Successful rvalue row insertion shall leave its source a valid descriptor with an unspecified value.
Copying and recycling have different source-ownership consequences, while their resulting conjunction and coordinate alignment must agree.
void Congruence_System::insert(const Congruence& cg); void Congruence_System::insert(Congruence&& cg); void Congruence_System::insert(const Constraint& c); void Congruence_System::insert(const Congruence_System& y); void Congruence_System::insert(Congruence_System&& y); void Congruence_System::clear(); static dimension_type Congruence_System::max_space_dimension(); dimension_type Congruence_System::space_dimension() const; void Congruence_System::set_space_dimension(dimension_type n); void Congruence_System::swap_space_dimensions(Variable x, Variable y); void Congruence_System::permute_space_dimensions(const std::vector<Variable>& cycle);
Check mixed dimensions, duplicates, borrowed-row and self-system ordinary insertion, recycled rows/systems, rejected inequalities, clear/reuse and coordinate transformations against independently evaluated conjunctions. Check source preservation for copy forms and source clearing for successful recycled systems.
src/Row_Transfers.cc; tests/consuminginsertions1.cc; src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
begin() and end() shall delimit retained nontautological rows. empty() shall report that this range is empty and shall not decide satisfiability of a nonempty conjunction. Exposed rows shall share the system's declared dimension. has_linear_equalities(), num_equalities() and num_proper_congruences() shall inspect/count retained stored rows, including tautologies omitted by public iteration.
The forward iterator shall borrow its system, expose row references/pointers, and support copied or assigned independent positions. Prefix increment shall return the advanced iterator; postfix shall return its entry-position copy. Comparison shall require positions in the same unchanged system. Default iterators shall admit copying, assignment and destruction before being assigned a valid position. Mutation/destruction shall invalidate iterators and borrowed rows.
Public iteration suppresses tautologies, whereas retained row-kind counts describe stored rows rather than the mathematical rank or minimum description.
class Congruence_System::const_iterator; Congruence_System::const_iterator Congruence_System::begin() const; Congruence_System::const_iterator Congruence_System::end() const; bool Congruence_System::empty() const; bool Congruence_System::has_linear_equalities() const; dimension_type Congruence_System::num_equalities() const; dimension_type Congruence_System::num_proper_congruences() const; Congruence_System::const_iterator::const_iterator(); Congruence_System::const_iterator::const_iterator(const const_iterator& y); Congruence_System::const_iterator::~const_iterator(); Congruence_System::const_iterator& Congruence_System::const_iterator::operator=(const const_iterator& y); const Congruence& Congruence_System::const_iterator::operator*() const; const Congruence* Congruence_System::const_iterator::operator->() const; Congruence_System::const_iterator& Congruence_System::const_iterator::operator++(); Congruence_System::const_iterator Congruence_System::const_iterator::operator++(int); bool Congruence_System::const_iterator::operator==(const const_iterator& y) const; bool Congruence_System::const_iterator::operator!=(const const_iterator& y) const;
Check empty, tautology-only, mixed and inconsistent systems; verify retained counts separately from public-range length. Exercise prefix/postfix, copied/default-assigned positions, borrowed pointer identity and shared row dimensions.
src/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000446 Reloadable textual representations (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
ascii_dump(s) shall export stored row count, public dimension, representation choice and every full congruence row; ascii_dump() shall write that representation on std::cerr. Export shall preserve the source. A complete compatible export with representable coefficients shall load with true, replacing the target conjunction, dimension, stored rows and encoded representation choice.
Malformed/truncated headers or rows, invalid modulus or coefficient structure, and inconsistent encoded row dimensions shall return false rather than be accepted as a valid system. Trailing input shall remain available. Failure may modify a destination but shall leave it destructible and replaceable by a complete valid load. No rollback or cross-version format stability is promised. Allocation and configured numerical exceptions may propagate. The decoded row count shall be nonnegative and fit the row container. The decoded header dimension shall be nonnegative and shall not exceed max_space_dimension(), including when the record contains no rows; not_a_dimension() shall be rejected as an unsupported extent.
Reloading must retain the system's ambient coordinate context as well as its modular rows.
void Congruence_System::ascii_dump(std::ostream& s) const; void Congruence_System::ascii_dump() const; bool Congruence_System::ascii_load(std::istream& s);
Round-trip empty positive-dimension, equality/proper and duplicate/tautology-containing systems through initial destination storage choices. Check encoded representation, dimensions and independent rational truth; reject malformed/truncated headers and rows and incompatible row dimensions. 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/Congruence_defs.hh; src/Congruence_inlines.hh; src/Congruence.cc; src/Congruence_System_defs.hh; src/Congruence_System_inlines.hh; src/Congruence_System.cc; tests/congruencespec1.cc; tests/exactboundedworking1.cc.
- PPL-LLR-000014 Meaning of linear congruences (Specifies)
- PPL-LLR-000041 Rational-grid meaning (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
For a valid congruence system with positive moduli m1, …, mk, normalize_moduli() shall set every proper row's modulus to L = lcm(m1, …, mk) and multiply its affine expression by L ⁄ mi. It shall preserve row order, row count, ambient dimension, storage representation and the relation denoted by every row. Modulus-zero equalities shall remain unchanged. Empty and equality-only systems shall remain unchanged.
Every evaluated LCM, ratio and coefficient-scaling intermediate shall be representable in the configured coefficient profile. Initialization, lifetime, synchronization and failure guarantees shall follow 🔗 1. Affine congruence meaning and valid numerical use.
Multiplying the expression and modulus by the same positive factor preserves their integral-quotient relation. A common positive modulus supports joint system transformations without changing the represented grid.
Internal member of Parma_Polyhedra_Library::Congruence_System:
void normalize_moduli();
Exercise public grid construction and normalization with empty systems, equalities, equal and unequal positive moduli, mixed row orders and both storage representations. Compare independent coordinate-period generator models and preserve copied sources. Include large GMP moduli and bounded profiles within representability limits. Inspect the exact row-scaling loop for order, count and representation preservation.
src/Congruence_System_defs.hh; src/Congruence_System.cc; tests/gridvaluesspec1.cc.