src/HOL/Tools/ATP/atp_systems.ML
changeset 68563 05fb05f94686
parent 68328 0d751da653d9
child 69593 3dda49e08b9d
equal deleted inserted replaced
68562:1ab1f1681263 68563:05fb05f94686
    44   val spass_H2LR0LT0 : string
    44   val spass_H2LR0LT0 : string
    45   val spass_H2NuVS0 : string
    45   val spass_H2NuVS0 : string
    46   val spass_H2NuVS0Red2 : string
    46   val spass_H2NuVS0Red2 : string
    47   val spass_H2SOS : string
    47   val spass_H2SOS : string
    48   val spass_extra_options : string Config.T
    48   val spass_extra_options : string Config.T
       
    49   val is_vampire_noncommercial_license_accepted : unit -> bool option
    49   val remote_atp : string -> string -> string list -> (string * string) list ->
    50   val remote_atp : string -> string -> string list -> (string * string) list ->
    50     (atp_failure * string) list -> atp_formula_role -> (Proof.context -> slice_spec * string) ->
    51     (atp_failure * string) list -> atp_formula_role -> (Proof.context -> slice_spec * string) ->
    51     string * (unit -> atp_config)
    52     string * (unit -> atp_config)
    52   val add_atp : string * (unit -> atp_config) -> theory -> theory
    53   val add_atp : string * (unit -> atp_config) -> theory -> theory
    53   val get_atp : theory -> string -> (unit -> atp_config)
    54   val get_atp : theory -> string -> (unit -> atp_config)
   167 val agsyhol_thf0 = THF (Monomorphic, THF_Without_Choice)
   168 val agsyhol_thf0 = THF (Monomorphic, THF_Without_Choice)
   168 
   169 
   169 val agsyhol_config : atp_config =
   170 val agsyhol_config : atp_config =
   170   {exec = K (["AGSYHOL_HOME"], ["agsyHOL"]),
   171   {exec = K (["AGSYHOL_HOME"], ["agsyHOL"]),
   171    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   172    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   172        "--proof --time-out " ^ string_of_int (to_secs 1 timeout) ^ " " ^
   173      "--proof --time-out " ^ string_of_int (to_secs 1 timeout) ^ " " ^ file_name,
   173        file_name,
       
   174    proof_delims = tstp_proof_delims,
   174    proof_delims = tstp_proof_delims,
   175    known_failures = known_szs_status_failures,
   175    known_failures = known_szs_status_failures,
   176    prem_role = Hypothesis,
   176    prem_role = Hypothesis,
   177    best_slices =
   177    best_slices =
   178      (* FUDGE *)
   178      (* FUDGE *)
   186 (* Alt-Ergo *)
   186 (* Alt-Ergo *)
   187 
   187 
   188 val alt_ergo_config : atp_config =
   188 val alt_ergo_config : atp_config =
   189   {exec = K (["WHY3_HOME"], ["why3"]),
   189   {exec = K (["WHY3_HOME"], ["why3"]),
   190    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   190    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   191        "--format tptp --prover 'Alt-Ergo,0.95.2,' --timelimit " ^
   191      "--format tptp --prover 'Alt-Ergo,0.95.2,' --timelimit " ^ string_of_int (to_secs 1 timeout) ^
   192        string_of_int (to_secs 1 timeout) ^ " " ^ file_name,
   192      " " ^ file_name,
   193    proof_delims = [],
   193    proof_delims = [],
   194    known_failures =
   194    known_failures =
   195      [(ProofMissing, ": Valid"),
   195      [(ProofMissing, ": Valid"),
   196       (TimedOut, ": Timeout"),
   196       (TimedOut, ": Timeout"),
   197       (GaveUp, ": Unknown")],
   197       (GaveUp, ": Unknown")],
   318 (* E-MaLeS *)
   318 (* E-MaLeS *)
   319 
   319 
   320 val e_males_config : atp_config =
   320 val e_males_config : atp_config =
   321   {exec = K (["E_MALES_HOME"], ["emales.py"]),
   321   {exec = K (["E_MALES_HOME"], ["emales.py"]),
   322    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   322    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   323        "-t " ^ string_of_int (to_secs 1 timeout) ^ " -p " ^ file_name,
   323      "-t " ^ string_of_int (to_secs 1 timeout) ^ " -p " ^ file_name,
   324    proof_delims = tstp_proof_delims,
   324    proof_delims = tstp_proof_delims,
   325    known_failures = #known_failures e_config,
   325    known_failures = #known_failures e_config,
   326    prem_role = Conjecture,
   326    prem_role = Conjecture,
   327    best_slices =
   327    best_slices =
   328      (* FUDGE *)
   328      (* FUDGE *)
   339 (* E-Par *)
   339 (* E-Par *)
   340 
   340 
   341 val e_par_config : atp_config =
   341 val e_par_config : atp_config =
   342   {exec = K (["E_HOME"], ["runepar.pl"]),
   342   {exec = K (["E_HOME"], ["runepar.pl"]),
   343    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   343    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   344        string_of_int (to_secs 1 timeout) ^ " 1 " (* SInE *) ^ file_name ^
   344      string_of_int (to_secs 1 timeout) ^ " 1 " (* SInE *) ^ file_name ^ " 2" (* proofs *),
   345        " 2" (* proofs *),
       
   346    proof_delims = tstp_proof_delims,
   345    proof_delims = tstp_proof_delims,
   347    known_failures = #known_failures e_config,
   346    known_failures = #known_failures e_config,
   348    prem_role = Conjecture,
   347    prem_role = Conjecture,
   349    best_slices = #best_slices e_males_config,
   348    best_slices = #best_slices e_males_config,
   350    best_max_mono_iters = default_max_mono_iters,
   349    best_max_mono_iters = default_max_mono_iters,
   358 val ehoh_thf0 = THF (Monomorphic, THF_Lambda_Free)
   357 val ehoh_thf0 = THF (Monomorphic, THF_Lambda_Free)
   359 
   358 
   360 val ehoh_config : atp_config =
   359 val ehoh_config : atp_config =
   361   {exec = fn _ => (["E_HOME"], ["eprover"]),
   360   {exec = fn _ => (["E_HOME"], ["eprover"]),
   362    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   361    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   363        "--auto-schedule --tstp-in --tstp-out --silent --cpu-limit=" ^
   362      "--auto-schedule --tstp-in --tstp-out --silent --cpu-limit=" ^
   364        string_of_int (to_secs 2 timeout) ^ " --proof-object=1 " ^ file_name,
   363      string_of_int (to_secs 2 timeout) ^ " --proof-object=1 " ^ file_name,
   365    proof_delims =
   364    proof_delims =
   366      [("# SZS output start CNFRefutation", "# SZS output end CNFRefutation")] @
   365      [("# SZS output start CNFRefutation", "# SZS output end CNFRefutation")] @
   367      tstp_proof_delims,
   366      tstp_proof_delims,
   368    known_failures =
   367    known_failures =
   369      [(TimedOut, "Failure: Resource limit exceeded (time)"),
   368      [(TimedOut, "Failure: Resource limit exceeded (time)"),
   382 (* iProver *)
   381 (* iProver *)
   383 
   382 
   384 val iprover_config : atp_config =
   383 val iprover_config : atp_config =
   385   {exec = K (["IPROVER_HOME"], ["iprover"]),
   384   {exec = K (["IPROVER_HOME"], ["iprover"]),
   386    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   385    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   387        "--clausifier \"$IPROVER_HOME\"/vclausify_rel --time_out_real " ^
   386      "--clausifier \"$IPROVER_HOME\"/vclausify_rel --time_out_real " ^
   388        string_of_real (Time.toReal timeout) ^ " " ^ file_name,
   387      string_of_real (Time.toReal timeout) ^ " " ^ file_name,
   389    proof_delims = tstp_proof_delims,
   388    proof_delims = tstp_proof_delims,
   390    known_failures =
   389    known_failures =
   391      [(ProofIncomplete, "% SZS output start CNFRefutation")] @
   390      [(ProofIncomplete, "% SZS output start CNFRefutation")] @
   392      known_szs_status_failures,
   391      known_szs_status_failures,
   393    prem_role = Hypothesis,
   392    prem_role = Hypothesis,
   471 val satallax_thf0 = THF (Monomorphic, THF_Without_Choice)
   470 val satallax_thf0 = THF (Monomorphic, THF_Without_Choice)
   472 
   471 
   473 val satallax_config : atp_config =
   472 val satallax_config : atp_config =
   474   {exec = K (["SATALLAX_HOME"], ["satallax.opt", "satallax"]),
   473   {exec = K (["SATALLAX_HOME"], ["satallax.opt", "satallax"]),
   475    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   474    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   476        "-p tstp -t " ^ string_of_int (to_secs 1 timeout) ^ " " ^ file_name,
   475      "-p tstp -t " ^ string_of_int (to_secs 1 timeout) ^ " " ^ file_name,
   477    proof_delims =
   476    proof_delims =
   478      [("% SZS output start Proof", "% SZS output end Proof")],
   477      [("% SZS output start Proof", "% SZS output end Proof")],
   479    known_failures = known_szs_status_failures,
   478    known_failures = known_szs_status_failures,
   480    prem_role = Hypothesis,
   479    prem_role = Hypothesis,
   481    best_slices =
   480    best_slices =
   499 val spass_extra_options =
   498 val spass_extra_options =
   500   Attrib.setup_config_string @{binding atp_spass_extra_options} (K "")
   499   Attrib.setup_config_string @{binding atp_spass_extra_options} (K "")
   501 
   500 
   502 val spass_config : atp_config =
   501 val spass_config : atp_config =
   503   {exec = K (["SPASS_HOME"], ["SPASS"]),
   502   {exec = K (["SPASS_HOME"], ["SPASS"]),
   504    arguments = fn _ => fn full_proofs => fn extra_options => fn timeout =>
   503    arguments = fn _ => fn full_proofs => fn extra_options => fn timeout => fn file_name => fn _ =>
   505        fn file_name => fn _ =>
   504      "-Isabelle=1 " ^ (if full_proofs then "-CNFRenaming=0 -Splits=0 " else "") ^
   506        "-Isabelle=1 " ^ (if full_proofs then "-CNFRenaming=0 -Splits=0 " else "") ^
   505      "-TimeLimit=" ^ string_of_int (to_secs 1 timeout) ^ " " ^ file_name
   507        "-TimeLimit=" ^ string_of_int (to_secs 1 timeout) ^ " " ^ file_name
   506      |> extra_options <> "" ? prefix (extra_options ^ " "),
   508        |> extra_options <> "" ? prefix (extra_options ^ " "),
       
   509    proof_delims = [("Here is a proof", "Formulae used in the proof")],
   507    proof_delims = [("Here is a proof", "Formulae used in the proof")],
   510    known_failures =
   508    known_failures =
   511      [(GaveUp, "SPASS beiseite: Completion found"),
   509      [(GaveUp, "SPASS beiseite: Completion found"),
   512       (TimedOut, "SPASS beiseite: Ran out of time"),
   510       (TimedOut, "SPASS beiseite: Ran out of time"),
   513       (OutOfResources, "SPASS beiseite: Maximal number of loops exceeded"),
   511       (OutOfResources, "SPASS beiseite: Maximal number of loops exceeded"),
   536 val spass = (spassN, fn () => spass_config)
   534 val spass = (spassN, fn () => spass_config)
   537 
   535 
   538 
   536 
   539 (* Vampire *)
   537 (* Vampire *)
   540 
   538 
   541 (* Vampire 1.8 has TFF0 support, but the support was buggy until revision
   539 fun is_vampire_noncommercial_license_accepted () =
   542    1435 (or shortly before). *)
   540   let
   543 fun is_vampire_at_least_1_8 () = is_greater_equal (string_ord (getenv "VAMPIRE_VERSION", "1.8"))
   541     val flag = Options.default_string @{system_option vampire_noncommercial}
   544 fun is_vampire_beyond_1_8 () = is_greater (string_ord (getenv "VAMPIRE_VERSION", "1.8"))
   542       |> String.map Char.toLower
       
   543   in
       
   544     if flag = "yes" then
       
   545       SOME true
       
   546     else if flag = "no" then
       
   547       SOME false
       
   548     else
       
   549       NONE
       
   550   end
       
   551 
       
   552 fun check_vampire_noncommercial () =
       
   553   (case is_vampire_noncommercial_license_accepted () of
       
   554     SOME true => ()
       
   555   | SOME false =>
       
   556     error (Pretty.string_of (Pretty.para
       
   557       "The Vampire prover may be used only for noncommercial applications"))
       
   558   | NONE =>
       
   559     error (Pretty.string_of (Pretty.para
       
   560       "The Vampire prover is not activated; to activate it, set the Isabelle system option \
       
   561       \\"vampire_noncommercial\" to \"yes\" (e.g. via the Isabelle/jEdit menu Plugin Options \
       
   562       \/ Isabelle / General)")))
   545 
   563 
   546 val vampire_tff0 = TFF Monomorphic
   564 val vampire_tff0 = TFF Monomorphic
   547 
   565 
   548 val vampire_basic_options = "--proof tptp --output_axiom_names on --mode casc"
   566 val vampire_basic_options = "--proof tptp --output_axiom_names on $VAMPIRE_EXTRA_OPTIONS"
   549 
   567 
   550 (* cf. p. 20 of https://www.complang.tuwien.ac.at/lkovacs/Cade23_Tutorial_Slides/Session2_Slides.pdf *)
   568 (* cf. p. 20 of https://www.complang.tuwien.ac.at/lkovacs/Cade23_Tutorial_Slides/Session2_Slides.pdf *)
   551 val vampire_full_proof_options =
   569 val vampire_full_proof_options =
   552   " --forced_options splitting=off:equality_proxy=off:general_splitting=off:inequality_splitting=0:\
   570   " --forced_options splitting=off:equality_proxy=off:general_splitting=off:inequality_splitting=0:\
   553   \naming=0"
   571   \naming=0"
   556   "vampire " ^ vampire_basic_options ^ " " ^ vampire_full_proof_options ^ " -t %d %s"
   574   "vampire " ^ vampire_basic_options ^ " " ^ vampire_full_proof_options ^ " -t %d %s"
   557 
   575 
   558 val vampire_config : atp_config =
   576 val vampire_config : atp_config =
   559   {exec = K (["VAMPIRE_HOME"], ["vampire"]),
   577   {exec = K (["VAMPIRE_HOME"], ["vampire"]),
   560    arguments = fn _ => fn full_proofs => fn sos => fn timeout => fn file_name => fn _ =>
   578    arguments = fn _ => fn full_proofs => fn sos => fn timeout => fn file_name => fn _ =>
   561      vampire_basic_options ^
   579      (check_vampire_noncommercial ();
   562      (if is_vampire_at_least_1_8 () andalso full_proofs then " " ^ vampire_full_proof_options
   580       vampire_basic_options ^ (if full_proofs then " " ^ vampire_full_proof_options else "") ^
   563       else "") ^
   581       " -t " ^ string_of_int (to_secs 1 timeout) ^ " --input_file " ^ file_name
   564      " -t " ^ string_of_int (to_secs 1 timeout) ^ " --input_file " ^ file_name
   582       |> sos = sosN ? prefix "--sos on "),
   565      |> sos = sosN ? prefix "--sos on ",
       
   566    proof_delims =
   583    proof_delims =
   567      [("=========== Refutation ==========",
   584      [("=========== Refutation ==========",
   568        "======= End of refutation =======")] @
   585        "======= End of refutation =======")] @
   569      tstp_proof_delims,
   586      tstp_proof_delims,
   570    known_failures =
   587    known_failures =
   575       (Interrupted, "Aborted by signal SIGINT")] @
   592       (Interrupted, "Aborted by signal SIGINT")] @
   576      known_szs_status_failures,
   593      known_szs_status_failures,
   577    prem_role = Hypothesis,
   594    prem_role = Hypothesis,
   578    best_slices = fn ctxt =>
   595    best_slices = fn ctxt =>
   579      (* FUDGE *)
   596      (* FUDGE *)
   580      (if is_vampire_beyond_1_8 () then
   597      [(0.333, (((500, meshN), vampire_tff0, "mono_native", combs_or_liftingN, false), sosN)),
   581         [(0.333, (((500, meshN), vampire_tff0, "mono_native", combs_or_liftingN, false), sosN)),
   598       (0.333, (((150, meshN), vampire_tff0, "poly_tags??", combs_or_liftingN, false), sosN)),
   582          (0.333, (((150, meshN), vampire_tff0, "poly_tags??", combs_or_liftingN, false), sosN)),
   599       (0.334, (((50, meshN), vampire_tff0, "mono_native", combs_or_liftingN, false), no_sosN))]
   583          (0.334, (((50, meshN), vampire_tff0, "mono_native", combs_or_liftingN, false), no_sosN))]
       
   584       else
       
   585         [(0.333, (((150, meshN), FOF, "poly_guards??", combs_or_liftingN, false), sosN)),
       
   586          (0.333, (((500, meshN), FOF, "mono_tags??", combs_or_liftingN, false), sosN)),
       
   587          (0.334, (((50, meshN), FOF, "mono_guards??", combs_or_liftingN, false), no_sosN))])
       
   588      |> Config.get ctxt force_sos ? (hd #> apfst (K 1.0) #> single),
   600      |> Config.get ctxt force_sos ? (hd #> apfst (K 1.0) #> single),
   589    best_max_mono_iters = default_max_mono_iters,
   601    best_max_mono_iters = default_max_mono_iters,
   590    best_max_new_mono_instances = 2 * default_max_new_mono_instances (* FUDGE *)}
   602    best_max_new_mono_instances = 2 * default_max_new_mono_instances (* FUDGE *)}
   591 
   603 
   592 val vampire = (vampireN, fn () => vampire_config)
   604 val vampire = (vampireN, fn () => vampire_config)
       
   605 
   593 
   606 
   594 (* Z3 with TPTP syntax (half experimental, half legacy) *)
   607 (* Z3 with TPTP syntax (half experimental, half legacy) *)
   595 
   608 
   596 val z3_tff0 = TFF Monomorphic
   609 val z3_tff0 = TFF Monomorphic
   597 
   610 
   617 (* Zipperposition*)
   630 (* Zipperposition*)
   618 
   631 
   619 val zipperposition_config : atp_config =
   632 val zipperposition_config : atp_config =
   620   {exec = K (["ZIPPERPOSITION_HOME"], ["zipperposition"]),
   633   {exec = K (["ZIPPERPOSITION_HOME"], ["zipperposition"]),
   621    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   634    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
   622        "-print none -proof tstp -print-types -timeout " ^
   635      "-print none -proof tstp -print-types -timeout " ^ string_of_int (to_secs 1 timeout) ^ " " ^
   623        string_of_int (to_secs 1 timeout) ^ " " ^ file_name,
   636      file_name,
   624    proof_delims = tstp_proof_delims,
   637    proof_delims = tstp_proof_delims,
   625    known_failures = known_szs_status_failures,
   638    known_failures = known_szs_status_failures,
   626    prem_role = Hypothesis,
   639    prem_role = Hypothesis,
   627    best_slices = fn _ =>
   640    best_slices = fn _ =>
   628      (* FUDGE *)
   641      (* FUDGE *)