Parma Polyhedra Library requirements
C++ octagonal bound-table distances

C++ octagonal bound-table distances

1. Octagonal distance normalization, boundaries and workspaces
UID: PPL-SPEC-001230
STATUS: APPROVED
COMPONENT: OCTAGONS
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

For a nonempty shape of ambient dimension n, let z2k = xk and z2k + 1 =  − xk for 0 ≤ k < n. The stored position (i, j) shall describe zj − zi ≤ bij. Let pi be zero for even i and one for odd i. The distance tuple shall contain exactly

Dn = {(i, j) ∣ 0 ≤ i < 2n,  0 ≤ j < i + 2 − pi}.

This is the physical pseudo-triangular domain of 🔗 1. Pseudo-triangular matrix values and physical coordinates, with 2n(n + 1) positions. Its 2n diagonal positive-infinity sentinels shall each contribute zero. Its 2n2 other positions shall count each signed octagonal normal once: ±2xk for unary bounds and ±xk±xl for k < l. Unary bounds shall remain doubled in the tuple; the coherently equivalent matrix position shall not be counted again. A positive-infinite bound shall impose no restriction.

The selected tables shall be those used after the call's required strong closure. With exact rational closure, finite entries shall be the primitive suprema of the represented set, with infinity for unbounded forms. Rounded or saturating closure, including integer halving, shall retain 🔗 1. Octagonal values, numerical profiles and valid use; selected tables need not be canonical, idempotent or invariant across alternative source descriptions. The distance shall use these selected tables, as retained in compatible post-call records of 🔗 1. Reloadable octagonal record export. It shall not denote minimum point separation or a 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 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 🔗 2. Rectilinear distance of octagonal closed-bound tables, 🔗 3. Euclidean distance of octagonal closed-bound tables or 🔗 4. Maximum-coordinate distance of octagonal 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 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 and 🔗 9. Distance workspace protocol and admissible overlaps shall apply to the selected metric specialization, 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. Finite source conversions shall not have 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 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. Octagonal 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 have mathematical significance when overwritten before reading. The result shall have live assignable storage disjoint from source-owned storage, but may overlap one supplied workspace or its compatible underlying raw storage. When the result overlaps a workspace, the distance shall still use source values on entry. 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-result/workspace guarantee above. Otherwise valid calls shall require no additional library initialization beyond their selected representation, numerical and thread runtime prerequisites.

RATIONALE:

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.

INTERFACE:

Public header: <ppl.hh>. This protocol applies to all nine free function overloads declared in 🔗 2. Rectilinear distance of octagonal closed-bound tables, 🔗 3. Euclidean distance of octagonal closed-bound tables and 🔗 4. Maximum-coordinate distance of octagonal 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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

Verify independent rational support closure, rounded selected-table norms and before/after denotation equality separately. Cover all nine forms, cold/classified/widened 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.

BIBLIOGRAPHY:

BagnaraHZ09FMSD | Section 4, coherent signed-variable encoding and Definition 5 of strong closure (PDF page indices 9–10, zero-based).

SOURCE:

src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc; tests/octagonalshapedistancefailure1.cc; tests/boxallocationfixture.hh; tests/octagonalshapesaturationspec1.cc.

2. Rectilinear distance of octagonal closed-bound tables
UID: PPL-SPEC-001231
STATUS: APPROVED
COMPONENT: OCTAGONS
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Under 🔗 1. Octagonal 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 the physical tuple Dn defined by 🔗 1. Octagonal distance normalization, boundaries and workspaces and finite corresponding differences, the exact distance shall be ∑(i, j) ∈ Dndij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001230].

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 🔗 6. Rectilinear distance of physical octagonal entry arrays.

RATIONALE:

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

INTERFACE:

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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

For exact rational closure, compute signed primitive suprema independently from rational conjunctions. For rounded profiles, decode the selected post-call physical tuples independently and check source-set preservation separately. Compare all three overload forms with exact tuple 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.

SOURCE:

src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc; tests/octagonalshapesaturationspec1.cc.

3. Euclidean distance of octagonal closed-bound tables
UID: PPL-SPEC-001232
STATUS: APPROVED
COMPONENT: OCTAGONS
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Under 🔗 1. Octagonal 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 the physical tuple Dn defined by 🔗 1. Octagonal distance normalization, boundaries and workspaces and finite corresponding differences, the exact distance shall be √(∑(i, j) ∈ Dnd 2ij), with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001230].

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 🔗 7. Euclidean distance of physical octagonal 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.

RATIONALE:

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

INTERFACE:

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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

For exact rational closure, compute signed primitive suprema independently from rational conjunctions. For rounded profiles, decode the selected post-call physical tuples independently and check source-set preservation separately. Compare all three overload forms with exact tuple 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.

SOURCE:

src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.

4. Maximum-coordinate distance of octagonal closed-bound tables
UID: PPL-SPEC-001233
STATUS: APPROVED
COMPONENT: OCTAGONS
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Under 🔗 1. Octagonal 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 the physical tuple Dn defined by 🔗 1. Octagonal distance normalization, boundaries and workspaces and finite corresponding differences, the exact distance shall be max(i, j) ∈ Dndij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001230].

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 🔗 8. Maximum-coordinate distance of physical octagonal entry arrays.

RATIONALE:

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

INTERFACE:

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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_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 Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir,
  Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

For exact rational closure, compute signed primitive suprema independently from rational conjunctions. For rounded profiles, decode the selected post-call physical tuples independently and check source-set preservation separately. Compare all three overload forms with exact tuple 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.

SOURCE:

src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.