Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
caisar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
caisar
Commits
a587241f
Commit
a587241f
authored
2 years ago
by
Michele Alberti
Browse files
Options
Downloads
Patches
Plain Diff
[cmdline][verification] Add support for selecting prover alternatives.
parent
f7dd4d10
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main.ml
+47
-30
47 additions, 30 deletions
src/main.ml
src/verification.ml
+24
-5
24 additions, 5 deletions
src/verification.ml
src/verification.mli
+6
-3
6 additions, 3 deletions
src/verification.mli
with
77 additions
and
38 deletions
src/main.ml
+
47
−
30
View file @
a587241f
...
@@ -135,7 +135,8 @@ let log_theory_answer =
...
@@ -135,7 +135,8 @@ let log_theory_answer =
Fmt
.(
option
~
none
:
nop
(
any
" "
++
string
))
Fmt
.(
option
~
none
:
nop
(
any
" "
++
string
))
additional_info
)))
additional_info
)))
let
verify
?
format
~
loadpath
?
memlimit
?
timelimit
?
dataset
prover
files
=
let
verify
?
format
~
loadpath
?
memlimit
?
timelimit
?
dataset
prover
?
prover_altern
files
=
let
debug
=
log_level_is_debug
()
in
let
debug
=
log_level_is_debug
()
in
let
memlimit
=
Option
.
map
memlimit
~
f
:
memlimit_of_string
in
let
memlimit
=
Option
.
map
memlimit
~
f
:
memlimit_of_string
in
let
timelimit
=
Option
.
map
timelimit
~
f
:
timelimit_of_string
in
let
timelimit
=
Option
.
map
timelimit
~
f
:
timelimit_of_string
in
...
@@ -143,7 +144,7 @@ let verify ?format ~loadpath ?memlimit ?timelimit ?dataset prover files =
...
@@ -143,7 +144,7 @@ let verify ?format ~loadpath ?memlimit ?timelimit ?dataset prover files =
List
.
map
files
List
.
map
files
~
f
:
~
f
:
(
Verification
.
verify
~
debug
?
format
~
loadpath
?
memlimit
?
timelimit
(
Verification
.
verify
~
debug
?
format
~
loadpath
?
memlimit
?
timelimit
?
dataset
prover
)
?
dataset
prover
?
prover_altern
)
in
in
List
.
iter
theory_answers
~
f
:
log_theory_answer
;
List
.
iter
theory_answers
~
f
:
log_theory_answer
;
theory_answers
theory_answers
...
@@ -285,39 +286,55 @@ let verify_cmd =
...
@@ -285,39 +286,55 @@ let verify_cmd =
let
doc
=
"File format."
in
let
doc
=
"File format."
in
Arg
.(
value
&
opt
(
some
string
)
None
&
info
[
"format"
]
~
doc
)
Arg
.(
value
&
opt
(
some
string
)
None
&
info
[
"format"
]
~
doc
)
in
in
let
term
=
let
prover
=
let
files
=
let
all_provers
=
Prover
.
list_available
()
in
let
doc
=
"File to verify."
in
let
doc
=
let
file_or_stdin
=
Arg
.
conv'
Verification
.
File
.(
of_string
,
pretty
)
in
Fmt
.
str
Arg
.(
non_empty
&
pos_all
file_or_stdin
[]
&
info
[]
~
doc
~
docv
:
"FILE"
)
"Prover to use. Support is provided for the following $(docv)s: %a."
in
(
Fmt
.
list
~
sep
:
Fmt
.
comma
Fmt
.
string
)
let
prover
=
(
List
.
map
~
f
:
Prover
.
to_string
all_provers
)
let
all_provers
=
Prover
.
list_available
()
in
let
doc
=
Fmt
.
str
"Prover to use. Support is provided for the following $(docv)s: %a."
(
Fmt
.
list
~
sep
:
Fmt
.
comma
Fmt
.
string
)
(
List
.
map
~
f
:
Prover
.
to_string
all_provers
)
in
let
provers
=
Arg
.
enum
(
List
.
map
~
f
:
(
fun
p
->
(
Prover
.
to_string
p
,
p
))
all_provers
)
in
Arg
.(
required
&
opt
(
some
provers
)
None
&
info
[
"p"
;
"prover"
]
~
doc
~
docv
:
"PROVER"
)
in
in
let
dataset
=
let
provers
=
let
doc
=
"Dataset $(docv) (CSV format only)."
in
Arg
.
enum
(
List
.
map
~
f
:
(
fun
p
->
(
Prover
.
to_string
p
,
p
))
all_provers
)
Arg
.(
value
&
opt
(
some
file
)
None
&
info
[
"dataset"
]
~
doc
~
docv
:
"FILE"
)
in
in
Arg
.(
required
&
opt
(
some
provers
)
None
&
info
[
"p"
;
"prover"
]
~
doc
~
docv
:
"PROVER"
)
in
let
prover_altern
=
let
doc
=
"Alternative prover configuration."
in
Arg
.(
value
&
opt
(
some
string
)
None
&
info
[
"prover-altern"
]
~
doc
)
in
let
dataset
=
let
doc
=
"Dataset $(docv) (CSV format only)."
in
Arg
.(
value
&
opt
(
some
file
)
None
&
info
[
"dataset"
]
~
doc
~
docv
:
"FILE"
)
in
let
files
=
let
doc
=
"File to verify."
in
let
file_or_stdin
=
Arg
.
conv'
Verification
.
File
.(
of_string
,
pretty
)
in
Arg
.(
non_empty
&
pos_all
file_or_stdin
[]
&
info
[]
~
doc
~
docv
:
"FILE"
)
in
let
term
=
Term
.(
Term
.(
const
(
fun
format
loadpath
memlimit
timelimit
prover
dataset
files
_
->
const
(
fun
format
loadpath
memlimit
timelimit
prover
prover_altern
dataset
files
_
->
exec_cmd
cmdname
(
fun
()
->
exec_cmd
cmdname
(
fun
()
->
ignore
ignore
(
verify
?
format
~
loadpath
?
memlimit
?
timelimit
?
dataset
prover
files
)))
(
verify
?
format
~
loadpath
?
memlimit
?
timelimit
?
dataset
prover
$
format
$
loadpath
$
memlimit
$
timelimit
$
prover
$
dataset
$
files
?
prover_altern
files
)))
$
setup_logs
)
$
format
$
loadpath
$
memlimit
$
timelimit
$
prover
$
prover_altern
$
dataset
$
files
$
setup_logs
)
in
in
Cmd
.
v
info
term
Cmd
.
v
info
term
...
...
This diff is collapsed.
Click to expand it.
src/verification.ml
+
24
−
5
View file @
a587241f
...
@@ -378,7 +378,7 @@ let call_prover ?dataset ~limit config env prover config_prover driver task =
...
@@ -378,7 +378,7 @@ let call_prover ?dataset ~limit config env prover config_prover driver task =
{
id
;
result
;
additional_info
}
{
id
;
result
;
additional_info
}
let
verify
?
(
debug
=
false
)
?
format
~
loadpath
?
memlimit
?
timelimit
?
dataset
let
verify
?
(
debug
=
false
)
?
format
~
loadpath
?
memlimit
?
timelimit
?
dataset
prover
file
=
prover
?
prover_altern
file
=
if
debug
then
Debug
.
set_flag
(
Debug
.
lookup_flag
"call_prover"
);
if
debug
then
Debug
.
set_flag
(
Debug
.
lookup_flag
"call_prover"
);
let
env
,
config
=
create_env
~
debug
loadpath
in
let
env
,
config
=
create_env
~
debug
loadpath
in
let
main
=
Whyconf
.
get_main
config
in
let
main
=
Whyconf
.
get_main
config
in
...
@@ -406,12 +406,31 @@ let verify ?(debug = false) ?format ~loadpath ?memlimit ?timelimit ?dataset
...
@@ -406,12 +406,31 @@ let verify ?(debug = false) ?format ~loadpath ?memlimit ?timelimit ?dataset
let
tasks
=
Task
.
split_theory
theory
None
None
in
let
tasks
=
Task
.
split_theory
theory
None
None
in
let
config_prover
=
let
config_prover
=
let
altern
=
let
altern
=
if
Prover
.
has_vnnlib_support
prover
&&
Option
.
is_some
dataset
let
default
=
then
"VNNLIB"
if
Prover
.
has_vnnlib_support
prover
&&
Option
.
is_some
dataset
else
""
then
"VNNLIB"
else
""
(* Select the default one, w/o an alternative. *)
in
Option
.
value
prover_altern
~
default
in
in
let
prover
=
Prover
.
to_string
prover
in
let
prover
=
Prover
.
to_string
prover
in
Whyconf
.(
filter_one_prover
config
(
mk_filter_prover
~
altern
prover
))
try
Whyconf
.(
filter_one_prover
config
(
mk_filter_prover
~
altern
prover
))
with
|
Whyconf
.
ProverNotFound
_
->
invalid_arg
(
Fmt
.
str
"No prover corresponds to %s%a"
prover
(
if
String
.
equal
altern
""
then
Fmt
.
nop
else
Fmt
.(
any
" "
++
parens
string
))
altern
)
|
Whyconf
.
ProverAmbiguity
_
->
invalid_arg
(
Fmt
.
str
"More than one prover correspond to %s%a"
prover
(
if
String
.
equal
altern
""
then
Fmt
.
nop
else
Fmt
.(
any
" "
++
parens
string
))
altern
)
in
in
let
driver
=
let
driver
=
match
match
...
...
This diff is collapsed.
Click to expand it.
src/verification.mli
+
6
−
3
View file @
a587241f
...
@@ -90,20 +90,23 @@ val verify :
...
@@ -90,20 +90,23 @@ val verify :
?
timelimit
:
int
->
?
timelimit
:
int
->
?
dataset
:
string
->
?
dataset
:
string
->
Prover
.
t
->
Prover
.
t
->
?
prover_altern
:
string
->
File
.
t
->
File
.
t
->
theory_answer
theory_answer
(** [verify debug format loadpath memlimit timeout dataset prover file] launches
(** [verify debug format loadpath memlimit timelimit dataset prover prover_altern file]
a verification of the given [file] with the provided [prover] and [dataset].
launches a verification of the given [file] with the provided [prover] and
[dataset].
@param debug when set, enables debug information.
@param debug when set, enables debug information.
@param format is the [file] format.
@param format is the [file] format.
@param loadpath is the additional loadpath.
@param loadpath is the additional loadpath.
@param memlimit
@param memlimit
is the memory limit (in megabytes) granted to the verification.
is the memory limit (in megabytes) granted to the verification.
@param time
ou
t is the timeout (in seconds) granted to the verification.
@param time
limi
t is the timeout (in seconds) granted to the verification.
@param dataset
@param dataset
is the filepath of a dataset (eg, in CSV format) possibly appearing in
is the filepath of a dataset (eg, in CSV format) possibly appearing in
[file].
[file].
@param prover_altern is the alternative [prover] configuration.
@return
@return
for each theory, an [answer] for each goal of the theory, respecting the
for each theory, an [answer] for each goal of the theory, respecting the
order of appearance. *)
order of appearance. *)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment