GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/theory_engine.h Lines: 42 42 100.0 %
Date: 2021-08-17 Branches: 100 364 27.5 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Dejan Jovanovic, Morgan Deters
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 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.
11
 * ****************************************************************************
12
 *
13
 * The theory engine.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY_ENGINE_H
19
#define CVC5__THEORY_ENGINE_H
20
21
#include <memory>
22
#include <vector>
23
24
#include "base/check.h"
25
#include "context/cdhashmap.h"
26
#include "expr/node.h"
27
#include "options/theory_options.h"
28
#include "proof/trust_node.h"
29
#include "theory/atom_requests.h"
30
#include "theory/engine_output_channel.h"
31
#include "theory/interrupted.h"
32
#include "theory/rewriter.h"
33
#include "theory/sort_inference.h"
34
#include "theory/theory.h"
35
#include "theory/theory_preprocessor.h"
36
#include "theory/trust_substitutions.h"
37
#include "theory/uf/equality_engine.h"
38
#include "theory/valuation.h"
39
#include "util/hash.h"
40
#include "util/statistics_stats.h"
41
#include "util/unsafe_interrupt_exception.h"
42
43
namespace cvc5 {
44
45
class Env;
46
class ResourceManager;
47
class TheoryEngineProofGenerator;
48
class ProofChecker;
49
50
/**
51
 * A pair of a theory and a node. This is used to mark the flow of
52
 * propagations between theories.
53
 */
54
421347036
struct NodeTheoryPair {
55
  Node d_node;
56
  theory::TheoryId d_theory;
57
  size_t d_timestamp;
58
61572148
  NodeTheoryPair(TNode n, theory::TheoryId t, size_t ts = 0)
59
61572148
      : d_node(n), d_theory(t), d_timestamp(ts)
60
  {
61
61572148
  }
62
42087480
  NodeTheoryPair() : d_theory(theory::THEORY_LAST), d_timestamp() {}
63
  // Comparison doesn't take into account the timestamp
64
73823313
  bool operator == (const NodeTheoryPair& pair) const {
65
73823313
    return d_node == pair.d_node && d_theory == pair.d_theory;
66
  }
67
};/* struct NodeTheoryPair */
68
69
struct NodeTheoryPairHashFunction {
70
  std::hash<Node> hashFunction;
71
  // Hash doesn't take into account the timestamp
72
137047091
  size_t operator()(const NodeTheoryPair& pair) const {
73
137047091
    uint64_t hash = fnv1a::fnv1a_64(std::hash<Node>()(pair.d_node));
74
137047091
    return static_cast<size_t>(fnv1a::fnv1a_64(pair.d_theory, hash));
75
  }
76
};/* struct NodeTheoryPairHashFunction */
77
78
79
/* Forward declarations */
80
namespace theory {
81
class TheoryModel;
82
class CombinationEngine;
83
class SharedSolver;
84
class DecisionManager;
85
class RelevanceManager;
86
87
}  // namespace theory
88
89
namespace prop {
90
class PropEngine;
91
}
92
93
/**
94
 * This is essentially an abstraction for a collection of theories.  A
95
 * TheoryEngine provides services to a PropEngine, making various
96
 * T-solvers look like a single unit to the propositional part of
97
 * cvc5.
98
 */
99
class TheoryEngine {
100
101
  /** Shared terms database can use the internals notify the theories */
102
  friend class SharedTermsDatabase;
103
  friend class theory::EngineOutputChannel;
104
  friend class theory::CombinationEngine;
105
  friend class theory::SharedSolver;
106
107
  /** Associated PropEngine engine */
108
  prop::PropEngine* d_propEngine;
109
110
  /**
111
   * Reference to the environment.
112
   */
113
  Env& d_env;
114
115
  /**
116
   * A table of from theory IDs to theory pointers. Never use this table
117
   * directly, use theoryOf() instead.
118
   */
119
  theory::Theory* d_theoryTable[theory::THEORY_LAST];
120
121
  /**
122
   * A collection of theories that are "active" for the current run.
123
   * This set is provided by the user (as a logic string, say, in SMT-LIBv2
124
   * format input), or else by default it's all-inclusive.  This is important
125
   * because we can optimize for single-theory runs (no sharing), can reduce
126
   * the cost of walking the DAG on registration, etc.
127
   */
128
  const LogicInfo& d_logicInfo;
129
130
  /** The separation logic location and data types */
131
  TypeNode d_sepLocType;
132
  TypeNode d_sepDataType;
133
134
  //--------------------------------- new proofs
135
  /** Proof node manager used by this theory engine, if proofs are enabled */
136
  ProofNodeManager* d_pnm;
137
  /** The lazy proof object
138
   *
139
   * This stores instructions for how to construct proofs for all theory lemmas.
140
   */
141
  std::shared_ptr<LazyCDProof> d_lazyProof;
142
  /** The proof generator */
143
  std::shared_ptr<TheoryEngineProofGenerator> d_tepg;
144
  //--------------------------------- end new proofs
145
  /** The combination manager we are using */
146
  std::unique_ptr<theory::CombinationEngine> d_tc;
147
  /** The shared solver of the above combination engine. */
148
  theory::SharedSolver* d_sharedSolver;
149
  /** The quantifiers engine, which is owned by the quantifiers theory */
150
  theory::QuantifiersEngine* d_quantEngine;
151
  /**
152
   * The decision manager
153
   */
154
  std::unique_ptr<theory::DecisionManager> d_decManager;
155
  /** The relevance manager */
156
  std::unique_ptr<theory::RelevanceManager> d_relManager;
157
  /**
158
   * An empty set of relevant assertions, which is returned as a dummy value for
159
   * getRelevantAssertions when relevance is disabled.
160
   */
161
  std::unordered_set<TNode> d_emptyRelevantSet;
162
163
  /** are we in eager model building mode? (see setEagerModelBuilding). */
164
  bool d_eager_model_building;
165
166
  /**
167
   * Output channels for individual theories.
168
   */
169
  theory::EngineOutputChannel* d_theoryOut[theory::THEORY_LAST];
170
171
  /**
172
   * Are we in conflict.
173
   */
174
  context::CDO<bool> d_inConflict;
175
176
  /**
177
   * Are we in "SAT mode"? In this state, the user can query for the model.
178
   * This corresponds to the state in Figure 4.1, page 52 of the SMT-LIB
179
   * standard, version 2.6.
180
   */
181
  bool d_inSatMode;
182
183
  /**
184
   * Called by the theories to notify of a conflict.
185
   *
186
   * @param conflict The trust node containing the conflict and its proof
187
   * generator (if it exists),
188
   * @param theoryId The theory that sent the conflict
189
   */
190
  void conflict(TrustNode conflict, theory::TheoryId theoryId);
191
192
  /** set in conflict */
193
  void markInConflict();
194
195
  /**
196
   * Debugging flag to ensure that shutdown() is called before the
197
   * destructor.
198
   */
199
  bool d_hasShutDown;
200
201
  /**
202
   * True if a theory has notified us of incompleteness (at this
203
   * context level or below).
204
   */
205
  context::CDO<bool> d_incomplete;
206
  /** The theory and identifier that (most recently) set incomplete */
207
  context::CDO<theory::TheoryId> d_incompleteTheory;
208
  context::CDO<theory::IncompleteId> d_incompleteId;
209
210
  /**
211
   * Called by the theories to notify that the current branch is incomplete.
212
   */
213
  void setIncomplete(theory::TheoryId theory, theory::IncompleteId id);
214
215
  /**
216
   * Mapping of propagations from recievers to senders.
217
   */
218
  typedef context::CDHashMap<NodeTheoryPair, NodeTheoryPair, NodeTheoryPairHashFunction> PropagationMap;
219
  PropagationMap d_propagationMap;
220
221
  /**
222
   * Timestamp of propagations
223
   */
224
  context::CDO<size_t> d_propagationMapTimestamp;
225
226
  /**
227
   * Literals that are propagated by the theory. Note that these are TNodes.
228
   * The theory can only propagate nodes that have an assigned literal in the
229
   * SAT solver and are hence referenced in the SAT solver.
230
   */
231
  context::CDList<TNode> d_propagatedLiterals;
232
233
  /**
234
   * The index of the next literal to be propagated by a theory.
235
   */
236
  context::CDO<unsigned> d_propagatedLiteralsIndex;
237
238
  /**
239
   * Called by the output channel to propagate literals and facts
240
   * @return false if immediate conflict
241
   */
242
  bool propagate(TNode literal, theory::TheoryId theory);
243
244
  /**
245
   * Internal method to call the propagation routines and collect the
246
   * propagated literals.
247
   */
248
  void propagate(theory::Theory::Effort effort);
249
250
  /**
251
   * A variable to mark if we added any lemmas.
252
   */
253
  bool d_lemmasAdded;
254
255
  /**
256
   * A variable to mark if the OutputChannel was "used" by any theory
257
   * since the start of the last check.  If it has been, we require
258
   * a FULL_EFFORT check before exiting and reporting SAT.
259
   *
260
   * See the documentation for the needCheck() function, below.
261
   */
262
  bool d_outputChannelUsed;
263
264
  /** Atom requests from lemmas */
265
  AtomRequests d_atomRequests;
266
267
  /**
268
   * Adds a new lemma, returning its status.
269
   * @param node the lemma
270
   * @param p the properties of the lemma.
271
   * @param atomsTo the theory that atoms of the lemma should be sent to
272
   * @param from the theory that sent the lemma
273
   */
274
  void lemma(TrustNode node,
275
             theory::LemmaProperty p,
276
             theory::TheoryId from = theory::THEORY_LAST);
277
278
  /** Ensure atoms from the given node are sent to the given theory */
279
  void ensureLemmaAtoms(TNode n, theory::TheoryId atomsTo);
280
  /** Ensure that the given atoms are sent to the given theory */
281
  void ensureLemmaAtoms(const std::vector<TNode>& atoms,
282
                        theory::TheoryId atomsTo);
283
284
  /** sort inference module */
285
  std::unique_ptr<theory::SortInference> d_sortInfer;
286
287
  /** Time spent in theory combination */
288
  TimerStat d_combineTheoriesTime;
289
290
  Node d_true;
291
  Node d_false;
292
293
  /** Whether we were just interrupted (or not) */
294
  bool d_interrupted;
295
296
 public:
297
  /** Constructs a theory engine */
298
  TheoryEngine(Env& env);
299
300
  /** Destroys a theory engine */
301
  ~TheoryEngine();
302
303
  void interrupt();
304
305
  /** "Spend" a resource during a search or preprocessing.*/
306
  void spendResource(Resource r);
307
308
  /**
309
   * Adds a theory. Only one theory per TheoryId can be present, so if
310
   * there is another theory it will be deleted.
311
   */
312
  template <class TheoryClass>
313
128086
  inline void addTheory(theory::TheoryId theoryId)
314
  {
315
128086
    Assert(d_theoryTable[theoryId] == NULL && d_theoryOut[theoryId] == NULL);
316
128086
    d_theoryOut[theoryId] = new theory::EngineOutputChannel(this, theoryId);
317
256172
    d_theoryTable[theoryId] =
318
128086
        new TheoryClass(d_env, *d_theoryOut[theoryId], theory::Valuation(this));
319
384258
    theory::Rewriter::registerTheoryRewriter(
320
384258
        theoryId, d_theoryTable[theoryId]->getTheoryRewriter());
321
128086
  }
322
323
  /** Register theory proof rule checkers to the given proof checker */
324
  void initializeProofChecker(ProofChecker* pc);
325
326
9917
  void setPropEngine(prop::PropEngine* propEngine)
327
  {
328
9917
    d_propEngine = propEngine;
329
9917
  }
330
331
  /**
332
   * Called when all initialization of options/logic is done, after theory
333
   * objects have been created.
334
   *
335
   * This initializes the quantifiers engine, the "official" equality engines
336
   * of each theory as required, and the model and model builder utilities.
337
   */
338
  void finishInit();
339
340
  /**
341
   * Get a pointer to the underlying propositional engine.
342
   */
343
2529696
  inline prop::PropEngine* getPropEngine() const {
344
2529696
    return d_propEngine;
345
  }
346
347
  /** Get the proof node manager */
348
  ProofNodeManager* getProofNodeManager() const;
349
350
  /**
351
   * Get a pointer to the underlying sat context.
352
   */
353
  context::Context* getSatContext() const;
354
355
  /**
356
   * Get a pointer to the underlying user context.
357
   */
358
  context::UserContext* getUserContext() const;
359
360
  /**
361
   * Get a pointer to the underlying quantifiers engine.
362
   */
363
13928
  theory::QuantifiersEngine* getQuantifiersEngine() const {
364
13928
    return d_quantEngine;
365
  }
366
  /**
367
   * Get a pointer to the underlying decision manager.
368
   */
369
  theory::DecisionManager* getDecisionManager() const
370
  {
371
    return d_decManager.get();
372
  }
373
374
 private:
375
  /**
376
   * Queue of nodes for pre-registration.
377
   */
378
  std::queue<TNode> d_preregisterQueue;
379
380
  /**
381
   * Boolean flag denoting we are in pre-registration.
382
   */
383
  bool d_inPreregister;
384
385
  /**
386
   * Did the theories get any new facts since the last time we called
387
   * check()
388
   */
389
  context::CDO<bool> d_factsAsserted;
390
391
  /**
392
   * Assert the formula to the given theory.
393
   * @param assertion the assertion to send (not necesserily normalized)
394
   * @param original the assertion as it was sent in from the propagating theory
395
   * @param toTheoryId the theory to assert to
396
   * @param fromTheoryId the theory that sent it
397
   */
398
  void assertToTheory(TNode assertion, TNode originalAssertion, theory::TheoryId toTheoryId, theory::TheoryId fromTheoryId);
399
400
  /**
401
   * Marks a theory propagation from a theory to a theory where a
402
   * theory could be the THEORY_SAT_SOLVER for literals coming from
403
   * or being propagated to the SAT solver. If the receiving theory
404
   * already recieved the literal, the method returns false, otherwise
405
   * it returns true.
406
   *
407
   * @param assertion the normalized assertion being sent
408
   * @param originalAssertion the actual assertion that was sent
409
   * @param toTheoryId the theory that is on the receiving end
410
   * @param fromTheoryId the theory that sent the assertion
411
   * @return true if a new assertion, false if theory already got it
412
   */
413
  bool markPropagation(TNode assertion, TNode originalAssertions, theory::TheoryId toTheoryId, theory::TheoryId fromTheoryId);
414
415
  /**
416
   * Computes the explanation by traversing the propagation graph and
417
   * asking relevant theories to explain the propagations. Initially
418
   * the explanation vector should contain only the element (node, theory)
419
   * where the node is the one to be explained, and the theory is the
420
   * theory that sent the literal.
421
   */
422
  TrustNode getExplanation(std::vector<NodeTheoryPair>& explanationVector);
423
424
  /** Are proofs enabled? */
425
  bool isProofEnabled() const;
426
427
 public:
428
  /**
429
   * Preprocess rewrite equality, called by the preprocessor to rewrite
430
   * equalities appearing in the input.
431
   */
432
  TrustNode ppRewriteEquality(TNode eq);
433
  /** Notify (preprocessed) assertions. */
434
  void notifyPreprocessedAssertions(const std::vector<Node>& assertions);
435
436
  /** Return whether or not we are incomplete (in the current context). */
437
7481
  inline bool isIncomplete() const { return d_incomplete; }
438
439
  /**
440
   * Returns true if we need another round of checking.  If this
441
   * returns true, check(FULL_EFFORT) _must_ be called by the
442
   * propositional layer before reporting SAT.
443
   *
444
   * This is especially necessary for incomplete theories that lazily
445
   * output some lemmas on FULL_EFFORT check (e.g. quantifier reasoning
446
   * outputing quantifier instantiations).  In such a case, a lemma can
447
   * be asserted that is simplified away (perhaps it's already true).
448
   * However, we must maintain the invariant that, if a theory uses the
449
   * OutputChannel, it implicitly requests that another check(FULL_EFFORT)
450
   * be performed before exit, even if no new facts are on its fact queue,
451
   * as it might decide to further instantiate some lemmas, precluding
452
   * a SAT response.
453
   */
454
4697282
  inline bool needCheck() const {
455
4697282
    return d_outputChannelUsed || d_lemmasAdded;
456
  }
457
  /**
458
   * Is the literal lit (possibly) critical for satisfying the input formula in
459
   * the current context? This call is applicable only during collectModelInfo
460
   * or during LAST_CALL effort.
461
   */
462
  bool isRelevant(Node lit) const;
463
  /**
464
   * This is called at shutdown time by the SmtEngine, just before
465
   * destruction.  It is important because there are destruction
466
   * ordering issues between PropEngine and Theory.
467
   */
468
  void shutdown();
469
470
  /**
471
   * Solve the given literal with a theory that owns it. The proof of tliteral
472
   * is carried in the trust node. The proof added to substitutionOut should
473
   * take this proof into account (when proofs are enabled).
474
   */
475
  theory::Theory::PPAssertStatus solve(
476
      TrustNode tliteral, theory::TrustSubstitutionMap& substitutionOut);
477
478
  /**
479
   * Preregister a Theory atom with the responsible theory (or
480
   * theories).
481
   */
482
  void preRegister(TNode preprocessed);
483
484
  /**
485
   * Assert the formula to the appropriate theory.
486
   * @param node the assertion
487
   */
488
  void assertFact(TNode node);
489
490
  /**
491
   * Check all (currently-active) theories for conflicts.
492
   * @param effort the effort level to use
493
   */
494
  void check(theory::Theory::Effort effort);
495
496
  /**
497
   * Calls ppStaticLearn() on all theories, accumulating their
498
   * combined contributions in the "learned" builder.
499
   */
500
  void ppStaticLearn(TNode in, NodeBuilder& learned);
501
502
  /**
503
   * Calls presolve() on all theories and returns true
504
   * if one of the theories discovers a conflict.
505
   */
506
  bool presolve();
507
508
   /**
509
   * Calls postsolve() on all theories.
510
   */
511
  void postsolve();
512
513
  /**
514
   * Calls notifyRestart() on all active theories.
515
   */
516
  void notifyRestart();
517
518
10358405
  void getPropagatedLiterals(std::vector<TNode>& literals) {
519
16716920
    for (; d_propagatedLiteralsIndex < d_propagatedLiterals.size(); d_propagatedLiteralsIndex = d_propagatedLiteralsIndex + 1) {
520
6358515
      Debug("getPropagatedLiterals") << "TheoryEngine::getPropagatedLiterals: propagating: " << d_propagatedLiterals[d_propagatedLiteralsIndex] << std::endl;
521
6358515
      literals.push_back(d_propagatedLiterals[d_propagatedLiteralsIndex]);
522
    }
523
3999890
  }
524
525
  /**
526
   * Returns the next decision request, or null if none exist. The next
527
   * decision request is a literal that this theory engine prefers the SAT
528
   * solver to make as its next decision. Decision requests are managed by
529
   * the decision manager d_decManager.
530
   */
531
  Node getNextDecisionRequest();
532
533
  bool properConflict(TNode conflict) const;
534
535
  /**
536
   * Returns an explanation of the node propagated to the SAT solver.
537
   */
538
  TrustNode getExplanation(TNode node);
539
540
  /**
541
   * Get the pointer to the model object used by this theory engine.
542
   */
543
  theory::TheoryModel* getModel();
544
  /**
545
   * Get the current model for the current set of assertions. This method
546
   * should only be called immediately after a satisfiable or unknown
547
   * response to a check-sat call, and only if produceModels is true.
548
   *
549
   * If the model is not already built, this will cause this theory engine
550
   * to build the model.
551
   *
552
   * If the model is not available (for instance, if the last call to check-sat
553
   * was interrupted), then this returns the null pointer.
554
   */
555
  theory::TheoryModel* getBuiltModel();
556
  /**
557
   * This forces the model maintained by the combination engine to be built
558
   * if it has not been done so already. This should be called only during a
559
   * last call effort check after theory combination is run.
560
   *
561
   * @return true if the model was successfully built (possibly prior to this
562
   * call).
563
   */
564
  bool buildModel();
565
  /** set eager model building
566
   *
567
   * If this method is called, then this TheoryEngine will henceforth build
568
   * its model immediately after every satisfiability check that results
569
   * in a satisfiable or unknown result. The motivation for this mode is to
570
   * accomodate API users that get the model object from the TheoryEngine,
571
   * where we want to ensure that this model is always valid.
572
   * TODO (#2648): revisit this.
573
   */
574
25
  void setEagerModelBuilding() { d_eager_model_building = true; }
575
576
  /**
577
   * Get the theory associated to a given Node.
578
   *
579
   * @returns the theory, or NULL if the TNode is
580
   * of built-in type.
581
   */
582
2362163
  inline theory::Theory* theoryOf(TNode node) const {
583
2362163
    return d_theoryTable[theory::Theory::theoryOf(node)];
584
  }
585
586
  /**
587
   * Get the theory associated to a the given theory id.
588
   *
589
   * @returns the theory
590
   */
591
41313822
  inline theory::Theory* theoryOf(theory::TheoryId theoryId) const {
592
41313822
    Assert(theoryId < theory::THEORY_LAST);
593
41313822
    return d_theoryTable[theoryId];
594
  }
595
596
1905675
  inline bool isTheoryEnabled(theory::TheoryId theoryId) const {
597
1905675
    return d_logicInfo.isTheoryEnabled(theoryId);
598
  }
599
  /** get the logic info used by this theory engine */
600
  const LogicInfo& getLogicInfo() const;
601
  /** get the separation logic heap types */
602
  bool getSepHeapTypes(TypeNode& locType, TypeNode& dataType) const;
603
604
  /**
605
   * Declare heap. This is used for separation logics to set the location
606
   * and data types. It should be called only once, and before any separation
607
   * logic constraints are asserted to this theory engine.
608
   */
609
  void declareSepHeap(TypeNode locT, TypeNode dataT);
610
611
  /**
612
   * Returns the equality status of the two terms, from the theory
613
   * that owns the domain type.  The types of a and b must be the same.
614
   */
615
  theory::EqualityStatus getEqualityStatus(TNode a, TNode b);
616
617
  /**
618
   * Returns the value that a theory that owns the type of var currently
619
   * has (or null if none);
620
   */
621
  Node getModelValue(TNode var);
622
623
  /**
624
   * Get relevant assertions. This returns a set of assertions that are
625
   * currently asserted to this TheoryEngine that propositionally entail the
626
   * (preprocessed) input formula and all theory lemmas that have been marked
627
   * NEEDS_JUSTIFY. For more details on this, see relevance_manager.h.
628
   *
629
   * This method updates success to false if the set of relevant assertions
630
   * is not available. This may occur if we are not in SAT mode, if the
631
   * relevance manager is disabled (see option::relevanceFilter) or if the
632
   * relevance manager failed to compute relevant assertions due to an internal
633
   * error.
634
   */
635
  const std::unordered_set<TNode>& getRelevantAssertions(bool& success);
636
637
  /**
638
   * Forwards an entailment check according to the given theoryOfMode.
639
   * See theory.h for documentation on entailmentCheck().
640
   */
641
  std::pair<bool, Node> entailmentCheck(options::TheoryOfMode mode, TNode lit);
642
643
  //---------------------- information about cardinality of types
644
  /**
645
   * Is the cardinality of type tn finite? This method depends on whether
646
   * finite model finding is enabled. If finite model finding is enabled, then
647
   * we assume that all uninterpreted sorts have finite cardinality.
648
   *
649
   * Notice that if finite model finding is enabled, this method returns true
650
   * if tn is an uninterpreted sort. It also returns true for the sort
651
   * (Array Int U) where U is an uninterpreted sort. This type
652
   * is finite if and only if U has cardinality one; for cases like this,
653
   * we conservatively return that tn has finite cardinality.
654
   *
655
   * This method does *not* depend on the state of the theory engine, e.g.
656
   * if U in the above example currently is entailed to have cardinality >1
657
   * based on the assertions.
658
   */
659
  bool isFiniteType(TypeNode tn) const;
660
  //---------------------- end information about cardinality of types
661
 private:
662
663
  /** Dump the assertions to the dump */
664
  void dumpAssertions(const char* tag);
665
666
  /** For preprocessing pass lifting bit-vectors of size 1 to booleans */
667
public:
668
5195
 theory::SortInference* getSortInference() { return d_sortInfer.get(); }
669
670
 /** Prints the assertions to the debug stream */
671
 void printAssertions(const char* tag);
672
673
private:
674
675
  std::map< std::string, std::vector< theory::Theory* > > d_attr_handle;
676
677
 public:
678
  /** Set user attribute.
679
   *
680
   * This function is called when an attribute is set by a user.  In SMT-LIBv2
681
   * this is done via the syntax (! n :attr)
682
   */
683
  void setUserAttribute(const std::string& attr,
684
                        Node n,
685
                        const std::vector<Node>& node_values,
686
                        const std::string& str_value);
687
688
  /** Handle user attribute.
689
   *
690
   * Associates theory t with the attribute attr.  Theory t will be
691
   * notified whenever an attribute of name attr is set.
692
   */
693
  void handleUserAttribute(const char* attr, theory::Theory* t);
694
695
  /**
696
   * Check that the theory assertions are satisfied in the model.
697
   * This function is called from the smt engine's checkModel routine.
698
   */
699
  void checkTheoryAssertionsWithModel(bool hardFailure);
700
};/* class TheoryEngine */
701
702
}  // namespace cvc5
703
704
#endif /* CVC5__THEORY_ENGINE_H */