Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
i7
peregrine
Commits
df541473
Commit
df541473
authored
Aug 02, 2018
by
Philipp Meyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to switch between Z3 and CVC4
parent
e0a8a025
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
src/Options.hs
src/Options.hs
+16
-1
src/Solver.hs
src/Solver.hs
+10
-3
No files found.
src/Options.hs
View file @
df541473
{-# LANGUAGE TupleSections #-}
module
Options
(
InputFormat
(
..
),
OutputFormat
(
..
),
RefinementType
(
..
),
RefinementOption
(
..
),
(
InputFormat
(
..
),
OutputFormat
(
..
),
RefinementType
(
..
),
RefinementOption
(
..
),
BackendSolver
(
..
),
PropertyOption
(
..
),
Options
(
..
),
startOptions
,
options
,
parseArgs
,
usageInformation
)
where
...
...
@@ -20,6 +20,9 @@ instance Show InputFormat where
instance
Show
OutputFormat
where
show
OutDOT
=
"DOT"
data
BackendSolver
=
Z3
|
CVC4
data
RefinementType
=
TrapRefinement
|
SiphonRefinement
|
UTrapRefinement
...
...
@@ -37,6 +40,7 @@ data Options = Options { inputFormat :: InputFormat
,
optVerbosity
::
Int
,
optShowHelp
::
Bool
,
optShowVersion
::
Bool
,
optSolver
::
BackendSolver
,
optProperties
::
PropertyOption
,
optRefinementType
::
RefinementOption
,
optMinimizeRefinement
::
Int
...
...
@@ -52,6 +56,7 @@ startOptions = Options { inputFormat = InPP
,
optVerbosity
=
1
,
optShowHelp
=
False
,
optShowVersion
=
False
,
optSolver
=
Options
.
Z3
,
optProperties
=
PropDefault
,
optRefinementType
=
RefDefault
,
optMinimizeRefinement
=
0
...
...
@@ -88,6 +93,16 @@ options =
(
NoArg
(
\
opt
->
Right
opt
{
optInvariant
=
True
}))
"Generate an invariant"
,
Option
""
[
"solver"
]
(
ReqArg
(
\
arg
opt
->
case
arg
of
"z3"
->
Right
opt
{
optSolver
=
Options
.
Z3
}
"cvc4"
->
Right
opt
{
optSolver
=
Options
.
CVC4
}
_
->
Left
(
"invalid argument for refinement method: "
++
arg
)
)
"SOLVER"
)
(
"Use backend solver SOLVER (z3, cvc4)"
)
,
Option
"r"
[
"refinement"
]
(
ReqArg
(
\
arg
opt
->
let
addRef
ref
=
...
...
src/Solver.hs
View file @
df541473
...
...
@@ -32,15 +32,22 @@ symConstraints vars exVars allVars constraint = do
allSyms
<-
mapM
forall
allVars
return
$
constraint
$
val
$
M
.
fromList
$
(
vars
`
zip
`
syms
)
++
(
exVars
`
zip
`
exSyms
)
++
(
allVars
`
zip
`
allSyms
)
getSolverConfig
::
Bool
->
SMTConfig
getSolverConfig
verbose
=
z3
{
verbose
=
verbose
}
getSolverConfig
::
BackendSolver
->
Bool
->
SMTConfig
getSolverConfig
Options
.
Z3
verbose
=
z3
{
verbose
=
verbose
}
getSolverConfig
Options
.
CVC4
verbose
=
cvc4
{
verbose
=
verbose
,
solverSetOptions
=
[]
,
solver
=
(
solver
cvc4
)
{
Data
.
SBV
.
options
=
const
[
"--lang"
,
"smt"
,
"--incremental"
,
"--no-interactive-prompt"
]
}
}
checkSat
::
(
SatModel
a
,
SymWord
a
,
Show
a
,
Show
b
)
=>
ConstraintProblem
a
b
->
OptIO
(
Maybe
b
)
checkSat
(
problemName
,
resultName
,
vars
,
exVars
,
allVars
,
constraint
,
interpretation
)
=
do
verbosePut
2
$
"Checking SAT of "
++
problemName
verbosity
<-
opt
optVerbosity
result
<-
liftIO
(
satWith
(
getSolverConfig
(
verbosity
>=
4
))
solver
<-
opt
optSolver
result
<-
liftIO
(
satWith
(
getSolverConfig
solver
(
verbosity
>=
4
))
(
symConstraints
vars
exVars
allVars
constraint
))
case
rebuildModel
vars
(
getModelAssignment
result
)
of
Nothing
->
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment