src/HOL/Tools/SMT/smt_solver.ML
changeset 40332 5edeb5d269fa
parent 40278 0fc78bb54f18
child 40357 82ebdd19c4a4
equal deleted inserted replaced
40330:3b7f570723f9 40332:5edeb5d269fa
    33   (*options*)
    33   (*options*)
    34   val oracle: bool Config.T
    34   val oracle: bool Config.T
    35   val filter_only: bool Config.T
    35   val filter_only: bool Config.T
    36   val datatypes: bool Config.T
    36   val datatypes: bool Config.T
    37   val keep_assms: bool Config.T
    37   val keep_assms: bool Config.T
    38   val timeout: int Config.T
    38   val timeout: real Config.T
    39   val with_timeout: Proof.context -> ('a -> 'b) -> 'a -> 'b
    39   val with_timeout: Proof.context -> ('a -> 'b) -> 'a -> 'b
    40   val traceN: string
    40   val traceN: string
    41   val trace: bool Config.T
    41   val trace: bool Config.T
    42   val trace_msg: Proof.context -> ('a -> string) -> 'a -> unit
    42   val trace_msg: Proof.context -> ('a -> string) -> 'a -> unit
    43   val trace_used_facts: bool Config.T
    43   val trace_used_facts: bool Config.T
   125 val (datatypes, setup_datatypes) = Attrib.config_bool "smt_datatypes" (K false)
   125 val (datatypes, setup_datatypes) = Attrib.config_bool "smt_datatypes" (K false)
   126 
   126 
   127 val (keep_assms, setup_keep_assms) =
   127 val (keep_assms, setup_keep_assms) =
   128   Attrib.config_bool "smt_keep_assms" (K true)
   128   Attrib.config_bool "smt_keep_assms" (K true)
   129 
   129 
   130 val (timeout, setup_timeout) = Attrib.config_int "smt_timeout" (K 30)
   130 val (timeout, setup_timeout) = Attrib.config_real "smt_timeout" (K 30.0)
   131 
   131 
   132 fun with_timeout ctxt f x =
   132 fun with_timeout ctxt f x =
   133   TimeLimit.timeLimit (Time.fromSeconds (Config.get ctxt timeout)) f x
   133   TimeLimit.timeLimit (seconds (Config.get ctxt timeout)) f x
   134   handle TimeLimit.TimeOut => raise SMT Time_Out
   134   handle TimeLimit.TimeOut => raise SMT Time_Out
   135 
   135 
   136 val traceN = "smt_trace"
   136 val traceN = "smt_trace"
   137 val (trace, setup_trace) = Attrib.config_bool traceN (K false)
   137 val (trace, setup_trace) = Attrib.config_bool traceN (K false)
   138 
   138 
   250 
   250 
   251 fun invoke translate_config name cmd more_opts options irules ctxt =
   251 fun invoke translate_config name cmd more_opts options irules ctxt =
   252   let
   252   let
   253     val args = more_opts @ options ctxt
   253     val args = more_opts @ options ctxt
   254     val comments = ("solver: " ^ name) ::
   254     val comments = ("solver: " ^ name) ::
   255       ("timeout: " ^ string_of_int (Config.get ctxt timeout)) ::
   255       ("timeout: " ^ Time.toString (seconds (Config.get ctxt timeout))) ::
   256       "arguments:" :: args
   256       "arguments:" :: args
   257   in
   257   in
   258     irules
   258     irules
   259     |> tap (trace_assms ctxt)
   259     |> tap (trace_assms ctxt)
   260     |> SMT_Translate.translate translate_config ctxt comments
   260     |> SMT_Translate.translate translate_config ctxt comments
   431 fun smt_filter run_remote time_limit st xrules i =
   431 fun smt_filter run_remote time_limit st xrules i =
   432   let
   432   let
   433     val {facts, goal, ...} = Proof.goal st
   433     val {facts, goal, ...} = Proof.goal st
   434     val ctxt =
   434     val ctxt =
   435       Proof.context_of st
   435       Proof.context_of st
   436       |> Config.put timeout (Time.toSeconds time_limit)
   436       |> Config.put timeout (Real.fromInt (Time.toSeconds time_limit))
   437       |> Config.put oracle false
   437       |> Config.put oracle false
   438       |> Config.put filter_only true
   438       |> Config.put filter_only true
   439       |> Config.put keep_assms false
   439       |> Config.put keep_assms false
   440     val cprop =
   440     val cprop =
   441       Thm.cprem_of goal i
   441       Thm.cprem_of goal i
   502     "Applies an SMT solver to the current goal."
   502     "Applies an SMT solver to the current goal."
   503 
   503 
   504 
   504 
   505 fun print_setup context =
   505 fun print_setup context =
   506   let
   506   let
   507     val t = string_of_int (Config.get_generic context timeout)
   507     val t = Time.toString (seconds (Config.get_generic context timeout))
   508     val names = sort_strings (all_solver_names_of context)
   508     val names = sort_strings (all_solver_names_of context)
   509     val ns = if null names then [no_solver] else names
   509     val ns = if null names then [no_solver] else names
   510     val n = solver_name_of context
   510     val n = solver_name_of context
   511     val opts =
   511     val opts =
   512       (case Symtab.lookup (Solvers.get context) n of
   512       (case Symtab.lookup (Solvers.get context) n of