Prolog Language Interface

0.11

The Parma Polyhedra Library comes equipped with a Prolog interface. Despite the lack of standardization of Prolog's foreign language interfaces, the PPL Prolog interface supports several Prolog systems and, to the extent this is possible, provides a uniform view of the library from each such system.

The system-independent features of the library are described in Section System-Independent Features. Section Compilation and Installation explains how the Prolog interface is compiled and installed. Section System-Dependent Features illustrates the system-dependent features of the interface for all the supported systems.

The structure of this section is as follows:

In the sequel, prefix is the prefix under which you have installed the library (typically /usr or /usr/local).

System-Independent Features

The Prolog interface provides access to the numerical abstractions (convex polyhedra, BD shapes, octagonal shapes, etc.) implemented by the PPL library. A general introduction to the numerical abstractions, their representation in the PPL and the operations provided by the PPL is given in the main PPL user manual. Here we just describe those aspects that are specific to the Prolog interface.

Overview

First, here is a list of notes with general information and advice on the use of the interface.

Predicate Specifications

The PPL predicates provided by the Prolog interface are specified below. The specification uses the following grammar rules:

 Number      --> unsigned integer       ranging from 0 to an upper bound
                                        depending on the actual Prolog system.

 C_int       --> Number | - Number      C integer

 C_unsigned  --> Number                 C unsigned integer

 Coeff       --> Number                 used in linear expressions;
                                        the upper bound will depend on how
                                        the PPL has been configured

 Dimension_Type
             --> Number                 used for the number of affine and
                                        space dimensions and the names of
                                        the dimensions;
                                        the upper bound will depend on
                                        the maximum number of dimensions
                                        allowed by the PPL
                                        (see ppl_max_space_dimensions/1)

 Boolean     --> true | false

 Handle      --> Prolog term            used to identify a Polyhedron

 Topology    --> c | nnc                Polyhedral kind;
                                        c is closed and nnc is NNC

 VarId       --> Dimension_Type         variable identifier

 PPL_Var     --> '$VAR'(VarId)          PPL variable

 Lin_Expr    --> PPL_Var                PPL variable
            | Coeff
            | Lin_Expr                  unary plus
            | - Lin_Expr                unary minus
            | Lin_Expr + Lin_Expr       addition
            | Lin_Expr - Lin_Expr       subtraction
            | Coeff * Lin_Expr          multiplication
            | Lin_Expr * Coeff          multiplication

 Relation_Symbol --> =                  equals
            | =<                        less than or equal
            | >=                        greater than or equal
            | <                         strictly less than
            | >                         strictly greater than

 Constraint  --> Lin_Expr Relation_Symbol Lin_Expr
                                        constraint

 Constraint_System                      list of constraints
             --> []
            | [Constraint | Constraint_System]

 Modulus     --> Coeff | - Coeff

 Congruence  --> Lin_Expr =:= Lin_Expr  congruence with modulo 1
            | (Lin_Expr =:= Lin_Expr) / Modulus
                                        congruence with modulo Modulus

 Congruence_System                      list of congruences
             --> []
            | [Congruence | Congruence_System]

 Generator_Denominator --> Coeff        must be non-zero
            | - Coeff

 Generator   --> point(Lin_Expr)        point
            | point(Lin_Expr, Generator_Denominator)
                                        point
            | closure_point(Lin_Expr)   closure point
            | closure_point(Lin_Expr, Generator_Denominator)
                                        closure point
            | ray(Lin_Expr)             ray
            | line(Lin_Expr)            line

 Generator_System                       list of generators
             --> []
            | [Generator | Generator_System]

 Grid_Generator
             --> grid_point(Lin_Expr)   grid point
            | grid_point(Lin_Expr, Generator_Denominator)
                                        grid point
            | parameter(Lin_Expr)       parameter
            | parameter(Lin_Expr, Generator_Denominator)
                                        parameter
            | grid_line(Lin_Expr)       grid line

 Grid_Generator_System                  list of grid generators
             --> []
            | [Grid_Generator | Grid_Generator_System]

 Artificial_Parameter  --> Lin_Expr / Coeff

 Artificial_Parameter_List --> []
            | [Artificial_Parameter | Artificial_Parameter_List]

 Atom        --> Prolog atom

 Universe_or_Empty                      PPL object
             --> universe | empty

 Poly_Relation --> is_disjoint          with a constraint or congruence
            | strictly_intersects       with a constraint or congruence
            | is_included               with a constraint or congruence
            | saturates                 with a constraint or congruence
            | subsumes                  with a (grid) generator

 Relation_List --> []
            | [Poly_Relation | Relation_List]

 Complexity  --> polynomial | simplex | any

 Vars_Pair   --> PPLVar - PPLVar        map relation

 P_Func      --> []                     list of map relations
            | [Vars_Pair | P_Func].

 Width  --> bits_8 | bits_16 | bits_32 | bits_64 | bits_128

 Representation  --> unsigned | signed_2_complement

 Overflow  --> overflow_wraps | overflow_undefined | overflow_impossible

 Optimization_Mode --> max | min

 Problem_Status --> unfeasible
            | unbounded
            | optimized

 Control_Parameter_Name --> pricing            for MIP problems
                        | control_strategy     for PIP problems
                        | pivot_row_strategy   for PIP problems

 Control_Parameter_Value
             --> pricing_steepest_edge_float
            | pricing_steepest_edge_exact
            | pricing_textbook
            | control_strategy_first
            | control_strategy_deepest
            | control_strategy_all
            | pivot_row_strategy_first
            | pivot_row_strategy_max_column

 Vars_List   --> []                     list of PPL variables
            | [PPL_Var | Vars_List].

Predicate Descriptions

Below is a short description of many of the interface predicates. For full definitions of terminology used here, see the main PPL user manual.

Domain Independent Predicates

First we describe the domain independent predicates that are included with all instantiations of the Prolog interfaces.

ppl_version_major(?C_int)
Unifies C_int with the major number of the PPL version.

ppl_version_minor(?C_int)
Unifies C_int with the minor number of the PPL version.

ppl_version_revision(?C_int)
Unifies C_int with the revision number of the PPL version.

ppl_version_beta(?C_int)
Unifies C_int with the beta number of the PPL version.

ppl_version(?Atom)
Unifies Atom with the PPL version.

ppl_banner(?Atom)
Unifies Atom with 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.

ppl_Coefficient_bits(?Bits)

Unifies Bits with the number of bits used to encode a Coefficient in the C++ interface; 0 if unbounded.

ppl_Coefficient_is_bounded

Succeeds if and only if the Coefficients in the C++ interface are bounded.

ppl_Coefficient_max(Max)

If the Coefficients in the C++ interface are bounded, then the maximum coefficient the C++ interface can handle is unified with Max. If the Prolog system cannot handle this coefficient, then an exception is thrown. It fails if the Coefficients in the C++ interface are unbounded.

ppl_Coefficient_min(Min)

If the Coefficients in the C++ interface are bounded, then the minimum coefficient the C++ interface can handle is unified with Min. If the Prolog system cannot handle this coefficient, then an exception is thrown. It fails if the Coefficients in the C++ interface are unbounded.

ppl_max_space_dimension(?Dimension_Type)

Unifies Dimension_Type with the maximum space dimension this library can handle.

ppl_initialize

Initializes the PPL interface. Multiple calls to ppl_initialize does no harm.

ppl_finalize

Finalizes the PPL interface. Once this is executed, the next call to an interface predicate must either be to ppl_initialize or to ppl_finalize. Multiple calls to ppl_finalize does no harm.

ppl_set_timeout_exception_atom(+Atom)

Sets the atom to be thrown by timeout exceptions to Atom. The default value is time_out.

ppl_timeout_exception_atom(?Atom)

The atom to be thrown by timeout exceptions is unified with Atom.

ppl_set_timeout(+Hsecs)

