Skip to content

Commit 723019d

Browse files
committed
Try simplifying the remainder predicate before checking it with SMT
1 parent d04ebc0 commit 723019d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

kore/src/Kore/Rewrite/RewriteStep.hs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import Kore.Simplify.Simplify (
8484
Simplifier,
8585
simplifyCondition,
8686
)
87+
import Kore.Simplify.Simplify qualified as Simplifier
8788
import Kore.Substitute
8889
import Logic (
8990
LogicT,
@@ -306,11 +307,22 @@ finalizeRulesParallel
306307
& fmap fold
307308
let unifications = MultiOr.make (Conditional.withoutTerm <$> unifiedRules)
308309
remainderPredicate = Remainder.remainder' unifications
309-
debugRewriteRulesRemainder initial (length unifiedRules) remainderPredicate
310+
311+
simplifiedRemainderConditional <-
312+
Logic.observeAllT $
313+
Simplifier.simplifyCondition
314+
( sideCondition
315+
& SideCondition.addConditionWithReplacements
316+
(Pattern.withoutTerm initial)
317+
)
318+
(Condition.fromPredicate remainderPredicate)
319+
let simplifiedRemainder = Remainder.remainder' $ MultiOr.make simplifiedRemainderConditional
320+
321+
debugRewriteRulesRemainder initial (length unifiedRules) simplifiedRemainder
310322
-- evaluate the remainder predicate to make sure it is actually satisfiable
311323
SMT.evalPredicate
312324
(ErrorDecidePredicateUnknown $srcLoc Nothing)
313-
remainderPredicate
325+
simplifiedRemainder
314326
Nothing
315327
>>= \case
316328
-- remainder condition is UNSAT: we prune the remainder branch early to avoid

0 commit comments

Comments
 (0)