GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/arith/nl/ext/tangent_plane_check.h Lines: 1 1 100.0 %
Date: 2021-05-22 Branches: 3 4 75.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, 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
 * Check for tangent_plane lemma.
14
 */
15
16
#ifndef CVC5__THEORY__ARITH__NL__EXT__TANGENT_PLANE_CHECK_H
17
#define CVC5__THEORY__ARITH__NL__EXT__TANGENT_PLANE_CHECK_H
18
19
#include <map>
20
21
#include "expr/node.h"
22
23
namespace cvc5 {
24
namespace theory {
25
namespace arith {
26
namespace nl {
27
28
struct ExtState;
29
30
4914
class TangentPlaneCheck
31
{
32
 public:
33
  TangentPlaneCheck(ExtState* data);
34
35
  /** check tangent planes
36
   *
37
   * Returns a set of valid theory lemmas, based on an
38
   * "incremental linearization" of non-linear monomials.
39
   * This linearization is accomplished by adding constraints
40
   * corresponding to "tangent planes" at the current
41
   * model value of each non-linear monomial. In particular
42
   * consider the definition for constants a,b :
43
   *   T_{a,b}( x*y ) = b*x + a*y - a*b.
44
   * The lemmas added by this function are of the form :
45
   *  ( ( x>a ^ y<b) ^ (x<a ^ y>b) ) => x*y < T_{a,b}( x*y )
46
   *  ( ( x>a ^ y>b) ^ (x<a ^ y<b) ) => x*y > T_{a,b}( x*y )
47
   * It is inspired by "Invariant Checking of NRA Transition
48
   * Systems via Incremental Reduction to LRA with EUF" by
49
   * Cimatti et al., TACAS 2017.
50
   * This schema is not terminating in general.
51
   * It is not enabled by default, and can
52
   * be enabled by --nl-ext-tplanes.
53
   *
54
   * Examples:
55
   *
56
   * ( ( x>2 ^ y>5) ^ (x<2 ^ y<5) ) => x*y > 5*x + 2*y - 10
57
   * ( ( x>2 ^ y<5) ^ (x<2 ^ y>5) ) => x*y < 5*x + 2*y - 10
58
   */
59
  void check(bool asWaitingLemmas);
60
61
 private:
62
  /** Basic data that is shared with other checks */
63
  ExtState* d_data;
64
  /** tangent plane bounds */
65
  std::map<Node, std::map<Node, Node> > d_tangent_val_bound[4];
66
};
67
68
}  // namespace nl
69
}  // namespace arith
70
}  // namespace theory
71
}  // namespace cvc5
72
73
#endif