Skip to content

Commit c60f050

Browse files
committed
[HolSmt] HOL4_Z3_EXECUTABLE, etc. can be set to "" (empty) to disable the related solvers
1 parent d151585 commit c60f050

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

src/HolSmt/CVC.sml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ structure CVC = struct
1919
end
2020

2121
fun is_configured () =
22-
Option.isSome (OS.Process.getEnv "HOL4_CVC_EXECUTABLE")
22+
let val v = OS.Process.getEnv "HOL4_CVC_EXECUTABLE" in
23+
(Option.isSome v) andalso (Option.valOf v <> "")
24+
end;
25+
26+
val error_msg = "CVC not configured: set the HOL4_CVC_EXECUTABLE environment variable to point to the cvc5 executable file.";
2327

2428
fun mk_CVC_fun name pre cmd_stem post goal =
2529
case OS.Process.getEnv "HOL4_CVC_EXECUTABLE" of
2630
SOME file =>
2731
SolverSpec.make_solver pre (file ^ cmd_stem) post goal
2832
| NONE =>
29-
raise Feedback.mk_HOL_ERR "CVC" name
30-
"CVC not configured: set the HOL4_CVC_EXECUTABLE environment variable to point to the cvc5 executable file."
33+
raise Feedback.mk_HOL_ERR "CVC" name error_msg
3134

3235
(* cvc5, SMT-LIB file format, no proofs *)
3336
val CVC_SMT_Oracle =

src/HolSmt/Yices.sml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,19 +777,25 @@ structure Yices = struct
777777
end
778778

779779
fun is_configured () =
780-
Option.isSome (OS.Process.getEnv "HOL4_YICES_EXECUTABLE")
780+
let val v = OS.Process.getEnv "HOL4_YICES_EXECUTABLE" in
781+
(Option.isSome v) andalso (Option.valOf v <> "")
782+
end;
783+
784+
val error_msg = "Yices not configured: set the HOL4_YICES_EXECUTABLE environment variable to point to the Yices executable file.";
781785

782786
(* Yices 1.0.29, native file format *)
783787
fun Yices_Oracle goal =
784788
case OS.Process.getEnv "HOL4_YICES_EXECUTABLE" of
785789
SOME file =>
790+
if file = "" then
791+
raise Feedback.mk_HOL_ERR "Yices" "Yices_Oracle" error_msg
792+
else
786793
SolverSpec.make_solver
787794
(Lib.pair () o goal_to_Yices)
788795
(file ^ " -tc ")
789796
(Lib.K result_fn)
790797
goal
791798
| NONE =>
792-
raise Feedback.mk_HOL_ERR "Yices" "Yices_Oracle"
793-
"Yices not configured: set the HOL4_YICES_EXECUTABLE environment variable to point to the Yices executable file."
799+
raise Feedback.mk_HOL_ERR "Yices" "Yices_Oracle" error_msg
794800

795801
end

src/HolSmt/Z3.sml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,21 @@ structure Z3 = struct
2121
end
2222

2323
fun is_configured () =
24-
Option.isSome (OS.Process.getEnv "HOL4_Z3_EXECUTABLE")
24+
let val v = OS.Process.getEnv "HOL4_Z3_EXECUTABLE" in
25+
(Option.isSome v) andalso (Option.valOf v <> "")
26+
end;
27+
28+
val error_msg = "Z3 not configured: set the HOL4_Z3_EXECUTABLE environment variable to point to the Z3 executable file.";
2529

2630
fun mk_Z3_fun name pre cmd_stem post goal =
2731
case OS.Process.getEnv "HOL4_Z3_EXECUTABLE" of
2832
SOME file =>
33+
if file = "" then
34+
raise Feedback.mk_HOL_ERR "Z3" name error_msg
35+
else
2936
SolverSpec.make_solver pre (file ^ cmd_stem) post goal
3037
| NONE =>
31-
raise Feedback.mk_HOL_ERR "Z3" name
32-
"Z3 not configured: set the HOL4_Z3_EXECUTABLE environment variable to point to the Z3 executable file."
38+
raise Feedback.mk_HOL_ERR "Z3" name error_msg
3339

3440
(* Z3 (Linux/Unix), SMT-LIB file format, no proofs *)
3541
val Z3_SMT_Oracle =
@@ -58,6 +64,7 @@ structure Z3 = struct
5864
case OS.Process.getEnv "HOL4_Z3_EXECUTABLE" of
5965
NONE => "0"
6066
| SOME p =>
67+
if p = "" then "0" else
6168
let
6269
val outfile = OS.FileSys.tmpName()
6370
fun work () = let

src/HolSmt/selftest.sml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
(* Copyright (c) 2009-2012 Tjark Weber. All rights reserved. *)
22

33
(* Unit tests for HolSmtLib *)
4+
open HolKernel Parse boolLib bossLib;
5+
6+
val _ = loose_equality ();
47

58
val _ = print "Testing HolSmtLib\n"
69

0 commit comments

Comments
 (0)