src/HOL/Tools/SMT/smt_setup_solvers.ML
changeset 55007 0c07990363a3
parent 50856 c091e46ec3c5
child 55012 e6cfa56a8bcd
equal deleted inserted replaced
55006:ea9fc64327cb 55007:0c07990363a3
   109   Z3_Non_Commercial_Accepted |
   109   Z3_Non_Commercial_Accepted |
   110   Z3_Non_Commercial_Declined
   110   Z3_Non_Commercial_Declined
   111 
   111 
   112 
   112 
   113 local
   113 local
   114   val flagN = "Z3_NON_COMMERCIAL"
   114   val flagN = @{option z3_non_commercial}
   115 
   115 
   116   val accepted = member (op =) ["yes", "Yes", "YES"]
   116   val accepted = member (op =) ["yes", "Yes", "YES"]
   117   val declined = member (op =) ["no", "No", "NO"]
   117   val declined = member (op =) ["no", "No", "NO"]
   118 in
   118 in
   119 
   119 
   120 fun z3_non_commercial () =
   120 fun z3_non_commercial () =
   121   if accepted (getenv flagN) then Z3_Non_Commercial_Accepted
   121   if accepted (Options.default_string flagN) then Z3_Non_Commercial_Accepted
   122   else if declined (getenv flagN) then Z3_Non_Commercial_Declined
   122   else if declined (Options.default_string flagN) then Z3_Non_Commercial_Declined
   123   else Z3_Non_Commercial_Unknown
   123   else Z3_Non_Commercial_Unknown
   124 
   124 
   125 fun if_z3_non_commercial f =
   125 fun if_z3_non_commercial f =
   126   (case z3_non_commercial () of
   126   (case z3_non_commercial () of
   127     Z3_Non_Commercial_Accepted => f ()
   127     Z3_Non_Commercial_Accepted => f ()
   128   | Z3_Non_Commercial_Declined =>
   128   | Z3_Non_Commercial_Declined =>
   129       error ("The SMT solver Z3 may only be used for non-commercial " ^
   129       error (Pretty.string_of (Pretty.para
   130         "applications.")
   130         "The SMT solver Z3 may only be used for non-commercial applications."))
   131   | Z3_Non_Commercial_Unknown =>
   131   | Z3_Non_Commercial_Unknown =>
   132       error ("The SMT solver Z3 is not activated. To activate it, set\n" ^
   132       error (Pretty.string_of (Pretty.para
   133         "the environment variable " ^ quote flagN ^ " to " ^ quote "yes" ^ ",\n" ^
   133         ("The SMT solver Z3 is not activated. To activate it, set the Isabelle \
   134         "and restart the Isabelle system." ^
   134          \system option " ^ quote flagN ^ " to \"yes\" (e.g. via \
   135         (if getenv "Z3_COMPONENT" = "" then ""
   135          \the Isabelle/jEdit menu Plugin Options / Isabelle / General)."))))
   136          else "\nSee also " ^ Path.print (Path.expand (Path.explode "$Z3_COMPONENT/etc/settings")))))
       
   137 
   136 
   138 end
   137 end
   139 
   138 
   140 
   139 
   141 val z3_with_extensions =
   140 val z3_with_extensions =