summaryrefslogtreecommitdiff
path: root/src/theory/arith/theory_arith.h
blob: c6b555bf8092fdad120edf356375abf09e6f2d3d (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
/*********************                                                        */
/*! \file theory_arith.h
 ** \verbatim
 ** Original author: mdeters
 ** Major contributors: taking
 ** Minor contributors (to current version): none
 ** This file is part of the CVC4 prototype.
 ** Copyright (c) 2009, 2010  The Analysis of Computer Systems Group (ACSys)
 ** Courant Institute of Mathematical Sciences
 ** New York University
 ** See the file COPYING in the top-level source directory for licensing
 ** information.\endverbatim
 **
 ** \brief Arithmetic theory.
 **
 ** Arithmetic theory.
 **/

#include "cvc4_private.h"

#ifndef __CVC4__THEORY__ARITH__THEORY_ARITH_H
#define __CVC4__THEORY__ARITH__THEORY_ARITH_H

#include "theory/theory.h"
#include "context/context.h"
#include "context/cdlist.h"
#include "expr/node.h"

#include "theory/arith/delta_rational.h"
#include "theory/arith/tableau.h"
#include "theory/arith/arith_rewriter.h"
#include "theory/arith/partial_model.h"

#include <vector>

namespace CVC4 {
namespace theory {
namespace arith {

class TheoryArith : public Theory {
private:
  /* Chopping block begins */

  std::vector<Node> d_splits;
  //This stores the eager splits sent out of the theory.
  //TODO get rid of this.

  context::CDList<Node> d_preprocessed;
  //TODO This is currently needed to save preprocessed nodes that may not
  //currently have an outisde reference. Get rid of when preprocessing is occuring
  //correctly.

  std::vector<Node> d_variables;
  //TODO get rid of this.  Currently forces every variable and skolem constant that
  // can hit the tableau to stay alive forever!
  //This needs to come before d_partialModel and d_tableau in the file


  /* Chopping block ends */
  ArithConstants d_constants;
  ArithPartialModel d_partialModel;

  context::CDList<Node> d_diseq;
  Tableau d_tableau;
  ArithRewriter d_rewriter;



public:
  TheoryArith(context::Context* c, OutputChannel& out);
  ~TheoryArith();

  Node rewrite(TNode n);

  void preRegisterTerm(TNode n);
  void registerTerm(TNode n);
  void check(Effort e);
  void propagate(Effort e) { Unimplemented(); }
  void explain(TNode n, Effort e) { Unimplemented(); }

private:
  bool AssertLower(TNode n, TNode orig);
  bool AssertUpper(TNode n, TNode orig);
  void update(TNode x_i, DeltaRational& v);
  void pivotAndUpdate(TNode x_i, TNode x_j, DeltaRational& v);

  Node updateInconsistentVars();

  TNode selectSlackBelow(TNode x_i);
  TNode selectSlackAbove(TNode x_i);
  TNode selectSmallestInconsistentVar();

  Node generateConflictAbove(TNode conflictVar);
  Node generateConflictBelow(TNode conflictVar);

  void setupVariable(TNode x);
  DeltaRational computeRowValueUsingAssignment(TNode x);
  DeltaRational computeRowValueUsingSavedAssignment(TNode x);
  void checkTableau();

  //TODO get rid of this!
  Node simulatePreprocessing(TNode n);

};

}/* CVC4::theory::arith namespace */
}/* CVC4::theory namespace */
}/* CVC4 namespace */

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