Merge branch '1.2.x'
[cvc5.git] / src / theory / arith / arith_static_learner.h
1 /********************* */
2 /*! \file arith_static_learner.h
3 ** \verbatim
4 ** Original author: Tim King
5 ** Major contributors: Morgan Deters
6 ** Minor contributors (to current version): Dejan Jovanovic
7 ** This file is part of the CVC4 project.
8 ** Copyright (c) 2009-2013 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
11 **
12 ** \brief [[ Add one-line brief description here ]]
13 **
14 ** [[ Add lengthier description here ]]
15 ** \todo document this file
16 **/
17
18 #include "cvc4_private.h"
19
20 #ifndef __CVC4__THEORY__ARITH__ARITH_STATIC_LEARNER_H
21 #define __CVC4__THEORY__ARITH__ARITH_STATIC_LEARNER_H
22
23
24 #include "util/statistics_registry.h"
25 #include "theory/arith/arith_utilities.h"
26 #include "theory/substitutions.h"
27
28 #include "context/context.h"
29 #include "context/cdlist.h"
30 #include "context/cdtrail_hashmap.h"
31 #include <set>
32
33 namespace CVC4 {
34 namespace theory {
35 namespace arith {
36
37 class ArithStaticLearner {
38 private:
39
40 /**
41 * Map from a node to it's minimum and maximum.
42 */
43 typedef context::CDTrailHashMap<Node, DeltaRational, NodeHashFunction> CDNodeToMinMaxMap;
44 CDNodeToMinMaxMap d_minMap;
45 CDNodeToMinMaxMap d_maxMap;
46
47 public:
48 ArithStaticLearner(context::Context* userContext);
49 void staticLearning(TNode n, NodeBuilder<>& learned);
50
51 void addBound(TNode n);
52
53 private:
54 void process(TNode n, NodeBuilder<>& learned, const TNodeSet& defTrue);
55
56 void iteMinMax(TNode n, NodeBuilder<>& learned);
57 void iteConstant(TNode n, NodeBuilder<>& learned);
58
59 /** These fields are designed to be accessible to ArithStaticLearner methods. */
60 class Statistics {
61 public:
62 IntStat d_iteMinMaxApplications;
63 IntStat d_iteConstantApplications;
64
65 Statistics();
66 ~Statistics();
67 };
68
69 Statistics d_statistics;
70
71 };/* class ArithStaticLearner */
72
73 }/* CVC4::theory::arith namespace */
74 }/* CVC4::theory namespace */
75 }/* CVC4 namespace */
76
77 #endif /* __CVC4__THEORY__ARITH__ARITH_STATIC_LEARNER_H */