1 /********************* */
2 /*! \file theory_engine.h
4 ** Top contributors (to current version):
5 ** Dejan Jovanovic, Morgan Deters, Andrew Reynolds
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2018 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
;
90 }/* CVC4::theory::eq namespace */
92 namespace quantifiers
{
96 class EntailmentCheckParameters
;
97 class EntailmentCheckSideEffects
;
98 }/* CVC4::theory namespace */
100 class DecisionEngine
;
101 class RemoveTermFormulas
;
102 class UnconstrainedSimplifier
;
105 * This is essentially an abstraction for a collection of theories. A
106 * TheoryEngine provides services to a PropEngine, making various
107 * T-solvers look like a single unit to the propositional part of
112 /** Shared terms database can use the internals notify the theories */
113 friend class SharedTermsDatabase
;
114 friend class theory::quantifiers::TermDb
;
116 /** Associated PropEngine engine */
117 prop::PropEngine
* d_propEngine
;
119 /** Access to decision engine */
120 DecisionEngine
* d_decisionEngine
;
123 context::Context
* d_context
;
125 /** Our user context */
126 context::UserContext
* d_userContext
;
129 * A table of from theory IDs to theory pointers. Never use this table
130 * directly, use theoryOf() instead.
132 theory::Theory
* d_theoryTable
[theory::THEORY_LAST
];
135 * A collection of theories that are "active" for the current run.
136 * This set is provided by the user (as a logic string, say, in SMT-LIBv2
137 * format input), or else by default it's all-inclusive. This is important
138 * because we can optimize for single-theory runs (no sharing), can reduce
139 * the cost of walking the DAG on registration, etc.
141 const LogicInfo
& d_logicInfo
;
144 * The database of shared terms.
146 SharedTermsDatabase d_sharedTerms
;
149 * Master equality engine, to share with theories.
151 theory::eq::EqualityEngine
* d_masterEqualityEngine
;
153 /** notify class for master equality engine */
154 class NotifyClass
: public theory::eq::EqualityEngineNotify
{
157 NotifyClass(TheoryEngine
& te
): d_te(te
) {}
158 bool eqNotifyTriggerEquality(TNode equality
, bool value
) override
162 bool eqNotifyTriggerPredicate(TNode predicate
, bool value
) override
166 bool eqNotifyTriggerTermEquality(theory::TheoryId tag
,
173 void eqNotifyConstantTermMerge(TNode t1
, TNode t2
) override
{}
174 void eqNotifyNewClass(TNode t
) override
{ d_te
.eqNotifyNewClass(t
); }
175 void eqNotifyPreMerge(TNode t1
, TNode t2
) override
177 d_te
.eqNotifyPreMerge(t1
, t2
);
179 void eqNotifyPostMerge(TNode t1
, TNode t2
) override
181 d_te
.eqNotifyPostMerge(t1
, t2
);
183 void eqNotifyDisequal(TNode t1
, TNode t2
, TNode reason
) override
185 d_te
.eqNotifyDisequal(t1
, t2
, reason
);
187 };/* class TheoryEngine::NotifyClass */
188 NotifyClass d_masterEENotify
;
191 * notification methods
193 void eqNotifyNewClass(TNode t
);
194 void eqNotifyPreMerge(TNode t1
, TNode t2
);
195 void eqNotifyPostMerge(TNode t1
, TNode t2
);
196 void eqNotifyDisequal(TNode t1
, TNode t2
, TNode reason
);
199 * The quantifiers engine
201 theory::QuantifiersEngine
* d_quantEngine
;
204 * Default model object
206 theory::TheoryModel
* d_curr_model
;
207 bool d_aloc_curr_model
;
209 * Model builder object
211 theory::TheoryEngineModelBuilder
* d_curr_model_builder
;
212 bool d_aloc_curr_model_builder
;
214 typedef std::unordered_map
<Node
, Node
, NodeHashFunction
> NodeMap
;
215 typedef std::unordered_map
<TNode
, Node
, TNodeHashFunction
> TNodeMap
;
218 * Cache for theory-preprocessing of assertions
223 * Used for "missed-t-propagations" dumping mode only. A set of all
224 * theory-propagable literals.
226 context::CDList
<TNode
> d_possiblePropagations
;
229 * Used for "missed-t-propagations" dumping mode only. A
230 * context-dependent set of those theory-propagable literals that
231 * have been propagated.
233 context::CDHashSet
<Node
, NodeHashFunction
> d_hasPropagated
;
237 * Statistics for a particular theory.
241 static std::string
mkName(std::string prefix
,
242 theory::TheoryId theory
,
243 std::string suffix
) {
244 std::stringstream ss
;
245 ss
<< prefix
<< theory
<< suffix
;
250 IntStat conflicts
, propagations
, lemmas
, requirePhase
, restartDemands
;
252 Statistics(theory::TheoryId theory
);
254 };/* class TheoryEngine::Statistics */
257 * An output channel for Theory that passes messages
258 * back to a TheoryEngine.
260 class EngineOutputChannel
: public theory::OutputChannel
{
261 friend class TheoryEngine
;
264 * The theory engine we're communicating with.
266 TheoryEngine
* d_engine
;
269 * The statistics of the theory interractions.
271 Statistics d_statistics
;
273 /** The theory owning this channel. */
274 theory::TheoryId d_theory
;
277 EngineOutputChannel(TheoryEngine
* engine
, theory::TheoryId theory
)
278 : d_engine(engine
), d_statistics(theory
), d_theory(theory
) {}
280 void safePoint(uint64_t amount
) override
{
281 spendResource(amount
);
282 if (d_engine
->d_interrupted
) {
283 throw theory::Interrupted();
287 void conflict(TNode conflictNode
,
288 std::unique_ptr
<Proof
> pf
= nullptr) override
;
289 bool propagate(TNode literal
) override
;
291 theory::LemmaStatus
lemma(TNode lemma
, ProofRule rule
,
292 bool removable
= false, bool preprocess
= false,
293 bool sendAtoms
= false) override
;
295 theory::LemmaStatus
splitLemma(TNode lemma
,
296 bool removable
= false) override
;
298 void demandRestart() override
{
299 NodeManager
* curr
= NodeManager::currentNM();
300 Node restartVar
= curr
->mkSkolem(
301 "restartVar", curr
->booleanType(),
302 "A boolean variable asserted to be true to force a restart");
303 Trace("theory::restart")
304 << "EngineOutputChannel<" << d_theory
<< ">::restart(" << restartVar
306 ++d_statistics
.restartDemands
;
307 lemma(restartVar
, RULE_INVALID
, true);
310 void requirePhase(TNode n
, bool phase
) override
{
311 Debug("theory") << "EngineOutputChannel::requirePhase(" << n
<< ", "
312 << phase
<< ")" << std::endl
;
313 ++d_statistics
.requirePhase
;
314 d_engine
->d_propEngine
->requirePhase(n
, phase
);
317 void setIncomplete() override
{
318 Trace("theory") << "TheoryEngine::setIncomplete()" << std::endl
;
319 d_engine
->setIncomplete(d_theory
);
322 void spendResource(unsigned amount
) override
{
323 d_engine
->spendResource(amount
);
326 void handleUserAttribute(const char* attr
, theory::Theory
* t
) override
{
327 d_engine
->handleUserAttribute(attr
, t
);
332 * A helper function for registering lemma recipes with the proof engine
334 void registerLemmaRecipe(Node lemma
, Node originalLemma
, bool preprocess
,
335 theory::TheoryId theoryId
);
336 }; /* class TheoryEngine::EngineOutputChannel */
339 * Output channels for individual theories.
341 EngineOutputChannel
* d_theoryOut
[theory::THEORY_LAST
];
344 * Are we in conflict.
346 context::CDO
<bool> d_inConflict
;
349 * Called by the theories to notify of a conflict.
351 void conflict(TNode conflict
, theory::TheoryId theoryId
);
354 * Debugging flag to ensure that shutdown() is called before the
360 * True if a theory has notified us of incompleteness (at this
361 * context level or below).
363 context::CDO
<bool> d_incomplete
;
366 * Called by the theories to notify that the current branch is incomplete.
368 void setIncomplete(theory::TheoryId theory
) {
374 * Mapping of propagations from recievers to senders.
376 typedef context::CDHashMap
<NodeTheoryPair
, NodeTheoryPair
, NodeTheoryPairHashFunction
> PropagationMap
;
377 PropagationMap d_propagationMap
;
380 * Timestamp of propagations
382 context::CDO
<size_t> d_propagationMapTimestamp
;
385 * Literals that are propagated by the theory. Note that these are TNodes.
386 * The theory can only propagate nodes that have an assigned literal in the
387 * SAT solver and are hence referenced in the SAT solver.
389 context::CDList
<TNode
> d_propagatedLiterals
;
392 * The index of the next literal to be propagated by a theory.
394 context::CDO
<unsigned> d_propagatedLiteralsIndex
;
397 * Called by the output channel to propagate literals and facts
398 * @return false if immediate conflict
400 bool propagate(TNode literal
, theory::TheoryId theory
);
403 * Internal method to call the propagation routines and collect the
404 * propagated literals.
406 void propagate(theory::Theory::Effort effort
);
409 * A variable to mark if we added any lemmas.
414 * A variable to mark if the OutputChannel was "used" by any theory
415 * since the start of the last check. If it has been, we require
416 * a FULL_EFFORT check before exiting and reporting SAT.
418 * See the documentation for the needCheck() function, below.
420 bool d_outputChannelUsed
;
422 /** Atom requests from lemmas */
423 AtomRequests d_atomRequests
;
426 * Adds a new lemma, returning its status.
427 * @param node the lemma
428 * @param negated should the lemma be asserted negated
429 * @param removable can the lemma be remove (restrictions apply)
430 * @param needAtoms if not THEORY_LAST, then
432 theory::LemmaStatus
lemma(TNode node
,
437 theory::TheoryId atomsTo
);
439 /** Enusre that the given atoms are send to the given theory */
440 void ensureLemmaAtoms(const std::vector
<TNode
>& atoms
, theory::TheoryId theory
);
442 RemoveTermFormulas
& d_tform_remover
;
444 /** sort inference module */
445 SortInference d_sortInfer
;
447 /** Time spent in theory combination */
448 TimerStat d_combineTheoriesTime
;
453 /** Whether we were just interrupted (or not) */
455 ResourceManager
* d_resourceManager
;
457 /** Container for lemma input and output channels. */
458 LemmaChannels
* d_channels
;
462 /** Constructs a theory engine */
463 TheoryEngine(context::Context
* context
, context::UserContext
* userContext
,
464 RemoveTermFormulas
& iteRemover
, const LogicInfo
& logic
,
465 LemmaChannels
* channels
);
467 /** Destroys a theory engine */
472 /** "Spend" a resource during a search or preprocessing.*/
473 void spendResource(unsigned amount
);
476 * Adds a theory. Only one theory per TheoryId can be present, so if
477 * there is another theory it will be deleted.
479 template <class TheoryClass
>
480 inline void addTheory(theory::TheoryId theoryId
) {
481 Assert(d_theoryTable
[theoryId
] == NULL
&& d_theoryOut
[theoryId
] == NULL
);
482 d_theoryOut
[theoryId
] = new EngineOutputChannel(this, theoryId
);
483 d_theoryTable
[theoryId
] =
484 new TheoryClass(d_context
, d_userContext
, *d_theoryOut
[theoryId
],
485 theory::Valuation(this), d_logicInfo
);
488 inline void setPropEngine(prop::PropEngine
* propEngine
) {
489 Assert(d_propEngine
== NULL
);
490 d_propEngine
= propEngine
;
493 inline void setDecisionEngine(DecisionEngine
* decisionEngine
) {
494 Assert(d_decisionEngine
== NULL
);
495 d_decisionEngine
= decisionEngine
;
498 /** Called when all initialization of options/logic is done */
502 * Get a pointer to the underlying propositional engine.
504 inline prop::PropEngine
* getPropEngine() const {
509 * Get a pointer to the underlying sat context.
511 inline context::Context
* getSatContext() const {
516 * Get a pointer to the underlying user context.
518 inline context::Context
* getUserContext() const {
519 return d_userContext
;
523 * Get a pointer to the underlying quantifiers engine.
525 theory::QuantifiersEngine
* getQuantifiersEngine() const {
526 return d_quantEngine
;
532 * Helper for preprocess
534 Node
ppTheoryRewrite(TNode term
);
537 * Queue of nodes for pre-registration.
539 std::queue
<TNode
> d_preregisterQueue
;
542 * Boolean flag denoting we are in pre-registration.
544 bool d_inPreregister
;
547 * Did the theories get any new facts since the last time we called
550 context::CDO
<bool> d_factsAsserted
;
553 * Map from equality atoms to theories that would like to be notified about them.
558 * Assert the formula to the given theory.
559 * @param assertion the assertion to send (not necesserily normalized)
560 * @param original the assertion as it was sent in from the propagating theory
561 * @param toTheoryId the theory to assert to
562 * @param fromTheoryId the theory that sent it
564 void assertToTheory(TNode assertion
, TNode originalAssertion
, theory::TheoryId toTheoryId
, theory::TheoryId fromTheoryId
);
567 * Marks a theory propagation from a theory to a theory where a
568 * theory could be the THEORY_SAT_SOLVER for literals coming from
569 * or being propagated to the SAT solver. If the receiving theory
570 * already recieved the literal, the method returns false, otherwise
573 * @param assertion the normalized assertion being sent
574 * @param originalAssertion the actual assertion that was sent
575 * @param toTheoryId the theory that is on the receiving end
576 * @param fromTheoryId the theory that sent the assertino
577 * @return true if a new assertion, false if theory already got it
579 bool markPropagation(TNode assertion
, TNode originalAssertions
, theory::TheoryId toTheoryId
, theory::TheoryId fromTheoryId
);
582 * Computes the explanation by travarsing the propagation graph and
583 * asking relevant theories to explain the propagations. Initially
584 * the explanation vector should contain only the element (node, theory)
585 * where the node is the one to be explained, and the theory is the
586 * theory that sent the literal. The lemmaProofRecipe will contain a list
587 * of the explanation steps required to produce the original node.
589 void getExplanation(std::vector
<NodeTheoryPair
>& explanationVector
, LemmaProofRecipe
* lemmaProofRecipe
);
594 * Signal the start of a new round of assertion preprocessing
596 void preprocessStart();
599 * Runs theory specific preprocessing on the non-Boolean parts of
600 * the formula. This is only called on input assertions, after ITEs
603 Node
preprocess(TNode node
);
605 /** Notify (preprocessed) assertions. */
606 void notifyPreprocessedAssertions(const std::vector
<Node
>& assertions
);
608 /** Return whether or not we are incomplete (in the current context). */
609 inline bool isIncomplete() const { return d_incomplete
; }
612 * Returns true if we need another round of checking. If this
613 * returns true, check(FULL_EFFORT) _must_ be called by the
614 * propositional layer before reporting SAT.
616 * This is especially necessary for incomplete theories that lazily
617 * output some lemmas on FULL_EFFORT check (e.g. quantifier reasoning
618 * outputing quantifier instantiations). In such a case, a lemma can
619 * be asserted that is simplified away (perhaps it's already true).
620 * However, we must maintain the invariant that, if a theory uses the
621 * OutputChannel, it implicitly requests that another check(FULL_EFFORT)
622 * be performed before exit, even if no new facts are on its fact queue,
623 * as it might decide to further instantiate some lemmas, precluding
626 inline bool needCheck() const {
627 return d_outputChannelUsed
|| d_lemmasAdded
;
631 * This is called at shutdown time by the SmtEngine, just before
632 * destruction. It is important because there are destruction
633 * ordering issues between PropEngine and Theory.
638 * Solve the given literal with a theory that owns it.
640 theory::Theory::PPAssertStatus
solve(TNode literal
,
641 theory::SubstitutionMap
& substitutionOut
);
644 * Preregister a Theory atom with the responsible theory (or
647 void preRegister(TNode preprocessed
);
650 * Assert the formula to the appropriate theory.
651 * @param node the assertion
653 void assertFact(TNode node
);
656 * Check all (currently-active) theories for conflicts.
657 * @param effort the effort level to use
659 void check(theory::Theory::Effort effort
);
662 * Run the combination framework.
664 void combineTheories();
667 * Calls ppStaticLearn() on all theories, accumulating their
668 * combined contributions in the "learned" builder.
670 void ppStaticLearn(TNode in
, NodeBuilder
<>& learned
);
673 * Calls presolve() on all theories and returns true
674 * if one of the theories discovers a conflict.
679 * Calls postsolve() on all theories.
684 * Calls notifyRestart() on all active theories.
686 void notifyRestart();
688 void getPropagatedLiterals(std::vector
<TNode
>& literals
) {
689 for (; d_propagatedLiteralsIndex
< d_propagatedLiterals
.size(); d_propagatedLiteralsIndex
= d_propagatedLiteralsIndex
+ 1) {
690 Debug("getPropagatedLiterals") << "TheoryEngine::getPropagatedLiterals: propagating: " << d_propagatedLiterals
[d_propagatedLiteralsIndex
] << std::endl
;
691 literals
.push_back(d_propagatedLiterals
[d_propagatedLiteralsIndex
]);
695 Node
getNextDecisionRequest();
697 bool properConflict(TNode conflict
) const;
698 bool properPropagation(TNode lit
) const;
699 bool properExplanation(TNode node
, TNode expl
) const;
702 * Returns an explanation of the node propagated to the SAT solver.
704 Node
getExplanation(TNode node
);
707 * Returns an explanation of the node propagated to the SAT solver and the theory
708 * that propagated it.
710 Node
getExplanationAndRecipe(TNode node
, LemmaProofRecipe
* proofRecipe
);
715 bool collectModelInfo(theory::TheoryModel
* m
);
716 /** post process model */
717 void postProcessModel( theory::TheoryModel
* m
);
720 * Get the current model
722 theory::TheoryModel
* getModel();
724 /** get synth solutions
726 * This function adds entries to sol_map that map functions-to-synthesize with
727 * their solutions, for all active conjectures. This should be called
728 * immediately after the solver answers unsat for sygus input.
730 * For details on what is added to sol_map, see
731 * CegConjecture::getSynthSolutions.
733 void getSynthSolutions(std::map
<Node
, Node
>& sol_map
);
736 * Get the model builder
738 theory::TheoryEngineModelBuilder
* getModelBuilder() { return d_curr_model_builder
; }
741 * Get the theory associated to a given Node.
743 * @returns the theory, or NULL if the TNode is
746 inline theory::Theory
* theoryOf(TNode node
) const {
747 return d_theoryTable
[theory::Theory::theoryOf(node
)];
751 * Get the theory associated to a the given theory id.
753 * @returns the theory
755 inline theory::Theory
* theoryOf(theory::TheoryId theoryId
) const {
756 return d_theoryTable
[theoryId
];
759 inline bool isTheoryEnabled(theory::TheoryId theoryId
) const {
760 return d_logicInfo
.isTheoryEnabled(theoryId
);
762 /** get the logic info used by this theory engine */
763 const LogicInfo
& getLogicInfo() const;
765 * Returns the equality status of the two terms, from the theory
766 * that owns the domain type. The types of a and b must be the same.
768 theory::EqualityStatus
getEqualityStatus(TNode a
, TNode b
);
771 * Returns the value that a theory that owns the type of var currently
772 * has (or null if none);
774 Node
getModelValue(TNode var
);
777 * Takes a literal and returns an equivalent literal that is guaranteed to be a SAT literal
779 Node
ensureLiteral(TNode n
);
782 * Print all instantiations made by the quantifiers module.
784 void printInstantiations( std::ostream
& out
);
787 * Print solution for synthesis conjectures found by ce_guided_instantiation module
789 void printSynthSolution( std::ostream
& out
);
792 * Get list of quantified formulas that were instantiated
794 void getInstantiatedQuantifiedFormulas( std::vector
< Node
>& qs
);
797 * Get instantiation methods
798 * first inputs forall x.q[x] and returns ( q[a], ..., q[z] )
799 * second inputs forall x.q[x] and returns ( a, ..., z )
800 * third and fourth return mappings e.g. forall x.q1[x] -> ( q1[a]...q1[z] ) , ... , forall x.qn[x] -> ( qn[a]...qn[z] )
802 void getInstantiations( Node q
, std::vector
< Node
>& insts
);
803 void getInstantiationTermVectors( Node q
, std::vector
< std::vector
< Node
> >& tvecs
);
804 void getInstantiations( std::map
< Node
, std::vector
< Node
> >& insts
);
805 void getInstantiationTermVectors( std::map
< Node
, std::vector
< std::vector
< Node
> > >& insts
);
808 * Get instantiated conjunction, returns q[t1] ^ ... ^ q[tn] where t1...tn are current set of instantiations for q.
809 * Can be used for quantifier elimination when satisfiable and q[t1] ^ ... ^ q[tn] |= q
811 Node
getInstantiatedConjunction( Node q
);
814 * Forwards an entailment check according to the given theoryOfMode.
815 * See theory.h for documentation on entailmentCheck().
817 std::pair
<bool, Node
> entailmentCheck(theory::TheoryOfMode mode
, TNode lit
, const theory::EntailmentCheckParameters
* params
= NULL
, theory::EntailmentCheckSideEffects
* out
= NULL
);
821 /** Default visitor for pre-registration */
822 PreRegisterVisitor d_preRegistrationVisitor
;
824 /** Visitor for collecting shared terms */
825 SharedTermsVisitor d_sharedTermsVisitor
;
827 /** Dump the assertions to the dump */
828 void dumpAssertions(const char* tag
);
830 /** For preprocessing pass simplifying unconstrained expressions */
831 UnconstrainedSimplifier
* d_unconstrainedSimp
;
833 /** For preprocessing pass lifting bit-vectors of size 1 to booleans */
835 void staticInitializeBVOptions(const std::vector
<Node
>& assertions
);
837 Node
ppSimpITE(TNode assertion
);
838 /** Returns false if an assertion simplified to false. */
839 bool donePPSimpITE(std::vector
<Node
>& assertions
);
841 void ppUnconstrainedSimp(std::vector
<Node
>& assertions
);
843 SharedTermsDatabase
* getSharedTermsDatabase() { return &d_sharedTerms
; }
845 theory::eq::EqualityEngine
* getMasterEqualityEngine() { return d_masterEqualityEngine
; }
847 RemoveTermFormulas
* getTermFormulaRemover() { return &d_tform_remover
; }
849 SortInference
* getSortInference() { return &d_sortInfer
; }
851 /** Prints the assertions to the debug stream */
852 void printAssertions(const char* tag
);
854 /** Theory alternative is in use. */
855 bool useTheoryAlternative(const std::string
& name
);
857 /** Enables using a theory alternative by name. */
858 void enableTheoryAlternative(const std::string
& name
);
861 std::set
< std::string
> d_theoryAlternatives
;
863 std::map
< std::string
, std::vector
< theory::Theory
* > > d_attr_handle
;
866 /** Set user attribute.
868 * This function is called when an attribute is set by a user. In SMT-LIBv2
869 * this is done via the syntax (! n :attr)
871 void setUserAttribute(const std::string
& attr
,
873 const std::vector
<Node
>& node_values
,
874 const std::string
& str_value
);
876 /** Handle user attribute.
878 * Associates theory t with the attribute attr. Theory t will be
879 * notified whenever an attribute of name attr is set.
881 void handleUserAttribute(const char* attr
, theory::Theory
* t
);
884 * Check that the theory assertions are satisfied in the model.
885 * This function is called from the smt engine's checkModel routine.
887 void checkTheoryAssertionsWithModel(bool hardFailure
);
890 IntStat d_arithSubstitutionsAdded
;
892 };/* class TheoryEngine */
894 }/* CVC4 namespace */
896 #endif /* __CVC4__THEORY_ENGINE_H */