export status function to query whether Z3 has been activated for usage within Isabelle
authorboehmes
Wed, 23 Mar 2011 14:29:29 +0100
changeset 42074 621321627d0f
parent 42073 217a1b61d42d
child 42075 c8be98f12b1c
export status function to query whether Z3 has been activated for usage within Isabelle
src/HOL/Tools/SMT/smt_setup_solvers.ML
--- a/src/HOL/Tools/SMT/smt_setup_solvers.ML	Wed Mar 23 10:38:50 2011 +0100
+++ b/src/HOL/Tools/SMT/smt_setup_solvers.ML	Wed Mar 23 14:29:29 2011 +0100
@@ -6,6 +6,7 @@
 
 signature SMT_SETUP_SOLVERS =
 sig
+  val z3_non_commercial: unit -> bool
   val setup: theory -> theory
 end
 
@@ -97,13 +98,23 @@
 
 local
   val flagN = "Z3_NON_COMMERCIAL"
+in
 
+fun z3_non_commercial () = (getenv flagN = "yes")
+
+fun if_z3_non_commercial f =
+  if z3_non_commercial () then f ()
+  else
+    error ("The SMT solver Z3 is not enabled. To enable it, set " ^
+      "the environment variable " ^ quote flagN ^ " to " ^ quote ("yes") ^
+      ".")
+
+end
+
+
+local
   fun z3_make_command is_remote name () =
-    if getenv flagN = "yes" then make_command is_remote name ()
-    else
-      error ("The SMT solver Z3 is not enabled. To enable it, set " ^
-        "the environment variable " ^ quote flagN ^ " to " ^ quote ("yes") ^
-        ".")
+    if_z3_non_commercial (make_command is_remote name)
 
   fun z3_options ctxt =
     ["-rs:" ^ string_of_int (Config.get ctxt SMT_Config.random_seed),