aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChantal Keller <Chantal.Keller@lri.fr>2022-04-14 18:01:15 +0200
committerChantal Keller <Chantal.Keller@lri.fr>2022-04-14 18:01:15 +0200
commit65c185275f8c78908c1496c6665bc7fd50a4607b (patch)
tree3d68caf8b482563c01ada2cf426f7f96d6fda76a
parentdeb9927455bcb3b506d17a63a9b7b5ec11fe9027 (diff)
downloadsmtcoq-65c185275f8c78908c1496c6665bc7fd50a4607b.tar.gz
smtcoq-65c185275f8c78908c1496c6665bc7fd50a4607b.zip
Clean-up
-rw-r--r--examples/Example.v30
-rw-r--r--src/trace/coqInterface.ml1
-rw-r--r--src/trace/coqInterface.mli1
-rw-r--r--src/verit/verit.ml2
-rw-r--r--unit-tests/Tests_verit_tactics.v64
5 files changed, 84 insertions, 14 deletions
diff --git a/examples/Example.v b/examples/Example.v
index 0cd1477..5e12e74 100644
--- a/examples/Example.v
+++ b/examples/Example.v
@@ -426,23 +426,27 @@ Section CompCert.
End CompCert.
-(** The verit solver can be called with an integer (the timeout in seconds).
-If the goal cannot be solved within timeout seconds, then an anomaly is raised **)
+(** The verit solver can be called with a timeout (a positive integer,
+ in seconds). If the goal cannot be solved within this given time,
+ then an anomaly is raised.
+ To test, one can uncomment the following examples.
+**)
Section test_timeout.
-Variable P : Z -> bool.
-Variable H0 : P 0.
-Variable HInd : forall n, implb (P n) (P (n + 1)).
+ Variable P : Z -> bool.
+ Variable H0 : P 0.
+ Variable HInd : forall n, implb (P n) (P (n + 1)).
-Goal P 3.
-(* verit_timeout 3. *) verit.
-Qed.
+ Goal P 3.
+ Proof.
+ (* verit_timeout 3. *) verit.
+ Qed.
-Goal true -> P 1000000000.
-intro H.
-(* Fail verit_timeout 1.
-Fail verit_timeout 5. *)
-Abort.
+ Goal true -> P 1000000000.
+ Proof.
+ intro H.
+ (* verit_timeout 5. *)
+ Abort.
End test_timeout.
diff --git a/src/trace/coqInterface.ml b/src/trace/coqInterface.ml
index a8af566..8b91225 100644
--- a/src/trace/coqInterface.ml
+++ b/src/trace/coqInterface.ml
@@ -150,6 +150,7 @@ let set_evars_tac noc =
(* Other differences between the two versions of Coq *)
type constr_expr = Constrexpr.constr_expr
let error s = CErrors.user_err (Pp.str s)
+let anomaly s = CErrors.anomaly (Pp.str s)
let warning n s = CWarnings.create ~name:n ~category:"SMTCoq plugin" Pp.str s
let extern_constr c = Constrextern.extern_constr true Environ.empty_env Evd.empty (EConstr.of_constr c)
diff --git a/src/trace/coqInterface.mli b/src/trace/coqInterface.mli
index 86fdd95..453bce1 100644
--- a/src/trace/coqInterface.mli
+++ b/src/trace/coqInterface.mli
@@ -98,6 +98,7 @@ val set_evars_tac : constr -> tactic
(* Other differences between the two versions of Coq *)
type constr_expr = Constrexpr.constr_expr
val error : string -> 'a
+val anomaly : string -> 'a
val warning : string -> string -> unit
val extern_constr : constr -> constr_expr
val destruct_rel_decl : (constr, types) Context.Rel.Declaration.pt -> name * types
diff --git a/src/verit/verit.ml b/src/verit/verit.ml
index eb8c5cc..33f9b4c 100644
--- a/src/verit/verit.ml
+++ b/src/verit/verit.ml
@@ -207,7 +207,7 @@ let call_verit timeout _ rt ro ra_quant rf_quant first lsmt =
CoqInterface.error ("veriT failed with the error: " ^ l)
done
with End_of_file -> () in
- if exit_code = 124 (*code for timeout*) then (Printf.printf "bar" ; flush stdout ; close_in win; Sys.remove wname; let _ = CErrors.anomaly (Pp.str "veriT timed out") in ()) ;
+ if exit_code = 124 (*code for timeout*) then (close_in win; Sys.remove wname; let _ = CoqInterface.anomaly "veriT timed out" in ());
try
if exit_code <> 0 then CoqInterface.warning "verit-non-zero-exit-code" ("Verit.call_verit: command " ^ command ^ " exited with code " ^ string_of_int exit_code);
raise_warnings_errors ();
diff --git a/unit-tests/Tests_verit_tactics.v b/unit-tests/Tests_verit_tactics.v
index a6ea27b..4285f96 100644
--- a/unit-tests/Tests_verit_tactics.v
+++ b/unit-tests/Tests_verit_tactics.v
@@ -1498,3 +1498,67 @@ Section OCamlCompDec.
x ++ y = a0::nil -> x = nil /\ y = a0::nil \/ x = a0::nil /\ y = nil.
Proof. verit_no_check. Qed.
End OCamlCompDec.
+
+
+Section TimeoutBool.
+ Variable P : Z -> bool.
+ Variable H0 : P 0.
+ Variable HInd : forall n, implb (P n) (P (n + 1)).
+
+ Goal P 3.
+ Proof.
+ verit_bool_base_auto_timeout (Some (H0, HInd)) 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_bool_no_check_base_auto_timeout (Some (H0, HInd)) 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_bool_timeout (H0, HInd) 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_bool_timeout 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_bool_no_check_timeout (H0, HInd) 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_bool_no_check_timeout 10.
+ Qed.
+End TimeoutBool.
+
+
+Section TimeoutProp.
+ Variable P : Z -> bool.
+ Variable H0 : P 0.
+ Variable HInd : forall n, (P n) -> (P (n + 1)).
+
+ Goal P 3.
+ Proof.
+ verit_timeout (H0, HInd) 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_timeout 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_no_check_timeout (H0, HInd) 10.
+ Qed.
+
+ Goal P 3.
+ Proof.
+ verit_no_check_timeout 10.
+ Qed.
+End TimeoutProp.