@@ -107,8 +107,6 @@ void MainSolver::insertFormula(PTRef fla) {
107107 if (logic.getSortRef (fla) != logic.getSort_bool ()) {
108108 throw ApiException (" Top-level assertion sort must be Bool, got " + logic.printSort (logic.getSortRef (fla)));
109109 }
110- // TODO: Move this to preprocessing of the formulas
111- fla = IteHandler (logic, getPartitionManager ().getNofPartitions ()).rewrite (fla);
112110
113111 if (trackPartitions ()) {
114112 // MB: Important for HiFrog! partition index is the index of the formula in an virtual array of inserted
@@ -147,7 +145,10 @@ sstat MainSolver::simplifyFormulas() {
147145 if (context.perPartition ) {
148146 vec<PTRef> frameFormulas;
149147 for (PTRef fla : frames[i].formulas ) {
150- PTRef processed = theory->preprocessAfterSubstitutions (fla, context);
148+ auto const partitionIndex = pmanager.getPartitionIndex (fla);
149+ simplifiedFormulasCount++;
150+ PTRef processed = IteHandler (logic, partitionIndex).rewrite (fla);
151+ processed = theory->preprocessAfterSubstitutions (processed, context);
151152 pmanager.transferPartitionMembership (fla, processed);
152153 frameFormulas.push (processed);
153154 preprocessor.addPreprocessedFormula (processed);
@@ -172,7 +173,13 @@ sstat MainSolver::simplifyFormulas() {
172173 if (status == s_False) { break ; }
173174 }
174175 } else {
175- PTRef frameFormula = logic.mkAnd (frames[i].formulas );
176+ vec<PTRef> frameFormulas;
177+ for (PTRef fla : frames[i].formulas ) {
178+ fla = IteHandler (logic, simplifiedFormulasCount++).rewrite (fla);
179+ frameFormulas.push (fla);
180+ }
181+
182+ PTRef frameFormula = logic.mkAnd (std::move (frameFormulas));
176183 if (context.frameCount > 0 ) { frameFormula = applyLearntSubstitutions (frameFormula); }
177184 frameFormula = theory->preprocessBeforeSubstitutions (frameFormula, context);
178185 frameFormula = substitutionPass (frameFormula, context);
@@ -481,6 +488,7 @@ PTRef MainSolver::applyLearntSubstitutions(PTRef fla) {
481488}
482489
483490PTRef MainSolver::substitutionPass (PTRef fla, PreprocessingContext const & context) {
491+ assert (not trackPartitions ());
484492 if (not config.do_substitutions ()) { return fla; }
485493 auto res = computeSubstitutions (fla);
486494 vec<PTRef> args;
0 commit comments