src/HOL/Tools/Sledgehammer/sledgehammer_isar.ML
changeset 53057 e18a028b345c
parent 53055 0fe8a9972eda
child 53142 966a251efd16
equal deleted inserted replaced
53056:3d22b952118b 53057:e18a028b345c
     7 signature SLEDGEHAMMER_ISAR =
     7 signature SLEDGEHAMMER_ISAR =
     8 sig
     8 sig
     9   type params = Sledgehammer_Provers.params
     9   type params = Sledgehammer_Provers.params
    10 
    10 
    11   val provers : string Unsynchronized.ref
    11   val provers : string Unsynchronized.ref
    12   val timeout : int Unsynchronized.ref
       
    13   val default_params : Proof.context -> (string * string) list -> params
    12   val default_params : Proof.context -> (string * string) list -> params
    14 end;
    13 end;
    15 
    14 
    16 structure Sledgehammer_Isar : SLEDGEHAMMER_ISAR =
    15 structure Sledgehammer_Isar : SLEDGEHAMMER_ISAR =
    17 struct
    16 struct
    59   fold merge_fact_override_pairwise rs (only_fact_override [])
    58   fold merge_fact_override_pairwise rs (only_fact_override [])
    60 
    59 
    61 (*** parameters ***)
    60 (*** parameters ***)
    62 
    61 
    63 val provers = Unsynchronized.ref ""
    62 val provers = Unsynchronized.ref ""
    64 val timeout = Unsynchronized.ref 30
       
    65 
    63 
    66 val _ =
    64 val _ =
    67   ProofGeneral.preference_string ProofGeneral.category_proof
    65   ProofGeneral.preference_string ProofGeneral.category_proof
    68     NONE
    66     NONE
    69     provers
    67     provers
    70     "Sledgehammer: Provers"
    68     "Sledgehammer: Provers"
    71     "Default automatic provers (separated by whitespace)"
    69     "Default automatic provers (separated by whitespace)"
    72 
    70 
    73 val _ =
    71 val _ =
    74   ProofGeneral.preference_int ProofGeneral.category_proof
    72   ProofGeneral.preference_option ProofGeneral.category_proof
    75     NONE
    73     NONE
    76     timeout
    74     @{option sledgehammer_timeout}
    77     "Sledgehammer: Time Limit"
    75     "Sledgehammer: Time Limit"
    78     "ATPs will be interrupted after this time (in seconds)"
    76     "ATPs will be interrupted after this time (in seconds)"
    79 
    77 
    80 type raw_param = string * string list
    78 type raw_param = string * string list
    81 
    79 
   238     Data.get thy
   236     Data.get thy
   239     |> fold (AList.default (op =))
   237     |> fold (AList.default (op =))
   240             [("provers", [case !provers of
   238             [("provers", [case !provers of
   241                             "" => default_provers_param_value ctxt
   239                             "" => default_provers_param_value ctxt
   242                           | s => s]),
   240                           | s => s]),
   243              ("timeout", let val timeout = !timeout in
   241              ("timeout", let val timeout = Options.default_int @{option sledgehammer_timeout} in
   244                            [if timeout <= 0 then "none"
   242                            [if timeout <= 0 then "none"
   245                             else string_of_int timeout]
   243                             else string_of_int timeout]
   246                          end)]
   244                          end)]
   247   end
   245   end
   248 
   246 
   498 val _ =
   496 val _ =
   499   Query_Operation.register sledgehammerN (fn {state = st, args, output_result} =>
   497   Query_Operation.register sledgehammerN (fn {state = st, args, output_result} =>
   500     (case try Toplevel.proof_of st of
   498     (case try Toplevel.proof_of st of
   501       SOME state =>
   499       SOME state =>
   502         let
   500         let
   503           val [provers_arg, timeout_arg, isar_proofs_arg] = args;
   501           val [provers_arg, isar_proofs_arg] = args;
   504           val ctxt = Proof.context_of state
   502           val ctxt = Proof.context_of state
   505 
   503 
   506           val override_params =
   504           val override_params =
   507             ((if provers_arg = "" then [] else [("provers", space_explode " " provers_arg)]) @
   505             ((if provers_arg = "" then [] else [("provers", space_explode " " provers_arg)]) @
   508               [("timeout", [timeout_arg]),
   506               [("isar_proofs", [isar_proofs_arg]),
   509                ("isar_proofs", [isar_proofs_arg]),
       
   510                ("blocking", ["true"]),
   507                ("blocking", ["true"]),
   511                ("minimize", ["true"]),
   508                ("minimize", ["true"]),
   512                ("debug", ["false"]),
   509                ("debug", ["false"]),
   513                ("verbose", ["false"]),
   510                ("verbose", ["false"]),
   514                ("overlord", ["false"])])
   511                ("overlord", ["false"])])