src/HOL/Tools/ATP_Manager/atp_minimal.ML
author blanchet
Fri, 19 Mar 2010 15:07:44 +0100
changeset 35866 513074557e06
parent 35865 2f8fb5242799
child 35867 16279c4c7a33
permissions -rw-r--r--
move the Sledgehammer Isar commands together into one file; this will make easier to add options and reorganize them later
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32327
0971cc0b6a57 src/HOL/Tools/ATP_Manager as separate component, with (almost) everything in one place;
wenzelm
parents: 32091
diff changeset
     1
(*  Title:      HOL/Tools/ATP_Manager/atp_minimal.ML
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
     2
    Author:     Philipp Meyer, TU Muenchen
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
     3
33492
4168294a9f96 Command atp_minimize uses the naive linear algorithm now
nipkow
parents: 33316
diff changeset
     4
Minimization of theorem list for metis by using an external automated theorem prover
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
     5
*)
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
     6
32525
ea322e847633 added signature ATP_MINIMAL,
boehmes
parents: 32510
diff changeset
     7
signature ATP_MINIMAL =
ea322e847633 added signature ATP_MINIMAL,
boehmes
parents: 32510
diff changeset
     8
sig
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
     9
  type 'a minimize_fun = ('a list -> bool) -> 'a list -> 'a list
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    10
  val linear_minimize : 'a minimize_fun
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    11
  val binary_minimize : 'a minimize_fun
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    12
  val minimize_theorems :
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    13
    (string * thm list) minimize_fun -> ATP_Wrapper.prover -> string -> int
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    14
    -> Proof.state -> (string * thm list) list
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    15
    -> (string * thm list) list option * string
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    16
end;
32525
ea322e847633 added signature ATP_MINIMAL,
boehmes
parents: 32510
diff changeset
    17
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35826
diff changeset
    18
structure ATP_Minimal : ATP_MINIMAL =
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    19
struct
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    20
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    21
open Sledgehammer_Fact_Preprocessor
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    22
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    23
type 'a minimize_fun = ('a list -> bool) -> 'a list -> 'a list
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    24
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    25
(* Linear minimization algorithm *)
33492
4168294a9f96 Command atp_minimize uses the naive linear algorithm now
nipkow
parents: 33316
diff changeset
    26
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    27
fun linear_minimize p s =
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    28
  let
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    29
    fun aux [] needed = needed
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    30
      | aux (x :: xs) needed = aux xs (needed |> not (p (xs @ needed)) ? cons x)
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    31
  in aux s [] end;
33492
4168294a9f96 Command atp_minimize uses the naive linear algorithm now
nipkow
parents: 33316
diff changeset
    32
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    33
(* Binary minimalization *)
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    34
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    35
local
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    36
  fun isplit (l, r) [] = (l, r)
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    37
    | isplit (l, r) [h] = (h :: l, r)
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    38
    | isplit (l, r) (h1 :: h2 :: t) = isplit (h1 :: l, h2 :: r) t
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    39
in
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    40
  fun split lst = isplit ([], []) lst
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    41
end
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    42
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    43
local
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    44
  fun min _ _ [] = raise Empty
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    45
    | min _ _ [s0] = [s0]
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    46
    | min p sup s =
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    47
      let
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    48
        val (l0, r0) = split s
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    49
      in
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    50
        if p (sup @ l0) then
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    51
          min p sup l0
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    52
        else if p (sup @ r0) then
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    53
          min p sup r0
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    54
        else
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    55
          let
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    56
            val l = min p (sup @ r0) l0
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    57
            val r = min p (sup @ l) r0
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    58
          in l @ r end
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    59
      end
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    60
in
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    61
  (* return a minimal subset v of s that satisfies p
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    62
   @pre p(s) & ~p([]) & monotone(p)
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    63
   @post v subset s & p(v) &
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    64
         forall e in v. ~p(v \ e)
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    65
   *)
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    66
  fun binary_minimize p s =
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    67
    case min p [] s of
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    68
      [x] => if p [] then [] else [x]
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    69
    | m => m
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    70
end
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    71
31037
ac8669134e7a added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff changeset
    72
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    73
(* failure check and producing answer *)
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    74
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    75
datatype 'a prove_result = Success of 'a | Failure | Timeout | Error
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    76
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    77
val string_of_result =
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    78
  fn Success _ => "Success"
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    79
   | Failure => "Failure"
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    80
   | Timeout => "Timeout"
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    81
   | Error => "Error"
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    82
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    83
val failure_strings =
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    84
  [("SPASS beiseite: Ran out of time.", Timeout),
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    85
   ("Timeout", Timeout),
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    86
   ("time limit exceeded", Timeout),
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    87
   ("# Cannot determine problem status within resource limit", Timeout),
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    88
   ("Error", Error)]
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
    89
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    90
fun produce_answer (result : ATP_Wrapper.prover_result) =
32864
a226f29d4bdc re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
boehmes
parents: 32740
diff changeset
    91
  let
