| 1 | /****************************************************************************** |
| 2 | * Top contributors (to current version): |
| 3 | * Gereon Kremer, Aina Niemetz |
| 4 | * |
| 5 | * This file is part of the cvc5 project. |
| 6 | * |
| 7 | * Copyright (c) 2009-2025 by the authors listed in the file AUTHORS |
| 8 | * in the top-level source directory and their institutional affiliations. |
| 9 | * All rights reserved. See the file COPYING in the top-level source |
| 10 | * directory for licensing information. |
| 11 | * **************************************************************************** |
| 12 | * |
| 13 | * Implements a container for coverings constraints. |
| 14 | */ |
| 15 | |
| 16 | #include "cvc5_private.h"cxx . . $ `<file>/src/include/cvc5_private.h`/ |
| 17 | |
| 18 | #ifndef CVC5__THEORY__ARITH__NL__COVERINGS__CONSTRAINTS_H |
| 19 | #define CVC5__THEORY__ARITH__NL__COVERINGS__CONSTRAINTS_Hcxx . . $ `src/theory/arith/nl/coverings/constraints.h:19:9`! |
| 20 | |
| 21 | #ifdef CVC5_POLY_IMP |
| 22 | |
| 23 | #include <poly/polyxx.h> |
| 24 | |
| 25 | #include <tuple> |
| 26 | #include <vector> |
| 27 | |
| 28 | #include "theory/arith/nl/poly_conversion.h" |
| 29 | |
| 30 | namespace cvc5::internal { |
| 31 | namespace theory { |
| 32 | namespace arith { |
| 33 | namespace nl { |
| 34 | namespace coverings { |
| 35 | |
| 36 | class Constraints |
| 37 | { |
| 38 | public: |
| 39 | /** Type alias for a list of constraints. */ |
| 40 | using Constraint = std::tuple<poly::Polynomial, poly::SignCondition, Node>; |
| 41 | using ConstraintVector = std::vector<Constraint>; |
| 42 | |
| 43 | VariableMapper& varMapper() { return d_varMapper; } |
| 44 | |
| 45 | /** |
| 46 | * Add a constraint (represented by a polynomial and a sign condition) to the |
| 47 | * list of constraints. |
| 48 | */ |
| 49 | void addConstraint(const poly::Polynomial& lhs, |
| 50 | poly::SignCondition sc, |
| 51 | Node n); |
| 52 | |
| 53 | /** |
| 54 | * Add a constraints (represented by a node) to the list of constraints. |
| 55 | * The given node can either be a negation (NOT) or a suitable relation symbol |
| 56 | * as checked by is_suitable_relation(). |
| 57 | */ |
| 58 | void addConstraint(Node n); |
| 59 | |
| 60 | /** |
| 61 | * Gives the list of added constraints. |
| 62 | */ |
| 63 | const ConstraintVector& getConstraints() const; |
| 64 | |
| 65 | /** |
| 66 | * Remove all constraints. |
| 67 | */ |
| 68 | void reset(); |
| 69 | |
| 70 | private: |
| 71 | /** |
| 72 | * A list of constraints, each comprised of a polynomial and a sign |
| 73 | * condition. |
| 74 | */ |
| 75 | ConstraintVector d_constraints; |
| 76 | |
| 77 | /** |
| 78 | * A mapping from cvc5 variables to poly variables. |
| 79 | */ |
| 80 | VariableMapper d_varMapper; |
| 81 | |
| 82 | void sortConstraints(); |
| 83 | }; |
| 84 | |
| 85 | } // namespace coverings |
| 86 | } // namespace nl |
| 87 | } // namespace arith |
| 88 | } // namespace theory |
| 89 | } // namespace cvc5::internal |
| 90 | |
| 91 | #endif |
| 92 | |
| 93 | #endif |