Skip to content

Commit 0425df1

Browse files
committed
Moved preprocessing of ITE terms into the preprocessing pipeline
1 parent 8d16283 commit 0425df1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/api/MainSolver.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ void MainSolver::insertFormula(PTRef fla) {
113113
if (logic.getSortRef(fla) != logic.getSort_bool()) {
114114
throw ApiException("Top-level assertion sort must be Bool, got " + logic.sortToString(logic.getSortRef(fla)));
115115
}
116-
// TODO: Move this to preprocessing of the formulas
117-
fla = IteHandler(logic, getPartitionManager().getNofPartitions()).rewrite(fla);
118116

119117
if (trackPartitions()) {
120118
// MB: Important for HiFrog! partition index is the index of the formula in an virtual array of inserted
@@ -186,6 +184,7 @@ PTRef MainSolver::preprocessFormulasDefault(vec<PTRef> const & frameFormulas, Pr
186184

187185
// Include even already preprocessed formulas which can still benefit from the new ones
188186
PTRef frameFormula = logic.mkAnd(frameFormulas);
187+
preprocessedAssertionsCount += frameFormulas.size();
189188
return preprocessFormula(frameFormula, context);
190189
}
191190

@@ -206,6 +205,8 @@ vec<PTRef> MainSolver::preprocessFormulasPerPartition(vec<PTRef> const & frameFo
206205
processedFormulas.push(processed);
207206
}
208207

208+
preprocessedAssertionsCount += processedFormulas.size();
209+
209210
assert(std::size_t(processedFormulas.size()) == formulasCountToProcess);
210211
assert(std::size_t(processedFormulas.size()) > 0);
211212
if (std::all_of(processedFormulas.begin(), processedFormulas.end(),
@@ -234,6 +235,9 @@ PTRef MainSolver::preprocessFormulaBeforeFinalTheoryPreprocessing(PTRef fla, Pre
234235
bool const perPartition = context.perPartition;
235236
PTRef processed = fla;
236237

238+
std::size_t const partitionNumber = perPartition ? pmanager.getPartitionIndex(fla) : preprocessedAssertionsCount;
239+
processed = IteHandler(logic, partitionNumber).rewrite(processed);
240+
237241
if (not perPartition) {
238242
if (context.frameCount > 0) { processed = applyLearntSubstitutions(processed); }
239243
processed = theory->preprocessBeforeSubstitutions(processed, context);
@@ -569,6 +573,7 @@ PTRef MainSolver::applyLearntSubstitutions(PTRef fla) {
569573
}
570574

571575
PTRef MainSolver::substitutionPass(PTRef fla, PreprocessingContext const & context) {
576+
assert(not trackPartitions());
572577
if (not config.do_substitutions()) { return fla; }
573578
auto res = computeSubstitutions(fla);
574579
vec<PTRef> args;

src/api/MainSolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ class MainSolver {
264264
Theory & getTheory() { return *theory; }
265265
Theory const & getTheory() const { return *theory; }
266266
TermMapper & getTermMapper() const { return *term_mapper; }
267-
PartitionManager & getPartitionManager() { return pmanager; }
268267

269268
// TODO: inefficient
270269
vec<PTRef> getCurrentAssertionsViewImpl() const { return getCurrentAssertions(); }
@@ -334,6 +333,7 @@ class MainSolver {
334333
vec<PTRef> frameTerms;
335334
std::size_t firstNotPreprocessedFrame = 0;
336335
std::size_t insertedAssertionsCount = 0;
336+
std::size_t preprocessedAssertionsCount = 0;
337337
std::vector<std::size_t> preprocessedAssertionsCountPerFrame;
338338
};
339339

0 commit comments

Comments
 (0)