src/HOL/Tools/ATP_Manager/atp_systems.ML
changeset 36382 b90fc0d75bca
parent 36377 b3dce4c715d0
child 36393 be73a2b2443b
equal deleted inserted replaced
36381:f4d84d84a01a 36382:b90fc0d75bca
    49   {home: string,
    49   {home: string,
    50    executable: string,
    50    executable: string,
    51    arguments: Time.time -> string,
    51    arguments: Time.time -> string,
    52    proof_delims: (string * string) list,
    52    proof_delims: (string * string) list,
    53    known_failures: (failure * string) list,
    53    known_failures: (failure * string) list,
    54    max_new_clauses: int,
    54    max_axiom_clauses: int,
    55    prefers_theory_relevant: bool};
    55    prefers_theory_relevant: bool};
    56 
    56 
    57 
    57 
    58 (* basic template *)
    58 (* basic template *)
    59 
    59 
   173       if Config.get ctxt measure_runtime then split_time s else (s, 0)
   173       if Config.get ctxt measure_runtime then split_time s else (s, 0)
   174     fun run_on probfile =
   174     fun run_on probfile =
   175       if File.exists command then
   175       if File.exists command then
   176         write_file full_types explicit_apply probfile clauses
   176         write_file full_types explicit_apply probfile clauses
   177         |> pair (apfst split_time' (bash_output (command_line probfile)))
   177         |> pair (apfst split_time' (bash_output (command_line probfile)))
   178       else error ("Bad executable: " ^ Path.implode command ^ ".");
   178       else
       
   179         error ("Bad executable: " ^ Path.implode command ^ ".");
   179 
   180 
   180     (* If the problem file has not been exported, remove it; otherwise, export
   181     (* If the problem file has not been exported, remove it; otherwise, export
   181        the proof file too. *)
   182        the proof file too. *)
   182     fun cleanup probfile =
   183     fun cleanup probfile =
   183       if the_dest_dir = "" then try File.rm probfile else NONE
   184       if the_dest_dir = "" then try File.rm probfile else NONE
   215 
   216 
   216 (* generic TPTP-based provers *)
   217 (* generic TPTP-based provers *)
   217 
   218 
   218 fun generic_tptp_prover
   219 fun generic_tptp_prover
   219         (name, {home, executable, arguments, proof_delims, known_failures,
   220         (name, {home, executable, arguments, proof_delims, known_failures,
   220                 max_new_clauses, prefers_theory_relevant})
   221                 max_axiom_clauses, prefers_theory_relevant})
   221         (params as {debug, overlord, respect_no_atp, relevance_threshold,
   222         (params as {debug, overlord, respect_no_atp, relevance_threshold,
   222                     convergence, theory_relevant, higher_order, follow_defs,
   223                     convergence, theory_relevant, higher_order, follow_defs,
   223                     isar_proof, ...})
   224                     isar_proof, ...})
   224         minimize_command timeout =
   225         minimize_command timeout =
   225   generic_prover overlord
   226   generic_prover overlord
   226       (get_relevant_facts respect_no_atp relevance_threshold convergence
   227       (get_relevant_facts respect_no_atp relevance_threshold convergence
   227                           higher_order follow_defs max_new_clauses
   228                           higher_order follow_defs max_axiom_clauses
   228                           (the_default prefers_theory_relevant theory_relevant))
   229                           (the_default prefers_theory_relevant theory_relevant))
   229       (prepare_clauses higher_order false)
   230       (prepare_clauses higher_order false)
   230       (write_tptp_file (debug andalso overlord andalso not isar_proof)) home
   231       (write_tptp_file (debug andalso overlord andalso not isar_proof)) home
   231       executable (arguments timeout) proof_delims known_failures name params
   232       executable (arguments timeout) proof_delims known_failures name params
   232       minimize_command
   233       minimize_command
   234 fun tptp_prover name p = (name, generic_tptp_prover (name, p));
   235 fun tptp_prover name p = (name, generic_tptp_prover (name, p));
   235 
   236 
   236 
   237 
   237 (** common provers **)
   238 (** common provers **)
   238 
   239 
   239 fun generous_to_secs time = (Time.toMilliseconds time + 999) div 1000
   240 fun to_generous_secs time = (Time.toMilliseconds time + 999) div 1000
   240 
   241 
   241 (* Vampire *)
   242 (* Vampire *)
   242 
   243 
   243 (* Vampire requires an explicit time limit. *)
   244 (* Vampire requires an explicit time limit. *)
   244 
   245 
   245 val vampire_config : prover_config =
   246 val vampire_config : prover_config =
   246   {home = getenv "VAMPIRE_HOME",
   247   {home = getenv "VAMPIRE_HOME",
   247    executable = "vampire",
   248    executable = "vampire",
   248    arguments = (fn timeout => "--output_syntax tptp --mode casc -t " ^
   249    arguments = fn timeout =>
   249                               string_of_int (generous_to_secs timeout)),
   250      "--output_syntax tptp --mode casc -t " ^
       
   251      string_of_int (to_generous_secs timeout),
   250    proof_delims = [("=========== Refutation ==========",
   252    proof_delims = [("=========== Refutation ==========",
   251                     "======= End of refutation =======")],
   253                     "======= End of refutation =======")],
   252    known_failures =
   254    known_failures =
   253      [(Unprovable, "Satisfiability detected"),
   255      [(Unprovable, "Satisfiability detected"),
   254       (OutOfResources, "CANNOT PROVE"),
   256       (OutOfResources, "CANNOT PROVE"),
   255       (OutOfResources, "Refutation not found")],
   257       (OutOfResources, "Refutation not found")],
   256    max_new_clauses = 60,
   258    max_axiom_clauses = 60,
   257    prefers_theory_relevant = false}
   259    prefers_theory_relevant = false}
   258 val vampire = tptp_prover "vampire" vampire_config
   260 val vampire = tptp_prover "vampire" vampire_config
   259 
   261 
   260 
   262 
   261 (* E prover *)
   263 (* E prover *)
   264   ("# SZS output start CNFRefutation.", "# SZS output end CNFRefutation")
   266   ("# SZS output start CNFRefutation.", "# SZS output end CNFRefutation")
   265 
   267 
   266 val e_config : prover_config =
   268 val e_config : prover_config =
   267   {home = getenv "E_HOME",
   269   {home = getenv "E_HOME",
   268    executable = "eproof",
   270    executable = "eproof",
   269    arguments = (fn timeout => "--tstp-in --tstp-out -l5 -xAutoDev \
   271    arguments = fn timeout =>
   270                               \-tAutoDev --silent --cpu-limit=" ^
   272      "--tstp-in --tstp-out -l5 -xAutoDev -tAutoDev --silent --cpu-limit=" ^
   271                               string_of_int (generous_to_secs timeout)),
   273      string_of_int (to_generous_secs timeout),
   272    proof_delims = [tstp_proof_delims],
   274    proof_delims = [tstp_proof_delims],
   273    known_failures =
   275    known_failures =
   274      [(Unprovable, "SZS status: Satisfiable"),
   276      [(Unprovable, "SZS status: Satisfiable"),
   275       (Unprovable, "SZS status Satisfiable"),
   277       (Unprovable, "SZS status Satisfiable"),
   276       (TimedOut, "Failure: Resource limit exceeded (time)"),
   278       (TimedOut, "Failure: Resource limit exceeded (time)"),
   277       (TimedOut, "time limit exceeded"),
   279       (TimedOut, "time limit exceeded"),
   278       (OutOfResources,
   280       (OutOfResources,
   279        "# Cannot determine problem status within resource limit"),
   281        "# Cannot determine problem status within resource limit"),
   280       (OutOfResources, "SZS status: ResourceOut"),
   282       (OutOfResources, "SZS status: ResourceOut"),
   281       (OutOfResources, "SZS status ResourceOut")],
   283       (OutOfResources, "SZS status ResourceOut")],
   282    max_new_clauses = 100,
   284    max_axiom_clauses = 100,
   283    prefers_theory_relevant = false}
   285    prefers_theory_relevant = false}
   284 val e = tptp_prover "e" e_config
   286 val e = tptp_prover "e" e_config
   285 
   287 
   286 
   288 
   287 (* SPASS *)
   289 (* SPASS *)
   288 
   290 
   289 fun generic_dfg_prover
   291 fun generic_dfg_prover
   290         (name, {home, executable, arguments, proof_delims, known_failures,
   292         (name, {home, executable, arguments, proof_delims, known_failures,
   291                 max_new_clauses, prefers_theory_relevant})
   293                 max_axiom_clauses, prefers_theory_relevant})
   292         (params as {overlord, respect_no_atp, relevance_threshold, convergence,
   294         (params as {overlord, respect_no_atp, relevance_threshold, convergence,
   293                     theory_relevant, higher_order, follow_defs, ...})
   295                     theory_relevant, higher_order, follow_defs, ...})
   294         minimize_command timeout =
   296         minimize_command timeout =
   295   generic_prover overlord
   297   generic_prover overlord
   296       (get_relevant_facts respect_no_atp relevance_threshold convergence
   298       (get_relevant_facts respect_no_atp relevance_threshold convergence
   297                           higher_order follow_defs max_new_clauses
   299                           higher_order follow_defs max_axiom_clauses
   298                           (the_default prefers_theory_relevant theory_relevant))
   300                           (the_default prefers_theory_relevant theory_relevant))
   299       (prepare_clauses higher_order true) write_dfg_file home executable
   301       (prepare_clauses higher_order true) write_dfg_file home executable
   300       (arguments timeout) proof_delims known_failures name params
   302       (arguments timeout) proof_delims known_failures name params
   301       minimize_command
   303       minimize_command
   302 
   304 
   305 (* The "-VarWeight=3" option helps the higher-order problems, probably by
   307 (* The "-VarWeight=3" option helps the higher-order problems, probably by
   306    counteracting the presence of "hAPP". *)
   308    counteracting the presence of "hAPP". *)
   307 val spass_config : prover_config =
   309 val spass_config : prover_config =
   308   {home = getenv "SPASS_HOME",
   310   {home = getenv "SPASS_HOME",
   309    executable = "SPASS",
   311    executable = "SPASS",
   310    arguments = (fn timeout => "-Auto -SOS=1 -PGiven=0 -PProblem=0 -Splits=0" ^
   312    arguments = fn timeout =>
   311      " -FullRed=0 -DocProof -VarWeight=3 -TimeLimit=" ^
   313      "-Auto -SOS=1 -PGiven=0 -PProblem=0 -Splits=0 -FullRed=0 -DocProof \
   312      string_of_int (generous_to_secs timeout)),
   314      \-VarWeight=3 -TimeLimit=" ^ string_of_int (to_generous_secs timeout),
   313    proof_delims = [("Here is a proof", "Formulae used in the proof")],
   315    proof_delims = [("Here is a proof", "Formulae used in the proof")],
   314    known_failures =
   316    known_failures =
   315      [(Unprovable, "SPASS beiseite: Completion found"),
   317      [(Unprovable, "SPASS beiseite: Completion found"),
   316       (TimedOut, "SPASS beiseite: Ran out of time"),
   318       (TimedOut, "SPASS beiseite: Ran out of time"),
   317       (OutOfResources, "SPASS beiseite: Maximal number of loops exceeded")],
   319       (OutOfResources, "SPASS beiseite: Maximal number of loops exceeded")],
   318    max_new_clauses = 40,
   320    max_axiom_clauses = 40,
   319    prefers_theory_relevant = true}
   321    prefers_theory_relevant = true}
   320 val spass = dfg_prover "spass" spass_config
   322 val spass = dfg_prover "spass" spass_config
   321 
   323 
   322 (* SPASS 3.7 supports both the DFG and the TPTP syntax, whereas SPASS 3.0
   324 (* SPASS 3.7 supports both the DFG and the TPTP syntax, whereas SPASS 3.0
   323    supports only the DFG syntax. As soon as all Isabelle repository/snapshot
   325    supports only the DFG syntax. As soon as all Isabelle repository/snapshot
   334    proof_delims = #proof_delims spass_config,
   336    proof_delims = #proof_delims spass_config,
   335    known_failures =
   337    known_failures =
   336      #known_failures spass_config @
   338      #known_failures spass_config @
   337      [(OldSpass, "unrecognized option `-TPTP'"),
   339      [(OldSpass, "unrecognized option `-TPTP'"),
   338       (OldSpass, "Unrecognized option TPTP")],
   340       (OldSpass, "Unrecognized option TPTP")],
   339    max_new_clauses = #max_new_clauses spass_config,
   341    max_axiom_clauses = #max_axiom_clauses spass_config,
   340    prefers_theory_relevant = #prefers_theory_relevant spass_config}
   342    prefers_theory_relevant = #prefers_theory_relevant spass_config}
   341 val spass_tptp = tptp_prover "spass_tptp" spass_tptp_config
   343 val spass_tptp = tptp_prover "spass_tptp" spass_tptp_config
   342 
   344 
   343 (* remote prover invocation via SystemOnTPTP *)
   345 (* remote prover invocation via SystemOnTPTP *)
   344 
   346 
   365 
   367 
   366 val remote_known_failures =
   368 val remote_known_failures =
   367   [(TimedOut, "says Timeout"),
   369   [(TimedOut, "says Timeout"),
   368    (MalformedOutput, "Remote script could not extract proof")]
   370    (MalformedOutput, "Remote script could not extract proof")]
   369 
   371 
   370 fun remote_prover_config prover_prefix args
   372 fun remote_prover_config atp_prefix args
   371         ({proof_delims, known_failures, max_new_clauses,
   373         ({proof_delims, known_failures, max_axiom_clauses,
   372           prefers_theory_relevant, ...} : prover_config) : prover_config =
   374           prefers_theory_relevant, ...} : prover_config) : prover_config =
   373   {home = getenv "ISABELLE_ATP_MANAGER",
   375   {home = getenv "ISABELLE_ATP_MANAGER",
   374    executable = "SystemOnTPTP",
   376    executable = "SystemOnTPTP",
   375    arguments = (fn timeout =>
   377    arguments = fn timeout =>
   376      args ^ " -t " ^ string_of_int (generous_to_secs timeout) ^ " -s " ^
   378      args ^ " -t " ^ string_of_int (to_generous_secs timeout) ^ " -s " ^
   377      the_system prover_prefix),
   379      the_system atp_prefix,
   378    proof_delims = insert (op =) tstp_proof_delims proof_delims,
   380    proof_delims = insert (op =) tstp_proof_delims proof_delims,
   379    known_failures = remote_known_failures @ known_failures,
   381    known_failures = remote_known_failures @ known_failures,
   380    max_new_clauses = max_new_clauses,
   382    max_axiom_clauses = max_axiom_clauses,
   381    prefers_theory_relevant = prefers_theory_relevant}
   383    prefers_theory_relevant = prefers_theory_relevant}
   382 
   384 
   383 val remote_vampire =
   385 val remote_vampire =
   384   tptp_prover (remotify (fst vampire))
   386   tptp_prover (remotify (fst vampire))
   385               (remote_prover_config "Vampire---9" "" vampire_config)
   387               (remote_prover_config "Vampire---9" "" vampire_config)