afb62fe6a9414ffec996c7cc7beb2e4e2e095061
1 /********************* */
3 ** Original author: mdeters
4 ** Major contributors: dejan
5 ** Minor contributors (to current version): none
6 ** This file is part of the CVC4 prototype.
7 ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys)
8 ** Courant Institute of Mathematical Sciences
10 ** See the file COPYING in the top-level source directory for licensing
13 ** SmtEngine: the main public entry point of libcvc4.
16 #ifndef __CVC4__SMT_ENGINE_H
17 #define __CVC4__SMT_ENGINE_H
21 #include "cvc4_config.h"
22 #include "expr/expr.h"
23 #include "expr/expr_manager.h"
24 #include "util/result.h"
25 #include "util/model.h"
26 #include "util/decision_engine.h"
28 // In terms of abstraction, this is below (and provides services to)
29 // ValidityChecker and above (and requires the services of)
42 // TODO: SAT layer (esp. CNF- versus non-clausal solvers under the
43 // hood): use a type parameter and have check() delegate, or subclass
44 // SmtEngine and override check()?
46 // Probably better than that is to have a configuration object that
47 // indicates which passes are desired. The configuration occurs
48 // elsewhere (and can even occur at runtime). A simple "pass manager"
49 // of sorts determines check()'s behavior.
51 // The CNF conversion can go on in PropEngine.
53 class CVC4_PUBLIC SmtEngine
{
58 * Construct an SmtEngine with the given expression manager and user options.
60 SmtEngine(ExprManager
* em
, const Options
* opts
) throw();
63 * Destruct the SMT engine.
70 void doCommand(Command
*);
73 * Add a formula to the current context: preprocess, do per-theory
74 * setup, use processAssertionList(), asserting to T-solver for
75 * literals and conjunction of literals. Returns false iff
78 Result
assertFormula(const BoolExpr
& e
);
81 * Add a formula to the current context and call check(). Returns
82 * true iff consistent.
84 Result
query(const BoolExpr
& e
);
87 * Add a formula to the current context and call check(). Returns
88 * true iff consistent.
90 Result
checkSat(const BoolExpr
& e
);
93 * Simplify a formula without doing "much" work. Requires assist
94 * from the SAT Engine.
96 Expr
simplify(const Expr
& e
);
99 * Get a (counter)model (only if preceded by a SAT or INVALID query).
104 * Push a user-level context.
109 * Pop a user-level context. Throws an exception if nothing to pop.
116 CVC4::context::Context
* d_ctxt
;
118 /** Our expression manager */
119 ExprManager
* d_exprManager
;
121 /** Out internal expression/node manager */
122 NodeManager
* d_nodeManager
;
124 /** User-level options */
125 const Options
* d_options
;
127 /** The decision engine */
128 DecisionEngine
* d_decisionEngine
;
130 /** The decision engine */
131 TheoryEngine
* d_theoryEngine
;
133 /** The propositional engine */
134 prop::PropEngine
* d_propEngine
;
137 * Pre-process an Node. This is expected to be highly-variable,
138 * with a lot of "source-level configurability" to add multiple
139 * passes over the Node. TODO: may need to specify a LEVEL of
140 * preprocessing (certain contexts need more/less ?).
142 Node
preprocess(TNode node
);
145 * Adds a formula to the current context.
147 void addFormula(TNode node
);
150 * Full check of consistency in current context. Returns true iff
156 * Quick check of consistency in current context: calls
157 * processAssertionList() then look for inconsistency (based only on
162 };/* class SmtEngine */
164 }/* CVC4 namespace */
166 #endif /* __CVC4__SMT_ENGINE_H */