GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/theory_engine.h Lines: 43 43 100.0 %
Date: 2021-08-14 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
454091648
struct NodeTheoryPair {
55
  Node d_node;
56
  theory::TheoryId d_theory;
57
  size_t d_timestamp;
58
66611902
  NodeTheoryPair(TNode n, theory::TheoryId t, size_t ts = 0)
59
66611902
      : d_node(n), d_theory(t), d_timestamp(ts)
60
  {
61
66611902
  }
62
45392714
  NodeTheoryPair() : d_theory(theory::THEORY_LAST), d_timestamp() {}
63
  // Comparison doesn't take into account the timestamp
64
79705855
  bool operator == (const NodeTheoryPair& pair) const {
65
79705855
    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
147888656
  size_t operator()(const NodeTheoryPair& pair) const {
73
147888656
    uint64_t hash = fnv1a::fnv1a_64(std::hash<Node>()(pair.d_node));
74
147888656
    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, ProofNodeManager* pnm);
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
128125
  inline void addTheory(theory::TheoryId theoryId)
314
  {
315
128125
    Assert(d_theoryTable[theoryId] == NULL && d_theoryOut[theoryId] == NULL);
316
128125
    d_theoryOut[theoryId] = new theory::EngineOutputChannel(this, theoryId);
317
384375
    d_theoryTable[theoryId] = new TheoryClass(getSatContext(),
318
128125
                                              getUserContext(),
319
128125
                                              *d_theoryOut[theoryId],
320
                                              theory::Valuation(this),
321
                                              d_logicInfo,
322
                                              d_pnm);
323
384375
    theory::Rewriter::registerTheoryRewriter(
324
384375
        theoryId, d_theoryTable[theoryId]->getTheoryRewriter());
325
128125
  }
326
327
  /** Register theory proof rule checkers to the given proof checker */
328
  void initializeProofChecker(ProofChecker* pc);
329
330
9920
  void setPropEngine(prop::PropEngine* propEngine)
331
  {
332
9920
    d_propEngine = propEngine;
333
9920
  }
334
335
  /**
336
   * Called when all initialization of options/logic is done, after theory
337
   * objects have been created.
338
   *
339
   * This initializes the quantifiers engine, the "official" equality engines
340
   * of each theory as required, and the model and model builder utilities.
341
   */
342
  void finishInit();
343
344
  /**
345
   * Get a pointer to the underlying propositional engine.
346
   */
347
2592033
  inline prop::PropEngine* getPropEngine() const {
348
2592033
    return d_propEngine;
349
  }
350
351
  /** Get the proof node manager */
352
  ProofNodeManager* getProofNodeManager() const;
353
354
  /**
355
   * Get a pointer to the underlying sat context.
356
   */
357
  context::Context* getSatContext() const;
358
359
  /**
360
   * Get a pointer to the underlying user context.
361
   */
362
  context::UserContext* getUserContext() const;
363
364
  /**
365
   * Get a pointer to the underlying quantifiers engine.
366
   */
367
13930
  theory::QuantifiersEngine* getQuantifiersEngine() const {
368
13930
    return d_quantEngine;
369
  }
370
  /**
371
   * Get a pointer to the underlying decision manager.
372
   */
373
  theory::DecisionManager* getDecisionManager() const
374
  {
375
    return d_decManager.get();
376
  }
377
378
 private:
379
  /**
380
   * Queue of nodes for pre-registration.
381
   */
382
  std::queue<TNode> d_preregisterQueue;
383
384
  /**
385
   * Boolean flag denoting we are in pre-registration.
386
   */
387
  bool d_inPreregister;
388
389
  /**
390
   * Did the theories get any new facts since the last time we called
391
   * check()
392
   */
393
  context::CDO<bool> d_factsAsserted;
394
395
  /**
396
   * Assert the formula to the given theory.
397
   * @param assertion the assertion to send (not necesserily normalized)
398
   * @param original the assertion as it was sent in from the propagating theory
399
   * @param toTheoryId the theory to assert to
400
   * @param fromTheoryId the theory that sent it
401
   */
402
  void assertToTheory(TNode assertion, TNode originalAssertion, theory::TheoryId toTheoryId, theory::TheoryId fromTheoryId);
403
404
  /**
405
   * Marks a theory propagation from a theory to a theory where a
406
   * theory could be the THEORY_SAT_SOLVER for literals coming from
407
   * or being propagated to the SAT solver. If the receiving theory
408
   * already recieved the literal, the method returns false, otherwise
409
   * it returns true.
410
   *
411
   * @param assertion the normalized assertion being sent
412
   * @param originalAssertion the actual assertion that was sent
413
   * @param toTheoryId the theory that is on the receiving end
414
   * @param fromTheoryId the theory that sent the assertion
415
   * @return true if a new assertion, false if theory already got it
416
   */
417
  bool markPropagation(TNode assertion, TNode originalAssertions, theory::TheoryId toTheoryId, theory::TheoryId fromTheoryId);
418
419
  /**
420
   * Computes the explanation by traversing the propagation graph and
421
   * asking relevant theories to explain the propagations. Initially
422
   * the explanation vector should contain only the element (node, theory)
423
   * where the node is the one to be explained, and the theory is the
424
   * theory that sent the literal.
425
   */
426
  TrustNode getExplanation(std::vector<NodeTheoryPair>& explanationVector);
427
428
  /** Are proofs enabled? */
429
  bool isProofEnabled() const;
430
431
 public:
432
  /**
433
   * Preprocess rewrite equality, called by the preprocessor to rewrite
434
   * equalities appearing in the input.
435
   */
436
  TrustNode ppRewriteEquality(TNode eq);
437
  /** Notify (preprocessed) assertions. */
438
  void notifyPreprocessedAssertions(const std::vector<Node>& assertions);
439
440
  /** Return whether or not we are incomplete (in the current context). */
441
7482
  inline bool isIncomplete() const { return d_incomplete; }
442
443
  /**
444
   * Returns true if we need another round of checking.  If this
445
   * returns true, check(FULL_EFFORT) _must_ be called by the
446
   * propositional layer before reporting SAT.
447
   *
448
   * This is especially necessary for incomplete theories that lazily
449
   * output some lemmas on FULL_EFFORT check (e.g. quantifier reasoning
450
   * outputing quantifier instantiations).  In such a case, a lemma can
451
   * be asserted that is simplified away (perhaps it's already true).
452
   * However, we must maintain the invariant that, if a theory uses the
453
   * OutputChannel, it implicitly requests that another check(FULL_EFFORT)
454
   * be performed before exit, even if no new facts are on its fact queue,
455
   * as it might decide to further instantiate some lemmas, precluding
456
   * a SAT response.
457
   */
458
4885629
  inline bool needCheck() const {
459
4885629
    return d_outputChannelUsed || d_lemmasAdded;
460
  }
461
  /**
462
   * Is the literal lit (possibly) critical for satisfying the input formula in
463
   * the current context? This call is applicable only during collectModelInfo
464
   * or during LAST_CALL effort.
465
   */
466
  bool isRelevant(Node lit) const;
467
  /**
468
   * This is called at shutdown time by the SmtEngine, just before
469
   * destruction.  It is important because there are destruction
470
   * ordering issues between PropEngine and Theory.
471
   */
472
  void shutdown();
473
474
  /**
475
   * Solve the given literal with a theory that owns it. The proof of tliteral
476
   * is carried in the trust node. The proof added to substitutionOut should
477
   * take this proof into account (when proofs are enabled).
478
   */
479
  theory::Theory::PPAssertStatus solve(
480
      TrustNode tliteral, theory::TrustSubstitutionMap& substitutionOut);
481
482
  /**
483
   * Preregister a Theory atom with the responsible theory (or
484
   * theories).
485
   */
486
  void preRegister(TNode preprocessed);
487
488
  /**
489
   * Assert the formula to the appropriate theory.
490
   * @param node the assertion
491
   */
492
  void assertFact(TNode node);
493
494
  /**
495
   * Check all (currently-active) theories for conflicts.
496
   * @param effort the effort level to use
497
   */
498
  void check(theory::Theory::Effort effort);
499
500
  /**
501
   * Calls ppStaticLearn() on all theories, accumulating their
502
   * combined contributions in the "learned" builder.
503
   */
504
  void ppStaticLearn(TNode in, NodeBuilder& learned);
505
506
  /**
507
   * Calls presolve() on all theories and returns true
508
   * if one of the theories discovers a conflict.
509
   */
510
  bool presolve();
511
512
   /**
513
   * Calls postsolve() on all theories.
514
   */
515
  void postsolve();
516
517
  /**
518
   * Calls notifyRestart() on all active theories.
519
   */
520
  void notifyRestart();
521
522
10963395
  void getPropagatedLiterals(std::vector<TNode>& literals) {
523
17740585
    for (; d_propagatedLiteralsIndex < d_propagatedLiterals.size(); d_propagatedLiteralsIndex = d_propagatedLiteralsIndex + 1) {
524
6777190
      Debug("getPropagatedLiterals") << "TheoryEngine::getPropagatedLiterals: propagating: " << d_propagatedLiterals[d_propagatedLiteralsIndex] << std::endl;
525
6777190
      literals.push_back(d_propagatedLiterals[d_propagatedLiteralsIndex]);
526
    }
527
4186205
  }
528
529
  /**
530
   * Returns the next decision request, or null if none exist. The next
531
   * decision request is a literal that this theory engine prefers the SAT
532
   * solver to make as its next decision. Decision requests are managed by
533
   * the decision manager d_decManager.
534
   */
535
  Node getNextDecisionRequest();
536
537
  bool properConflict(TNode conflict) const;
538
539
  /**
540
   * Returns an explanation of the node propagated to the SAT solver.
541
   */
542
  TrustNode getExplanation(TNode node);
543
544
  /**
545
   * Get the pointer to the model object used by this theory engine.
546
   */
547
  theory::TheoryModel* getModel();
548
  /**
549
   * Get the current model for the current set of assertions. This method
550
   * should only be called immediately after a satisfiable or unknown
551
   * response to a check-sat call, and only if produceModels is true.
552
   *
553
   * If the model is not already built, this will cause this theory engine
554
   * to build the model.
555
   *
556
   * If the model is not available (for instance, if the last call to check-sat
557
   * was interrupted), then this returns the null pointer.
558
   */
559
  theory::TheoryModel* getBuiltModel();
560
  /**
561
   * This forces the model maintained by the combination engine to be built
562
   * if it has not been done so already. This should be called only during a
563
   * last call effort check after theory combination is run.
564
   *
565
   * @return true if the model was successfully built (possibly prior to this
566
   * call).
567
   */
568
  bool buildModel();
569
  /** set eager model building
570
   *
571
   * If this method is called, then this TheoryEngine will henceforth build
572
   * its model immediately after every satisfiability check that results
573
   * in a satisfiable or unknown result. The motivation for this mode is to
574
   * accomodate API users that get the model object from the TheoryEngine,
575
   * where we want to ensure that this model is always valid.
576
   * TODO (#2648): revisit this.
577
   */
578
25
  void setEagerModelBuilding() { d_eager_model_building = true; }
579
580
  /**
581
   * Get the theory associated to a given Node.
582
   *
583
   * @returns the theory, or NULL if the TNode is
584
   * of built-in type.
585
   */
586
2361425
  inline theory::Theory* theoryOf(TNode node) const {
587
2361425
    return d_theoryTable[theory::Theory::theoryOf(node)];
588
  }
589
590
  /**
591
   * Get the theory associated to a the given theory id.
592
   *
593
   * @returns the theory
594
   */
595
43005066
  inline theory::Theory* theoryOf(theory::TheoryId theoryId) const {
596
43005066
    Assert(theoryId < theory::THEORY_LAST);
597
43005066
    return d_theoryTable[theoryId];
598
  }
599
600
1899822
  inline bool isTheoryEnabled(theory::TheoryId theoryId) const {
601
1899822
    return d_logicInfo.isTheoryEnabled(theoryId);
602
  }
603
  /** get the logic info used by this theory engine */
604
  const LogicInfo& getLogicInfo() const;
605
  /** get the separation logic heap types */
606
  bool getSepHeapTypes(TypeNode& locType, TypeNode& dataType) const;
607
608
  /**
609
   * Declare heap. This is used for separation logics to set the location
610
   * and data types. It should be called only once, and before any separation
611
   * logic constraints are asserted to this theory engine.
612
   */
613
  void declareSepHeap(TypeNode locT, TypeNode dataT);
614
615
  /**
616
   * Returns the equality status of the two terms, from the theory
617
   * that owns the domain type.  The types of a and b must be the same.
618
   */
619
  theory::EqualityStatus getEqualityStatus(TNode a, TNode b);
620
621
  /**
622
   * Returns the value that a theory that owns the type of var currently
623
   * has (or null if none);
624
   */
625
  Node getModelValue(TNode var);
626
627
  /**
628
   * Get relevant assertions. This returns a set of assertions that are
629
   * currently asserted to this TheoryEngine that propositionally entail the
630
   * (preprocessed) input formula and all theory lemmas that have been marked
631
   * NEEDS_JUSTIFY. For more details on this, see relevance_manager.h.
632
   *
633
   * This method updates success to false if the set of relevant assertions
634
   * is not available. This may occur if we are not in SAT mode, if the
635
   * relevance manager is disabled (see option::relevanceFilter) or if the
636
   * relevance manager failed to compute relevant assertions due to an internal
637
   * error.
638
   */
639
  const std::unordered_set<TNode>& getRelevantAssertions(bool& success);
640
641
  /**
642
   * Forwards an entailment check according to the given theoryOfMode.
643
   * See theory.h for documentation on entailmentCheck().
644
   */
645
  std::pair<bool, Node> entailmentCheck(options::TheoryOfMode mode, TNode lit);
646
647
  //---------------------- information about cardinality of types
648
  /**
649
   * Is the cardinality of type tn finite? This method depends on whether
650
   * finite model finding is enabled. If finite model finding is enabled, then
651
   * we assume that all uninterpreted sorts have finite cardinality.
652
   *
653
   * Notice that if finite model finding is enabled, this method returns true
654
   * if tn is an uninterpreted sort. It also returns true for the sort
655
   * (Array Int U) where U is an uninterpreted sort. This type
656
   * is finite if and only if U has cardinality one; for cases like this,
657
   * we conservatively return that tn has finite cardinality.
658
   *
659
   * This method does *not* depend on the state of the theory engine, e.g.
660
   * if U in the above example currently is entailed to have cardinality >1
661
   * based on the assertions.
662
   */
663
  bool isFiniteType(TypeNode tn) const;
664
  //---------------------- end information about cardinality of types
665
 private:
666
667
  /** Dump the assertions to the dump */
668
  void dumpAssertions(const char* tag);
669
670
  /** For preprocessing pass lifting bit-vectors of size 1 to booleans */
671
public:
672
5195
 theory::SortInference* getSortInference() { return d_sortInfer.get(); }
673
674
 /** Prints the assertions to the debug stream */
675
 void printAssertions(const char* tag);
676
677
private:
678
679
  std::map< std::string, std::vector< theory::Theory* > > d_attr_handle;
680
681
 public:
682
  /** Set user attribute.
683
   *
684
   * This function is called when an attribute is set by a user.  In SMT-LIBv2
685
   * this is done via the syntax (! n :attr)
686
   */
687
  void setUserAttribute(const std::string& attr,
688
                        Node n,
689
                        const std::vector<Node>& node_values,
690
                        const std::string& str_value);
691
692
  /** Handle user attribute.
693
   *
694
   * Associates theory t with the attribute attr.  Theory t will be
695
   * notified whenever an attribute of name attr is set.
696
   */
697
  void handleUserAttribute(const char* attr, theory::Theory* t);
698
699
  /**
700
   * Check that the theory assertions are satisfied in the model.
701
   * This function is called from the smt engine's checkModel routine.
702
   */
703
  void checkTheoryAssertionsWithModel(bool hardFailure);
704
};/* class TheoryEngine */
705
706
}  // namespace cvc5
707
708
#endif /* CVC5__THEORY_ENGINE_H */