summaryrefslogtreecommitdiff
path: root/src/theory/arith/nl/ext/factoring_check.h
blob: 4c017d1982c2ece8761b4f24ec3f1283f07227fb (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
/*********************                                                        */
/*! \file factoring_check.h
 ** \verbatim
 ** Top contributors (to current version):
 **   Gereon Kremer, Andrew Reynolds
 ** This file is part of the CVC4 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.\endverbatim
 **
 ** \brief Check for factoring lemma
 **/

#ifndef CVC4__THEORY__ARITH__NL__EXT__FACTORING_CHECK_H
#define CVC4__THEORY__ARITH__NL__EXT__FACTORING_CHECK_H

#include <vector>

#include "expr/node.h"

namespace CVC4 {

class CDProof;

namespace theory {
namespace arith {
namespace nl {

struct ExtState;

class FactoringCheck
{
 public:
  FactoringCheck(ExtState* data);

  /** check factoring
   *
   * Returns a set of valid theory lemmas, based on a
   * lemma schema that states a relationship between monomials
   * with common factors that occur in the same constraint.
   *
   * Examples:
   *
   * x*z+y*z > t => ( k = x + y ^ k*z > t )
   *   ...where k is fresh and x*z + y*z > t is a
   *      constraint that occurs in the current context.
   */
  void check(const std::vector<Node>& asserts,
             const std::vector<Node>& false_asserts);

 private:
  /** Basic data that is shared with other checks */
  ExtState* d_data;

  /** maps nodes to their factor skolems */
  std::map<Node, Node> d_factor_skolem;

  Node d_zero;
  Node d_one;

  /**
   * Introduces a new purification skolem k for n and adds k=n as lemma.
   * If proof is not nullptr, it proves this lemma via MACRO_SR_PRED_INTRO.
   */
  Node getFactorSkolem(Node n, CDProof* proof);
};

}  // namespace nl
}  // namespace arith
}  // namespace theory
}  // namespace CVC4

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