32942
b6711ec9de26 misc tuning and recovery of Isabelle coding style;
wenzelm
parents: 32941
diff changeset
    92
    val {success, proof = result_string, internal_thm_names = thm_name_vec,
b6711ec9de26 misc tuning and recovery of Isabelle coding style;
wenzelm
parents: 32941
diff changeset
    93
      filtered_clauses = filtered, ...} = result
32864
a226f29d4bdc re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
boehmes
parents: 32740
diff changeset
    94
  in
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    95
    if success then
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    96
      (Success (Vector.foldr (op ::) [] thm_name_vec, filtered), result_string)
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    97
    else
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    98
      let
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
    99
        val failure = failure_strings |> get_first (fn (s, t) =>
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   100
            if String.isSubstring s result_string then SOME (t, result_string) else NONE)
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   101
      in
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   102
        (case failure of
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   103
          SOME res => res
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   104
        | NONE => (Failure, result_string))
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   105
      end
32864
a226f29d4bdc re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
boehmes
parents: 32740
diff changeset
   106
  end
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   107
32936
9491bec20595 modernized structure names;
wenzelm
parents: 32864
diff changeset
   108
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   109
(* wrapper for calling external prover *)
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   110
32864
a226f29d4bdc re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
boehmes
parents: 32740
diff changeset
   111
fun sh_test_thms prover time_limit subgoalno state filtered name_thms_pairs =
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   112
  let
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   113
    val _ = priority ("Testing " ^ string_of_int (length name_thms_pairs) ^ " theorems... ")
32525
ea322e847633 added signature ATP_MINIMAL,
boehmes
parents: 32510
diff changeset
   114
    val name_thm_pairs = maps (fn (n, ths) => map (pair n) ths) name_thms_pairs
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   115
    val axclauses = cnf_rules_pairs (Proof.theory_of state) name_thm_pairs
35592
768d17f54125 use regular Proof.goal (which is what methods usually see) and prevent sledgehammer from crashing;
wenzelm
parents: 33492
diff changeset
   116
    val {context = ctxt, facts, goal} = Proof.goal state
32941
72d48e333b77 eliminated extraneous wrapping of public records;
wenzelm
parents: 32937
diff changeset
   117
    val problem =
72d48e333b77 eliminated extraneous wrapping of public records;
wenzelm
parents: 32937
diff changeset
   118
     {with_full_types = ! ATP_Manager.full_types,
32864
a226f29d4bdc re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
boehmes
parents: 32740
diff changeset
   119
      subgoal = subgoalno,
33292
affe60b3d864 renamed raw Proof.get_goal to Proof.raw_goal;
wenzelm
parents: 32948
diff changeset
   120
      goal = (ctxt, (facts, goal)),
32864
a226f29d4bdc re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
boehmes
parents: 32740
diff changeset
   121
      axiom_clauses = SOME axclauses,
32941
72d48e333b77 eliminated extraneous wrapping of public records;
wenzelm
parents: 32937
diff changeset
   122
      filtered_clauses = filtered}
