src/HOL/Tools/ATP/atp_systems.ML
changeset 49984 9f655a6bffd8
parent 48803 ffa31bf5c662
child 49987 25e333d2eccd
equal deleted inserted replaced
49983:33e18e9916a8 49984:9f655a6bffd8
   576 val spass_poly_config = dummy_config spass_poly_format "tc_native"
   576 val spass_poly_config = dummy_config spass_poly_format "tc_native"
   577 val spass_poly = (spass_polyN, fn () => spass_poly_config)
   577 val spass_poly = (spass_polyN, fn () => spass_poly_config)
   578 
   578 
   579 (* Remote ATP invocation via SystemOnTPTP *)
   579 (* Remote ATP invocation via SystemOnTPTP *)
   580 
   580 
   581 val systems = Synchronized.var "atp_systems" ([] : string list)
   581 val remote_systems = Synchronized.var "atp_remote_systems" ([] : string list)
   582 
   582 
   583 fun get_systems () =
   583 fun get_remote_systems () =
   584   case Isabelle_System.bash_output
   584   case Isabelle_System.bash_output
   585            "\"$ISABELLE_ATP/scripts/remote_atp\" -w 2>&1" of
   585            "\"$ISABELLE_ATP/scripts/remote_atp\" -w 2>&1" of
   586     (output, 0) => split_lines output
   586     (output, 0) => split_lines output
   587   | (output, _) =>
   587   | (output, _) =>
   588     error (case extract_known_failure known_perl_failures output of
   588     error (case extract_known_failure known_perl_failures output of
   589              SOME failure => string_for_failure failure
   589              SOME failure => string_for_failure failure
   590            | NONE => trim_line output ^ ".")
   590            | NONE => trim_line output ^ ".")
   591 
   591 
   592 fun find_system name [] systems =
   592 fun find_remote_system name [] systems =
   593     find_first (String.isPrefix (name ^ "---")) systems
   593     find_first (String.isPrefix (name ^ "---")) systems
   594   | find_system name (version :: versions) systems =
   594   | find_remote_system name (version :: versions) systems =
   595     case find_first (String.isPrefix (name ^ "---" ^ version)) systems of
   595     case find_first (String.isPrefix (name ^ "---" ^ version)) systems of
   596       NONE => find_system name versions systems
   596       NONE => find_remote_system name versions systems
   597     | res => res
   597     | res => res
   598 
   598 
   599 fun get_system name versions =
   599 fun get_remote_system name versions =
   600   Synchronized.change_result systems
   600   Synchronized.change_result remote_systems
   601       (fn systems => (if null systems then get_systems () else systems)
   601       (fn systems => (if null systems then get_remote_systems () else systems)
   602                      |> `(`(find_system name versions)))
   602                      |> `(`(find_remote_system name versions)))
   603 
   603 
   604 fun the_system name versions =
   604 fun the_remote_system name versions =
   605   case get_system name versions of
   605   case get_remote_system name versions of
   606     (SOME sys, _) => sys
   606     (SOME sys, _) => sys
   607   | (NONE, []) => error ("SystemOnTPTP is not available.")
   607   | (NONE, []) => error ("SystemOnTPTP is not available.")
   608   | (NONE, syss) =>
   608   | (NONE, syss) =>
   609     case syss |> filter_out (String.isPrefix "%")
   609     case syss |> filter_out (String.isPrefix "%")
   610               |> filter_out (curry (op =) "") of
   610               |> filter_out (curry (op =) "") of
   619 fun remote_config system_name system_versions proof_delims known_failures
   619 fun remote_config system_name system_versions proof_delims known_failures
   620                   prem_role best_slice : atp_config =
   620                   prem_role best_slice : atp_config =
   621   {exec = (["ISABELLE_ATP"], ["scripts/remote_atp"]),
   621   {exec = (["ISABELLE_ATP"], ["scripts/remote_atp"]),
   622    arguments = fn _ => fn _ => fn command => fn timeout => fn _ =>
   622    arguments = fn _ => fn _ => fn command => fn timeout => fn _ =>
   623        (if command <> "" then "-c " ^ quote command ^ " " else "") ^
   623        (if command <> "" then "-c " ^ quote command ^ " " else "") ^
   624        "-s " ^ the_system system_name system_versions ^ " " ^
   624        "-s " ^ the_remote_system system_name system_versions ^ " " ^
   625        "-t " ^ string_of_int (Int.min (max_remote_secs, to_secs 1 timeout)),
   625        "-t " ^ string_of_int (Int.min (max_remote_secs, to_secs 1 timeout)),
   626    proof_delims = union (op =) tstp_proof_delims proof_delims,
   626    proof_delims = union (op =) tstp_proof_delims proof_delims,
   627    known_failures = known_failures @ known_perl_failures @ known_says_failures,
   627    known_failures = known_failures @ known_perl_failures @ known_says_failures,
   628    prem_role = prem_role,
   628    prem_role = prem_role,
   629    best_slices = fn ctxt => [(1.0, best_slice ctxt)],
   629    best_slices = fn ctxt => [(1.0, best_slice ctxt)],
   700   let val {exec, ...} = get_atp thy name () in
   700   let val {exec, ...} = get_atp thy name () in
   701     exists (fn var => getenv var <> "") (fst exec)
   701     exists (fn var => getenv var <> "") (fst exec)
   702   end
   702   end
   703 
   703 
   704 fun refresh_systems_on_tptp () =
   704 fun refresh_systems_on_tptp () =
   705   Synchronized.change systems (fn _ => get_systems ())
   705   Synchronized.change remote_systems (fn _ => get_remote_systems ())
   706 
   706 
   707 fun effective_term_order ctxt atp =
   707 fun effective_term_order ctxt atp =
   708   let val ord = Config.get ctxt term_order in
   708   let val ord = Config.get ctxt term_order in
   709     if ord = smartN then
   709     if ord = smartN then
   710       if atp = spassN then
   710       if atp = spassN then