src/HOL/Tools/ATP/atp_systems.ML
changeset 48376 416e4123baf3
parent 48232 712d49104b13
child 48539 0debf65972c7
equal deleted inserted replaced
48375:48628962976b 48376:416e4123baf3
    12   type formula_role = ATP_Problem.formula_role
    12   type formula_role = ATP_Problem.formula_role
    13   type failure = ATP_Proof.failure
    13   type failure = ATP_Proof.failure
    14 
    14 
    15   type slice_spec = int * atp_format * string * string * bool
    15   type slice_spec = int * atp_format * string * string * bool
    16   type atp_config =
    16   type atp_config =
    17     {exec : string list * string,
    17     {exec : string list * string list,
    18      required_vars : string list list,
       
    19      arguments :
    18      arguments :
    20        Proof.context -> bool -> string -> Time.time
    19        Proof.context -> bool -> string -> Time.time
    21        -> term_order * (unit -> (string * int) list)
    20        -> term_order * (unit -> (string * int) list)
    22           * (unit -> (string * real) list) -> string,
    21           * (unit -> (string * real) list) -> string,
    23      proof_delims : (string * string) list,
    22      proof_delims : (string * string) list,
    85 val default_max_new_mono_instances = 200 (* FUDGE *)
    84 val default_max_new_mono_instances = 200 (* FUDGE *)
    86 
    85 
    87 type slice_spec = int * atp_format * string * string * bool
    86 type slice_spec = int * atp_format * string * string * bool
    88 
    87 
    89 type atp_config =
    88 type atp_config =
    90   {exec : string list * string,
    89   {exec : string list * string list,
    91    required_vars : string list list,
       
    92    arguments :
    90    arguments :
    93      Proof.context -> bool -> string -> Time.time
    91      Proof.context -> bool -> string -> Time.time
    94      -> term_order * (unit -> (string * int) list)
    92      -> term_order * (unit -> (string * int) list)
    95         * (unit -> (string * real) list) -> string,
    93         * (unit -> (string * real) list) -> string,
    96    proof_delims : (string * string) list,
    94    proof_delims : (string * string) list,
   188 (* Alt-Ergo *)
   186 (* Alt-Ergo *)
   189 
   187 
   190 val alt_ergo_tff1 = TFF (Polymorphic, TPTP_Explicit)
   188 val alt_ergo_tff1 = TFF (Polymorphic, TPTP_Explicit)
   191 
   189 
   192 val alt_ergo_config : atp_config =
   190 val alt_ergo_config : atp_config =
   193   {exec = (["WHY3_HOME"], "why3"),
   191   {exec = (["WHY3_HOME"], ["why3"]),
   194    required_vars = [],
       
   195    arguments =
   192    arguments =
   196      fn _ => fn _ => fn _ => fn timeout => fn _ =>
   193      fn _ => fn _ => fn _ => fn timeout => fn _ =>
   197         "--format tff1 --prover alt-ergo --timelimit " ^
   194         "--format tff1 --prover alt-ergo --timelimit " ^
   198         string_of_int (to_secs 1 timeout),
   195         string_of_int (to_secs 1 timeout),
   199    proof_delims = [],
   196    proof_delims = [],
   261     "--split-clauses=4 --split-reuse-defs --simul-paramod --forward-context-sr \
   258     "--split-clauses=4 --split-reuse-defs --simul-paramod --forward-context-sr \
   262     \--destructive-er-aggressive --destructive-er --presat-simplify \
   259     \--destructive-er-aggressive --destructive-er --presat-simplify \
   263     \--prefer-initial-clauses -winvfreqrank -c1 -Ginvfreqconjmax -F1 \
   260     \--prefer-initial-clauses -winvfreqrank -c1 -Ginvfreqconjmax -F1 \
   264     \--delete-bad-limit=150000000 -WSelectMaxLComplexAvoidPosPred -H'(4*" ^
   261     \--delete-bad-limit=150000000 -WSelectMaxLComplexAvoidPosPred -H'(4*" ^
   265     e_selection_heuristic_case heuristic "FunWeight" "SymOffsetWeight" ^
   262     e_selection_heuristic_case heuristic "FunWeight" "SymOffsetWeight" ^
   266     "(SimulateSOS, " ^
   263     "(SimulateSOS," ^
   267     (e_selection_heuristic_case heuristic
   264     (e_selection_heuristic_case heuristic
   268          e_default_fun_weight e_default_sym_offs_weight
   265          e_default_fun_weight e_default_sym_offs_weight
   269      |> Config.get ctxt |> Real.ceil |> signed_string_of_int) ^
   266      |> Config.get ctxt |> Real.ceil |> signed_string_of_int) ^
   270     ",20,1.5,1.5,1" ^
   267     ",20,1.5,1.5,1" ^
   271     (sel_weights ()
   268     (sel_weights ()
   301   else e_autoN
   298   else e_autoN
   302 
   299 
   303 fun e_kbo () = if is_recent_e_version () then "KBO6" else "KBO"
   300 fun e_kbo () = if is_recent_e_version () then "KBO6" else "KBO"
   304 
   301 
   305 val e_config : atp_config =
   302 val e_config : atp_config =
   306   {exec = (["E_HOME"], "eproof"),
   303   {exec = (["E_HOME"], ["eproof_ram", "eproof"]),
   307    required_vars = [],
       
   308    arguments =
   304    arguments =
   309      fn ctxt => fn full_proof => fn heuristic => fn timeout =>
   305      fn ctxt => fn full_proof => fn heuristic => fn timeout =>
   310         fn ({is_lpo, gen_weights, gen_prec, ...}, ord_info, sel_weights) =>
   306         fn ({is_lpo, gen_weights, gen_prec, ...}, ord_info, sel_weights) =>
   311         "--tstp-in --tstp-out --output-level=5 --silent " ^
   307         "--tstp-in --tstp-out --output-level=5 --silent " ^
   312         e_selection_weight_arguments ctxt heuristic sel_weights ^ " " ^
   308         e_selection_weight_arguments ctxt heuristic sel_weights ^ " " ^
   313         e_term_order_info_arguments gen_weights gen_prec ord_info ^ " " ^
   309         e_term_order_info_arguments gen_weights gen_prec ord_info ^ " " ^
   314         "--term-ordering=" ^ (if is_lpo then "LPO4" else e_kbo ()) ^ " " ^
   310         "--term-ordering=" ^ (if is_lpo then "LPO4" else e_kbo ()) ^ " " ^
   315         "--cpu-limit=" ^ string_of_int (to_secs 2 timeout) ^
   311         "--cpu-limit=" ^ string_of_int (to_secs 2 timeout) ^
   316         e_shell_level_argument full_proof,
   312         e_shell_level_argument full_proof,
   317    proof_delims =
   313    proof_delims = tstp_proof_delims,
   318      (* work-around for bug in "epclextract" version 1.6 *)
       
   319      ("# SZS status Theorem\n# SZS output start Saturation.",
       
   320       "# SZS output end Saturation.") ::
       
   321      tstp_proof_delims,
       
   322    known_failures =
   314    known_failures =
   323      [(TimedOut, "Failure: Resource limit exceeded (time)"),
   315      [(TimedOut, "Failure: Resource limit exceeded (time)"),
   324       (TimedOut, "time limit exceeded")] @
   316       (TimedOut, "time limit exceeded")] @
   325      known_szs_status_failures,
   317      known_szs_status_failures,
   326    prem_role = Conjecture,
   318    prem_role = Conjecture,
   346    benchmarks when they are not used. *)
   338    benchmarks when they are not used. *)
   347 val leo2_thf0 =
   339 val leo2_thf0 =
   348   THF (Monomorphic, TPTP_Explicit, THF_Without_Choice, THF_Without_Defs)
   340   THF (Monomorphic, TPTP_Explicit, THF_Without_Choice, THF_Without_Defs)
   349 
   341 
   350 val leo2_config : atp_config =
   342 val leo2_config : atp_config =
   351   {exec = (["LEO2_HOME"], "leo"),
   343   {exec = (["LEO2_HOME"], ["leo"]),
   352    required_vars = [],
       
   353    arguments =
   344    arguments =
   354      fn _ => fn _ => fn _ => fn timeout => fn _ =>
   345      fn _ => fn _ => fn _ => fn timeout => fn _ =>
   355         "--foatp e --atp e=\"$E_HOME\"/eprover \
   346         "--foatp e --atp e=\"$E_HOME\"/eprover \
   356         \--atp epclextract=\"$E_HOME\"/epclextract \
   347         \--atp epclextract=\"$E_HOME\"/epclextract \
   357         \--proofoutput 1 --timeout " ^
   348         \--proofoutput 1 --timeout " ^
   375 
   366 
   376 val satallax_thf0 =
   367 val satallax_thf0 =
   377   THF (Monomorphic, TPTP_Explicit, THF_With_Choice, THF_With_Defs)
   368   THF (Monomorphic, TPTP_Explicit, THF_With_Choice, THF_With_Defs)
   378 
   369 
   379 val satallax_config : atp_config =
   370 val satallax_config : atp_config =
   380   {exec = (["SATALLAX_HOME"], "satallax"),
   371   {exec = (["SATALLAX_HOME"], ["satallax"]),
   381    required_vars = [],
       
   382    arguments =
   372    arguments =
   383      fn _ => fn _ => fn _ => fn timeout => fn _ =>
   373      fn _ => fn _ => fn _ => fn timeout => fn _ =>
   384         "-p hocore -t " ^ string_of_int (to_secs 1 timeout),
   374         "-p hocore -t " ^ string_of_int (to_secs 1 timeout),
   385    proof_delims =
   375    proof_delims =
   386      [("% Higher-Order Unsat Core BEGIN", "% Higher-Order Unsat Core END")],
   376      [("% Higher-Order Unsat Core BEGIN", "% Higher-Order Unsat Core END")],
   403 val spass_H2NuVS0 = "-Heuristic=2 -RNuV=1 -Sorts=0"
   393 val spass_H2NuVS0 = "-Heuristic=2 -RNuV=1 -Sorts=0"
   404 val spass_H2NuVS0Red2 = "-Heuristic=2 -RNuV=1 -Sorts=0 -RFRew=2 -RBRew=2 -RTaut=2"
   394 val spass_H2NuVS0Red2 = "-Heuristic=2 -RNuV=1 -Sorts=0 -RFRew=2 -RBRew=2 -RTaut=2"
   405 
   395 
   406 (* FIXME: Make "SPASS_NEW_HOME" legacy. *)
   396 (* FIXME: Make "SPASS_NEW_HOME" legacy. *)
   407 val spass_config : atp_config =
   397 val spass_config : atp_config =
   408   {exec = (["SPASS_NEW_HOME", "SPASS_HOME"], "SPASS"),
   398   {exec = (["SPASS_NEW_HOME", "SPASS_HOME"], ["SPASS"]),
   409    required_vars = [],
       
   410    arguments = fn _ => fn _ => fn extra_options => fn timeout => fn _ =>
   399    arguments = fn _ => fn _ => fn extra_options => fn timeout => fn _ =>
   411      ("-Isabelle=1 -TimeLimit=" ^ string_of_int (to_secs 1 timeout))
   400      ("-Isabelle=1 -TimeLimit=" ^ string_of_int (to_secs 1 timeout))
   412      |> extra_options <> "" ? prefix (extra_options ^ " "),
   401      |> extra_options <> "" ? prefix (extra_options ^ " "),
   413    proof_delims = [("Here is a proof", "Formulae used in the proof")],
   402    proof_delims = [("Here is a proof", "Formulae used in the proof")],
   414    known_failures =
   403    known_failures =
   445   string_ord (getenv "VAMPIRE_VERSION", "1.8") = GREATER
   434   string_ord (getenv "VAMPIRE_VERSION", "1.8") = GREATER
   446 
   435 
   447 val vampire_tff0 = TFF (Monomorphic, TPTP_Implicit)
   436 val vampire_tff0 = TFF (Monomorphic, TPTP_Implicit)
   448 
   437 
   449 val vampire_config : atp_config =
   438 val vampire_config : atp_config =
   450   {exec = (["VAMPIRE_HOME"], "vampire"),
   439   {exec = (["VAMPIRE_HOME"], ["vampire"]),
   451    required_vars = [],
       
   452    arguments = fn _ => fn _ => fn sos => fn timeout => fn _ =>
   440    arguments = fn _ => fn _ => fn sos => fn timeout => fn _ =>
   453      "--mode casc -t " ^ string_of_int (to_secs 1 timeout) ^
   441      "--mode casc -t " ^ string_of_int (to_secs 1 timeout) ^
   454      " --proof tptp --output_axiom_names on\
   442      " --proof tptp --output_axiom_names on\
   455      \ --forced_options propositional_to_bdd=off\
   443      \ --forced_options propositional_to_bdd=off\
   456      \ --thanks \"Andrei and Krystof\" --input_file"
   444      \ --thanks \"Andrei and Krystof\" --input_file"
   489 (* Z3 with TPTP syntax *)
   477 (* Z3 with TPTP syntax *)
   490 
   478 
   491 val z3_tff0 = TFF (Monomorphic, TPTP_Implicit)
   479 val z3_tff0 = TFF (Monomorphic, TPTP_Implicit)
   492 
   480 
   493 val z3_tptp_config : atp_config =
   481 val z3_tptp_config : atp_config =
   494   {exec = (["Z3_HOME"], "z3"),
   482   {exec = (["Z3_HOME"], ["z3"]),
   495    required_vars = [],
       
   496    arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
   483    arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
   497      "MBQI=true -tptp -t:" ^ string_of_int (to_secs 1 timeout),
   484      "MBQI=true -tptp -t:" ^ string_of_int (to_secs 1 timeout),
   498    proof_delims = [],
   485    proof_delims = [],
   499    known_failures = known_szs_status_failures,
   486    known_failures = known_szs_status_failures,
   500    prem_role = Hypothesis,
   487    prem_role = Hypothesis,
   511 
   498 
   512 
   499 
   513 (* Not really a prover: Experimental Polymorphic THF and DFG output *)
   500 (* Not really a prover: Experimental Polymorphic THF and DFG output *)
   514 
   501 
   515 fun dummy_config format type_enc : atp_config =
   502 fun dummy_config format type_enc : atp_config =
   516   {exec = (["ISABELLE_ATP"], "scripts/dummy_atp"),
   503   {exec = (["ISABELLE_ATP"], ["scripts/dummy_atp"]),
   517    required_vars = [],
       
   518    arguments = K (K (K (K (K "")))),
   504    arguments = K (K (K (K (K "")))),
   519    proof_delims = [],
   505    proof_delims = [],
   520    known_failures = known_szs_status_failures,
   506    known_failures = known_szs_status_failures,
   521    prem_role = Hypothesis,
   507    prem_role = Hypothesis,
   522    best_slices =
   508    best_slices =
   575 
   561 
   576 val max_remote_secs = 240 (* give Geoff Sutcliffe's servers a break *)
   562 val max_remote_secs = 240 (* give Geoff Sutcliffe's servers a break *)
   577 
   563 
   578 fun remote_config system_name system_versions proof_delims known_failures
   564 fun remote_config system_name system_versions proof_delims known_failures
   579                   prem_role best_slice : atp_config =
   565                   prem_role best_slice : atp_config =
   580   {exec = (["ISABELLE_ATP"], "scripts/remote_atp"),
   566   {exec = (["ISABELLE_ATP"], ["scripts/remote_atp"]),
   581    required_vars = [],
       
   582    arguments = fn _ => fn _ => fn command => fn timeout => fn _ =>
   567    arguments = fn _ => fn _ => fn command => fn timeout => fn _ =>
   583      (if command <> "" then "-c " ^ quote command ^ " " else "") ^
   568      (if command <> "" then "-c " ^ quote command ^ " " else "") ^
   584      "-s " ^ the_system system_name system_versions ^ " " ^
   569      "-s " ^ the_system system_name system_versions ^ " " ^
   585      "-t " ^ string_of_int (Int.min (max_remote_secs, to_secs 1 timeout)),
   570      "-t " ^ string_of_int (Int.min (max_remote_secs, to_secs 1 timeout)),
   586    proof_delims = union (op =) tstp_proof_delims proof_delims,
   571    proof_delims = union (op =) tstp_proof_delims proof_delims,
   658   handle Option.Option => error ("Unknown ATP: " ^ name ^ ".")
   643   handle Option.Option => error ("Unknown ATP: " ^ name ^ ".")
   659 
   644 
   660 val supported_atps = Symtab.keys o Data.get
   645 val supported_atps = Symtab.keys o Data.get
   661 
   646 
   662 fun is_atp_installed thy name =
   647 fun is_atp_installed thy name =
   663   let val {exec, required_vars, ...} = get_atp thy name () in
   648   let val {exec, ...} = get_atp thy name () in
   664     forall (exists (fn var => getenv var <> "")) (fst exec :: required_vars)
   649     exists (fn var => getenv var <> "") (fst exec)
   665   end
   650   end
   666 
   651 
   667 fun refresh_systems_on_tptp () =
   652 fun refresh_systems_on_tptp () =
   668   Synchronized.change systems (fn _ => get_systems ())
   653   Synchronized.change systems (fn _ => get_systems ())
   669 
   654