src/HOL/Tools/ATP_Manager/atp_systems.ML
changeset 38041 3b80d6082131
parent 38033 df99f022751d
equal deleted inserted replaced
38040:174568533593 38041:3b80d6082131
   106 
   106 
   107 
   107 
   108 (* The "-VarWeight=3" option helps the higher-order problems, probably by
   108 (* The "-VarWeight=3" option helps the higher-order problems, probably by
   109    counteracting the presence of "hAPP". *)
   109    counteracting the presence of "hAPP". *)
   110 val spass_config : prover_config =
   110 val spass_config : prover_config =
   111   {executable = ("ISABELLE_ATP_MANAGER", "SPASS_TPTP"),
   111   {executable = ("ISABELLE_ATP_MANAGER", "scripts/spass"),
   112    required_executables = [("SPASS_HOME", "SPASS")],
   112    required_executables = [("SPASS_HOME", "SPASS")],
   113    (* "div 2" accounts for the fact that SPASS is often run twice. *)
   113    (* "div 2" accounts for the fact that SPASS is often run twice. *)
   114    arguments = fn complete => fn timeout =>
   114    arguments = fn complete => fn timeout =>
   115      ("-Auto -PGiven=0 -PProblem=0 -Splits=0 -FullRed=0 -DocProof \
   115      ("-Auto -PGiven=0 -PProblem=0 -Splits=0 -FullRed=0 -DocProof \
   116       \-VarWeight=3 -TimeLimit=" ^
   116       \-VarWeight=3 -TimeLimit=" ^
   155 (* Remote prover invocation via SystemOnTPTP *)
   155 (* Remote prover invocation via SystemOnTPTP *)
   156 
   156 
   157 val systems = Synchronized.var "atp_systems" ([]: string list)
   157 val systems = Synchronized.var "atp_systems" ([]: string list)
   158 
   158 
   159 fun get_systems () =
   159 fun get_systems () =
   160   case bash_output "\"$ISABELLE_ATP_MANAGER/SystemOnTPTP\" -w" of
   160   case bash_output "\"$ISABELLE_ATP_MANAGER/scripts/remote_atp\" -w" of
   161     (answer, 0) => split_lines answer
   161     (answer, 0) => split_lines answer
   162   | (answer, _) =>
   162   | (answer, _) =>
   163     error ("Failed to get available systems at SystemOnTPTP:\n" ^
   163     error ("Failed to get available systems at SystemOnTPTP:\n" ^
   164            perhaps (try (unsuffix "\n")) answer)
   164            perhaps (try (unsuffix "\n")) answer)
   165 
   165 
   178 val remote_known_failures =
   178 val remote_known_failures =
   179   [(CantConnect, "HTTP-Error"),
   179   [(CantConnect, "HTTP-Error"),
   180    (TimedOut, "says Timeout"),
   180    (TimedOut, "says Timeout"),
   181    (MalformedOutput, "Remote script could not extract proof")]
   181    (MalformedOutput, "Remote script could not extract proof")]
   182 
   182 
   183 fun remote_config atp_prefix args
   183 fun remote_config atp_prefix
   184         ({proof_delims, known_failures, max_new_relevant_facts_per_iter,
   184         ({proof_delims, known_failures, max_new_relevant_facts_per_iter,
   185           prefers_theory_relevant, explicit_forall, ...} : prover_config)
   185           prefers_theory_relevant, explicit_forall, ...} : prover_config)
   186         : prover_config =
   186         : prover_config =
   187   {executable = ("ISABELLE_ATP_MANAGER", "SystemOnTPTP"),
   187   {executable = ("ISABELLE_ATP_MANAGER", "scripts/remote_atp"),
   188    required_executables = [],
   188    required_executables = [],
   189    arguments = fn _ => fn timeout =>
   189    arguments = fn _ => fn timeout =>
   190      args ^ " -t " ^ string_of_int (to_generous_secs timeout) ^ " -s " ^
   190      " -t " ^ string_of_int (to_generous_secs timeout) ^ " -s " ^
   191      the_system atp_prefix,
   191      the_system atp_prefix,
   192    proof_delims = insert (op =) tstp_proof_delims proof_delims,
   192    proof_delims = insert (op =) tstp_proof_delims proof_delims,
   193    known_failures = remote_known_failures @ known_failures,
   193    known_failures = remote_known_failures @ known_failures,
   194    max_new_relevant_facts_per_iter = max_new_relevant_facts_per_iter,
   194    max_new_relevant_facts_per_iter = max_new_relevant_facts_per_iter,
   195    prefers_theory_relevant = prefers_theory_relevant,
   195    prefers_theory_relevant = prefers_theory_relevant,
   196    explicit_forall = explicit_forall}
   196    explicit_forall = explicit_forall}
   197 
   197 
   198 val remote_name = prefix "remote_"
   198 val remote_name = prefix "remote_"
   199 
   199 
   200 fun remote_prover prover atp_prefix args config =
   200 fun remote_prover (name, config) atp_prefix =
   201   (remote_name (fst prover), remote_config atp_prefix args config)
   201   (remote_name name, remote_config atp_prefix config)
   202 
   202 
   203 val remote_e = remote_prover e "EP---" "" e_config
   203 val remote_e = remote_prover e "EP---"
   204 val remote_spass = remote_prover spass "SPASS---" "-x" spass_config
   204 val remote_vampire = remote_prover vampire "Vampire---9"
   205 val remote_vampire = remote_prover vampire "Vampire---9" "" vampire_config
   205 
   206 
   206 fun is_installed ({executable, required_executables, ...} : prover_config) =
   207 fun maybe_remote (name, _)
   207   forall (curry (op <>) "" o getenv o fst) (executable :: required_executables)
   208                  ({executable, required_executables, ...} : prover_config) =
   208 fun maybe_remote (name, config) =
   209   name |> exists (curry (op =) "" o getenv o fst)
   209   name |> not (is_installed config) ? remote_name
   210                  (executable :: required_executables) ? remote_name
       
   211 
   210 
   212 fun default_atps_param_value () =
   211 fun default_atps_param_value () =
   213   space_implode " " [maybe_remote e e_config, maybe_remote spass spass_config,
   212   space_implode " " ([maybe_remote e] @
   214                      remote_name (fst vampire)]
   213                      (if is_installed (snd spass) then [fst spass] else []) @
   215 
   214                      [remote_name (fst vampire)])
   216 val provers = [e, spass, vampire, remote_e, remote_spass, remote_vampire]
   215 
       
   216 val provers = [e, spass, vampire, remote_e, remote_vampire]
   217 val setup = fold add_prover provers
   217 val setup = fold add_prover provers
   218 
   218 
   219 end;
   219 end;