Parma Polyhedra Library requirements
C VALUES

C VALUES

PPL-SPEC-001523
1. C coefficient ownership, conversion and bounds
UID: PPL-SPEC-001523
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Coefficient creation shall produce independent caller-owned zero, GMP-integer or copied values. Assignment and conversion to or from initialized mpz_t objects shall preserve the mathematical integer for every admitted value. For checked coefficient profiles, conversion from GMP with an out-of-range value shall report PPL_ARITHMETIC_OVERFLOW. Deletion shall release owned coefficients. The boundedness predicate shall identify the configured coefficient representation. Minimum/maximum queries shall assign bounds and return true for bounded coefficients, and return false without modifying the output for unbounded coefficients. OK shall report the coefficient representation's admitted validity.

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

RATIONALE:

Host GMP values and library coefficients require exact conversion with explicit ownership.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_new_Coefficient(ppl_Coefficient_t *pc);
int ppl_new_Coefficient_from_mpz_t(ppl_Coefficient_t *pc, mpz_t z);
int ppl_new_Coefficient_from_Coefficient(ppl_Coefficient_t *pc,
                                         ppl_const_Coefficient_t c);
int ppl_assign_Coefficient_from_mpz_t(ppl_Coefficient_t dst, mpz_t z);
int ppl_assign_Coefficient_from_Coefficient(ppl_Coefficient_t dst,
                                            ppl_const_Coefficient_t src);
int ppl_delete_Coefficient(ppl_const_Coefficient_t c);
int ppl_Coefficient_to_mpz_t(ppl_const_Coefficient_t c, mpz_t z);
int ppl_Coefficient_OK(ppl_const_Coefficient_t c);
int ppl_Coefficient_is_bounded(void);
int ppl_Coefficient_min(mpz_t min);
int ppl_Coefficient_max(mpz_t max);
int ppl_multiply_Linear_Expression_by_Coefficient(ppl_Linear_Expression_t le,
                                                  ppl_const_Coefficient_t n);
VERIFICATION_CRITERIA:

Check signed and large integers, copy/assignment independence, configured bounds, round trips and bounded overflow where configured.

SOURCE:

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

PPL-SPEC-001524
2. C affine expression values and updates
UID: PPL-SPEC-001524
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Expression construction shall produce independent zero, dimensioned, copied or descriptor-derived native affine expressions. Assignment, coefficient additions, constant additions, expression addition/subtraction and scaling shall have the corresponding native affine meaning and retain native dimension/admission rules. Source handles shall remain valid during operations; owned results shall be independently deletable. Mutations shall not alter an independent source copy.

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

RATIONALE:

C expression operations must preserve affine algebra and dimensions.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_new_Linear_Expression(ppl_Linear_Expression_t *ple);
int ppl_new_Linear_Expression_with_dimension(ppl_Linear_Expression_t *ple,
                                             ppl_dimension_type d);
int ppl_new_Linear_Expression_from_Linear_Expression(
    ppl_Linear_Expression_t *ple, ppl_const_Linear_Expression_t le);
int ppl_new_Linear_Expression_from_Constraint(ppl_Linear_Expression_t *ple,
                                              ppl_const_Constraint_t c);
int ppl_new_Linear_Expression_from_Generator(ppl_Linear_Expression_t *ple,
                                             ppl_const_Generator_t g);
int ppl_new_Linear_Expression_from_Congruence(ppl_Linear_Expression_t *ple,
                                              ppl_const_Congruence_t c);
int ppl_new_Linear_Expression_from_Grid_Generator(ppl_Linear_Expression_t *ple,
                                                  ppl_const_Grid_Generator_t g);
int ppl_assign_Linear_Expression_from_Linear_Expression(
    ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src);
int ppl_delete_Linear_Expression(ppl_const_Linear_Expression_t le);
int ppl_Linear_Expression_all_homogeneous_terms_are_zero(
    ppl_const_Linear_Expression_t le);
int ppl_Linear_Expression_add_to_coefficient(ppl_Linear_Expression_t le,
                                             ppl_dimension_type var,
                                             ppl_const_Coefficient_t n);
int ppl_Linear_Expression_add_to_inhomogeneous(ppl_Linear_Expression_t le,
                                               ppl_const_Coefficient_t n);
int ppl_add_Linear_Expression_to_Linear_Expression(
    ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src);
int ppl_subtract_Linear_Expression_from_Linear_Expression(
    ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src);
VERIFICATION_CRITERIA:

Compare literal coefficient vectors and constants after each constructor and arithmetic update, including cancellation, zero scaling, borrowed input conversion and rejected dimensions.

SOURCE:

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

PPL-SPEC-001525
3. C affine expression queries
UID: PPL-SPEC-001525
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Expression dimension and coefficient queries shall assign the corresponding native extent, selected coefficient or constant. Zero tests and validity tests shall return boolean results. Query outputs shall be live writable coefficient objects rather than newly allocated handles. Indexed access shall observe native index admission and virtual zero coefficients where provided.

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

RATIONALE:

Queries distinguish assigning an existing coefficient from creating another owned object.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_Linear_Expression_space_dimension(ppl_const_Linear_Expression_t le,
                                          ppl_dimension_type *m);
int ppl_Linear_Expression_coefficient(ppl_const_Linear_Expression_t le,
                                      ppl_dimension_type var,
                                      ppl_Coefficient_t n);
int ppl_Linear_Expression_inhomogeneous_term(ppl_const_Linear_Expression_t le,
                                             ppl_Coefficient_t n);
int ppl_Linear_Expression_OK(ppl_const_Linear_Expression_t le);
int ppl_Linear_Expression_is_zero(ppl_const_Linear_Expression_t le);
VERIFICATION_CRITERIA:

Check exact coefficients/constants, zero expressions, padded dimensions, range admission and query-output reuse.

SOURCE:

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

PPL-SPEC-001526
4. C linear constraint values
UID: PPL-SPEC-001526
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Creation shall copy inputs into an independent owned Constraint representing the supplied affine expression compared with zero using the requested supported relation, including strict relations. Dedicated zero-dimensional constructors shall provide the corresponding native canonical objects. Copying and assignment shall preserve native value and dimension; deletion shall release owned storage. An unsupported relation code shall report PPL_ERROR_INVALID_ARGUMENT. Native dimension and size failures shall be translated by the C failure protocol.

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

RATIONALE:

Descriptor conversion must preserve its geometric or arithmetic meaning.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_new_Constraint(ppl_Constraint_t *pc, ppl_const_Linear_Expression_t le,
                       enum ppl_enum_Constraint_Type rel);
int ppl_new_Constraint_zero_dim_false(ppl_Constraint_t *pc);
int ppl_new_Constraint_zero_dim_positivity(ppl_Constraint_t *pc);
int ppl_new_Constraint_from_Constraint(ppl_Constraint_t *pc,
                                       ppl_const_Constraint_t c);
int ppl_assign_Constraint_from_Constraint(ppl_Constraint_t dst,
                                          ppl_const_Constraint_t src);
int ppl_delete_Constraint(ppl_const_Constraint_t c);
VERIFICATION_CRITERIA:

Check each supported kind, exact coefficients and normalization, empty/universe canonical descriptors, source independence and native admission failures.

SOURCE:

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

PPL-SPEC-001527
5. C linear constraint queries
UID: PPL-SPEC-001527
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Queries shall report the native Constraint relation type, dimension, variable coefficients and inhomogeneous term. Validity queries shall return a boolean outcome. Coefficient and inhomogeneous-term outputs shall assign existing writable coefficient objects. Native argument failures shall be translated.

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

RATIONALE:

C query results need the same interpretation as their native descriptor.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_Constraint_space_dimension(ppl_const_Constraint_t c,
                                   ppl_dimension_type *m);
int ppl_Constraint_type(ppl_const_Constraint_t c);
int ppl_Constraint_coefficient(ppl_const_Constraint_t c, ppl_dimension_type var,
                               ppl_Coefficient_t n);
int ppl_Constraint_inhomogeneous_term(ppl_const_Constraint_t c,
                                      ppl_Coefficient_t n);
int ppl_Constraint_OK(ppl_const_Constraint_t c);
VERIFICATION_CRITERIA:

