1 /********************* -*- C++ -*- */
3 ** This file is part of the CVC4 prototype.
4 ** Copyright (c) 2009 The Analysis of Computer Systems Group (ACSys)
5 ** Courant Institute of Mathematical Sciences
7 ** See the file COPYING in the top-level source directory for licensing
12 #ifndef __CVC4__SMT_ENGINE_H
13 #define __CVC4__SMT_ENGINE_H
16 #include "expr/expr.h"
17 #include "expr/expr_manager.h"
18 #include "util/result.h"
19 #include "util/model.h"
20 #include "util/options.h"
22 // In terms of abstraction, this is below (and provides services to)
23 // ValidityChecker and above (and requires the services of)
30 // TODO: SAT layer (esp. CNF- versus non-clausal solvers under the
31 // hood): use a type parameter and have check() delegate, or subclass
32 // SmtEngine and override check()?
34 // Probably better than that is to have a configuration object that
35 // indicates which passes are desired. The configuration occurs
36 // elsewhere (and can even occur at runtime). A simple "pass manager"
37 // of sorts determines check()'s behavior.
39 // The CNF conversion can go on in PropEngine.
42 /** Current set of assertions. */
43 // TODO: make context-aware to handle user-level push/pop.
44 std::vector
<Expr
> d_assertList
;
46 /** Our expression manager */
49 /** User-level options */
53 * Pre-process an Expr. This is expected to be highly-variable,
54 * with a lot of "source-level configurability" to add multiple
55 * passes over the Expr. TODO: may need to specify a LEVEL of
56 * preprocessing (certain contexts need more/less ?).
58 void preprocess(Expr
);
61 * Adds a formula to the current context.
63 void addFormula(Expr
);
66 * Full check of consistency in current context. Returns true iff
72 * Quick check of consistency in current context: calls
73 * processAssertionList() then look for inconsistency (based only on
79 * Process the assertion list: for literals and conjunctions of
80 * literals, assert to T-solver.
82 void processAssertionList();
86 * Construct an SmtEngine with the given expression manager and user options.
88 SmtEngine(ExprManager
* em
, Options
* opts
) throw() : d_em(em
), d_opts(opts
) {}
93 void doCommand(Command
*);
96 * Add a formula to the current context: preprocess, do per-theory
97 * setup, use processAssertionList(), asserting to T-solver for
98 * literals and conjunction of literals. Returns false iff
104 * Add a formula to the current context and call check(). Returns
105 * true iff consistent.
110 * Add a formula to the current context and call check(). Returns
111 * true iff consistent.
113 Result
checkSat(Expr
);
116 * Simplify a formula without doing "much" work. Requires assist
117 * from the SAT Engine.
122 * Get a (counter)model (only if preceded by a SAT or INVALID query.
127 * Push a user-level context.
132 * Pop a user-level context. Throws an exception if nothing to pop.
135 };/* class SmtEngine */
137 }/* CVC4 namespace */
139 #endif /* __CVC4__SMT_ENGINE_H */