Skip to content

Commit 6bbfd27

Browse files
author
Martin Blicha
committed
Storing clause partitioning directly in Proof
This cleans up Cnfizer a bit, because it does not need to know about the partitioning anymore.
1 parent 8d0a77e commit 6bbfd27

File tree

14 files changed

+25
-51
lines changed

14 files changed

+25
-51
lines changed

src/api/MainSolver.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ sstat MainSolver::simplifyFormulas(char** err_msg)
165165
}
166166
assert(pmanager.getPartitionIndex(fla) != -1);
167167
pmanager.propagatePartitionMask(fla);
168+
getSMTSolver().setPartition(pmanager.getPartitionIndex(fla));
168169
status = giveToSolver(fla, frame.getId());
169170
}
170171
} else {

src/api/MainSolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class MainSolver
166166
pmanager(logic),
167167
config(conf),
168168
pfstore(getTheory().pfstore),
169-
ts( config, logic, pmanager, term_mapper, *smt_solver ),
169+
ts( config, logic, term_mapper, *smt_solver ),
170170
solver_name {std::move(name)},
171171
check_called(0),
172172
status(s_Undef),

src/api/PartitionManager.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ PartitionManager::getPartition(const ipartitions_t& mask, PartitionManager::part
6969
return A;
7070
}
7171

72-
void
73-
PartitionManager::addClauseClassMask(CRef c, const ipartitions_t& toadd)
74-
{
75-
partitionInfo.addClausePartition(c, toadd);
76-
}
77-
7872
void
7973
PartitionManager::invalidatePartitions(const ipartitions_t& toinvalidate) {
8074
partitionInfo.invalidatePartitions(toinvalidate);

src/api/PartitionManager.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ class PartitionManager {
4242

4343
ipartitions_t computeAllowedPartitions(PTRef p);
4444

45-
const ipartitions_t & getClauseClassMask(CRef c) const { return partitionInfo.getClausePartitions(c); }
46-
47-
void addClauseClassMask(CRef c, const ipartitions_t & toadd);
48-
4945
void invalidatePartitions(const ipartitions_t & toinvalidate);
5046

5147
inline std::vector<PTRef> getPartitions() { return partitionInfo.getTopLevelFormulas(); }

src/cnfizers/Cnfizer.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ using namespace std;
3333

3434
Cnfizer::Cnfizer ( SMTConfig &config_
3535
, Logic &logic_
36-
, PartitionManager &pmanager_
3736
, TermMapper &tmap
3837
, SimpSMTSolver &solver_
3938
) :
4039
solver (solver_)
4140
, config (config_ )
4241
, logic (logic_)
43-
, pmanager (pmanager_)
4442
, tmap (tmap)
4543
, s_empty (true)
4644
, alreadyAsserted(logic.getTerm_true())
@@ -52,7 +50,6 @@ Cnfizer::Cnfizer ( SMTConfig &config_
5250
void Cnfizer::initialize()
5351
{
5452
// TODO: MB: why is all this initialization necessary?
55-
currentPartition = 0;
5653
vec<Lit> c;
5754
Lit l = this->getOrCreateLiteralFor (logic.getTerm_true());
5855
c.push (l);
@@ -61,7 +58,6 @@ void Cnfizer::initialize()
6158
l = this->getOrCreateLiteralFor (logic.getTerm_false());
6259
c.push (~l);
6360
addClause(c);
64-
currentPartition = -1;
6561
}
6662

6763
lbool
@@ -148,11 +144,6 @@ lbool Cnfizer::cnfizeAndGiveToSolver(PTRef formula, FrameId frame_id)
148144
#ifdef PEDANTIC_DEBUG
149145
cerr << "cnfizerAndGiveToSolver: " << logic.printTerm (formula) << endl;
150146
#endif
151-
152-
if (keepPartitionInfo()) {
153-
assert(pmanager.getPartitionIndex(formula) != -1);
154-
currentPartition = pmanager.getPartitionIndex(formula);
155-
}
156147
vec<PTRef> top_level_formulae;
157148
// Retrieve top-level formulae - this is a list constructed from a conjunction
158149
retrieveTopLevelFormulae (formula, top_level_formulae);
@@ -214,7 +205,6 @@ lbool Cnfizer::cnfizeAndGiveToSolver(PTRef formula, FrameId frame_id)
214205
declareVars(logic.propFormulasAppearingInUF);
215206
}
216207

217-
currentPartition = -1;
218208
return res == false ? l_False : l_Undef;
219209
}
220210

@@ -442,15 +432,6 @@ bool Cnfizer::addClause(const vec<Lit> & c_in)
442432
#endif
443433
opensmt::pair<CRef, CRef> iorefs{CRef_Undef, CRef_Undef};
444434
bool res = solver.addOriginalSMTClause(c, iorefs);
445-
if (keepPartitionInfo()) {
446-
CRef ref = iorefs.first;
447-
if (ref != CRef_Undef) {
448-
ipartitions_t parts = 0;
449-
assert(currentPartition != -1);
450-
setbit(parts, static_cast<unsigned int>(currentPartition));
451-
pmanager.addClauseClassMask(ref, parts);
452-
}
453-
}
454435
return res;
455436
}
456437
//

src/cnfizers/Cnfizer.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3030
#include "Global.h"
3131
#include "Theory.h"
3232
#include "Logic.h"
33-
#include "PartitionManager.h"
3433
#include "TermMapper.h"
3534

3635
#include <unordered_set>
3736

3837
class SimpSMTSolver;
39-
class CnfState;
4038
class THandler;
4139
struct SMTConfig;
4240

@@ -50,7 +48,6 @@ class Cnfizer
5048
protected:
5149
SMTConfig& config;
5250
Logic& logic;
53-
PartitionManager& pmanager;
5451
TermMapper& tmap;
5552
bool s_empty;
5653

@@ -70,7 +67,6 @@ class Cnfizer
7067

7168
Cnfizer( SMTConfig & config_
7269
, Logic& logic_
73-
, PartitionManager& pmanager_
7470
, TermMapper& tmap_
7571
, SimpSMTSolver& solver_
7672
);
@@ -121,8 +117,6 @@ class Cnfizer
121117

122118
bool keepPartitionInfo() const { return config.produce_inter(); }
123119

124-
int currentPartition = -1;
125-
126120
PTRef frame_term;
127121
vec<PTRef> frame_terms;
128122
void setFrameTerm(FrameId frame_id);

src/cnfizers/Tseitin.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ class Tseitin : public Cnfizer
3737

3838
Tseitin( SMTConfig& config_
3939
, Logic& logic_
40-
, PartitionManager &pmanager_
4140
, TermMapper& tmap_
4241
, SimpSMTSolver& solver_
4342
)
4443
: Cnfizer( config_
4544
, logic_
46-
, pmanager_
4745
, tmap_
4846
, solver_ )
4947
, alreadyCnfized(logic_.getTerm_true())

src/common/PartitionInfo.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ PartitionInfo::addIPartitions(SymRef _s, const ipartitions_t& _p) {
3535
sym_partitions[_s] |= _p;
3636
}
3737

38-
const ipartitions_t & PartitionInfo::getClausePartitions(CRef c) const {
39-
return clause_class.at(c);
40-
}
41-
42-
void PartitionInfo::addClausePartition(CRef c, const ipartitions_t & p) {
43-
// opensmt::orbit(clause_class[c], clause_class[c], p);
44-
clause_class[c] |= p;
45-
}
4638

4739
void PartitionInfo::invalidatePartitions(const ipartitions_t& toinvalidate) {
4840
auto negated = ~toinvalidate;

src/common/PartitionInfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
class PartitionInfo {
1818
std::unordered_map<SymRef, ipartitions_t, SymRefHash> sym_partitions;
1919
std::unordered_map<PTRef, ipartitions_t, PTRefHash> term_partitions;
20-
std::unordered_map<CRef, ipartitions_t> clause_class;
2120
FlaPartitionMap flaPartitionMap;
2221

2322
public:
@@ -26,8 +25,6 @@ class PartitionInfo {
2625
void addIPartitions(PTRef t, const ipartitions_t& p);
2726
ipartitions_t& getIPartitions(SymRef _s);
2827
void addIPartitions(SymRef s, const ipartitions_t& p);
29-
const ipartitions_t& getClausePartitions(CRef) const;
30-
void addClausePartition(CRef c, const ipartitions_t& p);
3128

3229
inline std::vector<PTRef> getTopLevelFormulas() const { return flaPartitionMap.get_top_level_flas(); }
3330
inline unsigned int getNoOfPartitions() const {return flaPartitionMap.getNoOfPartitions(); }

src/proof/PGBuild.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void ProofGraph::buildProofGraph( int nVars )
238238
if (_ctype == clause_type::CLA_ORIG) {
239239
n->initClause(proof.getClause(clause));
240240
n->setClauseRef(clause);
241-
n->setInterpPartitionMask(pmanager.getClauseClassMask(clause));
241+
n->setInterpPartitionMask(proof.getClauseClassMask(clause));
242242
//Sort clause literals
243243
std::sort(n->getClause().begin(),n->getClause().end());
244244
if (n->getClauseSize() >= max_leaf_size) {

0 commit comments

Comments
 (0)