Check each kind against literal descriptors, normalized ratios or congruences, output reuse and rejected inappropriate queries.

SOURCE:

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

PPL-SPEC-001528
6. C polyhedral generator values
UID: PPL-SPEC-001528
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Creation shall copy inputs into an independent owned Generator representing the requested line, ray, point or closure point with the native direction or divisor semantics. Dedicated zero-dimensional constructors shall provide the corresponding native canonical objects. Copying and assignment shall preserve native value and dimension; deletion shall release owned storage. Invalid kinds, undefined divisors and dimension/size violations designated by the native operation shall be reported through the C failure protocol.

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

RATIONALE:

Descriptor conversion must preserve its geometric or arithmetic meaning.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_new_Generator(ppl_Generator_t *pg, ppl_const_Linear_Expression_t le,
                      enum ppl_enum_Generator_Type t,
                      ppl_const_Coefficient_t d);
int ppl_new_Generator_zero_dim_point(ppl_Generator_t *pg);
int ppl_new_Generator_zero_dim_closure_point(ppl_Generator_t *pg);
int ppl_new_Generator_from_Generator(ppl_Generator_t *pg,
                                     ppl_const_Generator_t g);
int ppl_assign_Generator_from_Generator(ppl_Generator_t dst,
                                        ppl_const_Generator_t src);
int ppl_delete_Generator(ppl_const_Generator_t g);
VERIFICATION_CRITERIA:

Check each supported kind, exact coefficients and normalization, empty/universe canonical descriptors, source independence and native admission failures.

SOURCE:

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

PPL-SPEC-001529
7. C polyhedral generator queries
UID: PPL-SPEC-001529
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Queries shall report the native Generator kind, dimension and variable coefficients. Divisor queries shall report the native divisor for a point or closure point and shall report PPL_ERROR_INVALID_ARGUMENT for a line or ray. Validity queries shall return a boolean outcome. Coefficient and divisor outputs shall assign existing writable coefficient objects. Native argument failures shall be translated.

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

RATIONALE:

C query results need the same interpretation as their native descriptor.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_Generator_space_dimension(ppl_const_Generator_t g,
                                  ppl_dimension_type *m);
int ppl_Generator_type(ppl_const_Generator_t g);
int ppl_Generator_coefficient(ppl_const_Generator_t g, ppl_dimension_type var,
                              ppl_Coefficient_t n);
int ppl_Generator_divisor(ppl_const_Generator_t g, ppl_Coefficient_t n);
int ppl_Generator_OK(ppl_const_Generator_t g);
VERIFICATION_CRITERIA:

Check each kind against literal descriptors, normalized ratios or congruences, output reuse and rejected inappropriate queries.

SOURCE:

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

PPL-SPEC-001530
8. C rational congruence values
UID: PPL-SPEC-001530
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Creation shall copy inputs into an independent owned Congruence representing the supplied affine expression and modulus, with modulus zero denoting equality and native normalization of nonzero moduli. Dedicated zero-dimensional constructors shall provide the corresponding native canonical objects. Copying and assignment shall preserve native value and dimension; deletion shall release owned storage. Native dimension and size failures shall be translated by the C failure protocol.

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

RATIONALE:

Descriptor conversion must preserve its geometric or arithmetic meaning.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_new_Congruence(ppl_Congruence_t *pc, ppl_const_Linear_Expression_t le,
                       ppl_const_Coefficient_t m);
int ppl_new_Congruence_zero_dim_false(ppl_Congruence_t *pc);
int ppl_new_Congruence_zero_dim_integrality(ppl_Congruence_t *pc);
int ppl_new_Congruence_from_Congruence(ppl_Congruence_t *pc,
                                       ppl_const_Congruence_t c);
int ppl_assign_Congruence_from_Congruence(ppl_Congruence_t dst,
                                          ppl_const_Congruence_t src);
int ppl_delete_Congruence(ppl_const_Congruence_t c);
VERIFICATION_CRITERIA:

Check each supported kind, exact coefficients and normalization, empty/universe canonical descriptors, source independence and native admission failures.

SOURCE:

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

PPL-SPEC-001531
9. C rational congruence queries
UID: PPL-SPEC-001531
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Queries shall report the native Congruence dimension, variable coefficients, inhomogeneous term and modulus. Validity queries shall return a boolean outcome. Coefficient, inhomogeneous-term and modulus outputs shall assign existing writable coefficient objects. Native argument failures shall be translated.

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

RATIONALE:

C query results need the same interpretation as their native descriptor.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_Congruence_space_dimension(ppl_const_Congruence_t c,
                                   ppl_dimension_type *m);
int ppl_Congruence_coefficient(ppl_const_Congruence_t c, ppl_dimension_type var,
                               ppl_Coefficient_t n);
int ppl_Congruence_inhomogeneous_term(ppl_const_Congruence_t c,
                                      ppl_Coefficient_t n);
int ppl_Congruence_modulus(ppl_const_Congruence_t c, ppl_Coefficient_t m);
int ppl_Congruence_OK(ppl_const_Congruence_t c);
VERIFICATION_CRITERIA:

Check each kind against literal descriptors, normalized ratios or congruences, output reuse and rejected inappropriate queries.

SOURCE:

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

PPL-SPEC-001532
10. C grid generator values
UID: PPL-SPEC-001532
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Creation shall copy inputs into an independent owned Grid_Generator representing the requested line, parameter or point with the native direction and divisor semantics. Dedicated zero-dimensional constructors shall provide the corresponding native canonical objects. Copying and assignment shall preserve native value and dimension; deletion shall release owned storage. Invalid kinds, undefined divisors and dimension/size violations designated by the native operation shall be reported through the C failure protocol.

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

RATIONALE:

Descriptor conversion must preserve its geometric or arithmetic meaning.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_new_Grid_Generator(ppl_Grid_Generator_t *pg,
                           ppl_const_Linear_Expression_t le,
                           enum ppl_enum_Grid_Generator_Type t,
                           ppl_const_Coefficient_t d);
int ppl_new_Grid_Generator_zero_dim_point(ppl_Grid_Generator_t *pg);
int ppl_new_Grid_Generator_from_Grid_Generator(ppl_Grid_Generator_t *pg,
                                               ppl_const_Grid_Generator_t g);
int ppl_assign_Grid_Generator_from_Grid_Generator(
    ppl_Grid_Generator_t dst, ppl_const_Grid_Generator_t src);
int ppl_delete_Grid_Generator(ppl_const_Grid_Generator_t g);
VERIFICATION_CRITERIA:

Check each supported kind, exact coefficients and normalization, empty/universe canonical descriptors, source independence and native admission failures.

SOURCE:

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

PPL-SPEC-001533
11. C grid generator queries
UID: PPL-SPEC-001533
STATUS: APPROVED
COMPONENT: C_INTERFACE
APPLICABILITY: IF_C
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: C
VISIBILITY: Public
RELATIONS (Parent):
STATEMENT:

Queries shall report the native Grid_Generator kind, dimension and variable coefficients. Divisor queries shall report the native divisor for a point or parameter and shall report PPL_ERROR_INVALID_ARGUMENT for a line. Validity queries shall return a boolean outcome. Coefficient and divisor outputs shall assign existing writable coefficient objects. Native argument failures shall be translated.

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

RATIONALE:

C query results need the same interpretation as their native descriptor.

INTERFACE:

Public header: <ppl_c.h>.

int ppl_Grid_Generator_space_dimension(ppl_const_Grid_Generator_t g,
                                       ppl_dimension_type *m);
int ppl_Grid_Generator_type(ppl_const_Grid_Generator_t g);
int ppl_Grid_Generator_coefficient(ppl_const_Grid_Generator_t g,
                                   ppl_dimension_type var, ppl_Coefficient_t n);
int ppl_Grid_Generator_divisor(ppl_const_Grid_Generator_t g,
                               ppl_Coefficient_t n);
int ppl_Grid_Generator_OK(ppl_const_Grid_Generator_t g);
VERIFICATION_CRITERIA:

Check each kind against literal descriptors, normalized ratios or congruences, output reuse and rejected inappropriate queries.

SOURCE:

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