1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Liana Hadarean, Mathias Preiner, Dejan Jovanovic |
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 |
|
* Algebraic solver. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#pragma once |
19 |
|
|
20 |
|
#include <unordered_map> |
21 |
|
|
22 |
|
#include "theory/bv/bv_subtheory.h" |
23 |
|
|
24 |
|
namespace cvc5 { |
25 |
|
|
26 |
|
namespace theory { |
27 |
|
namespace bv { |
28 |
|
|
29 |
|
class TLazyBitblaster; |
30 |
|
class AbstractionModule; |
31 |
|
class BVQuickCheck; |
32 |
|
class QuickXPlain; |
33 |
|
|
34 |
|
/** |
35 |
|
* BitblastSolver |
36 |
|
*/ |
37 |
|
class BitblastSolver : public SubtheorySolver |
38 |
|
{ |
39 |
|
struct Statistics |
40 |
|
{ |
41 |
|
IntStat d_numCallstoCheck; |
42 |
|
IntStat d_numBBLemmas; |
43 |
|
Statistics(); |
44 |
|
}; |
45 |
|
/** Bitblaster */ |
46 |
|
std::unique_ptr<TLazyBitblaster> d_bitblaster; |
47 |
|
|
48 |
|
/** Nodes that still need to be bit-blasted */ |
49 |
|
context::CDQueue<TNode> d_bitblastQueue; |
50 |
|
Statistics d_statistics; |
51 |
|
|
52 |
|
typedef std::unordered_map<Node, Node> NodeMap; |
53 |
|
NodeMap d_modelCache; |
54 |
|
context::CDO<bool> d_validModelCache; |
55 |
|
|
56 |
|
/** Queue for bit-blasting lemma atoms only in full check if we are sat */ |
57 |
|
context::CDQueue<TNode> d_lemmaAtomsQueue; |
58 |
|
bool d_useSatPropagation; |
59 |
|
AbstractionModule* d_abstractionModule; |
60 |
|
std::unique_ptr<BVQuickCheck> d_quickCheck; |
61 |
|
std::unique_ptr<QuickXPlain> d_quickXplain; |
62 |
|
// Node getModelValueRec(TNode node); |
63 |
|
void setConflict(TNode conflict); |
64 |
|
|
65 |
|
public: |
66 |
|
BitblastSolver(context::Context* c, BVSolverLayered* bv); |
67 |
|
~BitblastSolver(); |
68 |
|
|
69 |
|
void preRegister(TNode node) override; |
70 |
|
bool check(Theory::Effort e) override; |
71 |
|
void explain(TNode literal, std::vector<TNode>& assumptions) override; |
72 |
|
EqualityStatus getEqualityStatus(TNode a, TNode b) override; |
73 |
|
bool collectModelValues(TheoryModel* m, |
74 |
|
const std::set<Node>& termSet) override; |
75 |
|
Node getModelValue(TNode node) override; |
76 |
|
bool isComplete() override { return true; } |
77 |
|
void bitblastQueue(); |
78 |
|
void setAbstraction(AbstractionModule* module); |
79 |
|
uint64_t computeAtomWeight(TNode atom); |
80 |
|
}; |
81 |
|
|
82 |
|
} // namespace bv |
83 |
|
} // namespace theory |
84 |
|
} // namespace cvc5 |