# C Language Interface

Some details about the C Interface. More...

## Version Checking

#define | PPL_VERSION_MAJOR 0
| The major number of the PPL version.
#define | PPL_VERSION_MINOR 6
| The minor number of the PPL version.
#define | PPL_VERSION_REVISION 1
| The revision number of the PPL version.
#define | PPL_VERSION_BETA 0
| The beta number of the PPL version. This is zero for official releases and nonzero for development snapshots.
#define | PPL_VERSION "0.6.1"
| A string containing the PPL version.
int | ppl_version_major (void)
| Returns the major number of the PPL version.
int | ppl_version_minor (void)
| Returns the minor number of the PPL version.
int | ppl_version_revision (void)
| Returns the revision number of the PPL version.
int | ppl_version_beta (void)
| Returns the beta number of the PPL version.
int | ppl_version (const char **p)
| Writes to `m` a pointer to a character string containing the PPL version.
int | ppl_banner (const char **p)
| Writes to `m` a pointer to a character string containing the PPL banner.

## Simple I/O Functions

typedef const char * | ppl_io_variable_output_function_type (ppl_dimension_type var)
| The type of output functions used for printing variables.
int | ppl_io_print_variable (ppl_dimension_type var)
| Pretty-prints `x` to `stdout`.
int | ppl_io_fprint_variable (FILE *stream, ppl_dimension_type var)
| Pretty-prints `var` to the given output `stream`.
int | ppl_io_print_Coefficient (ppl_const_Coefficient_t x)
| Prints `x` to `stdout`.
int | ppl_io_fprint_Coefficient (FILE *stream, ppl_const_Coefficient_t x)
| Prints `x` to the given output `stream`.
int | ppl_io_print_LinExpression (ppl_const_LinExpression_t x)
| Prints `x` to `stdout`.
int | ppl_io_fprint_LinExpression (FILE *stream, ppl_const_LinExpression_t x)
| Prints `x` to the given output `stream`.
int | ppl_io_print_Constraint (ppl_const_Constraint_t x)
| Prints `x` to `stdout`.
int | ppl_io_fprint_Constraint (FILE *stream, ppl_const_Constraint_t x)
| Prints `x` to the given output `stream`.
int | ppl_io_print_ConSys (ppl_const_ConSys_t x)
| Prints `x` to `stdout`.
int | ppl_io_fprint_ConSys (FILE *stream, ppl_const_ConSys_t x)
| Prints `x` to the given output `stream`.
int | ppl_io_print_Generator (ppl_const_Generator_t x)
| Prints `x` to `stdout`.
int | ppl_io_fprint_Generator (FILE *stream, ppl_const_Generator_t x)
| Prints `x` to the given output `stream`.
int | ppl_io_print_GenSys (ppl_const_GenSys_t x)
| Prints `x` to `stdout`.
int | ppl_io_fprint_GenSys (FILE *stream, ppl_const_GenSys_t x)
| Prints `x` to the given output `stream`.
int | ppl_io_print_Polyhedron (ppl_const_Polyhedron_t x)
| Prints `x` to `stdout`.
int | ppl_io_fprint_Polyhedron (FILE *stream, ppl_const_Polyhedron_t x)
| Prints `x` to the given output `stream`.
int | ppl_io_set_variable_output_function (ppl_io_variable_output_function_type *p)
| Sets the output function to be used for printing variables to `p`.
int | ppl_io_get_variable_output_function (ppl_io_variable_output_function_type **pp)
| Writes a pointer to the current variable output function to `pp`.

## Initialization, Error Handling and Auxiliary Functions

int | ppl_max_space_dimension (ppl_dimension_type *m)
| Writes to `m` the maximum space dimension this library can handle.
int | ppl_not_a_dimension (ppl_dimension_type *m)
| Writes to `m` a value that does not designate a valid dimension.
int | ppl_initialize (void)
| Initializes the Parma Polyhedra Library. This function must be called before any other function.
int | ppl_finalize (void)
| Finalizes the Parma Polyhedra Library. This function must be called after any other function.
int | ppl_set_error_handler (void(*h)(enum ppl_enum_error_code code, const char *description))
| Installs the user-defined error handler pointed by `h`.

## Functions Related to Coefficients

int | ppl_new_Coefficient (ppl_Coefficient_t *pc)
| Creates a new coefficient with value 0 and writes an handle for the newly created coefficient at address `pc`.
int | ppl_new_Coefficient_from_mpz_t (ppl_Coefficient_t *pc, mpz_t z)
| Creates a new coefficient with the value given by the GMP integer `z` and writes an handle for the newly created coefficient at address `pc`.
int | ppl_new_Coefficient_from_Coefficient (ppl_Coefficient_t *pc, ppl_const_Coefficient_t c)
| Builds a coefficient that is a copy of `c`; writes an handle for the newly created coefficient at address `pc`.
int | ppl_assign_Coefficient_from_mpz_t (ppl_Coefficient_t dst, mpz_t z)
| Assign to `dst` the value given by the GMP integer `z`.
int | ppl_assign_Coefficient_from_Coefficient (ppl_Coefficient_t dst, ppl_const_Coefficient_t src)
| Assigns a copy of the coefficient `src` to `dst`.
int | ppl_delete_Coefficient (ppl_const_Coefficient_t c)
| Invalidates the handle `c:` this makes sure the corresponding resources will eventually be released.
int | ppl_Coefficient_to_mpz_t (ppl_const_Coefficient_t c, mpz_t z)
| Sets the value of the GMP integer `z` to the value of `c`.
int | ppl_Coefficient_OK (ppl_const_Coefficient_t c)
| Returns a positive integer if `c` is well formed, i.e., if it satisfies all its implementation invariants; returns 0 and perhaps make some noise if `c` is broken. Useful for debugging purposes.

## Functions Related to Linear Expressions

int | ppl_new_LinExpression (ppl_LinExpression_t *ple)
| Creates a new linear expression corresponding to the constant 0 in a zero-dimensional space; writes an handle for the new linear expression at address `ple`.
int | ppl_new_LinExpression_with_dimension (ppl_LinExpression_t *ple, ppl_dimension_type d)
| Creates a new linear expression corresponding to the constant 0 in a `d`-dimensional space; writes an handle for the new linear expression at address `ple`.
int | ppl_new_LinExpression_from_LinExpression (ppl_LinExpression_t *ple, ppl_const_LinExpression_t le)
| Builds a linear expression that is a copy of `le`; writes an handle for the newly created linear expression at address `ple`.
int | ppl_new_LinExpression_from_Constraint (ppl_LinExpression_t *ple, ppl_const_Constraint_t c)
| Builds a linear expression corresponding to constraint `c`; writes an handle for the newly created linear expression at address `ple`.
int | ppl_new_LinExpression_from_Generator (ppl_LinExpression_t *ple, ppl_const_Generator_t g)
| Builds a linear expression corresponding to generator `g`; writes an handle for the newly created linear expression at address `ple`.
int | ppl_delete_LinExpression (ppl_const_LinExpression_t le)
| Invalidates the handle `le:` this makes sure the corresponding resources will eventually be released.
int | ppl_assign_LinExpression_from_LinExpression (ppl_LinExpression_t dst, ppl_const_LinExpression_t src)
| Assigns a copy of the linear expression `src` to `dst`.
int | ppl_LinExpression_add_to_coefficient (ppl_LinExpression_t le, ppl_dimension_type var, ppl_const_Coefficient_t n)
| Adds `n` to the coefficient of variable `var` in the linear expression `le`. The space dimension is set to be the maximum between `var` + 1 and the old space dimension.
int | ppl_LinExpression_add_to_inhomogeneous (ppl_LinExpression_t le, ppl_const_Coefficient_t n)
| Adds `n` to the inhomogeneous term of the linear expression `le`.
int | ppl_add_LinExpression_to_LinExpression (ppl_LinExpression_t dst, ppl_const_LinExpression_t src)
| Adds the linear expression `src` to `dst`.
int | ppl_subtract_LinExpression_from_LinExpression (ppl_LinExpression_t dst, ppl_const_LinExpression_t src)
| Subtracts the linear expression `src` from `dst`.
int | ppl_multiply_LinExpression_by_Coefficient (ppl_LinExpression_t le, ppl_const_Coefficient_t n)
| Multiply the linear expression `dst` by `n`.
int | ppl_LinExpression_space_dimension (ppl_const_LinExpression_t le)
| Returns the space dimension of `le`.
int | ppl_LinExpression_coefficient (ppl_const_LinExpression_t le, ppl_dimension_type var, ppl_Coefficient_t n)
| Copies into `n` the coefficient of variable `var` in the linear expression `le`.
int | ppl_LinExpression_inhomogeneous_term (ppl_const_LinExpression_t le, ppl_Coefficient_t n)
| Copies into `n` the inhomogeneous term of linear expression `le`.
int | ppl_LinExpression_OK (ppl_const_LinExpression_t le)
| Returns a positive integer if `le` is well formed, i.e., if it satisfies all its implementation invariants; returns 0 and perhaps make some noise if `le` is broken. Useful for debugging purposes.

