Parma Polyhedra Library requirements
C PIP
PPL-SPEC-001544
1. C parametric problem values and ownership UID: PPL-SPEC-001544 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

PIP constructors shall create independent owned trivial, copied or constraint-range problems with the selected parameter coordinates. Range and counted-array arguments shall be valid during construction. Assignment shall replace native problem/tree state and rebind its owned nodes to the destination. Deletion shall release owned trees and problem data. Failed construction shall preserve its output handle and release acquired resources.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

A copied parametric problem owns another tree rather than borrowing the source tree.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_new_PIP_Problem_from_space_dimension(ppl_PIP_Problem_t *ppip,
                                             ppl_dimension_type d);
int ppl_new_PIP_Problem_from_PIP_Problem(ppl_PIP_Problem_t *ppip,
                                         ppl_const_PIP_Problem_t pip);
int ppl_assign_PIP_Problem_from_PIP_Problem(ppl_PIP_Problem_t dst,
                                            ppl_const_PIP_Problem_t src);
int ppl_new_PIP_Problem_from_constraints(
    ppl_PIP_Problem_t *ppip, ppl_dimension_type d,
    ppl_Constraint_System_const_iterator_t first,
    ppl_Constraint_System_const_iterator_t last, size_t n,
    ppl_dimension_type ds[]);
int ppl_delete_PIP_Problem(ppl_const_PIP_Problem_t pip);
VERIFICATION_CRITERIA:

Check zero/nonzero dimensions, parameter selection, copied solved/pending problems, independent destruction and rejected construction.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.

PPL-SPEC-001545
2. C parametric descriptors and parameter lists UID: PPL-SPEC-001545 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

PIP descriptor queries shall expose native dimension, parameter-coordinate count/list and original constraint count. Constraint-at-index shall return the corresponding borrowed input constraint and reject an out-of-range index without changing the output handle. Output arrays shall have sufficient capacity for their separately queried count. Read-only metadata inspection shall follow the documented safe borrowing rules.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

Clients require original parameter identities and constraints independent of solver transformations.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_PIP_Problem_space_dimension(ppl_const_PIP_Problem_t pip,
                                    ppl_dimension_type *m);
int ppl_PIP_Problem_number_of_parameter_space_dimensions(
    ppl_const_PIP_Problem_t pip, ppl_dimension_type *m);
int ppl_PIP_Problem_parameter_space_dimensions(ppl_const_PIP_Problem_t pip,
                                               ppl_dimension_type ds[]);
int ppl_PIP_Problem_number_of_constraints(ppl_const_PIP_Problem_t pip,
                                          ppl_dimension_type *m);
int ppl_PIP_Problem_constraint_at_index(ppl_const_PIP_Problem_t pip,
                                        ppl_dimension_type i,
                                        ppl_const_Constraint_t *pc);
VERIFICATION_CRITERIA:

Compare parameter arrays, original constraint order and borrowed values before and after solving and dimension changes.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.

PPL-SPEC-001546
3. C parametric incremental updates UID: PPL-SPEC-001546 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

PIP clear, variable/parameter growth, parameter-coordinate selection and constraint additions shall have native PIP_Problem effects and admission rules. Variables shall be appended before newly appended parameters. Selected dimensions shall be interpreted as a set. Existing processed decision variables shall not be reinterpreted as parameters. An empty constraint system shall still retain its declared dimension for compatibility checks. Later completed solution queries shall refer to the updated input and initial context.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

Parameter identity and dimension admission govern subsequent piecewise solutions.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_PIP_Problem_clear(ppl_PIP_Problem_t pip);
int ppl_PIP_Problem_add_space_dimensions_and_embed(
    ppl_PIP_Problem_t pip, ppl_dimension_type pip_vars,
    ppl_dimension_type pip_params);
int ppl_PIP_Problem_add_to_parameter_space_dimensions(ppl_PIP_Problem_t pip,
                                                      ppl_dimension_type ds[],
                                                      size_t n);
int ppl_PIP_Problem_add_constraint(ppl_PIP_Problem_t pip,
                                   ppl_const_Constraint_t c);
int ppl_PIP_Problem_add_constraints(ppl_PIP_Problem_t pip,
                                    ppl_const_Constraint_System_t cs);
VERIFICATION_CRITERIA:

Compare fresh and incremental models, floor-term renumbering, duplicate selections, dimension overflow and incompatible empty systems.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.

