src/HOL/Tools/Sledgehammer/sledgehammer.ML
changeset 38044 463177795c49
parent 38040 174568533593
child 38061 685d1f0f75b3
equal deleted inserted replaced
38043:f31ddd5da4e3 38044:463177795c49
    51   val measure_runtime : bool Config.T
    51   val measure_runtime : bool Config.T
    52   val kill_atps: unit -> unit
    52   val kill_atps: unit -> unit
    53   val running_atps: unit -> unit
    53   val running_atps: unit -> unit
    54   val messages: int option -> unit
    54   val messages: int option -> unit
    55   val get_prover_fun : theory -> string -> prover
    55   val get_prover_fun : theory -> string -> prover
    56   val start_prover_thread :
    56   val run_sledgehammer :
    57     params -> int -> int -> relevance_override -> (string -> minimize_command)
    57     params -> int -> relevance_override -> (string -> minimize_command)
    58     -> Proof.state -> string -> unit
    58     -> Proof.state -> unit
    59   val setup : theory -> theory
    59   val setup : theory -> theory
    60 end;
    60 end;
    61 
    61 
    62 structure Sledgehammer : SLEDGEHAMMER =
    62 structure Sledgehammer : SLEDGEHAMMER =
    63 struct
    63 struct
   843      filtered_clauses = the_filtered_clauses}
   843      filtered_clauses = the_filtered_clauses}
   844   end
   844   end
   845 
   845 
   846 fun get_prover_fun thy name = prover_fun name (get_prover thy name)
   846 fun get_prover_fun thy name = prover_fun name (get_prover thy name)
   847 
   847 
   848 (* start prover thread *)
       
   849 fun start_prover_thread (params as {verbose, full_types, timeout, ...}) i n
   848 fun start_prover_thread (params as {verbose, full_types, timeout, ...}) i n
   850                         relevance_override minimize_command proof_state name =
   849                         relevance_override minimize_command proof_state name =
   851   let
   850   let
   852     val thy = Proof.theory_of proof_state
   851     val thy = Proof.theory_of proof_state
   853     val birth_time = Time.now ()
   852     val birth_time = Time.now ()
   869               prover params (minimize_command name) timeout problem |> #message
   868               prover params (minimize_command name) timeout problem |> #message
   870               handle ERROR message => "Error: " ^ message ^ "\n"
   869               handle ERROR message => "Error: " ^ message ^ "\n"
   871             end)
   870             end)
   872   end
   871   end
   873 
   872 
       
   873 fun run_sledgehammer {atps = [], ...} _ _ _ _ = error "No ATP is set."
       
   874   | run_sledgehammer (params as {atps, ...}) i relevance_override
       
   875                      minimize_command state =
       
   876     case subgoal_count state of
       
   877       0 => priority "No subgoal!"
       
   878     | n =>
       
   879       let
       
   880         val _ = kill_atps ()
       
   881         val _ = priority "Sledgehammering..."
       
   882         val _ = app (start_prover_thread params i n relevance_override
       
   883                                          minimize_command state) atps
       
   884       in () end
       
   885 
   874 val setup =
   886 val setup =
   875   dest_dir_setup
   887   dest_dir_setup
   876   #> problem_prefix_setup
   888   #> problem_prefix_setup
   877   #> measure_runtime_setup
   889   #> measure_runtime_setup
   878 
   890