Internal finite interval cutoff conversions
|
Type
|
Level
|
MID
|
UID
|
REFS
|
Title
|
Statement
|
Rationale
|
Comment
|
BIBLIOGRAPHY
|
STATUS
|
COMPONENT
|
APPLICABILITY
|
VERIFICATION_METHODS
|
VERIFICATION_CRITERIA
|
SOURCE
|
LANGUAGE
|
VISIBILITY
|
INTERFACE
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
SW_SPEC
|
1 |
|
|
|
For a live constraint with finite canonical cutoff q and relation V_EMPTY, V_LGE, V_EQ, V_NE, V_LT, V_LE, V_GT or V_GE, convert_real(to) shall return a relation r’ and store a cutoff q’ such that, for every value x representable by the destination scalar type, x r q holds exactly when x r’ q’ holds. V_EMPTY shall denote false and V_LGE true, independently of the stored cutoff. This equivalence shall concern the destination's represented carrier; it shall not imply equivalence for all real numbers between adjacent representable destination values. An empty or unconstrained source shall return that same relation without changing to or reading a cutoff value; no initialized cutoff storage shall be required for those two relations. An exactly representable cutoff shall retain its ordinary relation and numerical cutoff. Equality at an inexact cutoff shall become V_EMPTY; disequality there shall become V_LGE. An upper inequality shall use an upward cutoff and a lower inequality a downward cutoff. A nonstrict inequality whose cutoff is inexact shall become strict at the outward-rounded cutoff. The source shall remain unchanged. Source and destination scalars shall be admitted native integer types, mpz_class, canonical mpq_class or configured supported native floating formats, including supported checked forms whose policies admit the conversions used. The finite cutoff's required upward and downward conversions shall remain within the destination's finite representable range. Source and destination storage shall be distinct, live and valid; borrowed cutoffs shall remain live. Numerical conversion, resource, shared-temporary serialization and FPU prerequisites shall be those of the corresponding assign_r contracts. In particular, a native floating destination requiring directed rounding shall have the required caller-owned FPU state. No additional library initialization shall be required. |
A quantized endpoint can represent the same predicate on its scalar carrier without representing the same subset of all real numbers. Explicit carrier semantics preserve the meaning of strictness and equality during conversion. |
|
|
|
|
|
Compare all eight source relations with independent rational predicates on destination-representable candidates. Cover positive, negative and zero cutoffs, exact and inexact fractions, every standard native integer type, GMP scalars and supported native floating formats. Include adjacent floating values and a rational cutoff strictly between them, preserved source values, unchanged unused destinations and caller rounding-state restoration. |
src/intervals_defs.hh; tests/intervalconversionspec1.cc. |
|
|
Internal header: intervals_defs.hh; member of Parma_Polyhedra_Library::I_Constraint_Common<Derived>: template <typename T> Result convert_real(T& to) const; Derived shall supply the live constraint's rel() and value(). |
||
|
SW_SPEC
|
2 |
|
|
|
Under the finite scalar, storage and numerical prerequisites of 🔗 1. Single real cutoff conversion on the destination carrier, convert_real(to1, rel2, to2) shall return rel1 and produce the conjunction of the predicates described by (rel1, to1) and (rel2, to2). This conjunction, interpreted over the reals, shall contain every real number admitted by the source constraint. The source shall remain unchanged. The output objects shall be distinct from one another and from the source's storage. For a source relation other than equality, rel1 shall be V_LGE, to1 shall remain unchanged, and the second relation and cutoff shall be the single-cut conversion of 🔗 1. Single real cutoff conversion on the destination carrier. For equality when the upward conversion reports exact equality, rel1 shall be V_LGE, to1 shall remain unchanged and the second predicate shall be equality at that cutoff. Otherwise, the two finite outputs shall enclose the source point using downward and upward cutoffs. Their reported relations shall retain the established strict or nonstrict comparison with that point. When the conversions establish the same exact point, the result shall reduce to an unconstrained first predicate and equality in the second predicate. In that latter case, to1 may have been written by the downward conversion. A returned V_LGE shall make its associated stored cutoff irrelevant to the predicate; callers shall not interpret an unchanged to1 as an established bound. |
A real point between representable endpoints requires two outward bounds. The unused first predicate must remain explicit so that its retained storage cannot be mistaken for a computed endpoint. |
|
|
|
|
|
For every ordinary relation, compare the conjunction with independent rational candidates and establish source-set containment. For equality, check exact reduction and outward enclosure at nonintegral rational cutoffs and between adjacent native floating values. Check unchanged unused first outputs where no downward conversion is performed, source preservation and all admitted destination scalar families. |
src/intervals_defs.hh; tests/intervalconversionspec1.cc. |
|
|
Internal header: intervals_defs.hh; member of Parma_Polyhedra_Library::I_Constraint_Common<Derived>: template <typename T> Result convert_real(T& to1, Result& rel2, T& to2) const; |
||
|
SW_SPEC
|
3 |
|
|
|
For a finite constraint satisfying 🔗 1. Single real cutoff conversion on the destination carrier, convert_integer(to) shall produce an equivalent predicate on integer candidates. Every resulting effective cutoff shall be integral. An upper inequality shall normalize to a closed upper bound, using ⌊q⌋ for x ≤ q and ⌈q⌉ − 1 for x < q. A lower inequality shall normalize to a closed lower bound, using ⌈q⌉ for x ≥ q and ⌊q⌋ + 1 for x > q. Equality at an integral cutoff shall remain equality and at a nonintegral cutoff shall become V_EMPTY. Disequality at an integral cutoff shall remain disequality and at a nonintegral cutoff shall become V_LGE. Empty and unconstrained inputs shall retain their relation without changing to. The source shall remain unchanged. This exact normalization shall require the relevant rounded integral cutoffs and any unit adjustment to be representable exactly by the destination scalar. Source/destination lifetimes, separation, resources, serialization and native FPU prerequisites shall follow 🔗 1. Single real cutoff conversion on the destination carrier and the scalar's floor, ceiling and unit-arithmetic contracts. A caller shall not infer an exact normalized predicate from a conversion or unit adjustment outside those prerequisites. |
Integer predicates admit closed integral endpoints even when their original real constraints are strict or fractional. Exact unit adjustment is required to preserve the accepted integer set. |
|
|
|
|
|
Compare every relation with an independent exact rational predicate on integer candidates. Check positive and negative fractions, integral and zero cutoffs, floor/ceiling asymmetry, strict unit adjustments and the empty/universe equality cases. Exercise all standard native integer types, GMP scalars and supported native floating formats within the stated exact range, preserving source and unused destination values. |
src/intervals_defs.hh; tests/intervalconversionspec1.cc. |
|
|
Internal header: intervals_defs.hh; member of Parma_Polyhedra_Library::I_Constraint_Common<Derived>: template <typename T> Result convert_integer(T& to) const; |