PPL-SPEC-001547
4. C parametric outcomes and borrowed solution trees UID: PPL-SPEC-001547 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

PIP satisfiability and solve shall return native boolean/status outcomes in the selected mode, including the big-parameter convention in 🔗 1. Parametric problem and context interpretation. Solution accessors shall return a borrowed root owned by the problem, or null as a successful result for infeasibility in that mode. The solution shall retain native nonnegative-integer, initial-context and lexicographic semantics within the declared assignment scope. Tree handles shall not be modified or deleted. Operations that compute or replace problem/tree state may invalidate them; documented read-only traversal and metadata queries shall remain permitted. Failed access shall preserve its output handle.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

A null solution root represents a mathematical outcome and is distinct from a negative failure status.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_PIP_Problem_is_satisfiable(ppl_const_PIP_Problem_t pip);
int ppl_PIP_Problem_solve(ppl_const_PIP_Problem_t pip);
int ppl_PIP_Problem_solution(ppl_const_PIP_Problem_t pip,
                             ppl_const_PIP_Tree_Node_t *pip_tree);
int ppl_PIP_Problem_optimizing_solution(ppl_const_PIP_Problem_t pip,
                                        ppl_const_PIP_Tree_Node_t *pip_tree);
VERIFICATION_CRITERIA:

Evaluate returned trees independently over bounded parameter contexts, including infeasible regions, floor terms, copies and incremental changes.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.

PPL-SPEC-001548
5. C parametric controls, big parameter and memory UID: PPL-SPEC-001548 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

PIP cutting/pivot controls and big-parameter selection shall forward native admission and stored values. A designated big parameter shall remain an admitted parameter coordinate and shall select the asymptotic interpretation in 🔗 1. Parametric problem and context interpretation. Native validity and memory results shall be returned or assigned without changing their meaning.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

C controls must preserve context and asymptotic meaning.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_PIP_Problem_get_big_parameter_dimension(ppl_const_PIP_Problem_t pip,
                                                ppl_dimension_type *pd);
int ppl_PIP_Problem_total_memory_in_bytes(ppl_const_PIP_Problem_t pip,
                                          size_t *sz);
int ppl_PIP_Problem_external_memory_in_bytes(ppl_const_PIP_Problem_t pip,
                                             size_t *sz);
int ppl_PIP_Problem_OK(ppl_const_PIP_Problem_t pip);
int ppl_PIP_Problem_set_big_parameter_dimension(ppl_PIP_Problem_t pip,
                                                ppl_dimension_type d);
int ppl_PIP_Problem_get_control_parameter(ppl_const_PIP_Problem_t pip,
                                          int name);
int ppl_PIP_Problem_set_control_parameter(ppl_PIP_Problem_t pip, int value);
VERIFICATION_CRITERIA:

Check all supported control choices against literal piecewise solutions, big-parameter histories, invalid native requests and memory/validity queries.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.

PPL-SPEC-001549
6. C solution-tree kind, guards, children and values UID: PPL-SPEC-001549 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

Tree-kind accessors shall return an alias of the input node for a matching kind and null for a different kind, without transferring ownership. Decision-child access shall select the requested boolean branch and return null for an absent branch. Guard getters shall return borrowed native constraint systems. Solution-coordinate getters shall return borrowed native affine expressions for decision coordinates, with native domain/index errors for invalid queries. Null handles shall be tested before further use. Traversal and independent coordinate queries shall not invalidate other documented read-only tree views.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

Safe traversal depends on distinguishing successful absent nodes from errors.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_PIP_Tree_Node_as_solution(ppl_const_PIP_Tree_Node_t spip_tree,
                                  ppl_const_PIP_Solution_Node_t *dpip_tree);
int ppl_PIP_Tree_Node_as_decision(ppl_const_PIP_Tree_Node_t spip_tree,
                                  ppl_const_PIP_Decision_Node_t *dpip_tree);
int ppl_PIP_Tree_Node_get_constraints(ppl_const_PIP_Tree_Node_t pip_tree,
                                      ppl_const_Constraint_System_t *pcs);
int ppl_PIP_Tree_Node_OK(ppl_const_PIP_Tree_Node_t pip);
int ppl_PIP_Solution_Node_OK(ppl_const_PIP_Solution_Node_t pip_sol);
int ppl_PIP_Solution_Node_get_parametric_values(
    ppl_const_PIP_Solution_Node_t pip_sol, ppl_dimension_type var,
    ppl_const_Linear_Expression_t *le);