Computations taking exponential time will be interrupted some time after Hsecs hundreths of seconds after that call. If the computation is interrupted that way, the current timeout exception atom will be thrown. Hsecs must be strictly greater than zero.

ppl_reset_timeout

Resets the timeout time so that the computation is not interrupted.

ppl_set_deterministic_timeout(+Weight)

Computations taking exponential time will be interrupted some time after reaching the Weight complexity threshold. If the computation is interrupted that way, the current timeout exception atom will be thrown. Weight must be strictly greater than zero.

NOTE: This "timeout" checking functionality is said to be deterministic because it is not based on actual elapsed time. Its behavior will only depend on (some of the) computations performed in the PPL library and it will be otherwise independent from the computation environment (CPU, operating system, compiler, etc.). The weight mechanism is under alpha testing: client applications should be ready to reconsider the tuning of these weight thresholds when upgrading to newer version of the PPL.

ppl_reset_deterministic_timeout

Resets the deterministic timeout so that the computation is not interrupted.

ppl_set_rounding_for_PPL

Sets the FPU rounding mode so that the PPL abstractions based on floating point numbers work correctly. This is performed automatically at initialization-time. Calling this function is needed only if restore_pre_PPL_rounding() has previously been called.

ppl_restore_pre_PPL_rounding

Sets the FPU rounding mode as it was before initialization of the PPL. After calling this function it is absolutely necessary to call set_rounding_for_PPL() before using any PPL abstractions based on floating point numbers. This is performed automatically at finalization-time.

ppl_irrational_precision(?Precision)

Unifies Precision with the precision parameter for irrational calculations.

ppl_set_irrational_precision(+Precision)

Sets the precision parameter for irrational calculations to Precision. In the following irrational calculations returning an unbounded rational (e.g., when computing a square root), the lesser between numerator and denominator will be limited to 2**Precision.

MIP Predicates

Here we describe the predicates available for PPL objects defining mixed integer (linear) programming problems.

ppl_new_MIP_Problem_from_space_dimension(+Dimension_Type, -Handle)

Creates an MIP Problem $\mathrm{MIP}$ with the feasible region the vector space of dimension Dimension_Type, objective function $0$ and optimization mode max. Handle is unified with the handle for $\mathrm{MIP}$.

ppl_new_MIP_Problem(+Constraint_System, +Lin_Expr, +Optimization_Mode, -Handle)

Creates an MIP Problem $\mathrm{MIP}$ with the feasible region represented by Constraint_System, objective function Lin_Expr and optimization mode Optimization_Mode. Handle is unified with the handle for $\mathrm{MIP}$.

ppl_new_MIP_Problem_from_MIP_Problem(+Handle_1, -Handle_2)

Creates an MIP Problem $\mathrm{MIP}$ from the MIP Problem referenced by Handle_1. Handle_2 is unified with the handle for $\mathrm{MIP}$.

ppl_MIP_Problem_swap(+Handle_1, +Handle_2)

Swaps the MIP Problem referenced by Handle_1 with the one referenced by Handle_2.

ppl_delete_MIP_Problem(+Handle)

Deletes the MIP Problem referenced by Handle. After execution, Handle is no longer a valid handle for a PPL MIP Problem.

ppl_MIP_Problem_space_dimension(+Handle, ?Dimension_Type)

Unifies the dimension of the vector space in which the MIP Problem referenced by Handle is embedded with Dimension_Type.

ppl_MIP_Problem_integer_space_dimensions(+Handle, ?Vars_List)

Unifies Vars_List with a list of variables representing the integer space dimensions of the MIP Problem referenced by Handle.

ppl_MIP_Problem_constraints(+Handle, -Constraint_System)

Unifies Constraint_System with a list of the constraints in the constraints system representing the feasible region for the MIP Problem referenced by Handle.

ppl_MIP_Problem_objective_function(+Handle, ?Lin_Expr)

Unifies Lin_Expr with the objective function for the MIP Problem referenced by Handle.

ppl_MIP_Problem_optimization_mode(+Handle, ?Optimization_Mode)

Unifies Optimization_Mode with the optimization mode for the MIP Problem referenced by Handle.

ppl_MIP_Problem_clear(+Handle)

Resets the MIP problem referenced by Handle to be the trivial problem with the feasible region the $0$-dimensional universe, objective function $0$ and optimization mode max.

ppl_MIP_Problem_add_space_dimensions_and_embed( +Handle, +Dimension_Type)

Embeds the MIP problem referenced by Handle in a space that is enlarged by Dimension_Type dimensions.

ppl_MIP_Problem_add_to_integer_space_dimensions(+Handle, +Vars_List)

Updates the MIP Problem referenced by Handle so that the variables in Vars_List are added to the set of integer space dimensions.

ppl_MIP_Problem_add_constraint(+Handle, +Constraint)

Updates the MIP Problem referenced by Handle so that the feasible region is represented by the original constraint system together with the constraint Constraint.

ppl_MIP_Problem_add_constraints(+Handle, +Constraint_System)

Updates the MIP Problem referenced by Handle so that the feasible region is represented by the original constraint system together with all the constraints in Constraint_System.

ppl_MIP_Problem_set_objective_function(+Handle, +Lin_Expr)

Updates the MIP Problem referenced by Handle so that the objective function is changed to Lin_Expr.

ppl_MIP_Problem_set_control_parameter(+Handle, +Control_Parameter_Value)

Updates the MIP Problem referenced by Handle so that the value for the relevant control parameter name is changed to Control_Parameter_Value.

ppl_MIP_Problem_get_control_parameter(+Handle, +Control_Parameter_Name, ?Control_Parameter_Value)

Unifies Control_Parameter_Value with the value of the control parameter Control_Parameter_Name.

ppl_MIP_Problem_set_optimization_mode(+Handle, +Optimization_Mode)

Updates the MIP Problem referenced by Handle so that the optimization mode is changed to Optimization_Mode.

ppl_MIP_Problem_is_satisfiable(+Handle)

Succeeds if and only if the MIP Problem referenced by Handle is satisfiable.

ppl_MIP_Problem_solve(+Handle, ?MIP_Problem_Status)

Solves the MIP problem referenced by Handle and unifies MIP_Problem_Status with: unfeasible, if the MIP problem is not satisfiable; unbounded, if the MIP problem is satisfiable but there is no finite bound to the value of the objective function; optimized, if the MIP problem admits an optimal solution.

ppl_MIP_Problem_feasible_point(+Handle, ?Generator)

Unifies Generator with a feasible point for the MIP problem referenced by Handle.

ppl_MIP_Problem_optimizing_point(+Handle, ?Generator)

Unifies Generator with an optimizing point for the MIP problem referenced by Handle.

ppl_MIP_Problem_optimal_value(+Handle, ?Coeff_1, ?Coeff_2)

Unifies Coeff_1 and Coeff_2 with the numerator and denominator, respectively, for the optimal value for the MIP problem referenced by Handle.

ppl_MIP_Problem_evaluate_objective_function(+Handle, +Generator, ?Coeff_1, ?Coeff_2)
Evaluates the objective function of the MIP problem referenced by Handle at point Generator. Coefficient_1 is unified with the numerator and Coefficient_2 is unified with the denominator of the objective function value at Generator.

ppl_MIP_Problem_OK(+Handle)

Succeeds only if the MIP Problem referenced by Handle is well formed, i.e., if it satisfies all its implementation invariants. Useful for debugging purposes.


PIP Predicates

Here we describe some functions available for PPL objects defining parametric integer programming problems.

ppl_new_PIP_Problem_from_space_dimension(+Dimension_Type, -Handle)

Creates a PIP Problem $\mathrm{PIP}$ with the feasible region the vector space of dimension dimension, empty constraint_system and empty set of parametric variables. Handle is unified with the handle for $\mathrm{PIP}$.

