Parma Polyhedra Library requirements
C++ bounded-difference closed-bound-table distances

C++ bounded-difference closed-bound-table distances

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-001142
Rectilinear distance of bounded-difference closed-bound tables

Under 🔗 4. Bounded-difference distance normalization, boundaries and workspaces, the three rectilinear_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.

For finite corresponding differences, the exact distance shall be ∑i ≠ jdij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001145].

On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 17. Rectilinear distance between bound-entry arrays.

The sum of absolute corresponding bound changes compares the selected graph-bound descriptions while retaining an explicit mathematical meaning and numerical direction.

APPROVED
BOUNDED_DIFFERENCES
IF_CPP
Test, Analysis, Inspection

Compute primitive suprema independently from rational conjunctions and compare all three overload forms with exact bound-array norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For rectilinear results compare the independent sum of absolute entry differences, including translated operands and differently signed entries.

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.

CPP
Public

Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:

template <typename To, typename T>
bool rectilinear_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir);

template <typename Temp, typename To, typename T>
bool rectilinear_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir);

template <typename Temp, typename To, typename T>
bool rectilinear_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);
SW_SPEC
2
PPL-SPEC-001143
Euclidean distance of bounded-difference closed-bound tables

Under 🔗 4. Bounded-difference distance normalization, boundaries and workspaces, the three euclidean_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.

For finite corresponding differences, the exact distance shall be √(∑i ≠ jd 2ij), with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001145].

On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 18. Euclidean distance between bound-entry arrays.

Rational square-root enclosure shall retain 🔗 2. Finite rational square root at the selected irrational precision and the calling precision of 🔗 3. Selection and ownership of irrational rational precision, which shall remain stable throughout the dependent call.

The square root of the sum of squared bound changes compares the selected graph-bound descriptions while retaining an explicit mathematical meaning and numerical direction.

APPROVED
BOUNDED_DIFFERENCES
IF_CPP
Test, Analysis, Inspection

Compute primitive suprema independently from rational conjunctions and compare all three overload forms with exact bound-array norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For Euclidean results compare exact rational squares and test rational precision, rather than using a rounded reference square root.

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.

CPP
Public

Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:

template <typename To, typename T>
bool euclidean_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir);

template <typename Temp, typename To, typename T>
bool euclidean_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir);

template <typename Temp, typename To, typename T>
bool euclidean_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);
SW_SPEC
3
PPL-SPEC-001144
Maximum-coordinate distance of bounded-difference closed-bound tables

Under 🔗 4. Bounded-difference distance normalization, boundaries and workspaces, the three l_infinity_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.

For finite corresponding differences, the exact distance shall be maxi ≠ jdij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001145].

On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 19. Maximum-coordinate distance between bound-entry arrays.

The largest absolute corresponding bound change compares the selected graph-bound descriptions while retaining an explicit mathematical meaning and numerical direction.

APPROVED
BOUNDED_DIFFERENCES
IF_CPP
Test, Analysis, Inspection

Compute primitive suprema independently from rational conjunctions and compare all three overload forms with exact bound-array norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For maximum-coordinate results identify the exact greatest absolute entry difference independently and exercise both first and later maximum updates.

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.

CPP
Public

Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:

template <typename To, typename T>
bool l_infinity_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir);

template <typename Temp, typename To, typename T>
bool l_infinity_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir);

template <typename Temp, typename To, typename T>
bool l_infinity_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);
SW_SPEC
4
PPL-SPEC-001145

For a nonempty shape of ambient dimension n, let z0 = 0 and zi = xi − 1 for 1 ≤ i ≤ n. Position (i, j) of its square bound table shall describe zj − zi ≤ bij. A positive-infinite bound shall impose no restriction. Distance tuples shall include every ordered off-diagonal position. Matching positive-infinite diagonal sentinels shall contribute zero.

The selected tables shall be those used after the call's required shortest-path normalization. When closure arithmetic is exact under its range prerequisites, finite entries shall be the primitive suprema of the represented set, with infinity for unbounded forms. Rounded or saturating closure shall retain 🔗 1. Bounded-difference values, numerical profiles and valid use; its tables need not be canonical, idempotent or invariant across alternative source descriptions. The distance shall be computed from the selected tables, as retained in compatible post-call records of 🔗 2. Reloadable bounded-difference record export, rather than being a point-set or Hausdorff distance. Normalization shall preserve each source's represented set and ambient dimension.

