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