@@ -12,6 +12,7 @@ module Booster.SMT.Interface (
12
12
SMTError (.. ),
13
13
initSolver ,
14
14
noSolver ,
15
+ isNoSolver ,
15
16
finaliseSolver ,
16
17
getModelFor ,
17
18
checkPredicates ,
@@ -34,7 +35,7 @@ import Data.Either.Extra (fromLeft', fromRight')
34
35
import Data.IORef
35
36
import Data.Map (Map )
36
37
import Data.Map qualified as Map
37
- import Data.Maybe (fromMaybe )
38
+ import Data.Maybe (fromMaybe , isNothing )
38
39
import Data.Set (Set )
39
40
import Data.Set qualified as Set
40
41
import Data.Text as Text (Text , pack , unlines , unwords )
@@ -121,6 +122,10 @@ noSolver = do
121
122
, options = defaultSMTOptions{retryLimit = Just 0 }
122
123
}
123
124
125
+ -- | Detect of the @SMTContext@ does not have a solver
126
+ isNoSolver :: SMT. SMTContext -> Bool
127
+ isNoSolver SMTContext {mbSolver} = isNothing mbSolver
128
+
124
129
-- | Hot-swap @SMTOptions@ in the active @SMTContext@, update the query timeout
125
130
swapSmtOptions :: forall io . Log. LoggerMIO io => SMTOptions -> SMT io ()
126
131
swapSmtOptions smtOptions = do
@@ -163,10 +168,14 @@ checkPrelude = do
163
168
case check of
164
169
Sat -> pure ()
165
170
other -> do
166
- Log. logMessage $ " Initial SMT definition check returned " <> pack (show other)
167
- SMT get >>= closeContext
168
- throwSMT' $
169
- " Aborting due to potentially-inconsistent SMT setup: Initial check returned " <> show other
171
+ ctxt <- SMT get
172
+ if isNoSolver ctxt
173
+ then -- when running with a dummy solver, ignore the Unknown prelude check
174
+ pure ()
175
+ else do
176
+ Log. logMessage $ " Initial SMT definition check returned " <> pack (show other)
177
+ throwSMT' $
178
+ " Aborting due to potentially-inconsistent SMT setup: Initial check returned " <> show other
170
179
171
180
-- | Send the commands from the definition's SMT prelude
172
181
runPrelude :: Log. LoggerMIO io => SMT io ()
0 commit comments