## Functions Related to Constraints

int | ppl_new_Constraint (ppl_Constraint_t *pc, ppl_const_LinExpression_t le, enum ppl_enum_Constraint_Type rel)
| Creates the new constraint ``le` `rel` 0' and writes an handle for it at address `pc`. The space dimension of the new constraint is equal to the space dimension of `le`.
int | ppl_new_Constraint_zero_dim_false (ppl_Constraint_t *pc)
| Creates the unsatisfiable (zero-dimension space) constraint and writes an handle for it at address `pc`.
int | ppl_new_Constraint_zero_dim_positivity (ppl_Constraint_t *pc)
| Creates the true (zero-dimension space) constraint , also known as positivity constraint. An handle for the newly created constraint is written at address `pc`.
int | ppl_new_Constraint_from_Constraint (ppl_Constraint_t *pc, ppl_const_Constraint_t c)
| Builds a constraint that is a copy of `c`; writes an handle for the newly created constraint at address `pc`.
int | ppl_delete_Constraint (ppl_const_Constraint_t c)
| Invalidates the handle `c:` this makes sure the corresponding resources will eventually be released.
int | ppl_assign_Constraint_from_Constraint (ppl_Constraint_t dst, ppl_const_Constraint_t src)
| Assigns a copy of the constraint `src` to `dst`.
int | ppl_Constraint_space_dimension (ppl_const_Constraint_t c)
| Returns the space dimension of `c`.
int | ppl_Constraint_type (ppl_const_Constraint_t c)
| Returns the type of constraint `c`.
int | ppl_Constraint_coefficient (ppl_const_Constraint_t c, ppl_dimension_type var, ppl_Coefficient_t n)
| Copies into `n` the coefficient of variable `var` in constraint `c`.
int | ppl_Constraint_inhomogeneous_term (ppl_const_Constraint_t c, ppl_Coefficient_t n)
| Copies into `n` the inhomogeneous term of constraint `c`.
int | ppl_Constraint_OK (ppl_const_Constraint_t c)
| Returns a positive integer if `c` is well formed, i.e., if it satisfies all its implementation invariants; returns 0 and perhaps make some noise if `c` is broken. Useful for debugging purposes.

## Functions Related to Constraint Systems

int | ppl_new_ConSys (ppl_ConSys_t *pcs)
| Builds an empty system of constraints and writes an handle to it at address `pcs`.
int | ppl_new_ConSys_zero_dim_empty (ppl_ConSys_t *pcs)
| Builds a zero-dimensional, unsatisfiable constraint system and writes an handle to it at address `pcs`.
int | ppl_new_ConSys_from_Constraint (ppl_ConSys_t *pcs, ppl_const_Constraint_t c)
| Builds the singleton constraint system containing only a copy of constraint `c`; writes an handle for the newly created system at address `pcs`.
int | ppl_new_ConSys_from_ConSys (ppl_ConSys_t *pcs, ppl_const_ConSys_t cs)
| Builds a constraint system that is a copy of `cs`; writes an handle for the newly created system at address `pcs`.
int | ppl_delete_ConSys (ppl_const_ConSys_t cs)
| Invalidates the handle `cs:` this makes sure the corresponding resources will eventually be released.
int | ppl_assign_ConSys_from_ConSys (ppl_ConSys_t dst, ppl_const_ConSys_t src)
| Assigns a copy of the constraint system `src` to `dst`.
int | ppl_ConSys_space_dimension (ppl_const_ConSys_t cs)
| Returns the dimension of the vector space enclosing `cs`.
int | ppl_ConSys_clear (ppl_ConSys_t cs)
| Removes all the constraints from the constraint system `cs` and sets its space dimension to 0.
int | ppl_ConSys_insert_Constraint (ppl_ConSys_t cs, ppl_const_Constraint_t c)
| Inserts a copy of the constraint `c` into `cs`; the space dimension is increased, if necessary.
int | ppl_ConSys_OK (ppl_const_ConSys_t c)
| Returns a positive integer if `cs` is well formed, i.e., if it satisfies all its implementation invariants; returns 0 and perhaps make some noise if `cs` is broken. Useful for debugging purposes.
int | ppl_new_ConSys_const_iterator (ppl_ConSys_const_iterator_t *pcit)
| Builds a new `const iterator' and writes an handle to it at address `pcit`.
int | ppl_new_ConSys_const_iterator_from_ConSys_const_iterator (ppl_ConSys_const_iterator_t *pcit, ppl_const_ConSys_const_iterator_t cit)
| Builds a const iterator that is a copy of `cit`; writes an handle for the newly created const iterator at address `pcit`.
int | ppl_delete_ConSys_const_iterator (ppl_const_ConSys_const_iterator_t cit)
| Invalidates the handle `cit:` this makes sure the corresponding resources will eventually be released.
int | ppl_assign_ConSys_const_iterator_from_ConSys_const_iterator (ppl_ConSys_const_iterator_t dst, ppl_const_ConSys_const_iterator_t src)
| Assigns a copy of the const iterator `src` to `dst`.
int | ppl_ConSys_begin (ppl_const_ConSys_t cs, ppl_ConSys_const_iterator_t cit)
| Assigns to `cit` a const iterator "pointing" to the beginning of the constraint system `cs`.
int | ppl_ConSys_end (ppl_const_ConSys_t cs, ppl_ConSys_const_iterator_t cit)
| Assigns to `cit` a const iterator "pointing" past the end of the constraint system `cs`.
int | ppl_ConSys_const_iterator_dereference (ppl_const_ConSys_const_iterator_t cit, ppl_const_Constraint_t *pc)
| Dereference `cit` writing a const handle to the resulting constraint at address `pc`.
int | ppl_ConSys_const_iterator_increment (ppl_ConSys_const_iterator_t cit)
| Increment `cit` so that it "points" to the next constraint.
int | ppl_ConSys_const_iterator_equal_test (ppl_const_ConSys_const_iterator_t x, ppl_const_ConSys_const_iterator_t y)
| Returns a positive integer if the iterators corresponding to `x` and `y` are equal; return 0 if they are different.

## Functions Related to Generators

int | ppl_new_Generator (ppl_Generator_t *pg, ppl_const_LinExpression_t le, enum ppl_enum_Generator_Type t, ppl_const_Coefficient_t d)
| Creates a new generator of direction `le` and type `t`. If the generator to be created is a point or a closure point, the divisor `d` is applied to `le`. For other types of generators `d` is simply disregarded. An handle for the new generator is written at address `pg`. The space dimension of the new generator is equal to the space dimension of `le`.
int | ppl_new_Generator_zero_dim_point (ppl_Generator_t *pg)
| Creates the point that is the origin of the zero-dimensional space . Writes an handle for the new generator at address `pg`.
int | ppl_new_Generator_zero_dim_closure_point (ppl_Generator_t *pg)
| Creates, as a closure point, the point that is the origin of the zero-dimensional space . Writes an handle for the new generator at address `pg`.
int | ppl_new_Generator_from_Generator (ppl_Generator_t *pg, ppl_const_Generator_t g)
| Builds a generator that is a copy of `g`; writes an handle for the newly created generator at address `pg`.
int | ppl_delete_Generator (ppl_const_Generator_t g)
| Invalidates the handle `g:` this makes sure the corresponding resources will eventually be released.
int | ppl_assign_Generator_from_Generator (ppl_Generator_t dst, ppl_const_Generator_t src)
| Assigns a copy of the generator `src` to `dst`.
int | ppl_Generator_space_dimension (ppl_const_Generator_t g)
| Returns the space dimension of `g`.
int | ppl_Generator_type (ppl_const_Generator_t g)
| Returns the type of generator `g`.
int | ppl_Generator_coefficient (ppl_const_Generator_t g, ppl_dimension_type var, ppl_Coefficient_t n)
| Copies into `n` the coefficient of variable `var` in generator `g`.
int | ppl_Generator_divisor (ppl_const_Generator_t g, ppl_Coefficient_t n)
| If `g` is a point or a closure point assigns its divisor to `n`.
int | ppl_Generator_OK (ppl_const_Generator_t g)
| Returns a positive integer if `g` is well formed, i.e., if it satisfies all its implementation invariants; returns 0 and perhaps make some noise if `g` is broken. Useful for debugging purposes.

