Parma Polyhedra Library requirements
C++ box coordinate transformations
PPL-SPEC-000961
1. Dimension-preserving box coordinate forgetting PPL-SPEC-000961

For a nonempty box, forgetting a selected coordinate shall replace its factor by the selected interval profile's universe, leaving every other factor and the ambient dimension unchanged. Forgetting a set of coordinates shall apply that meaning to all selected positions. The result shall exactly denote existential elimination of those values with the same positions restored as unrestricted coordinates. An empty source shall remain empty, including when emptiness is carried only by a factor being forgotten. Forgetting no coordinates shall preserve the value.

An out-of-dimension variable, or any member of a selected set outside the ambient dimension, shall throw std::invalid_argument. This validation shall apply also to empty boxes. Valid coordinate selections shall use the coordinate identity and lifetime rules for Variable and Variables_Set.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.

PPL-SPEC-000962
2. Unrestricted and zero-fixed box coordinate extension PPL-SPEC-000962

Adding m coordinates shall preserve every old coordinate in its original position and append the new coordinates at the highest indices. add_space_dimensions_and_embed(m) shall append unrestricted factors. add_space_dimensions_and_project(m) shall append factors containing exactly zero. Each completed result shall exactly denote the corresponding Cartesian extension. Empty sources shall remain empty, including empty zero-dimensional sources; zero-dimensional universe shall extend to the corresponding unrestricted or zero-fixed product. Adding zero coordinates shall preserve the value.

If the resulting ambient dimension would exceed max_space_dimension(), the operation shall throw std::length_error before attempting coordinate allocation of that size. Successful dimensions shall remain subject to resource availability.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.

PPL-SPEC-000963
3. Ordered Cartesian box concatenation PPL-SPEC-000963

concatenate_assign(y) shall replace the destination by the exact Cartesian product of its entry value and y's entry value, with destination coordinates preceding source coordinates. The ambient dimensions shall add. Either empty operand shall make the result empty. Zero-dimensional universe shall act as the identity on either side; zero-dimensional empty shall retain its empty-set meaning.

A distinct source shall remain unchanged. Self-concatenation shall be admitted and shall use the entry factors twice, with independently mutable factor storage after success. The two tuples in a self-product shall be chosen independently. Dimension overflow shall throw std::length_error; successful dimensions shall remain subject to allocation/resource availability.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.

PPL-SPEC-000964
4. Selected-coordinate box projection and compaction PPL-SPEC-000964

remove_space_dimensions(vars) shall existentially project away exactly the selected coordinates. Surviving factors shall retain their relative order and shall receive contiguous indices starting at zero. The resulting dimension shall be the entry dimension minus the selected set's cardinality. For boxes this projection shall be exact. Empty sources shall remain empty, even if the only empty factor is removed. Removing every coordinate from a nonempty box shall give zero-dimensional universe; removing every coordinate from empty shall give zero-dimensional empty. Removing no coordinates shall preserve the value.

A selected coordinate outside the entry ambient dimension shall throw std::invalid_argument, including for empty inputs.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.

PPL-SPEC-000965
5. Trailing-coordinate box projection PPL-SPEC-000965

remove_higher_space_dimensions(d) shall exactly project onto the first d entry coordinates. The ambient dimension shall become d and retained factors shall preserve order and values. An empty source shall remain empty regardless of which factors carried emptiness. Projection to dimension zero shall yield universe exactly for a nonempty source, and empty for an empty source. Requesting the current dimension shall preserve the value.

If d exceeds the entry ambient dimension, the operation shall throw std::invalid_argument. It shall not extend the box.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.

PPL-SPEC-000966
6. Injective partial box coordinate remapping PPL-SPEC-000966

For entry ambient dimension n, the supplied mapping shall be a stable injective partial function on indices from zero through n-1, with image exactly the contiguous indices from zero through m-1 for some m no greater than n. The operation shall exactly project away unmapped coordinates and place each retained entry factor at its mapped index. The result shall have dimension m. Empty sources shall remain empty. An empty mapping shall give zero-dimensional universe for a nonempty source and zero-dimensional empty for an empty source. A zero-dimensional source shall retain its value.

The mapping object shall provide the protocol shown below. has_empty_codomain() shall report whether the map is nowhere defined; max_in_codomain() shall return the maximum image when nonempty; maps(i,j) shall report membership in the domain and, on true, assign the image to j. Whenever callbacks are used, the empty-codomain query shall precede the others, and a true result shall preclude maximum/image queries. No callback shall be required for a zero-dimensional source. Values and mapping callbacks shall meet their own resource, lifetime and synchronization prerequisites. A mapping violating the stated mathematical/protocol preconditions shall be outside the contract.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.

PPL-SPEC-000967
7. Box coordinate expansion and replica precision PPL-SPEC-000967

For a valid existing coordinate var, expand_space_dimension(var,m) shall append m factors with the entry factor's value. Original coordinates shall retain their values and indices. Each new factor shall own independently mutable storage. The resulting box shall be the least Cartesian interval enclosure, in the selected factor profile, of the coordinate-expansion relation: the original selected value may be chosen independently of the replica value, while all replicas in a concrete expanded tuple use a common selected-factor value. The box enclosure may choose different values for different replicas. No original-to-replica equality shall be imposed. Empty sources shall remain empty. Adding no replicas shall preserve the value.

An out-of-dimension coordinate shall throw std::invalid_argument, including when m is zero or the box is empty. If the final dimension exceeds max_space_dimension(), the operation shall throw std::length_error. Successful dimensions shall remain subject to resource availability.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.

PPL-SPEC-000968
8. Box coordinate folding and interval enclosure PPL-SPEC-000968

For a valid destination coordinate dest and selected set vars that excludes it, folding shall replace the destination factor by the least interval of the selected profile containing the union of its entry factor and all selected entry factors. It shall then remove the selected coordinates, compacting the remaining positions in their original order. Other retained factors shall preserve their entry values. This shall be the least box enclosure of the alternatives obtained by choosing either the original destination or one selected coordinate for the surviving destination value. Gaps between those alternatives may be included by the interval hull. Empty sources shall remain empty. An empty selected set shall preserve the value.

An out-of-dimension destination or selected coordinate, or inclusion of the destination in the selected set, shall throw std::invalid_argument. Destination validity shall be required even for an empty selected set and for an empty box.

The validity, numerical, initialization, synchronization and resource prerequisites of 🔗 1. Cartesian box values, coordinate identity and valid use shall apply. Operations requiring Variables_Set or mapping objects shall retain those objects' own interface prerequisites. A distinct borrowed source shall remain unchanged unless explicitly included in the destination mutation. Underlying allocation or endpoint exceptions shall retain their own guarantees; no general rollback guarantee shall be inferred.