Parma Polyhedra Library requirements
C++ coordinate types and variables
  • 1. Coordinate identity and ambient dimension PPL-LLR-000011

    Geometric descriptors shall identify coordinates within a finite-dimensional ambient vector space and shall preserve coordinate identity when their declared dimension is increased without an explicit coordinate transformation.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

1. Coordinate type and reserved dimension index PPL-SPEC-000011

The public dimension_type shall be an unsigned integral type identical to std::size_t. Let S be its largest representable value. The function not_a_dimension() shall return S, reserved to indicate that no valid dimension is designated. Zero shall be an ordinary index and the dimension of a zero-dimensional space. The type shall not depend on the coefficient profile. The representable index range shall not by itself promise that a particular numerical object supports that many coordinates or that corresponding storage can be allocated.

PPL-SPEC-000012
2. Variable value identity and lifetime operations PPL-SPEC-000012

The public Variable type shall represent one Cartesian coordinate by its nonnegative identifier, with limits defined by 🔗 3. Variable construction, coordinate queries and bounds. Its meaning shall depend only on that identifier, independently of C++ object names, other variables and the current output function. Operations on existing variables shall require live valid objects; construction shall require valid source objects only where a source is supplied.

Implicit copy and move construction shall create a variable with the source's identifier and shall preserve the source. Implicit copy and move assignment shall set the target's identifier to the source's entry identifier, return a reference to the target and preserve a distinct source. Self-assignment shall preserve the identifier. Each variable shall remain an independent value. These value operations and destruction shall require no external storage allocation; destruction shall not alter another variable. Callers shall prevent unsynchronized access to an object while another operation changes its value.

3. Variable construction, coordinate queries and bounds PPL-SPEC-000013

Let S = not_a_dimension(). The query Variable::max_space_dimension() shall return S − 1. Construction from i shall succeed exactly for 0 ≤ i < S − 1, subject to ordinary C++ runtime conditions, and shall create a variable with id() == i and space_dimension() == i+1. In particular, the greatest admitted identifier shall be S − 2; its space dimension shall be S − 1.

An identifier equal to S − 1 or S shall be rejected with std::length_error without producing a variable. Range rejection shall not rely on wrapping i+1. Exact exception-message text is not prescribed. Queries on a live valid variable shall leave its identifier unchanged and return the exact identifier and enclosing-space dimension. These operations shall not depend on the active formatter or allocate coordinate storage.

PPL-SPEC-000014
4. Variable ordering by coordinate identity PPL-SPEC-000014

For live valid variables v and w, less(v, w) and Variable::Compare{}(v, w) shall both return true exactly when v.id() < w.id(). They shall leave the operands unchanged. Equal identifiers shall compare false in both directions, independently of object identity or formatted names. The predicates shall define a strict total ordering of coordinate identifiers and shall allocate no storage.

PPL-SPEC-000015
5. Variable exchange and self-exchange PPL-SPEC-000015

For live valid variables x and y, both x.m_swap(y) and swap(x, y) shall exchange their entry identifiers exactly and leave both variables valid. When both arguments designate the same variable, its identifier shall remain unchanged. Exchange shall allocate no storage and shall not depend on formatted names or the active output function.

  • 1. Coordinate identity and ambient dimension PPL-LLR-000011

    Geometric descriptors shall identify coordinates within a finite-dimensional ambient vector space and shall preserve coordinate identity when their declared dimension is increased without an explicit coordinate transformation.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 3. Failure and resource safety PPL-LLR-000133

    When a supported recoverable failure is reported through a documented error channel, the library shall release temporary resources it owns and leave surviving objects and outputs in the states permitted by the operation's documented failure guarantee. Failure during construction shall release resources acquired for the object whose construction failed. These obligations shall apply whether failure is reported by an exception, error status or host-language error mechanism.

    • PPL-HLR-000008
      8. Controlled runtime operation and resource use PPL-HLR-000008

      PPL shall define its initialization, cleanup, runtime configuration and failure behavior, and shall provide the supported mechanisms for controlling long-running computations, so that clients can use the library without violating its documented object and resource-lifetime rules.

PPL-SPEC-000016
6. Variable validity and memory accounting PPL-SPEC-000016

For every live valid variable, OK() shall return true without changing its value. The representation invariant checked by OK() shall be id() < max_space_dimension(). external_memory_in_bytes() shall return zero and total_memory_in_bytes() shall return sizeof(Variable): variables shall own no separately allocated coordinate storage. These queries shall leave the identifier and formatter state unchanged and shall allocate no storage. No operation shall require constructing an invalid object to use this diagnostic.

7. Active Variable formatter and initialized thread state PPL-SPEC-000017

The public output_function_type shall denote a function accepting an output stream and a Variable value, returning void. set_output_function(p) shall store exactly p without invoking it; get_output_function() shall return the pointer currently stored for the applicable runtime context. Neither operation shall allocate storage or change any variable identifier.

The applicable initialization and thread-entry protocol of 🔗 1. Initialization owners and automatic C++ initialization and 🔗 3. Thread initialization, default state and finalization shall establish the default output function before variable insertion is used. In a thread-safe build the stored pointer shall be thread-local. Otherwise it shall be shared within the process, and callers shall serialize formatter changes and uses. Callers shall also synchronize shared-stream access and mutable callback state as needed.

Storing a null pointer shall be permitted, and a subsequent getter shall return null; insertion shall require a nonnull callable pointer. The caller shall retain any callback dependencies for its use period and restore a callable pointer before subsequent insertion. Setting a formatter shall not acquire ownership of callback dependencies. This interface shall not diagnose every violation of initialization, callback-lifetime or concurrency preconditions.

8. Variable names, formatter dispatch and output failures PPL-SPEC-000018

For a live valid variable with identifier i, let q = ⌊i ⁄ 26⌋ and r = i − 26q. Successful direct use of default_output_function shall insert the uppercase character at position r in ABCDEFGHIJKLMNOPQRSTUVWXYZ. If q is nonzero, it shall then insert q as an unsigned integer using the stream's current formatting; otherwise it shall insert no suffix. Character and integer insertions shall honor their applicable stream formatting and locale. The function shall add no separator, newline or explicit flush, and shall not change the active formatter.

Under 🔗 7. Active Variable formatter and initialized thread state, IO_Operators::operator<< shall invoke the currently active output function exactly once with the supplied stream and variable value, and shall return that same stream reference on normal return. Each insertion shall obtain the pointer active for that call. A callback may change the formatter for subsequent calls; insertion shall not restore the old pointer or undo callback changes to the stream. Direct default formatting shall not consult the active pointer.

Output shall not change the variable identifier. Stream failures shall follow the stream's state and exception-mask rules. Callback exceptions and applicable C++ resource exceptions shall propagate; partial output and callback changes to formatter or stream state shall remain observable, with no output rollback promised. Callbacks shall satisfy the stream, lifetime and synchronization preconditions and shall not invalidate an object accessed by the call.