ppl_new_PIP_Problem(+Constraint_System, +Lin_Expr, +Vars_List, -Handle)

Creates a PIP Problem $\mathrm{PIP}$ having space dimension dimension, a feasible region represented by constraint_system and parametric variables represented by Vars_List. Handle is unified with the handle for $\mathrm{PIP}$.

ppl_new_PIP_Problem_from_PIP_Problem(+Handle_1, -Handle_2)
Creates a PIP Problem $\mathrm{PIP}$ from the PIP Problem referenced by Handle_1. Handle_2 is unified with the handle for $\mathrm{PIP}$.

ppl_PIP_Problem_swap(+Handle_1, +Handle_2)
Swaps the PIP Problem referenced by Handle_1 with the one referenced by Handle_2.

ppl_delete_PIP_Problem(+Handle)
Deletes the PIP Problem referenced by Handle. After execution, Handle is no longer a valid handle for a PPL PIP Problem.

ppl_PIP_Problem_space_dimension(+Handle, ?Dimension_Type)
Unifies the dimension of the vector space in which the PIP Problem referenced by Handle is embedded with Dimension_Type.

ppl_PIP_Problem_parameter_space_dimensions(+Handle, ?Vars_List)
Unifies Vars_List with a list of variables representing the parameter space dimensions of the PIP Problem referenced by Handle.

ppl_PIP_Problem_constraints(+Handle, ?Constraint_System)
Unifies Constraint_System with a list of the constraints in the constraints system representing the feasible region for the PIP Problem referenced by Handle.

ppl_PIP_Problem_clear(+Handle)
Resets the PIP problem referenced by Handle to be the trivial problem with the feasible region the $0$-dimensional universe.

ppl_PIP_Problem_add_space_dimensions_and_embed( +Handle, +Dimension_Type1, +Dimension_Type2)
Embeds the PIP problem referenced by handle in a space that is enlarged by dimension1 non-parameter dimensions and dimension2 parameter dimensions.

ppl_PIP_Problem_add_to_parameter_space_dimensions(+Handle, +Vars_List)
Updates the PIP Problem referenced by Handle so that the variables in Vars_List are added to the set of parameter space dimensions.

ppl_PIP_Problem_add_constraint(+Handle, +Constraint)
Updates the PIP Problem referenced by Handle so that the feasible region is represented by the original constraint system together with the constraint Constraint.

ppl_PIP_Problem_add_constraints(+Handle, +Constraint_System)
Updates the PIP Problem referenced by Handle so that the feasible region is represented by the original constraint system together with all the constraints in Constraint_System.

ppl_PIP_Problem_set_big_parameter_dimension(+Handle, +Dimension_Type)

Updates the PIP Problem referenced by Handle so that the dimension for the big parameter is Dimension_Type.

ppl_PIP_Problem_has_big_parameter_dimension(+Handle, +Dimension_Type)
Succeeds if and only if the PIP Problem referenced by Handle has a dimension dim for the big parameter and Dimension_Type unifies with dim.

ppl_PIP_Problem_is_satisfiable(+Handle)
Succeeds if and only if the PIP Problem referenced by Handle is satisfiable.

ppl_PIP_Problem_solve(+Handle, ?PIP_Problem_Status)
Solves the PIP problem referenced by Handle and unifies PIP_Problem_Status with: unfeasible, if the PIP problem is not satisfiable; optimized, if the PIP problem admits an optimal solution.

ppl_PIP_Problem_solution(+Handle1, ?Handle2)
Solves the PIP problem referenced by Handle1 and creates a PIP tree node $\mathrm{Node}$ representing this a solution if it exists and bottom otherwise Handle_2 is unified with the handle for $\mathrm{Sol}$.

ppl_PIP_Problem_optimizing_solution(+Handle, ?PIP_Tree_Node)
Solves the PIP problem referenced by Handle1 and creates a PIP tree node $\mathrm{Node}$ representing this an optimizing solution if a solution exists and bottom otherwise Handle_2 is unified with the handle for $\mathrm{Sol}$.

ppl_PIP_Problem_ascii_dump(+Handle)
Dumps an ascii representation of the PPL internal state for the PIP problem referenced by Handle on the standard output.

ppl_PIP_Problem_OK(+Handle)
Succeeds only if the PIP Problem referenced by Handle is well formed, i.e., if it satisfies all its implementation invariants. Useful for debugging purposes.

ppl_PIP_Tree_Node_swap(+Handle_1, +Handle_2)
Swaps the PIP tree node referenced by Handle_1 with the one referenced by Handle_2.

ppl_PIP_Tree_Node_ascii_dump(+Handle)
Dumps an ascii representation of the PPL internal state for the PIP tree node referenced by Handle on the standard output.

ppl_PIP_Tree_Node_OK(+Handle)
Succeeds only if the PIP tree node referenced by Handle is well formed, i.e., if it satisfies all its implementation invariants. Useful for debugging purposes.

ppl_PIP_Tree_Node_constraints(+Handle, ?Constraint_System)
Unifies Constraint_System with a list of the parameter constraints in the PIP tree node referenced by Handle.

ppl_PIP_Tree_Node_artificials(+Handle, ?Artificial_Parameter_List)
Unifies Artificial_Parameter_List with a list of the artificial parameters in the PIP tree node referenced by Handle.

ppl_PIP_Tree_Node_is_bottom(+Handle)
Succeeds if and only if handle represents bottom.

ppl_PIP_Tree_Node_is_decision(+Handle)
Succeeds if and only if handle represents a decision node.

ppl_PIP_Tree_Node_is_solution(+Handle)
Succeeds if and only if handle represents a solution node.

ppl_PIP_Tree_Node_parametric_values(+Handle, +Var, ?Lin_Expr)
Unifies Lin_Expr with a linear expression representing the values of problem variable Var in the solution node represented by Handle. The linear expression may involve problem parameters as well as artificial parameters.

ppl_PIP_Tree_Node_true_child(+Handle1, ?Handle2)
If the PIP_Tree_Node represented by Handle1 is a decision node unifies the PIP tree node referenced by Handle2 with the child on the true branch of the PIP tree node represented by Handle1. An exception is thrown if this is not a decision node.

ppl_PIP_Tree_Node_false_child(+Handle1, ?Handle2)
If the PIP_Tree_Node represented by Handle1 is a decision node unifies the PIP tree node referenced by Handle2 with the child on the false branch of the PIP tree node represented by Handle1. An exception is thrown if this is not a decision node.


Predicates for the C Polyhedron Domain

Here we provide a short description for each of the predicates available for the domain of C polyhedra. Note that predicates for other domains will follow a similar pattern.

Constructor, copy, conversion and destructor predicates

Constructor predicates for C polyhedra

The constructor predicates build a C polyhedron from a specification and binds the given variable to a handle for future referencing. The specification can be:

ppl_new_C_Polyhedron_from_space_dimension(+Dimension_Type, +Universe_or_Empty, -Handle)
Builds a new C polyhedron $\cP$ with Dimension_Type dimensions; it is empty or the universe depending on whether Atom is empty or universe, respectively. Handle is unified with the handle for $\cP$. Thus the query

   ?- ppl_new_C_Polyhedron_from_space_dimension(3, universe, X).

creates the C polyhedron defining the 3-dimensional vector space $\Rset^3$ with X bound to a valid handle for accessing it.

ppl_new_C_Polyhedron_from_constraints(+Constraint_System, -Handle)
Builds a new C polyhedron P from Constraint_System. Handle is unified with the handle for P.

ppl_new_C_Polyhedron_from_congruences(+Congruence_System, -Handle)
Builds a new C polyhedron P from Congruence_System. Handle is unified with the handle for P.

ppl_new_C_Polyhedron_from_generators(+Generator_System, -Handle)
Builds a new C polyhedron P from Generator_System. Handle is unified with the handle for P.

