1 /********************* */
2 /*! \file eager_bitblaster.h
4 ** Top contributors (to current version):
5 ** Mathias Preiner, Andres Noetzli
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 Bitblaster for eager BV solver.
14 ** Bitblaster for the eager BV solver.
17 #include "cvc4_private.h"
19 #ifndef __CVC4__THEORY__BV__BITBLAST__EAGER_BITBLASTER_H
20 #define __CVC4__THEORY__BV__BITBLAST__EAGER_BITBLASTER_H
22 #include <unordered_set>
24 #include "theory/bv/bitblast/bitblaster.h"
26 #include "proof/bitvector_proof.h"
27 #include "proof/resolution_bitvector_proof.h"
28 #include "prop/cnf_stream.h"
29 #include "prop/sat_solver.h"
35 class BitblastingRegistrar
;
38 class EagerBitblaster
: public TBitblaster
<Node
>
41 EagerBitblaster(TheoryBV
* theory_bv
, context::Context
* context
);
44 void addAtom(TNode atom
);
45 void makeVariable(TNode node
, Bits
& bits
) override
;
46 void bbTerm(TNode node
, Bits
& bits
) override
;
47 void bbAtom(TNode node
) override
;
48 Node
getBBAtom(TNode node
) const override
;
49 bool hasBBAtom(TNode atom
) const override
;
50 void bbFormula(TNode formula
);
51 void storeBBAtom(TNode atom
, Node atom_bb
) override
;
52 void storeBBTerm(TNode node
, const Bits
& bits
) override
;
54 bool assertToSat(TNode node
, bool propagate
= true);
56 bool solve(const std::vector
<Node
>& assumptions
);
57 bool collectModelInfo(TheoryModel
* m
, bool fullModel
);
60 context::Context
* d_context
;
62 typedef std::unordered_set
<TNode
, TNodeHashFunction
> TNodeSet
;
63 std::unique_ptr
<prop::SatSolver
> d_satSolver
;
64 std::unique_ptr
<BitblastingRegistrar
> d_bitblastingRegistrar
;
70 // This is either an MinisatEmptyNotify or NULL.
71 std::unique_ptr
<MinisatEmptyNotify
> d_notify
;
73 Node
getModelFromSatSolver(TNode a
, bool fullModel
) override
;
74 prop::SatSolver
* getSatSolver() override
{ return d_satSolver
.get(); }
75 bool isSharedTerm(TNode node
);
78 class BitblastingRegistrar
: public prop::Registrar
81 BitblastingRegistrar(EagerBitblaster
* bb
) : d_bitblaster(bb
) {}
82 void preRegister(Node n
) override
{ d_bitblaster
->bbAtom(n
); }
85 EagerBitblaster
* d_bitblaster
;
91 #endif // __CVC4__THEORY__BV__BITBLAST__EAGER_BITBLASTER_H