int ppl_PIP_Decision_Node_OK(ppl_const_PIP_Decision_Node_t pip_dec);
int ppl_PIP_Decision_Node_get_child_node(ppl_const_PIP_Decision_Node_t pip_dec,
                                         int b,
                                         ppl_const_PIP_Tree_Node_t *pip_tree);
VERIFICATION_CRITERIA:

Traverse both branch kinds and absent branches, evaluate guards and leaf expressions over admitted contexts, and check invalid coordinate queries and unchanged failure outputs.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.

PPL-SPEC-001550
7. C artificial-parameter expression and coefficient queries UID: PPL-SPEC-001550 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

The artificial-parameter input handle shall borrow an element of the owning tree. Expression access shall copy its affine numerator into the caller's existing expression object. That copy shall remain independent of the tree. Coefficient, constant and denominator queries shall assign their stored native values to existing coefficient objects. The artificial value shall remain the mathematical floor of the numerator divided by its positive denominator, including negative numerators. These accessors shall not normalize or replace the source representation or transfer ownership of the artificial parameter.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

The denominator is separate from an inherited affine numerator.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_Artificial_Parameter_get_Linear_Expression(
    ppl_const_Artificial_Parameter_t ap, ppl_Linear_Expression_t le);
int ppl_Artificial_Parameter_coefficient(ppl_const_Artificial_Parameter_t ap,
                                         ppl_dimension_type var,
                                         ppl_Coefficient_t n);
int ppl_Artificial_Parameter_inhomogeneous_term(
    ppl_const_Artificial_Parameter_t ap, ppl_Coefficient_t n);
int ppl_Artificial_Parameter_denominator(ppl_const_Artificial_Parameter_t ap,
                                         ppl_Coefficient_t n);
VERIFICATION_CRITERIA:

Check copied numerator dimensions and exact coefficients, independence after tree destruction, source preservation, positive denominators and independent floor evaluation for generated parameters.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.

PPL-SPEC-001551
8. C artificial-parameter sequence traversal UID: PPL-SPEC-001551 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): STATEMENT:

Allocated artificial-parameter iterators shall own only their iterator storage. Node begin/end shall position them in that node's local ordered sequence; equality, increment and dereference shall use valid positions in the same live sequence. Dereference shall return a borrowed artificial parameter tied to the owning problem/tree. Copying positions shall not copy parameters or extend tree lifetime; deleting positions shall not delete tree contents. Count shall report the local sequence length.

The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.

RATIONALE:

Local artificial parameters have an order and a lifetime inherited from the solution tree.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_PIP_Tree_Node_number_of_artificials(ppl_const_PIP_Tree_Node_t pip_tree,
                                            ppl_dimension_type *m);
int ppl_PIP_Tree_Node_begin(
    ppl_const_PIP_Tree_Node_t pip_tree,
    ppl_Artificial_Parameter_Sequence_const_iterator_t pit);
int ppl_PIP_Tree_Node_end(
    ppl_const_PIP_Tree_Node_t pip_tree,
    ppl_Artificial_Parameter_Sequence_const_iterator_t pit);
int ppl_new_Artificial_Parameter_Sequence_const_iterator(
    ppl_Artificial_Parameter_Sequence_const_iterator_t *papit);
int ppl_new_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator(
    ppl_Artificial_Parameter_Sequence_const_iterator_t *papit,
    ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit);
int ppl_assign_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator(
    ppl_Artificial_Parameter_Sequence_const_iterator_t dst,
    ppl_const_Artificial_Parameter_Sequence_const_iterator_t src);
int ppl_delete_Artificial_Parameter_Sequence_const_iterator(
    ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit);
int ppl_Artificial_Parameter_Sequence_const_iterator_dereference(
    ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit,
    ppl_const_Artificial_Parameter_t *pap);
int ppl_Artificial_Parameter_Sequence_const_iterator_increment(
    ppl_Artificial_Parameter_Sequence_const_iterator_t apit);
int ppl_Artificial_Parameter_Sequence_const_iterator_equal_test(
    ppl_const_Artificial_Parameter_Sequence_const_iterator_t x,
    ppl_const_Artificial_Parameter_Sequence_const_iterator_t y);
VERIFICATION_CRITERIA:

Traverse empty/nonempty local sequences, compare/copy/assign iterator positions and inspect borrowed parameters without invalidating the tree.

SOURCE:

interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.