Predicates that build new C polyhedra by copying or converting from other semantic geometric descriptions

Besides the constructors listed above, the library also provides:

The copy and conversion predicates have two versions, one with arity 2 for the source and target handles and one with an extra argument denoting the maximum complexity to be used in the conversion; this complexity argument is ignored when the the friend and the element being built are in the same class.

ppl_new_C_Polyhedron_from_C_Polyhedron(+Handle_1, -Handle_2)
Builds a new C polyhedron P_1 from the c polyhedron referenced by handle Handle_1. Handle_2 is unified with the handle for P_1.

ppl_new_C_Polyhedron_from_NNC_Polyhedron(+Handle_1, -Handle_2)
Builds a new C polyhedron P_1 from the nnc polyhedron referenced by handle Handle_1. Handle_2 is unified with the handle for P_1.

ppl_new_C_Polyhedron_from_C_Polyhedron_with_complexity(+Handle, +Complexity, -Handle)
Builds a new C polyhedron P_1 from the c polyhedron referenced by handle Handle_1 using an algorithm whose complexity does not exceed Complexity; Handle_2 is unified with the handle for P_1.

ppl_new_C_Polyhedron_from_NNC_Polyhedron_with_complexity(+Handle, +Complexity, -Handle)
Builds a new C polyhedron P_1 from the nnc polyhedron referenced by handle Handle_1 using an algorithm whose complexity does not exceed Complexity; Handle_2 is unified with the handle for P_1.

Destructor predicate

Below is the destructor predicate for the Polyhedron domain.

ppl_delete_Polyhedron(+Handle)
Invalidates the handle referenced by Handle: this makes sure the corresponding resources will eventually be released.

Predicates that do not change the polyhedron

Test Predicates

These predicates test the polyhedron for different properties and succeed or fail depending on the outcome.

ppl_Polyhedron_is_empty(+Handle)
Succeeds if and only if the polyhedron referenced by Handle is empty.

ppl_Polyhedron_is_universe(+Handle)
Succeeds if and only if the polyhedron referenced by Handle is the universe.

ppl_Polyhedron_is_bounded(+Handle)
Succeeds if and only if the polyhedron referenced by Handle is bounded.

ppl_Polyhedron_contains_integer_point(+Handle)
Succeeds if and only if the polyhedron referenced by Handle contains an integer point.

ppl_Polyhedron_is_topologically_closed(+Handle)
Succeeds if and only if the polyhedron referenced by Handle is topologically closed.

ppl_Polyhedron_is_discrete(+Handle)
Succeeds if and only if the polyhedron referenced by Handle is discrete.

ppl_Polyhedron_bounds_from_above(+Handle, +Lin_Expr)
Succeeds if and only if Lin_Expr is bounded from above in the polyhedron referenced by Handle.

ppl_Polyhedron_bounds_from_below(+Handle, +Lin_Expr)
Succeeds if and only if Lin_Expr is bounded from below in the polyhedron referenced by Handle.

ppl_Polyhedron_contains_Polyhedron(+Handle_1, +Handle_2)
Succeeds if and only if the polyhedron referenced by Handle_2 is included in or equal to the polyhedron referenced by Handle_1.

ppl_Polyhedron_strictly_contains_Polyhedron(+Handle_1, +Handle_2)
Succeeds if and only if the polyhedron referenced by Handle_2 is included in but not equal to the polyhedron referenced by Handle_1.

ppl_Polyhedron_is_disjoint_from_Polyhedron(+Handle_1, +Handle_2)
Succeeds if and only if the polyhedron referenced by Handle_2 is disjoint from the polyhedron referenced by Handle_1.

ppl_Polyhedron_equals_Polyhedron(+Handle_1, +Handle_2)
Succeeds if and only if the polyhedron referenced by Handle_1 is equal to the polyhedron referenced by Handle_2.

ppl_Polyhedron_OK(+Handle)
Succeeds only if the polyhedron referenced by Handle is well formed, i.e., if it satisfies all its implementation invariants. Useful for debugging purposes.

ppl_Polyhedron_constrains(+Handle, +PPL_Var)
Succeeds if and only if the polyhedron referenced by Handle constrains the dimension PPL_Var.

Predicates that return information about the polyhedron

These predicates will obtain more detailed information about the polyhedron unifying some of their arguments with the results.

ppl_Polyhedron_space_dimension(+Handle, ?Dimension_Type)
Unifies Dimension_Type with the dimension of the vector space enclosing the polyhedron referenced by Handle.

ppl_Polyhedron_affine_dimension(+Handle, ?Dimension_Type)
Unifies Dimension_Type with the affine dimension of the polyhedron referenced by Handle.

ppl_Polyhedron_relation_with_constraint(+Handle, +Constraint, ?Relation_List)
Unifies Relation_List with the list of relations the polyhedron referenced by Handle has with Constraint. The possible relations are listed in the grammar rules above.

ppl_Polyhedron_relation_with_generator(+Handle, +Generator, ?Relation_List)
Unifies Relation_List with the list of relations the polyhedron referenced by Handle has with Generator. The possible relations are listed in the grammar rules above.

ppl_Polyhedron_relation_with_congruence(+Handle, +Congruence, ?Relation_List)
Unifies Relation_List with the list of relations the polyhedron referenced by Handle has with Congruence. The possible relations are listed in the grammar rules above.

ppl_Polyhedron_get_constraints(+Handle, ?Constraint_System)
Unifies Constraint_System with the constraints (in the form of a list) in the constraint system satisfied by the polyhedron referenced by Handle.

ppl_Polyhedron_get_congruences(+Handle, ?Congruence_System)
Unifies Congruence_System with the congruences (in the form of a list) in the congruence system satisfied by the polyhedron referenced by Handle.

ppl_Polyhedron_get_generators(+Handle, ?Generator_System)
Unifies Generator_System with the generators (in the form of a list) in the generator system for the polyhedron referenced by Handle.

ppl_Polyhedron_get_minimized_constraints(+Handle, ?Constraint_System)
Unifies Constraint_System with the constraints (in the form of a list) in the minimized constraint system satisfied by the polyhedron referenced by Handle.

ppl_Polyhedron_get_minimized_congruences(+Handle, ?Congruence_System)
Unifies Congruence_System with the congruences (in the form of a list) in the minimized congruence system for the polyhedron referenced by Handle.

ppl_Polyhedron_get_minimized_generators(+Handle, ?Generator_System)
Unifies Generator_System with the generators (in the form of a list) in the minimized generator system satisfied by the polyhedron referenced by Handle.

ppl_Polyhedron_maximize(+Handle, +Lin_Expr, ?Coeff_1, ?Coeff_2, ?Boolean)
Succeeds if and only if polyhedron P referenced by Handle is not empty and Lin_Expr is bounded from above in P.

Coeff_1 is unified with the numerator of the supremum value and Coeff_2 with the denominator of the supremum value. If the supremum is also the maximum, Boolean is unified with the atom true and, otherwise, unified with the atom false.

ppl_Polyhedron_minimize(+Handle, +Lin_Expr, ?Coeff_1, ?Coeff_2, ?Boolean)
Succeeds if and only if polyhedron P referenced by Handle is not empty and Lin_Expr is bounded from below in P.

Coeff_1 is unified with the numerator of the infinum value and Coeff_2 with the denominator of the infinum value. If the infinum is also the minimum, Boolean is unified with the atom true and, otherwise, unified with the atom false.

ppl_Polyhedron_maximize_with_point(+Handle, +Lin_Expr, ?Coeff_1, ?Coeff_2, ?Boolean, ?Point)
Succeeds if and only if polyhedron P referenced by Handle is not empty and Lin_Expr is bounded from above in P.

Coeff_1 is unified with the numerator of the supremum value and Coeff_2 with the denominator of the supremum value and Point with a point or closure point where Lin_Expr reaches this value. If the supremum is also the maximum, Boolean is unified with the atom true and, otherwise, unified with the atom false.

