-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retry SMT query once if it fails (#2224)
* Retry SMT query once if it fails * checkPredicate: only run SMT.check * decidePredicate: Restart query after first failure * Clean-up: remove empty * Clean-up: use MaybeT instance of MonadSMT * Update kore/src/Kore/Log/ErrorDecidePredicateUnknown.hs Co-authored-by: Thomas Tuegel <ttuegel@mailbox.org> * Update WarnRetrySolverQuery.hs Co-authored-by: Thomas Tuegel <ttuegel@mailbox.org>
- Loading branch information
1 parent
11e10fb
commit 7ecea69
Showing
4 changed files
with
109 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{- | | ||
Copyright : (c) Runtime Verification, 2020 | ||
License : NCSA | ||
-} | ||
|
||
module Kore.Log.WarnRetrySolverQuery | ||
( WarnRetrySolverQuery | ||
, warnRetrySolverQuery | ||
) where | ||
|
||
import Prelude.Kore | ||
|
||
import Kore.Internal.Predicate | ||
( Predicate | ||
) | ||
import qualified Kore.Internal.Predicate as Predicate | ||
import Kore.Internal.Variable | ||
( InternalVariable | ||
, VariableName | ||
, toVariableName | ||
) | ||
import Kore.Unparser | ||
( unparse | ||
) | ||
import Log | ||
import Pretty | ||
( Pretty (..) | ||
) | ||
import qualified Pretty | ||
|
||
newtype WarnRetrySolverQuery = | ||
WarnRetrySolverQuery | ||
{ predicates :: NonEmpty (Predicate VariableName) } | ||
deriving (Show) | ||
|
||
instance Pretty WarnRetrySolverQuery where | ||
pretty WarnRetrySolverQuery { predicates } = | ||
Pretty.vsep $ | ||
[ "The SMT solver initially failed to solve the following query:" | ||
, Pretty.indent 2 "Decide predicate:" | ||
, Pretty.indent 4 (unparse predicate) | ||
, Pretty.indent 2 "with side conditions:" | ||
] | ||
<> fmap (Pretty.indent 4 . unparse) sideConditions | ||
<> ["The SMT solver was reset and the query\ | ||
\ was tried one more time." | ||
] | ||
where | ||
predicate :| sideConditions = predicates | ||
|
||
instance Entry WarnRetrySolverQuery where | ||
entrySeverity _ = Warning | ||
helpDoc _ = | ||
"warning raised when the solver failed to decide\ | ||
\ the satisfiability of a formula, indicating that\ | ||
\ the solver was reset and the formula retried" | ||
|
||
warnRetrySolverQuery | ||
:: InternalVariable variable | ||
=> MonadLog log | ||
=> NonEmpty (Predicate variable) | ||
-> log () | ||
warnRetrySolverQuery predicates' = | ||
logEntry WarnRetrySolverQuery { predicates } | ||
where | ||
predicates = | ||
Predicate.mapVariables (pure toVariableName) <$> predicates' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters