Skip to content

Commit fecafeb

Browse files
committed
Emit log only if the remainder is satisfiable
1 parent 9d04cb9 commit fecafeb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

kore/src/Kore/Log/DebugRewriteRulesRemainder.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ import Pretty (
3838
)
3939
import Pretty qualified
4040

41+
{- This log entry will be emitted if, after unifying with rewrite rules,
42+
there is a satisfiable remainder condition -}
4143
data DebugRewriteRulesRemainder = DebugRewriteRulesRemainder
4244
{ configuration :: !(Pattern VariableName)
45+
-- ^ the state the rules unified with
4346
, rulesCount :: !Int
47+
-- ^ how many rules were unified
4448
, remainder :: !(Predicate RewritingVariableName)
49+
-- ^ the condition not covered by the rules
4550
}
4651
deriving stock (Show)
4752

@@ -81,7 +86,7 @@ instance Entry DebugRewriteRulesRemainder where
8186
[ "After applying "
8287
, pretty rulesCount
8388
, " rewrite rules"
84-
, "there is a remainder condition: "
89+
, "there is a satisfiable remainder condition: "
8590
, Pretty.group . pretty $ remainder
8691
]
8792
)

kore/src/Kore/Rewrite/RewriteStep.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ finalizeRulesParallel
306306
& fmap fold
307307
let unifications = MultiOr.make (Conditional.withoutTerm <$> unifiedRules)
308308
remainderPredicate = Remainder.remainder' unifications
309-
debugRewriteRulesRemainder initial (length unifiedRules) remainderPredicate
310309
-- evaluate the remainder predicate to make sure it is actually satisfiable
311310
SMT.evalPredicate
312311
(ErrorDecidePredicateUnknown $srcLoc Nothing)
@@ -316,7 +315,8 @@ finalizeRulesParallel
316315
-- remainder condition is UNSAT: we prune the remainder branch early to avoid
317316
-- jumping into the pit of function evaluation in the configuration under the
318317
-- contradictory condition (the unsatisfiable remainder)
319-
Just False ->
318+
Just False -> do
319+
debugRewriteRulesRemainder initial (length unifiedRules) remainderPredicate
320320
return
321321
Step.Results
322322
{ results = Seq.fromList results

0 commit comments

Comments
 (0)