ppl_Polyhedron_minimize_with_point(+Handle, +Lin_Expr, ?Coeff_1, ?Coeff_2, ?Boolean, ?Point)
Succeeds if and only if polyhedron P referenced by Handle is not empty and Lin_Expr is bounded from below in P.

Coeff_1 is unified with the numerator of the infinum value and Coeff_2 with the denominator of the infinum value and Point with a point or closure point where Lin_Expr reaches this value. If the infinum is also the minimum, Boolean is unified with the atom true and, otherwise, unified with the atom false.

ppl_Polyhedron_external_memory_in_bytes(+Handle, ?Number)
Unifies Number with the size of the total memory in bytes occupied by the polyhedron referenced by Handle.

ppl_Polyhedron_total_memory_in_bytes(+Handle, ?Number)
Unifies Number with the size of the external memory in bytes occupied by the polyhedron referenced by Handle.

Ascii dump predicate

This output predicate is useful for debugging.

ppl_Polyhedron_ascii_dump(+Handle)
Dumps an ascii representation of the PPL internal state for the polyhedron referenced by Handle on the standard output.

Space-dimension preserving predicates that may change the polyhedron

These predicates may modify the polyhedron referred to by the handle in first argument; the (dimension of the) vector space in which it is embedded is unchanged.

Predicates that may change the polyhedron by adding to its constraint or generator descriptions

Note that there are two forms of these predicates differentiated in the names by the words "add" or "refine with"; see Section Generic Operations on Semantic Geometric Descriptors in the main PPL User Manual for the differences in the semantics and therefore, the expected behavior, between these forms.

ppl_Polyhedron_add_constraint(+Handle, +Constraint)
Updates the polyhedron referenced by Handle to one obtained by adding Constraint to its constraint system. For a C polyhedron, Constraint must be an equality or a non-strict inequality.

ppl_Polyhedron_add_congruence(+Handle, +Congruence)
Updates the polyhedron referenced by Handle to one obtained by adding Congruence to its congruence system. For a C polyhedron, Congruence must be an equality.

ppl_Polyhedron_add_generator(+Handle, +Generator)
Updates the polyhedron referenced by Handle to one obtained by adding Generator to its generator system. For a C polyhedron, Generator must be a line, ray or point.

ppl_Polyhedron_add_constraints( +Handle, +Constraint_System)
Updates the polyhedron referenced by Handle to one obtained by adding to its constraint system the constraints in Constraint_System. For a C polyhedron, Constraints must be a list of equalities and non-strict inequalities.

ppl_Polyhedron_add_congruences( +Handle, +Congruence_System)
Updates the polyhedron referenced by Handle to one obtained by adding to its congruence system the congruences in Congruence_System. For a C polyhedron, Congruences must be a list of equalities.

ppl_Polyhedron_add_generators( +Handle, +Generator_System)
Updates the polyhedron referenced by Handle to one obtained by adding to its generator system the generators in Generator_System. For a C polyhedron, Generators must be a list of lines, rays and points.

ppl_Polyhedron_refine_with_constraint( +Handle, +Constraint)
Updates the polyhedron referenced by Handle to one obtained by refining its constraint system with Constraint.

ppl_Polyhedron_refine_with_congruence( +Handle, +Congruence)
Updates the polyhedron referenced by Handle to one obtained by refining its congruence system with Congruence.

ppl_Polyhedron_refine_with_constraints( +Handle, +Constraint_System)
Updates the polyhedron referenced by Handle to one obtained by refining its constraint system with the constraints in Constraint_System.

ppl_Polyhedron_refine_with_congruences( +Handle, +Congruence_System)
Updates the polyhedron referenced by Handle to one obtained by refining its congruence system with the congruences in Congruence_System.

Predicates that transform the polyhedron

These predicates enable transformations such as taking the topological closure (which for the domain of C polyhedron is the identity transformation), unconstraining a specified dimension as explained in the main PPL User Manual in Section Cylindrification Operator and several different image and preimage affine transfer relations; for details of the latter see Sections Images and Preimages of Affine Transfer Relations and Generalized Affine Relations

ppl_Polyhedron_topological_closure_assign(+Handle)
Assigns to the polyhedron referenced by Handle its topological closure.

ppl_Polyhedron_unconstrain_space_dimension(+Handle, +PPL_Var)
Modifies the polyhedron P referenced by Handle by unconstraining the space dimension PPL_Var.

ppl_Polyhedron_unconstrain_space_dimensions(+Handle, +List_of_PPL_Var)
Modifies the polyhedron P referenced by Handle by unconstraining the space dimensions that are specified in List_of_PPL_Var. The presence of duplicates in List_of_PPL_Var is a waste but an innocuous one.

ppl_Polyhedron_affine_image(+Handle, +PPL_Var, +Lin_Expr, +Coeff)
Transforms the polyhedron referenced by Handle assigning the affine expression for Lin_Expr/Coeff to PPL_Var.

ppl_Polyhedron_affine_preimage(+Handle, +PPL_Var, +Lin_Expr, +Coeff)
Transforms the polyhedron referenced by Handle substituting the affine expression for Lin_Expr/Coeff to PPL_Var.

ppl_Polyhedron_bounded_affine_image(+Handle, +PPL_Var, +Lin_Expr_1, +Lin_Expr_2, +Coeff)
Assigns to polyhedron P referenced by Handle the generalized image with respect to the generalized affine transfer relation Lin_Expr_1/Coeff $\leq$ PPL_Var $\leq$ Lin_Expr_2/Coeff.

ppl_Polyhedron_bounded_affine_preimage(+Handle, +PPL_Var, +Lin_Expr_1, +Lin_Expr_2, +Coeff)
Assigns to polyhedron P referenced by Handle the generalized preimage with respect to the generalized affine transfer relation Lin_Expr_1/Coeff $\leq$ PPL_Var $\leq$ Lin_Expr_2/Coeff.

ppl_Polyhedron_generalized_affine_image(+Handle, +PPL_Var, +Relation_Symbol, +Lin_Expr, +Coeff)
Assigns to polyhedron P referenced by Handle the generalized image with respect to the generalized affine transfer relation PPL_Var $\bowtie$ Lin_Expr/Coeff, where $\bowtie$ is the symbol represented by Relation_Symbol.

ppl_Polyhedron_generalized_affine_preimage(+Handle, +PPL_Var, +Relation_Symbol, +Lin_Expr, +Coeff)
Assigns to polyhedron P referenced by Handle the generalized preimage with respect to the generalized affine transfer relation PPL_Var $\bowtie$ Lin_Expr/Coeff, where $\bowtie$ is the symbol represented by Relation_Symbol.

ppl_Polyhedron_generalized_affine_image_lhs_rhs(+Handle, +Lin_Expr_1, +Relation_Symbol, +Lin_Expr_2)
Assigns to polyhedron P referenced by Handle the generalized image with respect to the generalized affine transfer relation Lin_Expr_1 $\bowtie$ Lin_Expr_2, where $\bowtie$ is the symbol represented by Relation_Symbol.

ppl_Polyhedron_generalized_affine_preimage_lhs_rhs(+Handle, +Lin_Expr_1, +Relation_Symbol, +Lin_Expr_2)
Assigns to polyhedron P referenced by Handle the generalized preimage with respect to the generalized affine transfer relation Lin_Expr_1 $\bowtie$ Lin_Expr_2, where $\bowtie$ is the symbol represented by Relation_Symbol.

Predicates whose results depend on more than one polyhedron

These predicates include the binary operators which will assign to the polyhedron referred to by the first argument its combination with the polyhedron referred to by the second argument as described in the main PPL User Manual in Sections Intersection and Convex Polyhedral Hull and Convex Polyhedral Difference; and a linear partitioning operator described below.

