GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/arith/nl/cad/projections.h Lines: 2 6 33.3 %
Date: 2021-05-22 Branches: 0 4 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Gereon Kremer
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 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 utilities for CAD projection operators.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__ARITH__NL__CAD_PROJECTIONS_H
19
#define CVC5__THEORY__ARITH__NL__CAD_PROJECTIONS_H
20
21
#ifdef CVC5_USE_POLY
22
23
#include <poly/polyxx.h>
24
25
#include <vector>
26
27
namespace cvc5 {
28
namespace theory {
29
namespace arith {
30
namespace nl {
31
namespace cad {
32
33
/**
34
 * A simple wrapper around std::vector<poly::Polynomial> that ensures that all
35
 * polynomials are properly factorized and pruned when added to the list.
36
 */
37
57468
class PolyVector : public std::vector<poly::Polynomial>
38
{
39
 private:
40
  /** Disable all emplace() */
41
  void emplace() {}
42
  /** Disable all emplace_back() */
43
  void emplace_back() {}
44
  /** Disable all insert() */
45
  void insert() {}
46
  /** Disable all push_back() */
47
  void push_back() {}
48
49
 public:
50
4268
  PolyVector() {}
51
  /** Construct from a set of polynomials */
52
  PolyVector(std::initializer_list<poly::Polynomial> i)
53
  {
54
    for (const auto& p : i) add(p);
55
  }
56
  /**
57
   * Adds a polynomial to the list of projection polynomials.
58
   * Before adding, it factorizes the polynomials and removed constant factors.
59
   */
60
  void add(const poly::Polynomial& poly, bool assertMain = false);
61
  /** Sort and remove duplicates from the list of polynomials. */
62
  void reduce();
63
  /** Make this list of polynomials a finest square-free basis. */
64
  void makeFinestSquareFreeBasis();
65
  /** Push polynomials with a lower main variable to another PolyVector. */
66
  void pushDownPolys(PolyVector& down, poly::Variable var);
67
};
68
69
/**
70
 * Computes McCallum's projection operator.
71
 */
72
PolyVector projectionMcCallum(const std::vector<poly::Polynomial>& polys);
73
74
}  // namespace cad
75
}  // namespace nl
76
}  // namespace arith
77
}  // namespace theory
78
}  // namespace cvc5
79
80
#endif
81
82
#endif