@@ -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
571575PTRef 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;
0 commit comments