1 /********************* */
2 /*! \file theory_engine.h
4 ** Top contributors (to current version):
5 ** Morgan Deters, Dejan Jovanovic, Andrew Reynolds
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief The theory engine
17 #include "cvc4_private.h"
19 #ifndef __CVC4__THEORY_ENGINE_H
20 #define __CVC4__THEORY_ENGINE_H
25 #include <unordered_map>
29 #include "base/cvc4_assert.h"
30 #include "context/cdhashset.h"
31 #include "expr/node.h"
32 #include "options/options.h"
33 #include "options/smt_options.h"
34 #include "prop/prop_engine.h"
35 #include "smt/command.h"
36 #include "smt_util/lemma_channels.h"
37 #include "theory/atom_requests.h"
38 #include "theory/interrupted.h"
39 #include "theory/rewriter.h"
40 #include "theory/shared_terms_database.h"
41 #include "theory/sort_inference.h"
42 #include "theory/substitutions.h"
43 #include "theory/term_registration_visitor.h"
44 #include "theory/theory.h"
45 #include "theory/uf/equality_engine.h"
46 #include "theory/valuation.h"
47 #include "util/hash.h"
48 #include "util/statistics_registry.h"
49 #include "util/unsafe_interrupt_exception.h"
53 class ResourceManager
;
54 class LemmaProofRecipe
;
57 * A pair of a theory and a node. This is used to mark the flow of
58 * propagations between theories.
60 struct NodeTheoryPair
{
62 theory::TheoryId theory
;
64 NodeTheoryPair(TNode node
, theory::TheoryId theory
, size_t timestamp
= 0)
65 : node(node
), theory(theory
), timestamp(timestamp
) {}
66 NodeTheoryPair() : theory(theory::THEORY_LAST
), timestamp() {}
67 // Comparison doesn't take into account the timestamp
68 bool operator == (const NodeTheoryPair
& pair
) const {
69 return node
== pair
.node
&& theory
== pair
.theory
;
71 };/* struct NodeTheoryPair */
73 struct NodeTheoryPairHashFunction
{
74 NodeHashFunction hashFunction
;
75 // Hash doesn't take into account the timestamp
76 size_t operator()(const NodeTheoryPair
& pair
) const {
77 uint64_t hash
= fnv1a::fnv1a_64(NodeHashFunction()(pair
.node
));
78 return static_cast<size_t>(fnv1a::fnv1a_64(pair
.theory
, hash
));
80 };/* struct NodeTheoryPairHashFunction */
83 /* Forward declarations */
86 class TheoryEngineModelBuilder
;
91 }/* CVC4::theory::eq namespace */
93 namespace quantifiers
{
97 class EntailmentCheckParameters
;
98 class EntailmentCheckSideEffects
;
99 }/* CVC4::theory namespace */
101 class DecisionEngine
;
102 class RemoveTermFormulas
;
103 class UnconstrainedSimplifier
;
106 * This is essentially an abstraction for a collection of theories. A
107 * TheoryEngine provides services to a PropEngine, making various
108 * T-solvers look like a single unit to the propositional part of
113 /** Shared terms database can use the internals notify the theories */
114 friend class SharedTermsDatabase
;
115 friend class theory::quantifiers::TermDb
;
117 /** Associated PropEngine engine */
118 prop::PropEngine
* d_propEngine
;
120 /** Access to decision engine */
121 DecisionEngine
* d_decisionEngine
;
124 context::Context
* d_context
;
126 /** Our user context */
127 context::UserContext
* d_userContext
;
130 * A table of from theory IDs to theory pointers. Never use this table
131 * directly, use theoryOf() instead.
133 theory::Theory
* d_theoryTable
[theory::THEORY_LAST
];
136 * A collection of theories that are "active" for the current run.
137 * This set is provided by the user (as a logic string, say, in SMT-LIBv2
138 * format input), or else by default it's all-inclusive. This is important
139 * because we can optimize for single-theory runs (no sharing), can reduce
140 * the cost of walking the DAG on registration, etc.
142 const LogicInfo
& d_logicInfo
;
145 * The database of shared terms.
147 SharedTermsDatabase d_sharedTerms
;
150 * Master equality engine, to share with theories.
152 theory::eq::EqualityEngine
* d_masterEqualityEngine
;
154 /** notify class for master equality engine */
155 class NotifyClass
: public theory::eq::EqualityEngineNotify
{
158 NotifyClass(TheoryEngine
& te
): d_te(te
) {}
159 bool eqNotifyTriggerEquality(TNode equality
, bool value
) override
163 bool eqNotifyTriggerPredicate(TNode predicate
, bool value
) override
167 bool eqNotifyTriggerTermEquality(theory::TheoryId tag
,
174 void eqNotifyConstantTermMerge(TNode t1
, TNode t2
) override
{}
175 void eqNotifyNewClass(TNode t
) override
{ d_te
.eqNotifyNewClass(t
); }
176 void eqNotifyPreMerge(TNode t1
, TNode t2
) override
178 d_te
.eqNotifyPreMerge(t1
, t2
);
180 void eqNotifyPostMerge(TNode t1
, TNode t2
) override
182 d_te
.eqNotifyPostMerge(t1
, t2
);
184 void eqNotifyDisequal(TNode t1
, TNode t2
, TNode reason
) override
186 d_te
.eqNotifyDisequal(t1
, t2
, reason
);
188 };/* class TheoryEngine::NotifyClass */
189 NotifyClass d_masterEENotify
;
192 * notification methods
194 void eqNotifyNewClass(TNode t
);
195 void eqNotifyPreMerge(TNode t1
, TNode t2
);
196 void eqNotifyPostMerge(TNode t1
, TNode t2
);
197 void eqNotifyDisequal(TNode t1
, TNode t2
, TNode reason
);
200 * The quantifiers engine
202 theory::QuantifiersEngine
* d_quantEngine
;
205 * Default model object
207 theory::TheoryModel
* d_curr_model
;
208 bool d_aloc_curr_model
;
210 * Model builder object
212 theory::TheoryEngineModelBuilder
* d_curr_model_builder
;
213 bool d_aloc_curr_model_builder
;
215 typedef std::unordered_map
<Node
, Node
, NodeHashFunction
> NodeMap
;
216 typedef std::unordered_map
<TNode
, Node
, TNodeHashFunction
> TNodeMap
;
219 * Cache for theory-preprocessing of assertions
224 * Used for "missed-t-propagations" dumping mode only. A set of all
225 * theory-propagable literals.
227 context::CDList
<TNode
> d_possiblePropagations
;
230 * Used for "missed-t-propagations" dumping mode only. A
231 * context-dependent set of those theory-propagable literals that
232 * have been propagated.
234 context::CDHashSet
<Node
, NodeHashFunction
> d_hasPropagated
;
238 * Statistics for a particular theory.
242 static std::string
mkName(std::string prefix
,
243 theory::TheoryId theory
,
244 std::string suffix
) {
245 std::stringstream ss
;
246 ss
<< prefix
<< theory
<< suffix
;
252 IntStat conflicts
, propagations
, lemmas
, requirePhase
, flipDecision
, restartDemands
;
254 Statistics(theory::TheoryId theory
);
256 };/* class TheoryEngine::Statistics */
259 * An output channel for Theory that passes messages
260 * back to a TheoryEngine.
262 class EngineOutputChannel
: public theory::OutputChannel
{
263 friend class TheoryEngine
;
266 * The theory engine we're communicating with.
268 TheoryEngine
* d_engine
;
271 * The statistics of the theory interractions.
273 Statistics d_statistics
;
275 /** The theory owning this channel. */
276 theory::TheoryId d_theory
;
279 EngineOutputChannel(TheoryEngine
* engine
, theory::TheoryId theory
)
280 : d_engine(engine
), d_statistics(theory
), d_theory(theory
) {}
282 void safePoint(uint64_t amount
) override
{
283 spendResource(amount
);
284 if (d_engine
->d_interrupted
) {
285 throw theory::Interrupted();
289 void conflict(TNode conflictNode
,
290 std::unique_ptr
<Proof
> pf
= nullptr) override
;
291 bool propagate(TNode literal
) override
;
293 theory::LemmaStatus
lemma(TNode lemma
, ProofRule rule
,
294 bool removable
= false, bool preprocess
= false,
295 bool sendAtoms
= false) override
;
297 theory::LemmaStatus
splitLemma(TNode lemma
,
298 bool removable
= false) override
;
300 void demandRestart() override
{
301 NodeManager
* curr
= NodeManager::currentNM();
302 Node restartVar
= curr
->mkSkolem(
303 "restartVar", curr
->booleanType(),
304 "A boolean variable asserted to be true to force a restart");
305 Trace("theory::restart")
306 << "EngineOutputChannel<" << d_theory
<< ">::restart(" << restartVar
308 ++d_statistics
.restartDemands
;
309 lemma(restartVar
, RULE_INVALID
, true);
312 void requirePhase(TNode n
, bool phase
) override
{
313 Debug("theory") << "EngineOutputChannel::requirePhase(" << n
<< ", "
314 << phase
<< ")" << std::endl
;
315 ++d_statistics
.requirePhase
;
316 d_engine
->d_propEngine
->requirePhase(n
, phase
);
319 bool flipDecision() override
{
320 Debug("theory") << "EngineOutputChannel::flipDecision()" << std::endl
;
321 ++d_statistics
.flipDecision
;
322 return d_engine
->d_propEngine
->flipDecision();
325 void setIncomplete() override
{
326 Trace("theory") << "TheoryEngine::setIncomplete()" << std::endl
;
327 d_engine
->setIncomplete(d_theory
);
330 void spendResource(unsigned amount
) override
{
331 d_engine
->spendResource(amount
);
334 void handleUserAttribute(const char* attr
, theory::Theory
* t
) override
{
335 d_engine
->handleUserAttribute(attr
, t
);
340 * A helper function for registering lemma recipes with the proof engine
342 void registerLemmaRecipe(Node lemma
, Node originalLemma
, bool preprocess
,
343 theory::TheoryId theoryId
);
344 }; /* class TheoryEngine::EngineOutputChannel */
347 * Output channels for individual theories.
349 EngineOutputChannel
* d_theoryOut
[theory::THEORY_LAST
];
352 * Are we in conflict.
354 context::CDO
<bool> d_inConflict
;
357 * Called by the theories to notify of a conflict.
359 void conflict(TNode conflict
, theory::TheoryId theoryId
);
362 * Debugging flag to ensure that shutdown() is called before the
368 * True if a theory has notified us of incompleteness (at this
369 * context level or below).
371 context::CDO
<bool> d_incomplete
;
374 * Called by the theories to notify that the current branch is incomplete.
376 void setIncomplete(theory::TheoryId theory
) {
382 * Mapping of propagations from recievers to senders.
384 typedef context::CDHashMap
<NodeTheoryPair
, NodeTheoryPair
, NodeTheoryPairHashFunction
> PropagationMap
;
385 PropagationMap d_propagationMap
;
388 * Timestamp of propagations
390 context::CDO
<size_t> d_propagationMapTimestamp
;
393 * Literals that are propagated by the theory. Note that these are TNodes.
394 * The theory can only propagate nodes that have an assigned literal in the
395 * SAT solver and are hence referenced in the SAT solver.
397 context::CDList
<TNode
> d_propagatedLiterals
;
400 * The index of the next literal to be propagated by a theory.
402 context::CDO
<unsigned> d_propagatedLiteralsIndex
;
405 * Called by the output channel to propagate literals and facts
406 * @return false if immediate conflict
408 bool propagate(TNode literal
, theory::TheoryId theory
);
411 * Internal method to call the propagation routines and collect the
412 * propagated literals.
414 void propagate(theory::Theory::Effort effort
);
417 * Called by the output channel to request decisions "as soon as
420 void propagateAsDecision(TNode literal
, theory::TheoryId theory
);
423 * A variable to mark if we added any lemmas.
428 * A variable to mark if the OutputChannel was "used" by any theory
429 * since the start of the last check. If it has been, we require
430 * a FULL_EFFORT check before exiting and reporting SAT.
432 * See the documentation for the needCheck() function, below.
434 bool d_outputChannelUsed
;
436 /** Atom requests from lemmas */
437 AtomRequests d_atomRequests
;
440 * Adds a new lemma, returning its status.
441 * @param node the lemma
442 * @param negated should the lemma be asserted negated
443 * @param removable can the lemma be remove (restrictions apply)
444 * @param needAtoms if not THEORY_LAST, then
446 theory::LemmaStatus
lemma(TNode node
,
451 theory::TheoryId atomsTo
);
453 /** Enusre that the given atoms are send to the given theory */
454 void ensureLemmaAtoms(const std::vector
<TNode
>& atoms
, theory::TheoryId theory
);
456 RemoveTermFormulas
& d_tform_remover
;
458 /** sort inference module */
459 SortInference d_sortInfer
;
461 /** Time spent in theory combination */
462 TimerStat d_combineTheoriesTime
;
467 /** Whether we were just interrupted (or not) */
469 ResourceManager
* d_resourceManager
;
471 /** Container for lemma input and output channels. */
472 LemmaChannels
* d_channels
;
476 /** Constructs a theory engine */
477 TheoryEngine(context::Context
* context
, context::UserContext
* userContext
,
478 RemoveTermFormulas
& iteRemover
, const LogicInfo
& logic
,
479 LemmaChannels
* channels
);
481 /** Destroys a theory engine */
486 /** "Spend" a resource during a search or preprocessing.*/
487 void spendResource(unsigned amount
);
490 * Adds a theory. Only one theory per TheoryId can be present, so if
491 * there is another theory it will be deleted.
493 template <class TheoryClass
>
494 inline void addTheory(theory::TheoryId theoryId
) {
495 Assert(d_theoryTable
[theoryId
] == NULL
&& d_theoryOut
[theoryId
] == NULL
);
496 d_theoryOut
[theoryId
] = new EngineOutputChannel(this, theoryId
);
497 d_theoryTable
[theoryId
] =
498 new TheoryClass(d_context
, d_userContext
, *d_theoryOut
[theoryId
],
499 theory::Valuation(this), d_logicInfo
);
502 inline void setPropEngine(prop::PropEngine
* propEngine
) {
503 Assert(d_propEngine
== NULL
);
504 d_propEngine
= propEngine
;
507 inline void setDecisionEngine(DecisionEngine
* decisionEngine
) {
508 Assert(d_decisionEngine
== NULL
);
509 d_decisionEngine
= decisionEngine
;
512 /** Called when all initialization of options/logic is done */
516 * Get a pointer to the underlying propositional engine.
518 inline prop::PropEngine
* getPropEngine() const {
523 * Get a pointer to the underlying sat context.
525 inline context::Context
* getSatContext() const {
530 * Get a pointer to the underlying user context.
532 inline context::Context
* getUserContext() const {
533 return d_userContext
;
537 * Get a pointer to the underlying quantifiers engine.
539 theory::QuantifiersEngine
* getQuantifiersEngine() const {
540 return d_quantEngine
;
546 * Helper for preprocess
548 Node
ppTheoryRewrite(TNode term
);
551 * Queue of nodes for pre-registration.
553 std::queue
<TNode
> d_preregisterQueue
;
556 * Boolean flag denoting we are in pre-registration.
558 bool d_inPreregister
;
561 * Did the theories get any new facts since the last time we called
564 context::CDO
<bool> d_factsAsserted
;
567 * Map from equality atoms to theories that would like to be notified about them.
572 * Assert the formula to the given theory.
573 * @param assertion the assertion to send (not necesserily normalized)
574 * @param original the assertion as it was sent in from the propagating theory
575 * @param toTheoryId the theory to assert to
576 * @param fromTheoryId the theory that sent it
578 void assertToTheory(TNode assertion
, TNode originalAssertion
, theory::TheoryId toTheoryId
, theory::TheoryId fromTheoryId
);
581 * Marks a theory propagation from a theory to a theory where a
582 * theory could be the THEORY_SAT_SOLVER for literals coming from
583 * or being propagated to the SAT solver. If the receiving theory
584 * already recieved the literal, the method returns false, otherwise
587 * @param assertion the normalized assertion being sent
588 * @param originalAssertion the actual assertion that was sent
589 * @param toTheoryId the theory that is on the receiving end
590 * @param fromTheoryId the theory that sent the assertino
591 * @return true if a new assertion, false if theory already got it
593 bool markPropagation(TNode assertion
, TNode originalAssertions
, theory::TheoryId toTheoryId
, theory::TheoryId fromTheoryId
);
596 * Computes the explanation by travarsing the propagation graph and
597 * asking relevant theories to explain the propagations. Initially
598 * the explanation vector should contain only the element (node, theory)
599 * where the node is the one to be explained, and the theory is the
600 * theory that sent the literal. The lemmaProofRecipe will contain a list
601 * of the explanation steps required to produce the original node.
603 void getExplanation(std::vector
<NodeTheoryPair
>& explanationVector
, LemmaProofRecipe
* lemmaProofRecipe
);
608 * Signal the start of a new round of assertion preprocessing
610 void preprocessStart();
613 * Runs theory specific preprocessing on the non-Boolean parts of
614 * the formula. This is only called on input assertions, after ITEs
617 Node
preprocess(TNode node
);
619 /** Notify (preprocessed) assertions. */
620 void notifyPreprocessedAssertions(const std::vector
<Node
>& assertions
);
622 /** Return whether or not we are incomplete (in the current context). */
623 inline bool isIncomplete() const { return d_incomplete
; }
626 * Returns true if we need another round of checking. If this
627 * returns true, check(FULL_EFFORT) _must_ be called by the
628 * propositional layer before reporting SAT.
630 * This is especially necessary for incomplete theories that lazily
631 * output some lemmas on FULL_EFFORT check (e.g. quantifier reasoning
632 * outputing quantifier instantiations). In such a case, a lemma can
633 * be asserted that is simplified away (perhaps it's already true).
634 * However, we must maintain the invariant that, if a theory uses the
635 * OutputChannel, it implicitly requests that another check(FULL_EFFORT)
636 * be performed before exit, even if no new facts are on its fact queue,
637 * as it might decide to further instantiate some lemmas, precluding
640 inline bool needCheck() const {
641 return d_outputChannelUsed
|| d_lemmasAdded
;
645 * This is called at shutdown time by the SmtEngine, just before
646 * destruction. It is important because there are destruction
647 * ordering issues between PropEngine and Theory.
652 * Solve the given literal with a theory that owns it.
654 theory::Theory::PPAssertStatus
solve(TNode literal
,
655 theory::SubstitutionMap
& substitutionOut
);
658 * Preregister a Theory atom with the responsible theory (or
661 void preRegister(TNode preprocessed
);
664 * Assert the formula to the appropriate theory.
665 * @param node the assertion
667 void assertFact(TNode node
);
670 * Check all (currently-active) theories for conflicts.
671 * @param effort the effort level to use
673 void check(theory::Theory::Effort effort
);
676 * Run the combination framework.
678 void combineTheories();
681 * Calls ppStaticLearn() on all theories, accumulating their
682 * combined contributions in the "learned" builder.
684 void ppStaticLearn(TNode in
, NodeBuilder
<>& learned
);
687 * Calls presolve() on all theories and returns true
688 * if one of the theories discovers a conflict.
693 * Calls postsolve() on all theories.
698 * Calls notifyRestart() on all active theories.
700 void notifyRestart();
702 void getPropagatedLiterals(std::vector
<TNode
>& literals
) {
703 for (; d_propagatedLiteralsIndex
< d_propagatedLiterals
.size(); d_propagatedLiteralsIndex
= d_propagatedLiteralsIndex
+ 1) {
704 Debug("getPropagatedLiterals") << "TheoryEngine::getPropagatedLiterals: propagating: " << d_propagatedLiterals
[d_propagatedLiteralsIndex
] << std::endl
;
705 literals
.push_back(d_propagatedLiterals
[d_propagatedLiteralsIndex
]);
709 Node
getNextDecisionRequest();
711 bool properConflict(TNode conflict
) const;
712 bool properPropagation(TNode lit
) const;
713 bool properExplanation(TNode node
, TNode expl
) const;
716 * Returns an explanation of the node propagated to the SAT solver.
718 Node
getExplanation(TNode node
);
721 * Returns an explanation of the node propagated to the SAT solver and the theory
722 * that propagated it.
724 Node
getExplanationAndRecipe(TNode node
, LemmaProofRecipe
* proofRecipe
);
729 bool collectModelInfo(theory::TheoryModel
* m
);
730 /** post process model */
731 void postProcessModel( theory::TheoryModel
* m
);
734 * Get the current model
736 theory::TheoryModel
* getModel();
738 /** get synth solutions
740 * This function adds entries to sol_map that map functions-to-synthesize with
741 * their solutions, for all active conjectures. This should be called
742 * immediately after the solver answers unsat for sygus input.
744 * For details on what is added to sol_map, see
745 * CegConjecture::getSynthSolutions.
747 void getSynthSolutions(std::map
<Node
, Node
>& sol_map
);
750 * Get the model builder
752 theory::TheoryEngineModelBuilder
* getModelBuilder() { return d_curr_model_builder
; }
755 * Get the theory associated to a given Node.
757 * @returns the theory, or NULL if the TNode is
760 inline theory::Theory
* theoryOf(TNode node
) const {
761 return d_theoryTable
[theory::Theory::theoryOf(node
)];
765 * Get the theory associated to a the given theory id.
767 * @returns the theory
769 inline theory::Theory
* theoryOf(theory::TheoryId theoryId
) const {
770 return d_theoryTable
[theoryId
];
773 inline bool isTheoryEnabled(theory::TheoryId theoryId
) const {
774 return d_logicInfo
.isTheoryEnabled(theoryId
);
778 * Returns the equality status of the two terms, from the theory
779 * that owns the domain type. The types of a and b must be the same.
781 theory::EqualityStatus
getEqualityStatus(TNode a
, TNode b
);
784 * Returns the value that a theory that owns the type of var currently
785 * has (or null if none);
787 Node
getModelValue(TNode var
);
790 * Takes a literal and returns an equivalent literal that is guaranteed to be a SAT literal
792 Node
ensureLiteral(TNode n
);
795 * Print all instantiations made by the quantifiers module.
797 void printInstantiations( std::ostream
& out
);
800 * Print solution for synthesis conjectures found by ce_guided_instantiation module
802 void printSynthSolution( std::ostream
& out
);
805 * Get list of quantified formulas that were instantiated
807 void getInstantiatedQuantifiedFormulas( std::vector
< Node
>& qs
);
810 * Get instantiation methods
811 * first inputs forall x.q[x] and returns ( q[a], ..., q[z] )
812 * second inputs forall x.q[x] and returns ( a, ..., z )
813 * third and fourth return mappings e.g. forall x.q1[x] -> ( q1[a]...q1[z] ) , ... , forall x.qn[x] -> ( qn[a]...qn[z] )
815 void getInstantiations( Node q
, std::vector
< Node
>& insts
);
816 void getInstantiationTermVectors( Node q
, std::vector
< std::vector
< Node
> >& tvecs
);
817 void getInstantiations( std::map
< Node
, std::vector
< Node
> >& insts
);
818 void getInstantiationTermVectors( std::map
< Node
, std::vector
< std::vector
< Node
> > >& insts
);
821 * Get instantiated conjunction, returns q[t1] ^ ... ^ q[tn] where t1...tn are current set of instantiations for q.
822 * Can be used for quantifier elimination when satisfiable and q[t1] ^ ... ^ q[tn] |= q
824 Node
getInstantiatedConjunction( Node q
);
827 * Forwards an entailment check according to the given theoryOfMode.
828 * See theory.h for documentation on entailmentCheck().
830 std::pair
<bool, Node
> entailmentCheck(theory::TheoryOfMode mode
, TNode lit
, const theory::EntailmentCheckParameters
* params
= NULL
, theory::EntailmentCheckSideEffects
* out
= NULL
);
834 /** Default visitor for pre-registration */
835 PreRegisterVisitor d_preRegistrationVisitor
;
837 /** Visitor for collecting shared terms */
838 SharedTermsVisitor d_sharedTermsVisitor
;
840 /** Dump the assertions to the dump */
841 void dumpAssertions(const char* tag
);
844 * A collection of ite preprocessing passes.
846 theory::ITEUtilities
* d_iteUtilities
;
849 /** For preprocessing pass simplifying unconstrained expressions */
850 UnconstrainedSimplifier
* d_unconstrainedSimp
;
852 /** For preprocessing pass lifting bit-vectors of size 1 to booleans */
854 void staticInitializeBVOptions(const std::vector
<Node
>& assertions
);
856 Node
ppSimpITE(TNode assertion
);
857 /** Returns false if an assertion simplified to false. */
858 bool donePPSimpITE(std::vector
<Node
>& assertions
);
860 void ppUnconstrainedSimp(std::vector
<Node
>& assertions
);
862 SharedTermsDatabase
* getSharedTermsDatabase() { return &d_sharedTerms
; }
864 theory::eq::EqualityEngine
* getMasterEqualityEngine() { return d_masterEqualityEngine
; }
866 RemoveTermFormulas
* getTermFormulaRemover() { return &d_tform_remover
; }
868 SortInference
* getSortInference() { return &d_sortInfer
; }
870 /** Prints the assertions to the debug stream */
871 void printAssertions(const char* tag
);
873 /** Theory alternative is in use. */
874 bool useTheoryAlternative(const std::string
& name
);
876 /** Enables using a theory alternative by name. */
877 void enableTheoryAlternative(const std::string
& name
);
880 std::set
< std::string
> d_theoryAlternatives
;
882 std::map
< std::string
, std::vector
< theory::Theory
* > > d_attr_handle
;
885 /** Set user attribute.
887 * This function is called when an attribute is set by a user. In SMT-LIBv2
888 * this is done via the syntax (! n :attr)
890 void setUserAttribute(const std::string
& attr
,
892 const std::vector
<Node
>& node_values
,
893 const std::string
& str_value
);
895 /** Handle user attribute.
897 * Associates theory t with the attribute attr. Theory t will be
898 * notified whenever an attribute of name attr is set.
900 void handleUserAttribute(const char* attr
, theory::Theory
* t
);
903 * Check that the theory assertions are satisfied in the model.
904 * This function is called from the smt engine's checkModel routine.
906 void checkTheoryAssertionsWithModel(bool hardFailure
);
909 IntStat d_arithSubstitutionsAdded
;
911 };/* class TheoryEngine */
913 }/* CVC4 namespace */
915 #endif /* __CVC4__THEORY_ENGINE_H */