1 /* BHRZ03_Certificate class declaration.
2    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3    Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_BHRZ03_Certificate_defs_hh
25 #define PPL_BHRZ03_Certificate_defs_hh 1
26 
27 #include "BHRZ03_Certificate_types.hh"
28 #include "Polyhedron_types.hh"
29 #include "globals_defs.hh"
30 #include <vector>
31 
32 //! The convergence certificate for the BHRZ03 widening operator.
33 /*! \ingroup PPL_CXX_interface
34   Convergence certificates are used to instantiate the BHZ03 framework
35   so as to define widening operators for the finite powerset domain.
36 
37   \note
38   Each convergence certificate has to be used together with a
39   compatible widening operator. In particular, BHRZ03_Certificate
40   can certify the convergence of both the BHRZ03 and the H79 widenings.
41 */
42 class Parma_Polyhedra_Library::BHRZ03_Certificate {
43 public:
44   //! Default constructor.
45   BHRZ03_Certificate();
46 
47   //! Constructor: computes the certificate for \p ph.
48   BHRZ03_Certificate(const Polyhedron& ph);
49 
50   //! Copy constructor.
51   BHRZ03_Certificate(const BHRZ03_Certificate& y);
52 
53   //! Destructor.
54   ~BHRZ03_Certificate();
55 
56   //! The comparison function for certificates.
57   /*!
58     \return
59     \f$-1\f$, \f$0\f$ or \f$1\f$ depending on whether \p *this
60     is smaller than, equal to, or greater than \p y, respectively.
61 
62     Compares \p *this with \p y, using a total ordering which is a
63     refinement of the limited growth ordering relation for the
64     BHRZ03 widening.
65   */
66   int compare(const BHRZ03_Certificate& y) const;
67 
68   //! Compares \p *this with the certificate for polyhedron \p ph.
69   int compare(const Polyhedron& ph) const;
70 
71 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
72   /*! \brief
73     Returns <CODE>true</CODE> if and only if the certificate for
74     polyhedron \p ph is strictly smaller than \p *this.
75   */
76 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
77   bool is_stabilizing(const Polyhedron& ph) const;
78 
79   //! A total ordering on BHRZ03 certificates.
80   /*! \ingroup PPL_CXX_interface
81     This binary predicate defines a total ordering on BHRZ03 certificates
82     which is used when storing information about sets of polyhedra.
83   */
84   struct Compare {
85     //! Returns <CODE>true</CODE> if and only if \p x comes before \p y.
86     bool operator()(const BHRZ03_Certificate& x,
87                     const BHRZ03_Certificate& y) const;
88   };
89 
90 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
91   //! Check if gathered information is meaningful.
92 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
93   bool OK() const;
94 
95 private:
96   //! Affine dimension of the polyhedron.
97   dimension_type affine_dim;
98   //! Dimension of the lineality space of the polyhedron.
99   dimension_type lin_space_dim;
100   //! Cardinality of a non-redundant constraint system for the polyhedron.
101   dimension_type num_constraints;
102   /*! \brief
103     Number of non-redundant points in a generator system
104     for the polyhedron.
105   */
106   dimension_type num_points;
107   /*! \brief
108     A vector containing, for each index `0 <= i < space_dim',
109     the number of non-redundant rays in a generator system of the
110     polyhedron having exactly `i' null coordinates.
111   */
112   std::vector<dimension_type> num_rays_null_coord;
113 };
114 
115 #include "BHRZ03_Certificate_inlines.hh"
116 
117 #endif // !defined(PPL_BHRZ03_Certificate_defs_hh)
118