Different ambient dimensions shall return false before modifying the result or supplied workspaces. False shall assign no distance for that incompatible pair. Dimension-compatible two-empty shapes shall have distance zero; exactly one empty shape shall have positive-infinite distance. In dimension zero, two universe shapes shall also have distance zero. These rules shall apply to logically empty sources whose emptiness has not yet been classified. Equal dimensions shall return true on successful numerical completion, with the value specified by 🔗 1. Rectilinear distance of bounded-difference closed-bound tables, [LINK: PPL-SPEC-001143] or 🔗 3. Maximum-coordinate distance of bounded-difference closed-bound tables.

The overload without an explicit temporary type shall use three Checked_Number<To,Extended_Number_Policy> workspaces. The overload with an explicit scalar Temp argument shall instead use three Checked_Number<Temp,Extended_Number_Policy> workspaces. The supplied-workspace overload shall use the actual type of its three references, which may be an admitted raw or checked numeric type. The supported operation, rounding, representation and overlap conditions of 🔗 20. Distance scratch storage, admissible overlaps and numeric conditions shall apply to the selected metric specializations, subject to the public source-storage condition below.

Calls evaluating finite entry differences shall use ROUND_DOWN or ROUND_UP, optionally combined with ROUND_STRICT_RELATION. They shall not require finite source conversions to be exact merely to establish the requested directed bound. Paths performing only exact zero or positive-infinity assignments shall admit directions valid for those selected scalar assignments. An output profile shall support positive infinity whenever that outcome is reachable. Every conversion, difference, sum, square, square root and final assignment shall satisfy its selected backend's arithmetic, range, numerical-failure, resource, initialization and nontrapping prerequisites. Native arithmetic shall retain configured support and the initialized caller-owned FPU conditions; the call shall preserve caller rounding. Rational square-root precision shall remain stable throughout a dependent call.

Sources shall be live valid objects under 🔗 1. Bounded-difference values, numerical profiles and valid use. The same shape may be supplied for both operands. The three mutable supplied workspaces shall be live, pairwise distinct, and disjoint from source-owned storage. Their entry values need not be initialized when overwritten before reading. The result shall have live assignable storage disjoint from source-owned storage, but may overlap any one supplied workspace or its compatible underlying raw storage. When the result overlaps a workspace, its mathematical value shall still use source values on entry. No workspace entry value shall be required when overwritten before reading. Callers shall preserve object/storage lifetimes and synchronize source access, including logically const cache updates.

Numerical and recoverable resource failures shall retain their selected propagation channels and permitted partial result/workspace states; no aggregate rollback guarantee shall be inferred. Discarded owned temporaries shall be released, while reusable numerical cache storage shall retain its own lifetime and cleanup contract. Ordinary dimension mismatch shall retain the stronger unchanged-output/workspace guarantee above. Otherwise valid calls shall require no additional library initialization beyond their selected representation, numerical and thread runtime prerequisites.

A bound-array metric needs an explicit normalization convention, source carrier and numeric protocol. Exact semantic support tuples and rounded representation tuples have different invariance properties, while their empty/dimension outcomes and storage obligations remain explicit.

BagnaraHZ09FMSD | Section 3.1, difference constraints, unary zero-node encoding and transitive closure (PDF page index 5, zero-based).

APPROVED
BOUNDED_DIFFERENCES
IF_CPP
Test, Analysis, Inspection

Verify independent rational support closure, rounded selected-table norms and before/after denotation equality separately. Cover all nine forms, cold/classified/reduced histories, lazy emptiness, zero dimensions, one-sided infinities, mismatched dimensions and unchanged sentinels. Test same-owner inputs, result aliases to each raw/checked workspace, different temporary/result profiles, required initialized native modes and caller-mode preservation. Measure and exercise meaningful allocation/cleanup paths, distinguishing C++ new/new[] observation from backend GMP allocation failures.

src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc; tests/bdshapedistancefailure1.cc; tests/boxallocationfixture.hh.

CPP
Public

Public header: <ppl.hh>. This protocol applies to all nine free function overloads declared in 🔗 1. Rectilinear distance of bounded-difference closed-bound tables, 🔗 2. Euclidean distance of bounded-difference closed-bound tables and 🔗 3. Maximum-coordinate distance of bounded-difference closed-bound tables, in Parma_Polyhedra_Library. Their result, shape, rounding and optional three-workspace parameters retain those exact signatures.

template <typename Temp, typename To, typename T>
bool rectilinear_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);

template <typename Temp, typename To, typename T>
bool euclidean_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);

template <typename Temp, typename To, typename T>
bool l_infinity_distance_assign(
  Checked_Number<To, Extended_Number_Policy>& r,
  const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);