Skip to content

Commit 61633ab

Browse files
authored
HOTFIX abort rewrite when SMT solver times out (#4078)
When the SMT solver timed out while checking `requires` clauses of a rule, the unclear conditions were returned in the same way as conditions that were known to be indeterminate. This created bogus branches in proofs when the solver had a problem to decide a condition. On such timeouts, and on inconsistent ground truths, booster now aborts the entire rewrite. This might lead to increased spurious aborts in complex proofs, but is probably better than having to prune the bogus branches from the client side. The fall-back to legacy kore was able to prune the bogus branch easily in the case that was investigated.
1 parent 097e560 commit 61633ab

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

booster/library/Booster/Pattern/Rewrite.hs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -590,15 +590,18 @@ applyRule pat@Pattern{ceilConditions} rule =
590590
-- check unclear requires-clauses in the context of known constraints (priorKnowledge)
591591
solver <- lift $ RewriteT $ (.smtSolver) <$> ask
592592
SMT.checkPredicates solver pat.constraints pat.substitution (Set.fromList stillUnclear) >>= \case
593-
SMT.IsUnknown reason -> do
594-
withContext CtxWarn $ logMessage reason
595-
-- return unclear rewrite rule condition if the condition is indeterminate
596-
withContext CtxConstraint . withContext CtxWarn . logMessage $
593+
SMT.IsUnknown SMT.ImplicationIndeterminate -> do
594+
-- return unclear conditions if SMT solver reports the condition indeterminate
595+
withContexts [CtxConstraint, CtxSMT] . logMessage $
597596
WithJsonMessage (object ["conditions" .= (externaliseTerm . coerce <$> stillUnclear)]) $
598597
renderOneLineText $
599-
"Uncertain about condition(s) in a rule:"
598+
"Indeterminate condition(s) after SMT solver:"
600599
<+> (hsep . punctuate comma . map (pretty' @mods) $ stillUnclear)
601-
pure unclearRequires
600+
pure stillUnclear
601+
SMT.IsUnknown reason -> do
602+
-- abort on unclear predicates due to SMT solver timeout or inconsistent ground truth
603+
withContexts [CtxConstraint, CtxSMT, CtxWarn] $ logMessage reason
604+
smtUnclear stillUnclear
602605
SMT.IsInvalid -> do
603606
-- requires is actually false given the prior
604607
withContext CtxFailure $ logMessage ("Required clauses evaluated to #Bottom." :: Text)
@@ -649,7 +652,7 @@ applyRule pat@Pattern{ceilConditions} rule =
649652

650653
pure newConstraints
651654

652-
smtUnclear :: [Predicate] -> RewriteRuleAppT (RewriteT io) ()
655+
smtUnclear :: [Predicate] -> RewriteRuleAppT (RewriteT io) a
653656
smtUnclear predicates = do
654657
ModifiersRep (_ :: FromModifiersT mods => Proxy mods) <- getPrettyModifiers
655658
withContext CtxConstraint . withContext CtxAbort . logMessage $

0 commit comments

Comments
 (0)