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 "prop/cnf_stream.h"
27 #include "prop/sat_solver.h"
33 class BitblastingRegistrar
;
36 class EagerBitblaster
: public TBitblaster
<Node
>
39 EagerBitblaster(TheoryBV
* theory_bv
, context::Context
* context
);
42 void addAtom(TNode atom
);
43 void makeVariable(TNode node
, Bits
& bits
) override
;
44 void bbTerm(TNode node
, Bits
& bits
) override
;
45 void bbAtom(TNode node
) override
;
46 Node
getBBAtom(TNode node
) const override
;
47 bool hasBBAtom(TNode atom
) const override
;
48 void bbFormula(TNode formula
);
49 void storeBBAtom(TNode atom
, Node atom_bb
) override
;
50 void storeBBTerm(TNode node
, const Bits
& bits
) override
;
52 bool assertToSat(TNode node
, bool propagate
= true);
54 bool solve(const std::vector
<Node
>& assumptions
);
55 bool collectModelInfo(TheoryModel
* m
, bool fullModel
);
56 void setProofLog(BitVectorProof
* bvp
);
59 context::Context
* d_context
;
60 std::unique_ptr
<context::Context
> d_nullContext
;
62 typedef std::unordered_set
<TNode
, TNodeHashFunction
> TNodeSet
;
63 // sat solver used for bitblasting and associated CnfStream
64 std::unique_ptr
<prop::SatSolver
> d_satSolver
;
65 std::unique_ptr
<BitblastingRegistrar
> d_bitblastingRegistrar
;
66 std::unique_ptr
<prop::CnfStream
> d_cnfStream
;
72 // This is either an MinisatEmptyNotify or NULL.
73 std::unique_ptr
<MinisatEmptyNotify
> d_notify
;
75 Node
getModelFromSatSolver(TNode a
, bool fullModel
) override
;
76 bool isSharedTerm(TNode node
);
79 class BitblastingRegistrar
: public prop::Registrar
82 BitblastingRegistrar(EagerBitblaster
* bb
) : d_bitblaster(bb
) {}
83 void preRegister(Node n
) override
{ d_bitblaster
->bbAtom(n
); }
86 EagerBitblaster
* d_bitblaster
;
92 #endif // __CVC4__THEORY__BV__BITBLAST__EAGER_BITBLASTER_H