ppl_Polyhedron_intersection_assign(+Handle_1, +Handle_2)
Assigns to the polyhedron P referenced by Handle_1 the intersection of P and the polyhedron referenced by Handle_2.

ppl_Polyhedron_upper_bound_assign(+Handle_1, +Handle_2)
Assigns to the polyhedron P referenced by Handle_1 the upper bound of P and the polyhedron referenced by Handle_2.

ppl_Polyhedron_difference_assign(+Handle_1, +Handle_2)
Assigns to the polyhedron P referenced by Handle_1 the difference of P and the polyhedron referenced by Handle_2.

ppl_Polyhedron_time_elapse_assign(+Handle_1, +Handle_2)
Assigns to the polyhedron P referenced by Handle_1 the time elapse of P and the polyhedron referenced by Handle_2.

ppl_Polyhedron_poly_hull(+Handle_1, +Handle_2)
Assigns to the polyhedron P referenced by Handle_1 the poly-hull of P and the polyhedron referenced by Handle_2.

ppl_Polyhedron_poly_difference(+Handle_1, +Handle_2)
Assigns to the polyhedron P referenced by Handle_1 the poly-difference of P and the polyhedron referenced by Handle_2.

ppl_Polyhedron_upper_bound_assign_if_exact(+Handle_1, +Handle_2)
Succeeds if the least upper bound of the polyhedron P_1 referenced by Handle_1 with the polyhedron referenced by Handle_2 is exact; in which case the least upper bound is assigned to P_1; fails otherwise.

ppl_Polyhedron_poly_hull_assign_if_exact(+Handle_1, +Handle_2)
Succeeds if the least upper bound of the polyhedron P_1 referenced by Handle_1 with the polyhedron referenced by Handle_2 is exact; in which case the least upper bound is assigned to P_1; fails otherwise.

ppl_Polyhedron_simplify_using_context_assign(+Handle_1, +Handle_2, ?Boolean)
Succeeds if and only if the intersection of polyhedron P_1 referenced by Handle_1 and the polyhedron P_2 referenced by Handle_2 is non-empty. Assigns to P_1 its meet-preserving simplification with respect to P_2.

ppl_Polyhedron_linear_partition(+Handle_1, +Handle_2, -Handle_3, -Handle_4)
Handle_1 and Handle_2 are handles for elements P_1 and P_2 in the Polyhedron domain. The predicate unifies handle Handle_3 to a reference to the intersection of P_1 and P_2 and Handle_4 to a reference to a pointset powerset of nnc polyhedra P_4; where P_4 is the linear partition of P_1 with respect to P_2. This predicate is only provided if the class Pointset_Powerset_NNC_Polyhedron has been enabled when configuring the library.

Predicates for widening and extrapolation

In addition to the above binary operators, there are also a number of widening, extrapolation and narrowing operators as described in the main PPL User Manual in Sections Widening Operators, Widening with Tokens and Extrapolation Operators. Note that for all these widening and extrapolation predicates to behave as specified the polyhedron referred to by the second argument has to be contained in (or equal to) the polyhedron referred to by the first argument.

