@@ -12,6 +12,7 @@ module Booster.SMT.Interface (
1212 SMTError (.. ),
1313 initSolver ,
1414 noSolver ,
15+ isNoSolver ,
1516 finaliseSolver ,
1617 getModelFor ,
1718 checkPredicates ,
@@ -34,7 +35,7 @@ import Data.Either.Extra (fromLeft', fromRight')
3435import Data.IORef
3536import Data.Map (Map )
3637import Data.Map qualified as Map
37- import Data.Maybe (fromMaybe )
38+ import Data.Maybe (fromMaybe , isNothing )
3839import Data.Set (Set )
3940import Data.Set qualified as Set
4041import Data.Text as Text (Text , pack , unlines , unwords )
@@ -121,6 +122,10 @@ noSolver = do
121122 , options = defaultSMTOptions{retryLimit = Just 0 }
122123 }
123124
125+ -- | Detect of the @SMTContext@ does not have a solver
126+ isNoSolver :: SMT. SMTContext -> Bool
127+ isNoSolver SMTContext {mbSolver} = isNothing mbSolver
128+
124129-- | Hot-swap @SMTOptions@ in the active @SMTContext@, update the query timeout
125130swapSmtOptions :: forall io . Log. LoggerMIO io => SMTOptions -> SMT io ()
126131swapSmtOptions smtOptions = do
@@ -163,10 +168,14 @@ checkPrelude = do
163168 case check of
164169 Sat -> pure ()
165170 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
170179
171180-- | Send the commands from the definition's SMT prelude
172181runPrelude :: Log. LoggerMIO io => SMT io ()
0 commit comments