Parma Polyhedra Library requirements
C++ pip trees
PPL-SPEC-001496
1. Parametric tree interpretation and artificial scope PPL-SPEC-001496

A returned tree shall be interpreted at parameter assignments in the scope defined by 🔗 1. Parametric problem and context interpretation. At each node, local artificial parameters shall be introduced in stored order after all original coordinates and inherited artificial parameters. An artificial parameter a = ⌊e ⁄ d⌋ shall use mathematical floor, including for negative numerators. Its expression shall refer only to original parameters and earlier artificial parameters in scope.

A decision's true branch shall require all local guards; its false branch, when present, shall require the complement of its single guard. A solution leaf shall require its own guards in addition to the path context. Missing branches and failed leaf guards shall mean infeasibility within that result's scope.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001497
2. Parametric node guards and artificial-parameter views PPL-SPEC-001497

constraints shall return a borrowed const view of the node's local parameter guards. Artificial-parameter iterators shall traverse the local stored sequence in introduction order; the count shall report its size, without including ancestor parameters. The half-open range shall be empty when no local artificial parameter is introduced. Storage changes and node destruction may invalidate these borrowed views and iterators. Borrowing local constraints or artificial-parameter iterators shall require an lvalue node.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001498
3. Parametric tree ownership associations PPL-SPEC-001498

get_owner shall return the node's non-owning problem association. set_owner shall update that association throughout the receiver's subtree; check_ownership shall report whether every node in that subtree has the supplied owner. Rebinding shall not copy nodes or re-solve a problem. Callers rebinding a tree for interpretation shall provide a live owner with compatible original dimensions and parameter meanings. Every tree returned by a problem shall refer to that problem throughout its subtree.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001499
4. Parametric tree cloning and lifetime PPL-SPEC-001499

clone shall allocate a structurally independent copy of the subtree, including guards, artificial parameters and solution representation, and return ownership of that copy to its caller. It shall preserve the original owner association but detach the clone's root from its former parent. Copied children shall refer to their copied parent. Deleting a tree through its virtual base shall release every owned descendant. Failed cloning shall release any subtree already acquired. Initial solution-node construction shall create solver state associated with the supplied owner; numerical leaf access shall require a complete solved representation.

Temporary ownership during recursive solving shall protect the successfully returned subtree or newly adopting parent. Retargeting that protection shall not delete a root already consumed by solving or adopted by the parent.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001500
5. Artificial parameter construction and value operations PPL-SPEC-001500

Default construction shall represent zero with denominator one. Construction from expr and nonzero d shall preserve their rational ratio while normalizing the denominator to positive and dividing numerator coefficients, constant and denominator by their common factor. Zero denominator shall raise std::invalid_argument. In tree interpretation the value shall be the floor of that normalized rational expression.

Copying and assignment shall preserve the stored numerator expression, dimension and denominator, with independent later mutations. Exchange shall swap them. Equality shall compare stored dimension, numerator and denominator; inequality shall negate it. Equality shall not identify all distinct formulas that happen to have equal floors on a particular context. Inherited expression mutations shall follow the linear-expression contracts and shall not implicitly renormalize this denominator.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001501
6. Artificial parameter persistence and diagnostics PPL-SPEC-001501

Serialization shall retain numerator dimension, coefficients and the positive denominator. Loading shall preserve an admitted stored representation, including a common factor, without constructor normalization. Malformed or nonpositive denominators shall return false in both build modes. False shall not promise rollback or further queries; owned storage shall remain destructible. OK shall require a positive denominator. Human output shall display the expression and integer-division denominator and return its stream. External memory shall estimate expression storage; total shall add the artificial-parameter object's own size.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001502
7. Reloadable parametric tree structure PPL-SPEC-001502

Node dumping shall write local guards and artificial parameters; concrete solution and decision dumping shall additionally write their complete respective representation. Concrete loading shall replace the corresponding stored state, retain the receiver's live owner association and restore parent and owner links for loaded children. Reloading shall not append old artificial parameters. Recursive decision subtrees shall be supported on both branches.

Malformed fields, nonpositive tableau denominators, incompatible vector/matrix sizes, out-of-range mappings and invalid decision structure shall return false in both build modes, before unsafe indexing or successful use of the broken representation. Surviving ownership shall remain destructible after false, without a rollback or further-query guarantee. A tree shall be interpreted only after association with a compatible live problem. Stream and resource exceptions may propagate.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001503
8. Parametric solution leaves and coordinate values PPL-SPEC-001503

A solution node shall return itself from as_solution and null from as_decision. On a complete solved leaf associated with a live problem, parametric_values(var) shall return a borrowed affine expression in original and in-scope artificial parameters describing that decision coordinate on the leaf's valid path context. Its coordinate shall be an original problem variable; a parameter coordinate or dimension-incompatible variable shall raise std::invalid_argument. Cached expressions may be materialized lazily. No tuple shall be inferred from the leaf when its guards fail. Returning a parametric-value reference shall require an lvalue solution node.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001504
9. Parametric decision nodes and branches PPL-SPEC-001504

A decision node shall return itself from as_decision and null from as_solution. child_node(true) and child_node(false) shall expose the respective borrowed subtree, with null denoting an absent branch. A valid decision shall have a true child. A decision with a false child shall have exactly one local guard. The mutable accessor shall expose the same node as the const accessor; callers shall preserve the owner's structure, backlinks and coordinate meaning when mutating an independently owned tree.

Borrowing a child pointer shall require an lvalue decision node.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.

PPL-SPEC-001505
10. Parametric tree diagnostics, display and memory PPL-SPEC-001505

OK shall check local guard, tableau/vector and decision-structure invariants and recursively check owned children. Invalid mapping indices shall be rejected before indexing the corresponding vector. These checks shall not prove lexicographic optimality. Printing shall show the subtree's guards, artificial parameters and decision-coordinate formulas under its compatible live owner, with nonnegative indentation. Stream insertion shall return its stream. Memory estimates shall include local storage and owned descendants; total shall add the concrete object's own size.

The initialization, arithmetic, ownership and exceptional-completion conditions in 🔗 1. Optimization and ranking valid use shall apply.