32948
e95a4be101a8 natural argument order for prover;
wenzelm
parents: 32947
diff changeset
   123
    val (result, proof) = produce_answer (prover time_limit problem)
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   124
    val _ = priority (string_of_result result)
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   125
  in
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   126
    (result, proof)
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   127
  end
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   128
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   129
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   130
(* minimalization of thms *)
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   131
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   132
fun minimize_theorems gen_min prover prover_name time_limit state
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   133
                      name_thms_pairs =
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   134
  let
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   135
    val _ =
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   136
      priority ("Minimize called with " ^ string_of_int (length name_thms_pairs) ^
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   137
        " theorems, prover: " ^ prover_name ^
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   138
        ", time limit: " ^ string_of_int time_limit ^ " seconds")
32864
a226f29d4bdc re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
boehmes
parents: 32740
diff changeset
   139
    val test_thms_fun = sh_test_thms prover time_limit 1 state
31752
19a5f1c8a844 use results of relevance-filter to determine additional clauses;
immler@in.tum.de
parents: 31409
diff changeset
   140
    fun test_thms filtered thms =
19a5f1c8a844 use results of relevance-filter to determine additional clauses;
immler@in.tum.de
parents: 31409
diff changeset
   141
      case test_thms_fun filtered thms of (Success _, _) => true | _ => false
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   142
  in
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   143
    (* try prove first to check result and get used theorems *)
31409
d8537ba165b5 split preparing clauses and writing problemfile;
immler@in.tum.de
parents: 31236
diff changeset
   144
    (case test_thms_fun NONE name_thms_pairs of
31752
19a5f1c8a844 use results of relevance-filter to determine additional clauses;
immler@in.tum.de
parents: 31409
diff changeset
   145
      (Success (used, filtered), _) =>
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   146
        let
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   147
          val ordered_used = sort_distinct string_ord used
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   148
          val to_use =
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   149
            if length ordered_used < length name_thms_pairs then
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   150
              filter (fn (name1, _) => List.exists (equal name1) ordered_used) name_thms_pairs
33305
wenzelm
parents: 33292
diff changeset
   151
            else name_thms_pairs
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   152
          val min_thms =
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   153
            if null to_use then []
33492
4168294a9f96 Command atp_minimize uses the naive linear algorithm now
nipkow
parents: 33316
diff changeset
   154
            else gen_min (test_thms (SOME filtered)) to_use
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   155
          val min_names = sort_distinct string_ord (map fst min_thms)
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   156
          val _ = priority (cat_lines
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   157
            ["Minimal " ^ string_of_int (length min_thms) ^ " theorems"])
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   158
        in
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   159
          (SOME min_thms, "Try this command: " ^
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   160
            Markup.markup Markup.sendback ("apply (metis " ^ space_implode " " min_names ^ ")"))
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   161
        end
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   162
    | (Timeout, _) =>
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   163
        (NONE, "Timeout: You may need to increase the time limit of " ^
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   164
          string_of_int time_limit ^ " seconds. Call atp_minimize [time=...] ")
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   165
    | (Error, msg) =>
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   166
        (NONE, "Error in prover: " ^ msg)
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   167
    | (Failure, _) =>
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   168
        (NONE, "Failure: No proof with the theorems supplied"))
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35826
diff changeset
   169
    handle Sledgehammer_HOL_Clause.TRIVIAL =>
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   170
        (SOME [], "Trivial: Try this command: " ^ Markup.markup Markup.sendback "apply metis")
32947
3c19b98a35cd ATP_Manager.get_prover: canonical argument order;
wenzelm
parents: 32942
diff changeset
   171
      | ERROR msg => (NONE, "Error: " ^ msg)
31236
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   172
  end
2a1f5c87ac28 proper signature constraint;
wenzelm
parents: 31037
diff changeset
   173
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   174
end;