summaryrefslogtreecommitdiff
path: root/src/theory/arith/nl/transcendental/exponential_solver.h
blob: 8bd00c456b59d1b07c384b0d3af2a0c71f10be51 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*********************                                                        */
/*! \file exponential_solver.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 Solving for handling exponential function.
 **/

#ifndef CVC4__THEORY__ARITH__NL__TRANSCENDENTAL__EXPONENTIAL_SOLVER_H
#define CVC4__THEORY__ARITH__NL__TRANSCENDENTAL__EXPONENTIAL_SOLVER_H

#include <map>

#include "expr/node.h"

namespace CVC5 {
namespace theory {
namespace arith {
namespace nl {
namespace transcendental {

struct TranscendentalState;

/** Transcendental solver class
 *
 * This class implements model-based refinement schemes
 * for transcendental functions, described in:
 *
 * - "Satisfiability Modulo Transcendental
 * Functions via Incremental Linearization" by Cimatti
 * et al., CADE 2017.
 *
 * It's main functionality are methods that implement lemma schemas below,
 * which return a set of lemmas that should be sent on the output channel.
 */
class ExponentialSolver
{
 public:
  ExponentialSolver(TranscendentalState* tstate);
  ~ExponentialSolver();

  /**
   * Ensures that new_a is properly registered as a term where new_a is the
   * purified version of a, y being the new skolem used for purification.
   */
  void doPurification(TNode a, TNode new_a, TNode y);

  /**
   * check initial refine
   *
   * Constructs a set of valid theory lemmas, based on
   * simple facts about the exponential function.
   * This mostly follows the initial axioms described in
   * Section 4 of "Satisfiability
   * Modulo Transcendental Functions via Incremental
   * Linearization" by Cimatti et al., CADE 2017.
   *
   * Examples:
   *
   * exp( x )>0
   * x<0 => exp( x )<1
   */
  void checkInitialRefine();

  /**
   * check monotonicity
   *
   * Constructs a set of valid theory lemmas, based on a
   * lemma scheme that ensures that applications
   * of the exponential function respect monotonicity.
   *
   * Examples:
   *
   * x > y => exp( x ) > exp( y )
   */
  void checkMonotonic();

  /** Send tangent lemma around c for e */
  void doTangentLemma(TNode e, TNode c, TNode poly_approx, std::uint64_t d);

  /** Send secant lemmas around c for e */
  void doSecantLemmas(TNode e,
                      TNode poly_approx,
                      TNode center,
                      TNode cval,
                      unsigned d,
                      unsigned actual_d);

 private:
  /** Generate bounds for secant lemmas */
  std::pair<Node, Node> getSecantBounds(TNode e, TNode center, unsigned d);

  /** Holds common state for transcendental solvers */
  TranscendentalState* d_data;

  /** The transcendental functions we have done initial refinements on */
  std::map<Node, bool> d_tf_initial_refine;

}; /* class ExponentialSolver */

}  // namespace transcendental
}  // namespace nl
}  // namespace arith
}  // namespace theory
}  // namespace CVC5

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