ppl_Polyhedron_BHRZ03_widening_assign_with_tokens(+Handle_1, +Handle_2, +C_unsigned_1, ?C_unsigned_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the BHRZ03-widening of P_1 with the polyhedron referenced by Handle_2. The widening with tokens delay technique is applied with C_unsigned_1 tokens; C_unsigned_2 is unified with the number of tokens remaining at the end of the operation.

ppl_Polyhedron_H79_widening_assign_with_tokens(+Handle_1, +Handle_2, +C_unsigned_1, ?C_unsigned_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the H79-widening of P_1 with the polyhedron referenced by Handle_2. The widening with tokens delay technique is applied with C_unsigned_1 tokens; C_unsigned_2 is unified with the number of tokens remaining at the end of the operation.

ppl_Polyhedron_BHRZ03_widening_assign(+Handle_1, +Handle_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the BHRZ03-widening of P_1 with the polyhedron referenced by Handle_2.

ppl_Polyhedron_H79_widening_assign(+Handle_1, +Handle_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the H79-widening of P_1 with the polyhedron referenced by Handle_2.

ppl_Polyhedron_widening_assign_with_tokens(+Handle_1, +Handle_2, +C_unsigned_1, ?C_unsigned_2)
Same as predicate ppl_Polyhedron_H79_widening_assign_with_tokens/4

ppl_Polyhedron_widening_assign(+Handle_1, +Handle_2)
Same as predicate ppl_Polyhedron_H79_widening_assign/2

ppl_Polyhedron_limited_BHRZ03_extrapolation_assign_with_tokens(+Handle_1, +Handle_2, +Constraint_System, +C_unsigned_1, ?C_unsigned_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the BHRZ03-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1. The widening with tokens delay technique is applied with C_unsigned_1 tokens; C_unsigned_2 is unified with the number of tokens remaining at the end of the operation.

ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign_with_tokens(+Handle_1, +Handle_2, +Constraint_System, +C_unsigned_1, ?C_unsigned_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the BHRZ03-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1, further intersected with the smallest box containing P_1. The widening with tokens delay technique is applied with C_unsigned_1 tokens; C_unsigned_2 is unified with the number of tokens remaining at the end of the operation.

ppl_Polyhedron_limited_H79_extrapolation_assign_with_tokens(+Handle_1, +Handle_2, +Constraint_System, +C_unsigned_1, ?C_unsigned_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the H79-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1. The widening with tokens delay technique is applied with C_unsigned_1 tokens; C_unsigned_2 is unified with the number of tokens remaining at the end of the operation.

ppl_Polyhedron_bounded_H79_extrapolation_assign_with_tokens(+Handle_1, +Handle_2, +Constraint_System, +C_unsigned_1, ?C_unsigned_2)
Assigns to the polyhedron P_1 referenced by Handle_1 the H79-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1, further intersected with the smallest box containing P_1. The widening with tokens delay technique is applied with C_unsigned_1 tokens; C_unsigned_2 is unified with the number of tokens remaining at the end of the operation.

ppl_Polyhedron_limited_BHRZ03_extrapolation_assign(+Handle_1, +Handle_2, +Constraint_System)
Assigns to the polyhedron P_1 referenced by Handle_1 the BHRZ03-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1.

ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign(+Handle_1, +Handle_2, +Constraint_System)
Assigns to the polyhedron P_1 referenced by Handle_1 the BHRZ03-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1, further intersected with the smallest box containing P_1.

ppl_Polyhedron_limited_H79_extrapolation_assign(+Handle_1, +Handle_2, +Constraint_System)
Assigns to the polyhedron P_1 referenced by Handle_1 the H79-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1.

ppl_Polyhedron_bounded_H79_extrapolation_assign(+Handle_1, +Handle_2, +Constraint_System)
Assigns to the polyhedron P_1 referenced by Handle_1 the H79-widening of P_1 with the polyhedron referenced by Handle_2 intersected with the constraints in Constraint_System that are satisfied by all the points of P_1, further intersected with the smallest box containing P_1.

Predicates that may modify the vector space

These predicates enable the modification of the vector space of the polyhedron referred to in the first argument.

Predicate for concatenation

For more information on this operation, see Section Concatenating Polyhedra, of the main PPL User Manual.

ppl_Polyhedron_concatenate_assign(+Handle_1, +Handle_2)
Assigns to the polyhedron P referenced by Handle_1 the concatenation of P and the polyhedron referenced by Handle_2.

Predicates for mapping dimensions or changing the vector space

These predicates enable the modification of the vector space of the polyhedron referred to in the first argument. These predicates enable the modification of the vector space of the polyhedron referred to in the first argument. Detailed descriptions of these can be found in the main PPL User Manual in Sections Adding New Dimensions to the Vector Space, Removing Dimensions from the Vector Space, Mapping the Dimensions of the Vector Space, Expanding One Dimension of the Vector Space to Multiple Dimensions and Folding Multiple Dimensions of the Vector Space into One Dimension.

ppl_Polyhedron_add_space_dimensions_and_embed(+Handle, +Dimension_Type)
Adds Dimension_Type new dimensions to the space enclosing the polyhedron P referenced by Handle and and_embeds P in this space.

ppl_Polyhedron_add_space_dimensions_and_project(+Handle, +Dimension_Type)
Adds Dimension_Type new dimensions to the space enclosing the polyhedron P referenced by Handle and and_projects P in this space.

ppl_Polyhedron_remove_space_dimensions(+Handle, +List_of_PPL_Vars)
Removes from the vector space enclosing the polyhedron P referenced by Handle the space dimensions that are specified in List_of_PPL_Var. The presence of duplicates in List_of_PPL_Var is a waste but an innocuous one.

ppl_Polyhedron_remove_higher_space_dimensions(+Handle, +Dimension_Type)
Removes the higher dimensions from the vector space enclosing the polyhedron P referenced by Handle so that, upon successful return, the new space dimension is Dimension_Type.

ppl_Polyhedron_expand_space_dimension(+Handle, +PPL_Var, +Dimension_Type)
Expands the PPL_Var-th dimension of the vector space enclosing the polyhedron referenced by Handle to Dimension_Type new space dimensions.

ppl_Polyhedron_fold_space_dimensions(+Handle, +List_of_PPL_Vars, +PPL_Var)
Modifies the polyhedron referenced by Handle by folding the space dimensions contained in List_of_PPL_Vars into dimension PPL_Var. The presence of duplicates in List_of_PPL_Vars is a waste but an innocuous one.

ppl_Polyhedron_map_space_dimensions(+Handle, +P_Func)
Remaps the dimensions of the vector space according to a partial function. This function is specified by means of the P_Func, which has n entries. The result is undefined if P_Func does not encode a partial function.

Ad hoc Predicates for Other Domains

Extra Predicates Specifically for the Pointset Powerset Domains

The powerset domains can be instantiated by taking as a base domain any fixed semantic geometric description (C and NNC polyhedra, BD and octagonal shapes, boxes and grids). An element of the powerset domain represents a disjunctive collection of base objects (its disjuncts), all having the same space dimension. For more information on this construct, see Section The Powerset Domain in the main PPL User Manual.

Besides the predicates that are available in all semantic geometric descriptions (whose documentation is not repeated here), the powerset domain also provides several ad hoc predicates. These are specified below, instantiated for the PPL domain Pointset_Powerset_C_Polyhedron. Note that predicates for other pointset powerset domains will follow similar patterns.

Predicates for pointset powerset iterators and disjuncts.

Iterators allow the user to examine and change individual elements (called here disjuncts) of a pointset powerset. Detailed descriptions for adding and removing disjuncts can be found in the main PPL User Manual in Section Adding a Disjunct. The following predicates support useful operations on these iterators and disjuncts via the usual handles.

ppl_new_Pointset_Powerset_C_Polyhedron_iterator_from_iterator(+Iterator_1, -Iterator_2)
Builds a new iterator it from the iterator referenced by Iterator_1. Iterator_2 is unified with the handle for it.

ppl_Pointset_Powerset_C_Polyhedron_begin_iterator(+Handle, -Iterator)
Unifies Iterator with a handle to an iterator "pointing" to the beginning of the sequence of disjuncts of the powerset referred to by Handle.

ppl_Pointset_Powerset_C_Polyhedron_end_iterator(+Handle, -Iterator)
Unifies Iterator with a handle to an iterator "pointing" to the end of the sequence of disjuncts of the powerset referred to by Handle.

ppl_Pointset_Powerset_C_Polyhedron_iterator_equals_iterator(+Iterator_1, +Iterator_2)
Succeeds if and only if the iterator referenced by Iterator_1 is equal to the iterator referenced by Iterator_2.

ppl_Pointset_Powerset_C_Polyhedron_iterator_increment(+Iterator)
Increments the iterator referenced by Iterator so that it "points" to the next disjunct.

ppl_Pointset_Powerset_C_Polyhedron_iterator_decrement(+Iterator)
Decrements the iterator referenced by Iterator so that it "points" to the previous disjunct.

ppl_Pointset_Powerset_C_Polyhedron_iterator_get_disjunct(+Iterator, -Handle)
Unifies with Handle a reference to the disjunct referred to by Iterator_1.

ppl_delete_Pointset_Powerset_C_Polyhedron_iterator(+Iterator)
Invalidates the handle referenced by Iterator: this makes sure the corresponding resources will eventually be released.

ppl_Pointset_Powerset_C_Polyhedron_add_disjunct(+Handle_1, +Handle_2)
Adds to the pointset powerset referenced by Handle_1 a disjunct referred to by Handle_2.

ppl_Pointset_Powerset_C_Polyhedron_drop_disjunct(+Handle, +Iterator)
If it is the iterator referred to by Iterator, drops from the pointset powerset referenced by Handle the disjunct pointed to by it and assigns to it an iterator to the next disjunct.

ppl_Pointset_Powerset_C_Polyhedron_drop_disjuncts(+Handle, +Iterator_1, +Iterator_2)
If it_1 and it_2 are the iterators referred to by Iterator_1 and Iterator_2, respectively, drops from the pointset powerset referenced by Handle all the disjuncts from it_1 to it_2 (excluded).

Other Ad Hoc Predicates for the pointset powerset domains.

Collected here are some other predicates that are specific to pointset powersets of C polyhedra; these provide operations for simplifying the powerset, geometric comparisons and widening and extrapolation. Detailed descriptions of these can be found in the main PPL User Manual in Sections Geometric Comparisons, Certificate-Based Widenings, Powerset Extrapolation Operators.

ppl_Pointset_Powerset_C_Polyhedron_pairwise_reduce(+Handle)
Assigns the result of pairwise reduction on the pointset powerset referenced by Handle.

ppl_Pointset_Powerset_C_Polyhedron_omega_reduce(+Handle)
Assigns the result of omega reduction on the pointset powerset referenced by Handle.

ppl_Pointset_Powerset_C_Polyhedron_geometrically_covers_Pointset_Powerset_C_Polyhedron(+Handle_1, +Handle_2)
Succeeds if and only if the pointset powerset referenced by Handle_2 geometrically covers the pointset powerset referenced by Handle_1; see Section Geometric Comparisons in the main PPL User Manual.

ppl_Pointset_Powerset_C_Polyhedron_geometrically_equals_Pointset_Powerset_C_Polyhedron(+Handle_1, +Handle_2)
Succeeds if and only if the pointset powerset referenced by Handle_2 geometrically equals the pointset powerset referenced by Handle_1; see Section Geometric Comparisons in the main PPL User Manual.

ppl_Pointset_Powerset_C_Polyhedron_BHZ03_BHRZ03_BHRZ03_widening_assign(+Handle_1, +Handle_2)
Assigns to the pointset powerset P_1 referenced by Handle_1 the BHZ03-widening between P_1 and the pointset powerset referenced by Handle_2, using the BHRZ03-widening certified by the convergence certificate for BHRZ03.

ppl_Pointset_Powerset_C_Polyhedron_BHZ03_H79_H79_widening_assign(+Handle_1, +Handle_2)
Assigns to the pointset powerset P_1 referenced by Handle_1 the BHZ03-widening between P_1 and the pointset powerset referenced by Handle_2, using the H79-widening certified by the convergence certificate for H79.

ppl_Pointset_Powerset_C_Polyhedron_BGP99_BHRZ03_extrapolation_assign(+Handle_1, +Handle_2, C_unsigned)
Assigns to the pointset powerset P_1 referenced by Handle_1 the result of applying the BGP99 extrapolation operator between P_1 and the pointset powerset referenced by Handle_2, using the BHRZ03-widening and the cardinality threshold C_unsigned.

ppl_Pointset_Powerset_C_Polyhedron_BGP99_H79_extrapolation_assign(+Handle_1, +Handle_2, C_unsigned)
Assigns to the pointset powerset P_1 referenced by Handle_1 the result of applying the BGP99 extrapolation operator between P_1 and the pointset powerset referenced by Handle_2, using the H79-widening and the cardinality threshold C_unsigned.

Compilation and Installation

When the Parma Polyhedra Library is configured, it tests for the existence of each supported Prolog system. If a supported Prolog system is correctly installed in a standard location, things are arranged so that the corresponding interface is built and installed.

The Prolog interface files are all installed in the directory prefix/lib/ppl. Since this includes shared and dynamically loaded libraries, you must make your dynamic linker/loader aware of this fact. If you use a GNU/Linux system, try the commands man ld.so and man ldconfig for more information.

As an option, the Prolog interface can track the creation and disposal of polyhedra. In fact, differently from native Prolog data, PPL polyhedra must be explicitly disposed and forgetting to do so is a very common mistake. To enable this option, configure the library adding -DPROLOG_TRACK_ALLOCATION to the options passed to the C++ compiler. Your configure command would then look like

  path/to/configure --with-cxxflags="-DPROLOG_TRACK_ALLOCATION" ...

System-Dependent Features

CIAO Prolog

The Ciao Prolog interface to the PPL is available both as `PPL enhanced' Ciao Prolog interpreter and as a library that can be linked to Ciao Prolog programs. Only Ciao Prolog versions 1.10 #5 and later are supported.

So that it can be used with the Ciao Prolog PPL interface, the Ciao Prolog installation must be configured with the --disable-regs option.

The ppl_ciao Executable

If an appropriate version of Ciao Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_ciao in the directory prefix/bin. The ppl_ciao executable is simply the Ciao Prolog interpreter with the Parma Polyhedra Library linked in. The only thing you should do to use the library is to call ppl_initialize/0 before any other PPL predicate and to call ppl_finalize/0 when you are done with the library.

Linking the Library To Ciao Prolog Programs

In order to allow linking Ciao Prolog programs to the PPL, the following files are installed in the directory prefix/lib/ppl: ppl_ciao.pl contains the required foreign declarations; libppl_ciao.* contain the executable code for the Ciao Prolog interface in various formats (static library, shared library, libtool library). If your Ciao Prolog program is constituted by, say, source1.pl and source2.pl and you want to create the executable myprog, your compilation command may look like

ciaoc -o myprog prefix/lib/ppl/ppl_ciao.pl ciao_pl_check.pl \
  -L '-Lprefix/lib/ppl -lppl_ciao -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'

GNU Prolog

The GNU Prolog interface to the PPL is available both as a `PPL enhanced' GNU Prolog interpreter and as a library that can be linked to GNU Prolog programs. The only GNU Prolog version that is known to work is a patched version of the `unstable version' tagged 20040608 (which unpacks to a directory called gprolog-1.2.18). The patch is contained in the interfaces/Prolog/GNU/README file of the PPL's distribution.

So that it can be used with the GNU Prolog PPL interface (and, for that matter, with any foreign code), the GNU Prolog installation must be configured with the --disable-regs option.

The ppl_gprolog Executable

If an appropriate version of GNU Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_gprolog in the directory prefix/bin. The ppl_gprolog executable is simply the GNU Prolog interpreter with the Parma Polyhedra Library linked in. The only thing you should do to use the library is to call ppl_initialize/0 before any other PPL predicate and to call ppl_finalize/0 when you are done with the library.

Linking the Library To GNU Prolog Programs

In order to allow linking GNU Prolog programs to the PPL, the following files are installed in the directory prefix/lib/ppl: ppl_gprolog.pl contains the required foreign declarations; libppl_gprolog.* contain the executable code for the GNU Prolog interface in various formats (static library, shared library, libtool library). If your GNU Prolog program is constituted by, say, source1.pl and source2.pl and you want to create the executable myprog, your compilation command may look like

gplc -o myprog prefix/lib/ppl/ppl_gprolog.pl source1.pl source2.pl \
  -L '-Lprefix/lib/ppl -lppl_gprolog -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'

GNU Prolog uses several stacks to execute a Prolog program each with a pre-defined default size. If the size of a stack is too small for the application an overflow will occur. To change the default size of a stack, the user has to set the value of the relevant environment variable; in particular, to execute some of the tests, we found it necessary to increase the size of GLOBALSZ. Thus, for the above example, the compilation command would be

GLOBALSZ=32768 gplc -o myprog prefix/lib/ppl/ppl_gprolog.pl source1.pl source2.pl \
  -L '-Lprefix/lib/ppl -lppl_gprolog -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'

More information on adjusting the size of the stacks can be found in Section 3.3 in the GNU Prolog Manual

SICStus Prolog

The SICStus Prolog interface to the PPL is available both as a statically linked module or as a dynamically linked one. Only SICStus Prolog versions 3.9.1 and later are supported.

The Statically Linked ppl_sicstus Executable

If an appropriate version of SICStus Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_sicstus in the directory prefix/bin. The ppl_sicstus executable is simply the SICStus Prolog system with the Parma Polyhedra Library statically linked. The only thing you should do to use the library is to load prefix/lib/ppl/ppl_sicstus.pl.

Loading the SICStus Interface Dynamically

In order to dynamically load the library from SICStus Prolog you should simply load prefix/lib/ppl/ppl_sicstus.pl. Notice that, for dynamic linking to work, you should have configured the library with the --enable-shared option.

SWI-Prolog

The SWI-Prolog interface to the PPL is available both as a statically linked module or as a dynamically linked one. Only SWI-Prolog version 5.6.0 and later versions are supported.

The ppl_pl Executable

If an appropriate version of SWI-Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_pl in the directory prefix/bin. The ppl_pl executable is simply the SWI-Prolog shell with the Parma Polyhedra Library statically linked: from within ppl_pl all the services of the library are available without further action.

Loading the SWI-Prolog Interface Dynamically

In order to dynamically load the library from SWI-Prolog you should simply load prefix/lib/ppl/ppl_swiprolog.pl. This will invoke ppl_initialize/0 and ppl_finalize/0 automatically. Alternatively, you can load the library directly with

:- load_foreign_library('prefix/lib/ppl/libppl_swiprolog').

This will call ppl_initialize/0 automatically. Analogously,

:- unload_foreign_library('prefix/lib/ppl/libppl_swiprolog').

will, as part of the unload process, invoke ppl_finalize/0.

Notice that, for dynamic linking to work, you should have configured the library with the --enable-shared option.

XSB

The XSB Prolog interface to the PPL is available as a dynamically linked module. Only some CVS versions of XSB starting from 2 July 2005 are known to work. CVS versions starting from 11 November 2005 are known not to work.

In order to dynamically load the library from XSB you should load the ppl_xsb module and import the predicates you need. For things to work, you may have to copy the files prefix/lib/ppl/ppl_xsb.xwam and prefix/lib/ppl/ppl_xsb.so in your current directory or in one of the XSB library directories.

YAP

The YAP Prolog interface to the PPL is available as a dynamically linked module. Only YAP versions following 5.1.0 and CVS HEAD versions starting from 4 January 2006 are supported. Notice that support for unbounded integers in YAP is young and may have errors that could affect programs using the PPL (see, e.g., http://www.cs.unipr.it/pipermail/ppl-devel/2006-January/007780.html).

In order to dynamically load the library from YAP you should simply load prefix/lib/ppl/ppl_yap.pl. This will invoke ppl_initialize/0 automatically; it is the programmer's responsibility to call ppl_finalize/0 when the PPL library is no longer needed. Notice that, for dynamic linking to work, you should have configured the library with the --enable-shared option.