summaryrefslogtreecommitdiff
path: root/src/theory/arith/nl/cad/constraints.h
blob: 4321800f2051990e99b07daccb7a0da7b05cdf35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/******************************************************************************
 * Top contributors (to current version):
 *   Gereon Kremer
 *
 * This file is part of the cvc5 project.
 *
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
 * in the top-level source directory and their institutional affiliations.
 * All rights reserved.  See the file COPYING in the top-level source
 * directory for licensing information.
 * ****************************************************************************
 *
 * Implements a container for CAD constraints.
 */

#include "cvc5_private.h"

#ifndef CVC5__THEORY__ARITH__NL__CAD__CONSTRAINTS_H
#define CVC5__THEORY__ARITH__NL__CAD__CONSTRAINTS_H

#ifdef CVC5_POLY_IMP

#include <poly/polyxx.h>

#include <tuple>
#include <vector>

#include "theory/arith/nl/poly_conversion.h"

namespace cvc5 {
namespace theory {
namespace arith {
namespace nl {
namespace cad {

class Constraints
{
 public:
  /** Type alias for a list of constraints. */
  using Constraint = std::tuple<poly::Polynomial, poly::SignCondition, Node>;
  using ConstraintVector = std::vector<Constraint>;

  VariableMapper& varMapper() { return d_varMapper; }

  /**
   * Add a constraint (represented by a polynomial and a sign condition) to the
   * list of constraints.
   */
  void addConstraint(const poly::Polynomial& lhs,
                     poly::SignCondition sc,
                     Node n);

  /**
   * Add a constraints (represented by a node) to the list of constraints.
   * The given node can either be a negation (NOT) or a suitable relation symbol
   * as checked by is_suitable_relation().
   */
  void addConstraint(Node n);

  /**
   * Gives the list of added constraints.
   */
  const ConstraintVector& getConstraints() const;

  /**
   * Remove all constraints.
   */
  void reset();

 private:
  /**
   * A list of constraints, each comprised of a polynomial and a sign
   * condition.
   */
  ConstraintVector d_constraints;

  /**
   * A mapping from cvc5 variables to poly variables.
   */
  VariableMapper d_varMapper;

  void sortConstraints();
};

}  // namespace cad
}  // namespace nl
}  // namespace arith
}  // namespace theory
}  // namespace cvc5

#endif

#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback