Skip to content

Commit 1f2a22b

Browse files
Merge pull request #2513 from clayrat/cvc5-opt
scan for cvc5 before cvc4 + generate the error msg for missing smt
2 parents 82e07ab + e132e58 commit 1f2a22b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

liquidhaskell-boot/src/Language/Haskell/Liquid/UX/CmdLine.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import System.Console.CmdArgs.Implicit hiding (Verbosity(..))
5959
import System.Console.CmdArgs.Text
6060
import GitHash
6161

62-
import Data.List (nub)
62+
import Data.List (nub, intercalate)
6363

6464

6565
import System.FilePath (isAbsolute, takeDirectory, (</>))
@@ -376,7 +376,7 @@ config = cmdArgsMode $ Config {
376376
= def
377377
&= help "Eta expand and beta reduce terms to aid PLE"
378378
&= name "etabeta"
379-
379+
380380
, dependantCase
381381
= def
382382
&= help "Allow PLE to reason about dependent cases"
@@ -524,12 +524,13 @@ withSmtSolver cfg =
524524
case found of
525525
Just _ -> return cfg
526526
Nothing -> panic Nothing (missingSmtError smt)
527-
Nothing -> do smts <- mapM findSmtSolver [FC.Z3, FC.Cvc4, FC.Mathsat]
527+
Nothing -> do smts <- mapM findSmtSolver smtLookupOrder
528528
case catMaybes smts of
529529
(s:_) -> return (cfg {smtsolver = Just s})
530530
_ -> panic Nothing noSmtError
531531
where
532-
noSmtError = "LiquidHaskell requires an SMT Solver, i.e. z3, cvc4, or mathsat to be installed."
532+
smtLookupOrder = [FC.Z3, FC.Cvc5, FC.Cvc4, FC.Mathsat]
533+
noSmtError = "LiquidHaskell requires one of the following SMT solvers to be installed: " ++ intercalate ", " (show <$> smtLookupOrder) ++ "."
533534
missingSmtError smt = "Could not find SMT solver '" ++ show smt ++ "'. Is it on your PATH?"
534535

535536
findSmtSolver :: FC.SMTSolver -> IO (Maybe FC.SMTSolver)

liquidhaskell-boot/src/Language/Haskell/Liquid/UX/Config.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ data Config = Config
7474
, minPartSize :: Int -- ^ Minimum size of a partition
7575
, maxPartSize :: Int -- ^ Maximum size of a partition. Overrides minPartSize
7676
, maxParams :: Int -- ^ the maximum number of parameters to accept when mining qualifiers
77-
, smtsolver :: Maybe SMTSolver -- ^ name of smtsolver to use [default: try z3, cvc4, mathsat in order]
77+
, smtsolver :: Maybe SMTSolver -- ^ SMT solver to use [if `Nothing`, try looking one up using the order defined in L.H.L.UX.CmdLine.withSmtSolver]
7878
, shortNames :: Bool -- ^ drop module qualifers from pretty-printed names.
7979
, shortErrors :: Bool -- ^ don't show subtyping errors and contexts.
8080
, cabalDir :: Bool -- ^ find and use .cabal file to include paths to sources for imported modules
@@ -111,11 +111,11 @@ data Config = Config
111111
, compileSpec :: Bool -- ^ Only "compile" the spec -- into .bspec file -- don't do any checking.
112112
, noCheckImports :: Bool -- ^ Do not check the transitive imports
113113
, typeclass :: Bool -- ^ enable typeclass support.
114-
, auxInline :: Bool -- ^
114+
, auxInline :: Bool -- ^
115115
, rwTerminationCheck :: Bool -- ^ Enable termination checking for rewriting
116116
, skipModule :: Bool -- ^ Skip this module entirely (don't even compile any specs in it)
117117
, noLazyPLE :: Bool
118-
, fuel :: Maybe Int -- ^ Maximum PLE "fuel" (unfold depth) (default=infinite)
118+
, fuel :: Maybe Int -- ^ Maximum PLE "fuel" (unfold depth) (default=infinite)
119119
, environmentReduction :: Bool -- ^ Perform environment reduction
120120
, noEnvironmentReduction :: Bool -- ^ Don't perform environment reduction
121121
, inlineANFBindings :: Bool -- ^ Inline ANF bindings.

0 commit comments

Comments
 (0)