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
114
115
116
117
118
|
/********************* */
/** theory_engine.h
** Original author: mdeters
** Major contributors: none
** 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.
**
** The theory engine.
**/
#include "cvc4_private.h"
#ifndef __CVC4__THEORY_ENGINE_H
#define __CVC4__THEORY_ENGINE_H
#include "expr/node.h"
#include "theory/theory.h"
#include "theory/theoryof_table.h"
#include "theory/booleans/theory_bool.h"
#include "theory/uf/theory_uf.h"
#include "theory/arith/theory_arith.h"
#include "theory/arrays/theory_arrays.h"
#include "theory/bv/theory_bv.h"
namespace CVC4 {
class SmtEngine;
// In terms of abstraction, this is below (and provides services to)
// PropEngine.
/**
* This is essentially an abstraction for a collection of theories. A
* TheoryEngine provides services to a PropEngine, making various
* T-solvers look like a single unit to the propositional part of
* CVC4.
*/
class TheoryEngine {
/** Associated SMT engine */
SmtEngine* d_smt;
/** A table of Kinds to pointers to Theory */
theory::TheoryOfTable theoryOfTable;
/**
* An output channel for Theory that passes messages
* back to a TheoryEngine.
*/
class EngineOutputChannel : public theory::OutputChannel {
TheoryEngine* d_engine;
public:
void setEngine(TheoryEngine& engine) throw() {
d_engine = &engine;
}
void conflict(TNode, bool) throw(theory::Interrupted) {
}
void propagate(TNode, bool) throw(theory::Interrupted) {
}
void lemma(TNode, bool) throw(theory::Interrupted) {
}
void explanation(TNode, bool) throw(theory::Interrupted) {
}
};
EngineOutputChannel d_theoryOut;
theory::booleans::TheoryBool d_bool;
theory::uf::TheoryUF d_uf;
theory::arith::TheoryArith d_arith;
theory::arrays::TheoryArrays d_arrays;
theory::bv::TheoryBV d_bv;
public:
/**
* Construct a theory engine.
*/
TheoryEngine(SmtEngine* smt, context::Context* ctxt) :
d_smt(smt),
d_theoryOut(),
d_bool(ctxt, d_theoryOut),
d_uf(ctxt, d_theoryOut),
d_arith(ctxt, d_theoryOut),
d_arrays(ctxt, d_theoryOut),
d_bv(ctxt, d_theoryOut) {
d_theoryOut.setEngine(*this);
theoryOfTable.registerTheory(&d_bool);
theoryOfTable.registerTheory(&d_uf);
theoryOfTable.registerTheory(&d_arith);
theoryOfTable.registerTheory(&d_arrays);
theoryOfTable.registerTheory(&d_bv);
}
/**
* Get the theory associated to a given Node.
*
* @returns the theory, or NULL if the TNode is
* of built-in type.
*/
theory::Theory* theoryOf(TNode n) {
return theoryOfTable[n];
}
};/* class TheoryEngine */
}/* CVC4 namespace */
#endif /* __CVC4__THEORY_ENGINE_H */
|