## Functions Related to Generator Systems

int | ppl_new_GenSys (ppl_GenSys_t *pgs)
| Builds an empty system of generators and writes an handle to it at address `pgs`.
int | ppl_new_GenSys_from_Generator (ppl_GenSys_t *pgs, ppl_const_Generator_t g)
| Builds the singleton generator system containing only a copy of generator `g`; writes an handle for the newly created system at address `pgs`.
int | ppl_new_GenSys_from_GenSys (ppl_GenSys_t *pgs, ppl_const_GenSys_t gs)
| Builds a generator system that is a copy of `gs`; writes an handle for the newly created system at address `pgs`.
int | ppl_delete_GenSys (ppl_const_GenSys_t gs)
| Invalidates the handle `gs:` this makes sure the corresponding resources will eventually be released.
int | ppl_assign_GenSys_from_GenSys (ppl_GenSys_t dst, ppl_const_GenSys_t src)
| Assigns a copy of the generator system `src` to `dst`.
int | ppl_GenSys_space_dimension (ppl_const_GenSys_t gs)
| Returns the dimension of the vector space enclosing `gs`.
int | ppl_GenSys_clear (ppl_GenSys_t gs)
| Removes all the generators from the generator system `gs` and sets its space dimension to 0.
int | ppl_GenSys_insert_Generator (ppl_GenSys_t gs, ppl_const_Generator_t g)
| Inserts a copy of the generator `g` into `gs`; the space dimension is increased, if necessary.
int | ppl_GenSys_OK (ppl_const_GenSys_t c)
| Returns a positive integer if `gs` is well formed, i.e., if it satisfies all its implementation invariants; returns 0 and perhaps make some noise if `gs` is broken. Useful for debugging purposes.
int | ppl_new_GenSys_const_iterator (ppl_GenSys_const_iterator_t *pgit)
| Builds a new `const iterator' and writes an handle to it at address `pgit`.
int | ppl_new_GenSys_const_iterator_from_GenSys_const_iterator (ppl_GenSys_const_iterator_t *pgit, ppl_const_GenSys_const_iterator_t git)
| Builds a const iterator that is a copy of `git`; writes an handle for the newly created const iterator at address `pgit`.
int | ppl_delete_GenSys_const_iterator (ppl_const_GenSys_const_iterator_t git)
| Invalidates the handle `git:` this makes sure the corresponding resources will eventually be released.
int | ppl_assign_GenSys_const_iterator_from_GenSys_const_iterator (ppl_GenSys_const_iterator_t dst, ppl_const_GenSys_const_iterator_t src)
| Assigns a copy of the const iterator `src` to `dst`.
int | ppl_GenSys_begin (ppl_const_GenSys_t gs, ppl_GenSys_const_iterator_t git)
| Assigns to `git` a const iterator "pointing" to the beginning of the generator system `gs`.
int | ppl_GenSys_end (ppl_const_GenSys_t gs, ppl_GenSys_const_iterator_t git)
| Assigns to `git` a const iterator "pointing" past the end of the generator system `gs`.
int | ppl_GenSys_const_iterator_dereference (ppl_const_GenSys_const_iterator_t git, ppl_const_Generator_t *pg)
| Dereference `git` writing a const handle to the resulting generator at address `pg`.
int | ppl_GenSys_const_iterator_increment (ppl_GenSys_const_iterator_t git)
| Increment `git` so that it "points" to the next generator.
int | ppl_GenSys_const_iterator_equal_test (ppl_const_GenSys_const_iterator_t x, ppl_const_GenSys_const_iterator_t y)
| Return a positive integer if the iterators corresponding to `x` and `y` are equal; return 0 if they are different.

## Functions Related to Polyhedra

int | ppl_new_C_Polyhedron_from_dimension (ppl_Polyhedron_t *pph, ppl_dimension_type d)
| Builds an universe closed polyhedron of dimension `d` and writes an handle to it at address `pph`.
int | ppl_new_NNC_Polyhedron_from_dimension (ppl_Polyhedron_t *pph, ppl_dimension_type d)
| Builds an universe NNC polyhedron of dimension `d` and writes an handle to it at address `pph`.
int | ppl_new_C_Polyhedron_empty_from_dimension (ppl_Polyhedron_t *pph, ppl_dimension_type d)
| Builds an empty closed polyhedron of dimension `d` and writes an handle to it at address `pph`.
int | ppl_new_NNC_Polyhedron_empty_from_dimension (ppl_Polyhedron_t *pph, ppl_dimension_type d)
| Builds an empty NNC polyhedron of dimension `d` and writes an handle to it at address `pph`.
int | ppl_new_C_Polyhedron_from_C_Polyhedron (ppl_Polyhedron_t *pph, ppl_const_Polyhedron_t ph)
| Builds a closed polyhedron that is a copy of `ph`; writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_C_Polyhedron_from_NNC_Polyhedron (ppl_Polyhedron_t *pph, ppl_const_Polyhedron_t ph)
| Builds a closed polyhedron that is a copy of of the NNC polyhedron `ph`; writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_NNC_Polyhedron_from_C_Polyhedron (ppl_Polyhedron_t *pph, ppl_const_Polyhedron_t ph)
| Builds an NNC polyhedron that is a copy of of the closed polyhedron `ph`; writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_NNC_Polyhedron_from_NNC_Polyhedron (ppl_Polyhedron_t *pph, ppl_const_Polyhedron_t ph)
| Builds an NNC polyhedron that is a copy of `ph`; writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_C_Polyhedron_from_ConSys (ppl_Polyhedron_t *pph, ppl_const_ConSys_t cs)
| Builds a new closed polyhedron from the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_C_Polyhedron_recycle_ConSys (ppl_Polyhedron_t *pph, ppl_ConSys_t cs)
| Builds a new closed polyhedron recycling the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_NNC_Polyhedron_from_ConSys (ppl_Polyhedron_t *pph, ppl_const_ConSys_t cs)
| Builds a new NNC polyhedron from the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_NNC_Polyhedron_recycle_ConSys (ppl_Polyhedron_t *pph, ppl_ConSys_t cs)
| Builds a new NNC polyhedron recycling the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_C_Polyhedron_from_GenSys (ppl_Polyhedron_t *pph, ppl_const_GenSys_t gs)
| Builds a new closed polyhedron from the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_C_Polyhedron_recycle_GenSys (ppl_Polyhedron_t *pph, ppl_GenSys_t gs)
| Builds a new closed polyhedron recycling the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_NNC_Polyhedron_from_GenSys (ppl_Polyhedron_t *pph, ppl_const_GenSys_t gs)
| Builds a new NNC polyhedron from the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_NNC_Polyhedron_recycle_GenSys (ppl_Polyhedron_t *pph, ppl_GenSys_t gs)
| Builds a new NNC polyhedron recycling the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`.
int | ppl_new_C_Polyhedron_from_bounding_box (ppl_Polyhedron_t *pph, ppl_dimension_type(*space_dimension)(void), int(*is_empty)(void), int(*get_lower_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d), int(*get_upper_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d))
| Builds a new C polyhedron corresponding to an interval-based bounding box, writing a handle for the newly created polyhedron at address `pph`.
int | ppl_new_NNC_Polyhedron_from_bounding_box (ppl_Polyhedron_t *pph, ppl_dimension_type(*space_dimension)(void), int(*is_empty)(void), int(*get_lower_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d), int(*get_upper_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d))
| Builds a new C polyhedron corresponding to an interval-based bounding box, writing a handle for the newly created polyhedron at address `pph`.
int | ppl_assign_C_Polyhedron_from_C_Polyhedron (ppl_Polyhedron_t dst, ppl_const_Polyhedron_t src)
| Assigns a copy of the closed polyhedron `src` to the closed polyhedron `dst`.
int | ppl_assign_NNC_Polyhedron_from_NNC_Polyhedron (ppl_Polyhedron_t dst, ppl_const_Polyhedron_t src)
| Assigns a copy of the NNC polyhedron `src` to the NNC polyhedron `dst`.
int | ppl_delete_Polyhedron (ppl_const_Polyhedron_t ph)
| Invalidates the handle `ph:` this makes sure the corresponding resources will eventually be released.
int | ppl_Polyhedron_space_dimension (ppl_const_Polyhedron_t ph)
| Returns the dimension of the vector space enclosing `ph`.
int | ppl_Polyhedron_constraints (ppl_const_Polyhedron_t ph, ppl_const_ConSys_t *pcs)
| Writes a const handle to the constraint system defining the polyhedron `ph` at address `pcs`.
int | ppl_Polyhedron_minimized_constraints (ppl_const_Polyhedron_t ph, ppl_const_ConSys_t *pcs)
| Writes a const handle to the minimized constraint system defining the polyhedron `ph` at address `pcs`.
int | ppl_Polyhedron_generators (ppl_const_Polyhedron_t ph, ppl_const_GenSys_t *pgs)
| Writes a const handle to the generator system defining the polyhedron `ph` at address `pgs`.
int | ppl_Polyhedron_minimized_generators (ppl_const_Polyhedron_t ph, ppl_const_GenSys_t *pgs)
| Writes a const handle to the minimized generator system defining the polyhedron `ph` at address `pgs`.
int | ppl_Polyhedron_relation_with_Constraint (ppl_const_Polyhedron_t ph, ppl_const_Constraint_t c)
| Checks the relation between the polyhedron `ph` with the constraint `c`.
int | ppl_Polyhedron_relation_with_Generator (ppl_const_Polyhedron_t ph, ppl_const_Generator_t g)
| Checks the relation between the polyhedron `ph` with the generator `g`.
int | ppl_Polyhedron_shrink_bounding_box (ppl_const_Polyhedron_t ph, unsigned int complexity, void(*set_empty)(void), void(*raise_lower_bound)(ppl_dimension_type k, int closed, ppl_const_Coefficient_t n, ppl_const_Coefficient_t d), void(*lower_upper_bound)(ppl_dimension_type k, int closed, ppl_const_Coefficient_t n, ppl_const_Coefficient_t d))
| Use `ph` to shrink a generic, interval-based bounding box. The bounding box is abstractly provided by means of the parameters.
int | ppl_Polyhedron_is_empty (ppl_const_Polyhedron_t ph)
| Returns a positive integer if `ph` is empty; returns 0 if `ph` is not empty.
int | ppl_Polyhedron_is_universe (ppl_const_Polyhedron_t ph)
| Returns a positive integer if `ph` is a universe polyhedron; returns 0 if it is not.
int | ppl_Polyhedron_is_bounded (ppl_const_Polyhedron_t ph)
| Returns a positive integer if `ph` is bounded; returns 0 if `ph` is unbounded.
int | ppl_Polyhedron_bounds_from_above (ppl_const_Polyhedron_t ph, ppl_const_LinExpression_t le)
| Returns a positive integer if `le` is bounded from above in `ph`; returns 0 otherwise.
int | ppl_Polyhedron_bounds_from_below (ppl_const_Polyhedron_t ph, ppl_const_LinExpression_t le)
| Returns a positive integer if `le` is bounded from below in `ph`; returns 0 otherwise.
int | ppl_Polyhedron_maximize (ppl_const_Polyhedron_t ph, ppl_const_LinExpression_t le, ppl_Coefficient_t sup_n, ppl_Coefficient_t sup_d, int *pmaximum, ppl_const_Generator_t *ppoint)
| Returns a positive integer if `ph` is not empty and `le` is bounded from above in `ph`, in which case the supremum value and a point where `le` reaches it are computed.
int | ppl_Polyhedron_minimize (ppl_const_Polyhedron_t ph, ppl_const_LinExpression_t le, ppl_Coefficient_t inf_n, ppl_Coefficient_t inf_d, int *pminimum, ppl_const_Generator_t *ppoint)
| Returns a positive integer if `ph` is not empty and `le` is bounded from above in `ph`, in which case the infimum value and a point where `le` reaches it are computed.
int | ppl_Polyhedron_is_topologically_closed (ppl_const_Polyhedron_t ph)
| Returns a positive integer if `ph` is topologically closed; returns 0 if `ph` is not topologically closed.
int | ppl_Polyhedron_contains_Polyhedron (ppl_const_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Returns a positive integer if `x` contains or is equal to `y`; returns 0 if it does not.
int | ppl_Polyhedron_strictly_contains_Polyhedron (ppl_const_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Returns a positive integer if `x` strictly contains `y`; returns 0 if it does not.
int | ppl_Polyhedron_is_disjoint_from_Polyhedron (ppl_const_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Returns a positive integer if `x` and `y` are disjoint; returns 0 if they are not.
int | ppl_Polyhedron_equals_Polyhedron (ppl_const_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Returns a positive integer if `x` and `y` are the same polyhedron; return 0 if they are different.
int | ppl_Polyhedron_OK (ppl_const_Polyhedron_t ph)
| Returns a positive integer if `ph` is well formed, i.e., if it satisfies all its implementation invariants; returns 0 and perhaps make some noise if `ph` is broken. Useful for debugging purposes.
int | ppl_Polyhedron_add_constraint (ppl_Polyhedron_t ph, ppl_const_Constraint_t c)
| Adds a copy of the constraint `c` to the system of constraints of `ph`.
int | ppl_Polyhedron_add_constraint_and_minimize (ppl_Polyhedron_t ph, ppl_const_Constraint_t c)
| Adds a copy of the constraint `c` to the system of constraints of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.
int | ppl_Polyhedron_add_generator (ppl_Polyhedron_t ph, ppl_const_Generator_t g)
| Adds a copy of the generator `g` to the system of generators of `ph`.
int | ppl_Polyhedron_add_generator_and_minimize (ppl_Polyhedron_t ph, ppl_const_Generator_t g)
| Adds a copy of the generator `g` to the system of generators of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.
int | ppl_Polyhedron_add_constraints (ppl_Polyhedron_t ph, ppl_const_ConSys_t cs)
| Adds a copy of the system of constraints `cs` to the system of constraints of `ph`.
int | ppl_Polyhedron_add_constraints_and_minimize (ppl_Polyhedron_t ph, ppl_const_ConSys_t cs)
| Adds a copy of the system of constraints `cs` to the system of constraints of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.
int | ppl_Polyhedron_add_generators (ppl_Polyhedron_t ph, ppl_const_GenSys_t gs)
| Adds a copy of the system of generators `gs` to the system of generators of `ph`.
int | ppl_Polyhedron_add_generators_and_minimize (ppl_Polyhedron_t ph, ppl_const_GenSys_t gs)
| Adds a copy of the system of generators `gs` to the system of generators of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.
int | ppl_Polyhedron_add_recycled_constraints (ppl_Polyhedron_t ph, ppl_ConSys_t cs)
| Adds the system of constraints `cs` to the system of constraints of `ph`.
int | ppl_Polyhedron_add_recycled_constraints_and_minimize (ppl_Polyhedron_t ph, ppl_ConSys_t cs)
| Adds the system of constraints `cs` to the system of constraints of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.
int | ppl_Polyhedron_add_recycled_generators (ppl_Polyhedron_t ph, ppl_GenSys_t gs)
| Adds the system of generators `gs` to the system of generators of `ph`.
int | ppl_Polyhedron_add_recycled_generators_and_minimize (ppl_Polyhedron_t ph, ppl_GenSys_t gs)
| Adds the system of generators `gs` to the system of generators of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.
int | ppl_Polyhedron_intersection_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Intersects `x` with polyhedron `y` and assigns the result `x`.
int | ppl_Polyhedron_intersection_assign_and_minimize (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Intersects `x` with polyhedron `y` and assigns the result `x`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `x` is also guaranteed to be minimized.
int | ppl_Polyhedron_poly_hull_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Assigns to `x` the poly-hull of `x` and `y`.
int | ppl_Polyhedron_poly_hull_assign_and_minimize (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Assigns to `x` the poly-hull of `x` and `y`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `x` is also guaranteed to be minimized.
int | ppl_Polyhedron_poly_difference_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Assigns to `x` the poly-difference of `x` and `y`.
int | ppl_Polyhedron_affine_image (ppl_Polyhedron_t ph, ppl_dimension_type var, ppl_const_LinExpression_t le, ppl_const_Coefficient_t d)
| Transforms the polyhedron `ph`, assigning an affine expression to the specified variable.
int | ppl_Polyhedron_affine_preimage (ppl_Polyhedron_t ph, ppl_dimension_type var, ppl_const_LinExpression_t le, ppl_const_Coefficient_t d)
| Transforms the polyhedron `ph`, substituting an affine expression to the specified variable.
int | ppl_Polyhedron_generalized_affine_image (ppl_Polyhedron_t ph, ppl_dimension_type var, enum ppl_enum_Constraint_Type relsym, ppl_const_LinExpression_t le, ppl_const_Coefficient_t d)
| Assigns to `ph` the image of `ph` with respect to the generalized affine transfer function , where is the relation symbol encoded by `relsym`.
int | ppl_Polyhedron_generalized_affine_image_lhs_rhs (ppl_Polyhedron_t ph, ppl_const_LinExpression_t lhs, enum ppl_enum_Constraint_Type relsym, ppl_const_LinExpression_t rhs)
| Assigns to `ph` the image of `ph` with respect to the generalized affine transfer function , where is the relation symbol encoded by `relsym`.
int | ppl_Polyhedron_time_elapse_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Assigns to `x` the time-elapse between the polyhedra `x` and `y`.
int | ppl_Polyhedron_BHRZ03_widening_assign_with_tokens (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, unsigned *tp)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the BHRZ03-widening of `x` and `y`. If `tp` is not the null pointer, the widening with tokens delay technique is applied with `*tp` available tokens.
int | ppl_Polyhedron_BHRZ03_widening_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the BHRZ03-widening of `x` and `y`.
int | ppl_Polyhedron_limited_BHRZ03_extrapolation_assign_with_tokens (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs, unsigned *tp)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the BHRZ03-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`. If `tp` is not the null pointer, the widening with tokens delay technique is applied with `*tp` available tokens.
int | ppl_Polyhedron_limited_BHRZ03_extrapolation_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the BHRZ03-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`.
int | ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign_with_tokens (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs, unsigned *tp)

If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the BHRZ03-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`, further intersected with all the constraints of the form and , with , that are satisfied by all the points of `x`. If `tp` is not the null pointer, the widening with tokens delay technique is applied with `*tp` available tokens.

int | ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the BHRZ03-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`, further intersected with all the constraints of the form and , with , that are satisfied by all the points of `x`.
int | ppl_Polyhedron_H79_widening_assign_with_tokens (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, unsigned *tp)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the H79-widening of `x` and `y`. If `tp` is not the null pointer, the widening with tokens delay technique is applied with `*tp` available tokens.
int | ppl_Polyhedron_H79_widening_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the H79-widening of `x` and `y`.
int | ppl_Polyhedron_limited_H79_extrapolation_assign_with_tokens (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs, unsigned *tp)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the H79-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`. If `tp` is not the null pointer, the widening with tokens delay technique is applied with `*tp` available tokens.
int | ppl_Polyhedron_limited_H79_extrapolation_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the H79-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`.
int | ppl_Polyhedron_bounded_H79_extrapolation_assign_with_tokens (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs, unsigned *tp)

If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the H79-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`, further intersected with all the constraints of the form and , with , that are satisfied by all the points of `x`. If `tp` is not the null pointer, the widening with tokens delay technique is applied with `*tp` available tokens.

int | ppl_Polyhedron_bounded_H79_extrapolation_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y, ppl_const_ConSys_t cs)
| If the polyhedron `y` is contained in (or equal to) the polyhedron `x`, assigns to `x` the H79-widening of `x` and `y` intersected with the constraints in `cs` that are satisfied by all the points of `x`, further intersected with all the constraints of the form and , with , that are satisfied by all the points of `x`.
int | ppl_Polyhedron_topological_closure_assign (ppl_Polyhedron_t ph)
| Assigns to `ph` its topological closure.
int | ppl_Polyhedron_add_dimensions_and_embed (ppl_Polyhedron_t ph, ppl_dimension_type d)
| Adds `d` new dimensions to the space enclosing the polyhedron `ph` and to `ph` itself.
int | ppl_Polyhedron_add_dimensions_and_project (ppl_Polyhedron_t ph, ppl_dimension_type d)
| Adds `d` new dimensions to the space enclosing the polyhedron `ph`.
int | ppl_Polyhedron_concatenate_assign (ppl_Polyhedron_t x, ppl_const_Polyhedron_t y)
| Seeing a polyhedron as a set of tuples (its points), assigns to `x` all the tuples that can be obtained by concatenating, in the order given, a tuple of `x` with a tuple of `y`.
int | ppl_Polyhedron_remove_dimensions (ppl_Polyhedron_t ph, ppl_dimension_type ds[], size_t n)
| Removes from `ph` and its containing space the dimensions that are specified in first `n` positions of the array `ds`. The presence of duplicates in `ds` is a waste but an innocuous one.
int | ppl_Polyhedron_remove_higher_dimensions (ppl_Polyhedron_t ph, ppl_dimension_type d)
| Removes the higher dimensions from `ph` and its enclosing space so that, upon successful return, the new space dimension is `d`.
int | ppl_Polyhedron_map_dimensions (ppl_Polyhedron_t ph, ppl_dimension_type maps[], size_t n)
| Remaps the dimensions of the vector space according to a partial function. This function is specified by means of the `maps` array, which has `n` entries.
int | ppl_Polyhedron_expand_dimension (ppl_Polyhedron_t ph, ppl_dimension_type d, ppl_dimension_type m)
| Expands the -th dimension of `ph` to `m` new dimensions.
int | ppl_Polyhedron_fold_dimensions (ppl_Polyhedron_t ph, ppl_dimension_type ds[], size_t n, ppl_dimension_type d)
| Modifies `ph` by folding the dimensions contained in the first `n` positions of the array `ds` into dimension `d`. The presence of duplicates in `ds` is a waste but an innocuous one.

## Typedefs

typedef size_t | ppl_dimension_type
| An unsigned integral type for representing space dimensions.
typedef ppl_Coefficient_tag * | ppl_Coefficient_t
| Opaque pointer.
typedef ppl_Coefficient_tag const * | ppl_const_Coefficient_t
| Opaque pointer to const object.
typedef ppl_LinExpression_tag * | ppl_LinExpression_t
| Opaque pointer.
typedef ppl_LinExpression_tag const * | ppl_const_LinExpression_t
| Opaque pointer to const object.
typedef ppl_Constraint_tag * | ppl_Constraint_t
| Opaque pointer.
typedef ppl_Constraint_tag const * | ppl_const_Constraint_t
| Opaque pointer to const object.
typedef ppl_ConSys_tag * | ppl_ConSys_t
| Opaque pointer.
typedef ppl_ConSys_tag const * | ppl_const_ConSys_t
| Opaque pointer to const object.
typedef ppl_ConSys_const_iterator_tag * | ppl_ConSys_const_iterator_t
| Opaque pointer.
typedef ppl_ConSys_const_iterator_tag const * | ppl_const_ConSys_const_iterator_t
| Opaque pointer to const object.
typedef ppl_Generator_tag * | ppl_Generator_t
| Opaque pointer.
typedef ppl_Generator_tag const * | ppl_const_Generator_t
| Opaque pointer to const object.
typedef ppl_GenSys_tag * | ppl_GenSys_t
| Opaque pointer.
typedef ppl_GenSys_tag const * | ppl_const_GenSys_t
| Opaque pointer to const object.
typedef ppl_GenSys_const_iterator_tag * | ppl_GenSys_const_iterator_t
| Opaque pointer.
typedef ppl_GenSys_const_iterator_tag const * | ppl_const_GenSys_const_iterator_t
| Opaque pointer to const object.
typedef ppl_Polyhedron_tag * | ppl_Polyhedron_t
| Opaque pointer.
typedef ppl_Polyhedron_tag const * | ppl_const_Polyhedron_t
| Opaque pointer to const object.

## Enumerations

enum | ppl_enum_error_code { PPL_ERROR_OUT_OF_MEMORY, PPL_ERROR_INVALID_ARGUMENT, PPL_ERROR_LENGTH_ERROR, PPL_ARITHMETIC_OVERFLOW, PPL_STDIO_ERROR, PPL_ERROR_INTERNAL_ERROR, PPL_ERROR_UNKNOWN_STANDARD_EXCEPTION, PPL_ERROR_UNEXPECTED_ERROR }
| Defines the error codes that any function may return. More...
enum | ppl_enum_Constraint_Type { PPL_CONSTRAINT_TYPE_LESS_THAN, PPL_CONSTRAINT_TYPE_LESS_THAN_OR_EQUAL, PPL_CONSTRAINT_TYPE_EQUAL, PPL_CONSTRAINT_TYPE_GREATER_THAN_OR_EQUAL, PPL_CONSTRAINT_TYPE_GREATER_THAN }
| Describes the relations represented by a constraint. More...
enum | ppl_enum_Generator_Type { PPL_GENERATOR_TYPE_LINE, PPL_GENERATOR_TYPE_RAY, PPL_GENERATOR_TYPE_POINT, PPL_GENERATOR_TYPE_CLOSURE_POINT }
| Describes the different kinds of generators. More...

## Variables

unsigned int | PPL_COMPLEXITY_CLASS_POLYNOMIAL
| Code of the worst-case polynomial complexity class.
unsigned int | PPL_COMPLEXITY_CLASS_SIMPLEX
| Code of the worst-case exponential but typically polynomial complexity class.
unsigned int | PPL_COMPLEXITY_CLASS_ANY
| Code of the universal complexity class.
unsigned int | PPL_POLY_CON_RELATION_IS_DISJOINT
| Individual bit saying that the polyhedron and the set of points satisfying the constraint are disjoint.
unsigned int | PPL_POLY_CON_RELATION_STRICTLY_INTERSECTS
| Individual bit saying that the polyhedron intersects the set of points satisfying the constraint, but it is not included in it.
unsigned int | PPL_POLY_CON_RELATION_IS_INCLUDED
| Individual bit saying that the polyhedron is included in the set of points satisfying the constraint.
unsigned int | PPL_POLY_CON_RELATION_SATURATES
| Individual bit saying that the polyhedron is included in the set of points saturating the constraint.
unsigned int | PPL_POLY_GEN_RELATION_SUBSUMES
| Individual bit saying that adding the generator would not change the polyhedron.

## Detailed Description

Some details about the C Interface.

All the declarations needed for using the PPL's C interface (preprocessor symbols, data types, variables and functions) are collected in the header file `ppl_c.h`. This file, which is designed to work with pre-ANSI and ANSI C compilers as well as C99 and C++ compilers, should be included, either directly or via some other header file, with the directive

    #include <ppl_c.h>

If this directive does not work, then your compiler is unable to find the file `ppl_c.h`. So check that the library is installed (if it is not installed, you may want to `make install`, perhaps with root privileges); that it is installed in the right place (if not you may want to reconfigure the library using the appropriate pathname for the `--prefix` option); and that your compiler knows where it is installed (if not you should add the path to the directory where `ppl_c.h` is located to the compiler's include file search path; this is usually done with the `-I` option).

The name space of the PPL's C interface is `PPL_*` for preprocessor symbols, enumeration values and variables; and `ppl_*` for data types and function names. The interface systematically uses opaque data types (generic pointers that completely hide the internal representations from the client code) and provides all required access functions. By using just the interface, the client code can exploit all the functionalities of the library yet avoid directly manipulating the library's data structures. The advantages are that (1) applications do not depend on the internals of the library (these may change from release to release), and (2) the interface invariants can be thoroughly checked (by the access functions).

The PPL's C interface is initialized by means of the `ppl_initialize` function. This function must be called before using any other interface of the library. The application can release the resources allocated by the library by calling the `ppl_finalize` function. After this function is called no other interface of the library may be used until the interface is re-initialized using `ppl_initialize`.

Any application using the PPL should make sure that only the intended version(s) of the library are ever used. The version used can be checked at compile-time thanks to the macros PPL_VERSION_MAJOR, PPL_VERSION_MINOR, PPL_VERSION_REVISION and PPL_VERSION_BETA, which give, respectively major, minor, revision and beta numbers of the PPL version. This is an example of their use:

    #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 6
    # error "PPL version 0.6 or following is required"
    #endif

Compile-time checking, however, is not normally enough, particularly in an environment where there is dynamic linking. Run-time checking can be performed by means of the functions `ppl_version_major`, `ppl_version_minor`, `ppl_version_revision`, and `ppl_version_beta`. The PPL's C interface also provides functions `ppl_version`, returning character string containing the full version number, and `ppl_banner`, returning a string that, in addition, provides (pointers to) other useful information for the library user.

All programs using the PPL's C interface must link with the following libraries: `libppl_c` (PPL's C interface), `libppl` (PPL's core), `libgmpxx` (GMP's C++ interface), and `libgmp` (GMP's library core). On most Unix-like systems, this is done by adding `-lppl_c`, `-lppl`, `-lgmpxx`, and `-lgmp` to the compiler's or linker's command line. For example:

    gcc myprogram.o -lppl_c -lppl -lgmpxx -lgmp

If this does not work, it means that your compiler/linker is not finding the libraries where it expects. Again, this could be because you forgot to install the library or you installed it in a non-standard location. In the latter case you will need to use the appropriate options (usually `-L`) and, if you use shared libraries, some sort of run-time path selection mechanisms. Consult your compiler's documentation for details. Notice that the PPL is built using Libtool and an application can exploit this fact to significantly simplify the linking phase. See Libtool's documentation for details. Those working under Linux can find a lot of useful information on how to use program libraries (including static, shared, and dynamically loaded libraries) in the Program Library HOWTO.

For examples on how to use the functions provided by the C interface, you are referred to the `interfaces/C/lpenum/` directory in the source distribution. It contains a toy Linear Programming solver written in C. In order to use this solver you will need to install GLPK (the GNU Linear Programming Kit): this is used to read linear programs in MPS format.

## Define Documentation

#define PPL_VERSION "0.6.1"

A string containing the PPL version.

Let `M` and `m` denote the numbers associated to PPL_VERSION_MAJOR and PPL_VERSION_MINOR, respectively. The format of PPL_VERSION is `M "." m` if both PPL_VERSION_REVISION (`r`) and PPL_VERSION_BETA (`b`)are zero, `M "." m "pre" b` if PPL_VERSION_REVISION is zero and PPL_VERSION_BETA is not zero, `M "." m "." r` if PPL_VERSION_REVISION is not zero and PPL_VERSION_BETA is zero, `M "." m "." r "pre" b` if neither PPL_VERSION_REVISION nor PPL_VERSION_BETA are zero.

## Typedef Documentation

typedef const char* ppl_io_variable_output_function_type(ppl_dimension_type var)

The type of output functions used for printing variables.

An output function for variables must write a textual representation for `var` to a character buffer, null-terminate it, and return a pointer to the beginning of the buffer. In case the operation fails, 0 should be returned and perhaps `errno` should be set in a meaningful way. The library does nothing with the buffer, besides printing its contents.

## Enumeration Type Documentation

enum ppl_enum_error_code

Defines the error codes that any function may return.

Enumeration values:

  PPL_ERROR_OUT_OF_MEMORY | The virtual memory available to the process has been exhausted.
  PPL_ERROR_INVALID_ARGUMENT | A function has been invoked with an invalid argument.
  PPL_ERROR_LENGTH_ERROR | The construction of an object that would exceed its maximum permitted size was attempted.
  PPL_ARITHMETIC_OVERFLOW | An arithmetic overflow occurred and the computation was consequently interrupted. This can only happen in library's incarnations using bounded integers as coefficients.
  PPL_STDIO_ERROR | An error occurred during a C input/output operation. A more precise indication of what went wrong is availble via `errno`.
  PPL_ERROR_INTERNAL_ERROR | An internal error that was diagnosed by the PPL itself. This indicates a bug in the PPL.
  PPL_ERROR_UNKNOWN_STANDARD_EXCEPTION | A standard exception has been raised by the C++ run-time environment. This indicates a bug in the PPL.
  PPL_ERROR_UNEXPECTED_ERROR | A totally unknown, totally unexpected error happened. This indicates a bug in the PPL.

enum ppl_enum_Constraint_Type

Describes the relations represented by a constraint.

Enumeration values:

  PPL_CONSTRAINT_TYPE_LESS_THAN | The constraint is of the form .
  PPL_CONSTRAINT_TYPE_LESS_THAN_OR_EQUAL | The constraint is of the form .
  PPL_CONSTRAINT_TYPE_EQUAL | The constraint is of the form .
  PPL_CONSTRAINT_TYPE_GREATER_THAN_OR_EQUAL | The constraint is of the form .
  PPL_CONSTRAINT_TYPE_GREATER_THAN | The constraint is of the form .

enum ppl_enum_Generator_Type

Describes the different kinds of generators.

Enumeration values:

  PPL_GENERATOR_TYPE_LINE | The generator is a line.
  PPL_GENERATOR_TYPE_RAY | The generator is a ray.
  PPL_GENERATOR_TYPE_POINT | The generator is a point.
  PPL_GENERATOR_TYPE_CLOSURE_POINT | The generator is a closure point.

## Function Documentation

int ppl_banner | ( | const char ** | p | ) |

| Writes to `m` a pointer to a character string containing the PPL banner. The banner provides information about the PPL version, the licensing, the lack of any warranty whatsoever, the C++ compiler used to build the library, where to report bugs and where to look for further information.

int ppl_initialize | ( | void |  | ) |

Initializes the Parma Polyhedra Library. This function must be called before any other function.

Returns:
  `PPL_ERROR_INVALID_ARGUMENT` if the library was already initialized.

int ppl_finalize | ( | void |  | ) |

Finalizes the Parma Polyhedra Library. This function must be called after any other function.

Returns:
  `PPL_ERROR_INVALID_ARGUMENT` if the library was already finalized.

int ppl_set_error_handler | ( | void(* | h)(enum ppl_enum_error_code code, const char *description) | ) |

| Installs the user-defined error handler pointed by `h`. The error handler takes an error code and a textual description that gives further information about the actual error. The C string containing the textual description is read-only and its existence it not guaranteed after the handler has returned.

int ppl_new_C_Polyhedron_from_ConSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_const_ConSys_t | cs
| ) |

| Builds a new closed polyhedron from the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`. The new polyhedron will inherit the space dimension of `cs`.

int ppl_new_C_Polyhedron_recycle_ConSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_ConSys_t | cs
| ) |

Builds a new closed polyhedron recycling the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`.

Since `cs` will be the system of constraints of the new polyhedron, the space dimension is also inherited.

Warning:
  This function modifies the constraint system referenced by `cs:` upon return, no assumption can be made on its value.

int ppl_new_NNC_Polyhedron_from_ConSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_const_ConSys_t | cs
| ) |

| Builds a new NNC polyhedron from the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`. The new polyhedron will inherit the space dimension of `cs`.

int ppl_new_NNC_Polyhedron_recycle_ConSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_ConSys_t | cs
| ) |

Builds a new NNC polyhedron recycling the system of constraints `cs` and writes an handle for the newly created polyhedron at address `pph`.

Since `cs` will be the system of constraints of the new polyhedron, the space dimension is also inherited.

Warning:
  This function modifies the constraint system referenced by `cs:` upon return, no assumption can be made on its value.

int ppl_new_C_Polyhedron_from_GenSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_const_GenSys_t | gs
| ) |

| Builds a new closed polyhedron from the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`. The new polyhedron will inherit the space dimension of `gs`.

int ppl_new_C_Polyhedron_recycle_GenSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_GenSys_t | gs
| ) |

Builds a new closed polyhedron recycling the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`.

Since `gs` will be the system of generators of the new polyhedron, the space dimension is also inherited.

Warning:
  This function modifies the generator system referenced by `gs:` upon return, no assumption can be made on its value.

int ppl_new_NNC_Polyhedron_from_GenSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_const_GenSys_t | gs
| ) |

| Builds a new NNC polyhedron from the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`. The new polyhedron will inherit the space dimension of `gs`.

int ppl_new_NNC_Polyhedron_recycle_GenSys | ( | ppl_Polyhedron_t * | pph,
|  | ppl_GenSys_t | gs
| ) |

Builds a new NNC polyhedron recycling the system of generators `gs` and writes an handle for the newly created polyhedron at address `pph`.

Since `gs` will be the system of generators of the new polyhedron, the space dimension is also inherited.

Warning:
  This function modifies the generator system referenced by `gs:` upon return, no assumption can be made on its value.

int ppl_new_C_Polyhedron_from_bounding_box | ( | ppl_Polyhedron_t * | pph,
|  | ppl_dimension_type(* | space_dimension)(void),
|  | int(* | is_empty)(void),
|  | int(* | get_lower_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d),
|  | int(* | get_upper_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d)
| ) |

Builds a new C polyhedron corresponding to an interval-based bounding box, writing a handle for the newly created polyhedron at address `pph`.

If an interval of the bounding box is provided with any finite but open bound, then the polyhedron is not built and the value `PPL_ERROR_INVALID_ARGUMENT` is returned. The bounding box is accessed by using the following functions, passed as arguments:

          ppl_dimension_type space_dimension()

returns the dimension of the vector space enclosing the polyhedron represented by the bounding box.

          int is_empty()

returns 0 if and only if the bounding box describes a non-empty set. The function `is_empty()` will always be called before the other functions. However, if `is_empty()` does not return 0, none of the functions below will be called.

          int get_lower_bound(ppl_dimension_type k, int closed,
                              ppl_Coefficient_t n, ppl_Coefficient_t d)

Let the interval corresponding to the `k`-th dimension. If is not bounded from below, simply return 0. Otherwise, set `closed`, `n` and `d` as follows: `closed` is set to 0 if the lower boundary of is open and is set to a value different from zero otherwise; `n` and `d` are assigned the integers and such that the canonical fraction corresponds to the greatest lower bound of . The fraction is in canonical form if and only if and have no common factors and is positive, being the unique representation for zero.

          int get_upper_bound(ppl_dimension_type k, int closed,
                              ppl_Coefficient_t n, ppl_Coefficient_t d)

Let the interval corresponding to the `k`-th dimension. If is not bounded from above, simply return 0. Otherwise, set `closed`, `n` and `d` as follows: `closed` is set to 0 if the upper boundary of is open and is set to a value different from 0 otherwise; `n` and `d` are assigned the integers and such that the canonical fraction corresponds to the least upper bound of .

int ppl_new_NNC_Polyhedron_from_bounding_box | ( | ppl_Polyhedron_t * | pph,
|  | ppl_dimension_type(* | space_dimension)(void),
|  | int(* | is_empty)(void),
|  | int(* | get_lower_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d),
|  | int(* | get_upper_bound)(ppl_dimension_type k, int closed, ppl_Coefficient_t n, ppl_Coefficient_t d)
| ) |

Builds a new C polyhedron corresponding to an interval-based bounding box, writing a handle for the newly created polyhedron at address `pph`.

The bounding box is accessed by using the following functions, passed as arguments:

          ppl_dimension_type space_dimension()

returns the dimension of the vector space enclosing the polyhedron represented by the bounding box.

          int is_empty()

returns 0 if and only if the bounding box describes a non-empty set. The function `is_empty()` will always be called before the other functions. However, if `is_empty()` does not return 0, none of the functions below will be called.

          int get_lower_bound(ppl_dimension_type k, int closed,
                              ppl_Coefficient_t n, ppl_Coefficient_t d)

Let the interval corresponding to the `k`-th dimension. If is not bounded from below, simply return 0. Otherwise, set `closed`, `n` and `d` as follows: `closed` is set to 0 if the lower boundary of is open and is set to a value different from zero otherwise; `n` and `d` are assigned the integers and such that the canonical fraction corresponds to the greatest lower bound of . The fraction is in canonical form if and only if and have no common factors and is positive, being the unique representation for zero.

          int get_upper_bound(ppl_dimension_type k, int closed,
                              ppl_Coefficient_t n, ppl_Coefficient_t d)

Let the interval corresponding to the `k`-th dimension. If is not bounded from above, simply return 0. Otherwise, set `closed`, `n` and `d` as follows: `closed` is set to 0 if the upper boundary of is open and is set to a value different from 0 otherwise; `n` and `d` are assigned the integers and such that the canonical fraction corresponds to the least upper bound of .

int ppl_Polyhedron_relation_with_Constraint | ( | ppl_const_Polyhedron_t | ph,
|  | ppl_const_Constraint_t | c
| ) |

| Checks the relation between the polyhedron `ph` with the constraint `c`. If successful, returns a non-negative integer that is obtained as the bitwise or of the bits (chosen among PPL_POLY_CON_RELATION_IS_DISJOINT PPL_POLY_CON_RELATION_STRICTLY_INTERSECTS, PPL_POLY_CON_RELATION_IS_INCLUDED, and PPL_POLY_CON_RELATION_SATURATES) that describe the relation between `ph` and `c`.

int ppl_Polyhedron_relation_with_Generator | ( | ppl_const_Polyhedron_t | ph,
|  | ppl_const_Generator_t | g
| ) |

| Checks the relation between the polyhedron `ph` with the generator `g`. If successful, returns a non-negative integer that is obtained as the bitwise or of the bits (only PPL_POLY_GEN_RELATION_SUBSUMES, at present) that describe the relation between `ph` and `g`.

int ppl_Polyhedron_shrink_bounding_box | ( | ppl_const_Polyhedron_t | ph,
|  | unsigned int | complexity,
|  | void(* | set_empty)(void),
|  | void(* | raise_lower_bound)(ppl_dimension_type k, int closed, ppl_const_Coefficient_t n, ppl_const_Coefficient_t d),
|  | void(* | lower_upper_bound)(ppl_dimension_type k, int closed, ppl_const_Coefficient_t n, ppl_const_Coefficient_t d)
| ) |

Use `ph` to shrink a generic, interval-based bounding box. The bounding box is abstractly provided by means of the parameters.

Parameters:

  | ph | The polyhedron that is used to shrink the bounding box;
  | complexity | The code of the complexity class of the algorithm to be used. Must be one of PPL_COMPLEXITY_CLASS_POLYNOMIAL, PPL_COMPLEXITY_CLASS_SIMPLEX, or PPL_COMPLEXITY_CLASS_ANY;
  | set_empty | A pointer to a void function with no arguments that causes the bounding box to become empty, i.e., to represent the empty set;

  raise_lower_bound

  A pointer to a void function with arguments `(ppl_dimension_type k, int closed, ppl_const_Coefficient_t n, ppl_const_Coefficient_t d)` that intersects the interval corresponding to the `k`-th dimension with if `closed` is non-zero, with if `closed` is zero. The fraction is in canonical form, that is, and have no common factors and is positive, being the unique representation for zero;

  | lower_upper_bound | a pointer to a void function with argument `(ppl_dimension_type k, int closed, ppl_const_Coefficient_t n, ppl_const_Coefficient_t d)` that intersects the interval corresponding to the `k`-th dimension with if `closed` is non-zero, with if `closed` is zero. The fraction is in canonical form.

int ppl_Polyhedron_maximize | ( | ppl_const_Polyhedron_t | ph,
|  | ppl_const_LinExpression_t | le,
|  | ppl_Coefficient_t | sup_n,
|  | ppl_Coefficient_t | sup_d,
|  | int * | pmaximum,
|  | ppl_const_Generator_t * | ppoint
| ) |

Returns a positive integer if `ph` is not empty and `le` is bounded from above in `ph`, in which case the supremum value and a point where `le` reaches it are computed.

Parameters:

  | ph | The polyhedron constraining `le`;
  | le | The linear expression to be maximized subject to `ph`;
  | sup_n | Will be assigned the numerator of the supremum value;
  | sup_d | Will be assigned the denominator of the supremum value;
  | pmaximum | Will store 1 in this location if the supremum is also the maximum, will store 0 otherwise;
  | ppoint | When nonzero, a point or closure point where `le` reaches the extremum value will be stored here. If `ph` is empty or `le` is not bounded from above, 0 is returned and `sup_n`, `sup_d`, `*pmaximum` and `*ppoint` are left untouched.

int ppl_Polyhedron_minimize | ( | ppl_const_Polyhedron_t | ph,
|  | ppl_const_LinExpression_t | le,
|  | ppl_Coefficient_t | inf_n,
|  | ppl_Coefficient_t | inf_d,
|  | int * | pminimum,
|  | ppl_const_Generator_t * | ppoint
| ) |

Returns a positive integer if `ph` is not empty and `le` is bounded from above in `ph`, in which case the infimum value and a point where `le` reaches it are computed.

Parameters:

  | ph | The polyhedron constraining `le`;
  | le | The linear expression to be minimized subject to `ph`;
  | inf_n | Will be assigned the numerator of the infimum value;
  | inf_d | Will be assigned the denominator of the infimum value;
  | pminimum | Will store 1 in this location if the infimum is also the minimum, will store 0 otherwise;
  | ppoint | When nonzero, a point or closure point where `le` reaches the extremum value will be stored here. If `ph` is empty or `le` is not bounded from below, 0 is returned and `inf_n`, `inf_d`, `*pminimum` and `*ppoint` are left untouched.

int ppl_Polyhedron_equals_Polyhedron | ( | ppl_const_Polyhedron_t | x,
|  | ppl_const_Polyhedron_t | y
| ) |

| Returns a positive integer if `x` and `y` are the same polyhedron; return 0 if they are different. Note that `x` and `y` may be topology- and/or dimension-incompatible polyhedra: in those cases, the value 0 is returned.

int ppl_Polyhedron_add_recycled_constraints | ( | ppl_Polyhedron_t | ph,
|  | ppl_ConSys_t | cs
| ) |

Adds the system of constraints `cs` to the system of constraints of `ph`.

Warning:
  This function modifies the constraint system referenced by `cs:` upon return, no assumption can be made on its value.

int ppl_Polyhedron_add_recycled_constraints_and_minimize | ( | ppl_Polyhedron_t | ph,
|  | ppl_ConSys_t | cs
| ) |

Adds the system of constraints `cs` to the system of constraints of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.

Warning:
  This function modifies the constraint system referenced by `cs:` upon return, no assumption can be made on its value.

int ppl_Polyhedron_add_recycled_generators | ( | ppl_Polyhedron_t | ph,
|  | ppl_GenSys_t | gs
| ) |

Adds the system of generators `gs` to the system of generators of `ph`.

Warning:
  This function modifies the generator system referenced by `gs:` upon return, no assumption can be made on its value.

int ppl_Polyhedron_add_recycled_generators_and_minimize | ( | ppl_Polyhedron_t | ph,
|  | ppl_GenSys_t | gs
| ) |

Adds the system of generators `gs` to the system of generators of `ph`. Returns a positive integer if the resulting polyhedron is non-empty; returns 0 if it is empty. Upon successful return, `ph` is guaranteed to be minimized.

Warning:
  This function modifies the generator system referenced by `gs:` upon return, no assumption can be made on its value.

int ppl_Polyhedron_affine_image | ( | ppl_Polyhedron_t | ph,
|  | ppl_dimension_type | var,
|  | ppl_const_LinExpression_t | le,
|  | ppl_const_Coefficient_t | d
| ) |

Transforms the polyhedron `ph`, assigning an affine expression to the specified variable.

Parameters:

  | ph | The polyhedron that is transformed;
  | var | The variable to which the affine expression is assigned;
  | le | The numerator of the affine expression;
  | d | The denominator of the affine expression.

int ppl_Polyhedron_affine_preimage | ( | ppl_Polyhedron_t | ph,
|  | ppl_dimension_type | var,
|  | ppl_const_LinExpression_t | le,
|  | ppl_const_Coefficient_t | d
| ) |

Transforms the polyhedron `ph`, substituting an affine expression to the specified variable.

Parameters:

  | ph | The polyhedron that is transformed;
  | var | The variable to which the affine expression is substituted;
  | le | The numerator of the affine expression;
  | d | The denominator of the affine expression.

int ppl_Polyhedron_generalized_affine_image | ( | ppl_Polyhedron_t | ph,
|  | ppl_dimension_type | var,
|  | enum ppl_enum_Constraint_Type | relsym,
|  | ppl_const_LinExpression_t | le,
|  | ppl_const_Coefficient_t | d
| ) |

Assigns to `ph` the image of `ph` with respect to the generalized affine transfer function , where is the relation symbol encoded by `relsym`.

Parameters:

  | ph | The polyhedron that is transformed;
  | var | The left hand side variable of the generalized affine transfer function;
  | relsym | The relation symbol;
  | le | The numerator of the right hand side affine expression;
  | d | The denominator of the right hand side affine expression.

int ppl_Polyhedron_generalized_affine_image_lhs_rhs | ( | ppl_Polyhedron_t | ph,
|  | ppl_const_LinExpression_t | lhs,
|  | enum ppl_enum_Constraint_Type | relsym,
|  | ppl_const_LinExpression_t | rhs
| ) |

Assigns to `ph` the image of `ph` with respect to the generalized affine transfer function , where is the relation symbol encoded by `relsym`.

Parameters:

  | ph | The polyhedron that is transformed;
  | lhs | The left hand side affine expression;
  | relsym | The relation symbol;
  | rhs | The right hand side affine expression.

int ppl_Polyhedron_map_dimensions | ( | ppl_Polyhedron_t | ph,
|  | ppl_dimension_type | maps[],
|  | size_t | n
| ) |

Remaps the dimensions of the vector space according to a partial function. This function is specified by means of the `maps` array, which has `n` entries.

The partial function is defined on dimension `i` if `i < n` and `maps[i] != ppl_not_a_dimension`; otherwise it is undefined on dimension `i`. If the function is defined on dimension `i`, then dimension `i` is mapped onto dimension `maps[i]`.

The result is undefined if `maps` does not encode a partial function with the properties described in the specification of the mapping operator.