src/HOL/Tools/ATP/atp_systems.ML
changeset 54788 a898e15b522a
parent 54197 994ebb795b75
child 54802 9ce867291c76
equal deleted inserted replaced
54787:6d1670095414 54788:a898e15b522a
    60   val iprover_eqN : string
    60   val iprover_eqN : string
    61   val leo2N : string
    61   val leo2N : string
    62   val satallaxN : string
    62   val satallaxN : string
    63   val snarkN : string
    63   val snarkN : string
    64   val spassN : string
    64   val spassN : string
    65   val spass_polyN : string
    65   val spass_pirateN : string
    66   val vampireN : string
    66   val vampireN : string
    67   val waldmeisterN : string
    67   val waldmeisterN : string
    68   val z3_tptpN : string
    68   val z3_tptpN : string
    69   val remote_prefix : string
    69   val remote_prefix : string
    70   val remote_atp :
    70   val remote_atp :
   171 val iprover_eqN = "iprover_eq"
   171 val iprover_eqN = "iprover_eq"
   172 val leo2N = "leo2"
   172 val leo2N = "leo2"
   173 val satallaxN = "satallax"
   173 val satallaxN = "satallax"
   174 val snarkN = "snark"
   174 val snarkN = "snark"
   175 val spassN = "spass"
   175 val spassN = "spass"
   176 val spass_polyN = "spass_poly"
   176 val spass_pirateN = "spass_pirate"
   177 val vampireN = "vampire"
   177 val vampireN = "vampire"
   178 val waldmeisterN = "waldmeister"
   178 val waldmeisterN = "waldmeister"
   179 val z3_tptpN = "z3_tptp"
   179 val z3_tptpN = "z3_tptp"
   180 val remote_prefix = "remote_"
   180 val remote_prefix = "remote_"
   181 
   181 
   652                 else combsN, uncurried_aliases), ""))],
   652                 else combsN, uncurried_aliases), ""))],
   653    best_max_mono_iters = default_max_mono_iters,
   653    best_max_mono_iters = default_max_mono_iters,
   654    best_max_new_mono_instances = default_max_new_mono_instances}
   654    best_max_new_mono_instances = default_max_new_mono_instances}
   655 
   655 
   656 val dummy_thf_format = THF (Polymorphic, THF_With_Choice)
   656 val dummy_thf_format = THF (Polymorphic, THF_With_Choice)
   657 val dummy_thf_config =
   657 val dummy_thf_config = dummy_config Hypothesis dummy_thf_format "poly_native_higher" false
   658   dummy_config Hypothesis dummy_thf_format "poly_native_higher" false
       
   659 val dummy_thf = (dummy_thfN, fn () => dummy_thf_config)
   658 val dummy_thf = (dummy_thfN, fn () => dummy_thf_config)
   660 
   659 
   661 val spass_poly_format = DFG Polymorphic
   660 val spass_pirate_format = DFG Polymorphic
   662 val spass_poly_config =
   661 val remote_spass_pirate_config =
   663   dummy_config (#prem_role spass_config) spass_poly_format "tc_native" true
   662   {exec = K (["ISABELLE_ATP"], ["scripts/remote_spass_pirate"]),
   664 val spass_poly = (spass_polyN, fn () => spass_poly_config)
   663    arguments = fn _ => fn _ => fn _ => fn timeout => fn file_name => fn _ =>
       
   664      string_of_int (to_secs 1 timeout) ^ " " ^ file_name,
       
   665    proof_delims = [("Involved clauses:", "Involved clauses:")],
       
   666    known_failures = known_szs_status_failures,
       
   667    prem_role = #prem_role spass_config,
       
   668    best_slices = K [(1.0, (((200, ""), spass_pirate_format, "tc_native", combsN, true), ""))],
       
   669    best_max_mono_iters = default_max_mono_iters,
       
   670    best_max_new_mono_instances = default_max_new_mono_instances}
       
   671 val remote_spass_pirate = (remote_prefix ^ spass_pirateN, fn () => remote_spass_pirate_config)
   665 
   672 
   666 
   673 
   667 (* Remote ATP invocation via SystemOnTPTP *)
   674 (* Remote ATP invocation via SystemOnTPTP *)
   668 
   675 
   669 val remote_systems = Synchronized.var "atp_remote_systems" ([] : string list)
   676 val remote_systems = Synchronized.var "atp_remote_systems" ([] : string list)
   691   Synchronized.change_result remote_systems
   698   Synchronized.change_result remote_systems
   692       (fn systems => (if null systems then get_remote_systems () else systems)
   699       (fn systems => (if null systems then get_remote_systems () else systems)
   693                      |> `(`(find_remote_system name versions)))
   700                      |> `(`(find_remote_system name versions)))
   694 
   701 
   695 fun the_remote_system name versions =
   702 fun the_remote_system name versions =
   696   case get_remote_system name versions of
   703   (case get_remote_system name versions of
   697     (SOME sys, _) => sys
   704     (SOME sys, _) => sys
   698   | (NONE, []) => error ("SystemOnTPTP is not available.")
   705   | (NONE, []) => error "SystemOnTPTP is not available."
   699   | (NONE, syss) =>
   706   | (NONE, syss) =>
   700     case syss |> filter_out (String.isPrefix "%")
   707     (case syss |> filter_out (String.isPrefix "%") |> filter_out (curry (op =) "") of
   701               |> filter_out (curry (op =) "") of
   708       [] => error "SystemOnTPTP is currently not available."
   702       [] => error ("SystemOnTPTP is currently not available.")
       
   703     | [msg] => error ("SystemOnTPTP is currently not available: " ^ msg ^ ".")
   709     | [msg] => error ("SystemOnTPTP is currently not available: " ^ msg ^ ".")
   704     | syss =>
   710     | syss =>
   705       error ("System " ^ quote name ^ " is not available at SystemOnTPTP.\n" ^
   711       error ("System " ^ quote name ^ " is not available at SystemOnTPTP.\n(Available systems: " ^
   706              "(Available systems: " ^ commas_quote syss ^ ".)")
   712         commas_quote syss ^ ".)")))
   707 
   713 
   708 val max_remote_secs = 240 (* give Geoff Sutcliffe's servers a break *)
   714 val max_remote_secs = 240 (* give Geoff Sutcliffe's servers a break *)
   709 
   715 
   710 fun remote_config system_name system_versions proof_delims known_failures
   716 fun remote_config system_name system_versions proof_delims known_failures
   711                   prem_role best_slice : atp_config =
   717                   prem_role best_slice : atp_config =
   712   {exec = K (["ISABELLE_ATP"], ["scripts/remote_atp"]),
   718   {exec = K (["ISABELLE_ATP"], ["scripts/remote_atp"]),
   713    arguments = fn _ => fn _ => fn command => fn timeout => fn file_name =>
   719    arguments = fn _ => fn _ => fn command => fn timeout => fn file_name => fn _ =>
   714        fn _ =>
   720      (if command <> "" then "-c " ^ quote command ^ " " else "") ^
   715        (if command <> "" then "-c " ^ quote command ^ " " else "") ^
   721      "-s " ^ the_remote_system system_name system_versions ^ " " ^
   716        "-s " ^ the_remote_system system_name system_versions ^ " " ^
   722      "-t " ^ string_of_int (Int.min (max_remote_secs, to_secs 1 timeout)) ^
   717        "-t " ^ string_of_int (Int.min (max_remote_secs, to_secs 1 timeout)) ^
   723      " " ^ file_name,
   718        " " ^ file_name,
       
   719    proof_delims = union (op =) tstp_proof_delims proof_delims,
   724    proof_delims = union (op =) tstp_proof_delims proof_delims,
   720    known_failures = known_failures @ known_perl_failures @ known_says_failures,
   725    known_failures = known_failures @ known_perl_failures @ known_says_failures,
   721    prem_role = prem_role,
   726    prem_role = prem_role,
   722    best_slices = fn ctxt => [(1.0, best_slice ctxt)],
   727    best_slices = fn ctxt => [(1.0, best_slice ctxt)],
   723    best_max_mono_iters = default_max_mono_iters,
   728    best_max_mono_iters = default_max_mono_iters,
   786 fun add_atp (name, config) thy =
   791 fun add_atp (name, config) thy =
   787   Data.map (Symtab.update_new (name, (config, stamp ()))) thy
   792   Data.map (Symtab.update_new (name, (config, stamp ()))) thy
   788   handle Symtab.DUP name => error ("Duplicate ATP: " ^ quote name ^ ".")
   793   handle Symtab.DUP name => error ("Duplicate ATP: " ^ quote name ^ ".")
   789 
   794 
   790 fun get_atp thy name =
   795 fun get_atp thy name =
   791   the (Symtab.lookup (Data.get thy) name) |> fst
   796   fst (the (Symtab.lookup (Data.get thy) name))
   792   handle Option.Option => error ("Unknown ATP: " ^ name ^ ".")
   797   handle Option.Option => error ("Unknown ATP: " ^ name ^ ".")
   793 
   798 
   794 val supported_atps = Symtab.keys o Data.get
   799 val supported_atps = Symtab.keys o Data.get
   795 
   800 
   796 fun is_atp_installed thy name =
   801 fun is_atp_installed thy name =
   802   Synchronized.change remote_systems (fn _ => get_remote_systems ())
   807   Synchronized.change remote_systems (fn _ => get_remote_systems ())
   803 
   808 
   804 fun effective_term_order ctxt atp =
   809 fun effective_term_order ctxt atp =
   805   let val ord = Config.get ctxt term_order in
   810   let val ord = Config.get ctxt term_order in
   806     if ord = smartN then
   811     if ord = smartN then
   807       let val is_spass = (atp = spassN orelse atp = spass_polyN) in
   812       {is_lpo = false, gen_weights = (atp = spassN), gen_prec = (atp = spassN),
   808         {is_lpo = false, gen_weights = is_spass, gen_prec = is_spass,
   813        gen_simp = String.isSuffix spass_pirateN atp}
   809          gen_simp = false}
       
   810       end
       
   811     else
   814     else
   812       let val is_lpo = String.isSubstring lpoN ord in
   815       let val is_lpo = String.isSubstring lpoN ord in
   813         {is_lpo = is_lpo,
   816         {is_lpo = is_lpo, gen_weights = not is_lpo andalso String.isSubstring xweightsN ord,
   814          gen_weights = not is_lpo andalso String.isSubstring xweightsN ord,
   817          gen_prec = String.isSubstring xprecN ord, gen_simp = String.isSubstring xsimpN ord}
   815          gen_prec = String.isSubstring xprecN ord,
       
   816          gen_simp = String.isSubstring xsimpN ord}
       
   817       end
   818       end
   818   end
   819   end
   819 
   820 
   820 val atps =
   821 val atps =
   821   [agsyhol, alt_ergo, e, e_males, e_par, iprover, iprover_eq, leo2, satallax,
   822   [agsyhol, alt_ergo, e, e_males, e_par, iprover, iprover_eq, leo2, satallax, spass, vampire,
   822    spass, spass_poly, vampire, z3_tptp, dummy_thf, remote_agsyhol, remote_e,
   823    z3_tptp, dummy_thf, remote_agsyhol, remote_e, remote_e_sine, remote_e_tofof, remote_iprover,
   823    remote_e_sine, remote_e_tofof, remote_iprover, remote_iprover_eq,
   824    remote_iprover_eq, remote_leo2, remote_satallax, remote_vampire, remote_snark,
   824    remote_leo2, remote_satallax, remote_vampire, remote_snark,
   825    remote_spass_pirate, remote_waldmeister]
   825    remote_waldmeister]
       
   826 
   826 
   827 val setup = fold add_atp atps
   827 val setup = fold add_atp atps
   828 
   828 
   829 end;
   829 end;