GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/theory_engine.h Lines: 43 43 100.0 %
Date: 2021-08-01 Branches: 101 364 27.7 %

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