src/HOL/Tools/Sledgehammer/sledgehammer_proof_methods.ML
author blanchet
Thu, 13 Feb 2014 13:16:16 +0100
changeset 55451 ea1d9408a233
parent 55323 253a029335a2
child 55452 29ec8680e61f
permissions -rw-r--r--
removed hint that is seldom useful in practice
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55287
ffa306239316 renamed ML file
blanchet
parents: 55286
diff changeset
     1
(*  Title:      HOL/Tools/Sledgehammer/sledgehammer_proof_methods.ML
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
     2
    Author:     Jasmin Blanchette, TU Muenchen
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
     3
    Author:     Steffen Juilf Smolka, TU Muenchen
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
     4
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
     5
Reconstructors.
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
     6
*)
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
     7
55287
ffa306239316 renamed ML file
blanchet
parents: 55286
diff changeset
     8
signature SLEDGEHAMMER_PROOF_METHODS =
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
     9
sig
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    10
  type stature = ATP_Problem_Generate.stature
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    11
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    12
  datatype proof_method =
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    13
    Metis_Method of string option * string option |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    14
    Meson_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    15
    SMT_Method |
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    16
    Blast_Method |
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    17
    Simp_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    18
    Simp_Size_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    19
    Auto_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    20
    Fastforce_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    21
    Force_Method |
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    22
    Linarith_Method |
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    23
    Presburger_Method |
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    24
    Algebra_Method
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    25
54824
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    26
  datatype play_outcome =
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    27
    Played of Time.time |
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    28
    Play_Timed_Out of Time.time |
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    29
    Play_Failed |
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    30
    Not_Played
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    31
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    32
  type minimize_command = string list -> string
54824
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    33
  type one_line_params =
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    34
    (proof_method * play_outcome) * string * (string * stature) list * minimize_command * int * int
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    35
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    36
  val string_of_proof_method : proof_method -> string
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    37
  val tac_of_proof_method : Proof.context -> thm list * thm list -> proof_method -> int -> tactic
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
    38
  val string_of_play_outcome : play_outcome -> string
55269
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
    39
  val play_outcome_ord : play_outcome * play_outcome -> order
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
    40
  val one_line_proof_text : int -> one_line_params -> string
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    41
  val silence_proof_methods : bool -> Proof.context -> Proof.context
54495
237d5be57277 refactored
blanchet
parents: 52590
diff changeset
    42
end;
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    43
55287
ffa306239316 renamed ML file
blanchet
parents: 55286
diff changeset
    44
structure Sledgehammer_Proof_Methods : SLEDGEHAMMER_PROOF_METHODS =
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    45
struct
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    46
54828
b2271ad695db don't do 'isar_try0' if preplaying is off
blanchet
parents: 54824
diff changeset
    47
open ATP_Util
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    48
open ATP_Problem_Generate
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
    49
open ATP_Proof_Reconstruct
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    50
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    51
datatype proof_method =
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    52
  Metis_Method of string option * string option |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    53
  Meson_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    54
  SMT_Method |
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    55
  Blast_Method |
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    56
  Simp_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    57
  Simp_Size_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    58
  Auto_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    59
  Fastforce_Method |
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    60
  Force_Method |
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    61
  Linarith_Method |
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    62
  Presburger_Method |
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    63
  Algebra_Method
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    64
54824
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    65
datatype play_outcome =
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    66
  Played of Time.time |
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    67
  Play_Timed_Out of Time.time |
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    68
  Play_Failed |
4e58a38b330b refactored preplaying outcome data structure
blanchet
parents: 54823
diff changeset
    69
  Not_Played
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
    70
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
    71
type minimize_command = string list -> string
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
    72
type one_line_params =
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    73
  (proof_method * play_outcome) * string * (string * stature) list * minimize_command * int * int
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
    74
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    75
fun string_of_proof_method meth =
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    76
  (case meth of
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    77
    Metis_Method (NONE, NONE) => "metis"
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    78
  | Metis_Method (type_enc_opt, lam_trans_opt) =>
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    79
    "metis (" ^ commas (map_filter I [type_enc_opt, lam_trans_opt]) ^ ")"
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    80
  | Meson_Method => "meson"
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    81
  | SMT_Method => "smt"
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    82
  | Blast_Method => "blast"
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    83
  | Simp_Method => "simp"
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    84
  | Simp_Size_Method => "simp add: size_ne_size_imp_ne"
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    85
  | Auto_Method => "auto"
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    86
  | Fastforce_Method => "fastforce"
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    87
  | Force_Method => "force"
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    88
  | Linarith_Method => "linarith"
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    89
  | Presburger_Method => "presburger"
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    90
  | Algebra_Method => "algebra")
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    91
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    92
fun tac_of_proof_method ctxt (local_facts, global_facts) meth =
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    93
  Method.insert_tac local_facts THEN'
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    94
  (case meth of
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    95
    Metis_Method (type_enc_opt, lam_trans_opt) =>
55315
54b0352fb46d removed legacy 'metisFT' method
blanchet
parents: 55314
diff changeset
    96
    Metis_Tactic.metis_tac [type_enc_opt |> the_default (hd partial_type_encs)]
55314
blanchet
parents: 55287
diff changeset
    97
      (lam_trans_opt |> the_default default_metis_lam_trans) ctxt global_facts
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
    98
  | Meson_Method => Meson.meson_tac ctxt global_facts
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
    99
  | SMT_Method => SMT_Solver.smt_tac ctxt global_facts
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   100
  | _ =>
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   101
    Method.insert_tac global_facts THEN'
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   102
    (case meth of
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
   103
      Blast_Method => blast_tac ctxt
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
   104
    | Simp_Method => Simplifier.asm_full_simp_tac ctxt
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   105
    | Simp_Size_Method =>
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   106
      Simplifier.asm_full_simp_tac (Simplifier.add_simp @{thm size_ne_size_imp_ne} ctxt)
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   107
    | Auto_Method => K (Clasimp.auto_tac ctxt)
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   108
    | Fastforce_Method => Clasimp.fast_force_tac ctxt
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   109
    | Force_Method => Clasimp.force_tac ctxt
55323
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
   110
    | Linarith_Method => Lin_Arith.tac ctxt
253a029335a2 split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
blanchet
parents: 55315
diff changeset
   111
    | Presburger_Method => Cooper.tac true [] [] ctxt
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   112
    | Algebra_Method => Groebner.algebra_tac [] [] ctxt))
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   113
54828
b2271ad695db don't do 'isar_try0' if preplaying is off
blanchet
parents: 54824
diff changeset
   114
fun string_of_play_outcome (Played time) = string_of_ext_time (false, time)
b2271ad695db don't do 'isar_try0' if preplaying is off
blanchet
parents: 54824
diff changeset
   115
  | string_of_play_outcome (Play_Timed_Out time) = string_of_ext_time (true, time) ^ ", timed out"
b2271ad695db don't do 'isar_try0' if preplaying is off
blanchet
parents: 54824
diff changeset
   116
  | string_of_play_outcome Play_Failed = "failed"
b2271ad695db don't do 'isar_try0' if preplaying is off
blanchet
parents: 54824
diff changeset
   117
  | string_of_play_outcome _ = "unknown"
b2271ad695db don't do 'isar_try0' if preplaying is off
blanchet
parents: 54824
diff changeset
   118
55269
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   119
fun play_outcome_ord (Played time1, Played time2) =
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   120
    int_ord (pairself Time.toMilliseconds (time1, time2))
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   121
  | play_outcome_ord (Played _, _) = LESS
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   122
  | play_outcome_ord (_, Played _) = GREATER
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   123
  | play_outcome_ord (Not_Played, Not_Played) = EQUAL
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   124
  | play_outcome_ord (Not_Played, _) = LESS
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   125
  | play_outcome_ord (_, Not_Played) = GREATER
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   126
  | play_outcome_ord (Play_Timed_Out time1, Play_Timed_Out time2) =
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   127
    int_ord (pairself Time.toMilliseconds (time1, time2))
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   128
  | play_outcome_ord (Play_Timed_Out _, _) = LESS
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   129
  | play_outcome_ord (_, Play_Timed_Out _) = GREATER
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   130
  | play_outcome_ord (Play_Failed, Play_Failed) = EQUAL
aae87746f412 more thorough, hybrid compression
blanchet
parents: 55212
diff changeset
   131
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   132
(* FIXME: Various bugs, esp. with "unfolding"
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   133
fun unusing_chained_facts _ 0 = ""
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   134
  | unusing_chained_facts used_chaineds num_chained =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   135
    if length used_chaineds = num_chained then ""
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   136
    else if null used_chaineds then "(* using no facts *) "
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   137
    else "(* using only " ^ space_implode " " used_chaineds ^ " *) "
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   138
*)
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   139
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   140
fun apply_on_subgoal _ 1 = "by "
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   141
  | apply_on_subgoal 1 _ = "apply "
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   142
  | apply_on_subgoal i n =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   143
    "prefer " ^ string_of_int i ^ " " ^ apply_on_subgoal 1 n
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   144
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   145
fun command_call name [] =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   146
    name |> not (Symbol_Pos.is_identifier name) ? enclose "(" ")"
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   147
  | command_call name args = "(" ^ name ^ " " ^ space_implode " " args ^ ")"
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   148
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   149
(* FIXME *)
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   150
fun proof_method_command meth i n used_chaineds num_chained ss =
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   151
  (* unusing_chained_facts used_chaineds num_chained ^ *)
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   152
  apply_on_subgoal i n ^ command_call (string_of_proof_method meth) ss
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   153
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   154
fun show_time NONE = ""
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   155
  | show_time (SOME ext_time) = " (" ^ string_of_ext_time ext_time ^ ")"
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   156
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   157
fun try_command_line banner time command =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   158
  banner ^ ": " ^ Active.sendback_markup [Markup.padding_command] command ^ show_time time ^ "."
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
   159
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   160
fun minimize_line _ [] = ""
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   161
  | minimize_line minimize_command ss =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   162
    (case minimize_command ss of
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   163
      "" => ""
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   164
    | command => "\nTo minimize: " ^ Active.sendback_markup [Markup.padding_command] command ^ ".")
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   165
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   166
fun split_used_facts facts =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   167
  facts
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   168
  |> List.partition (fn (_, (sc, _)) => sc = Chained)
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   169
  |> pairself (sort_distinct (string_ord o pairself fst))
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   170
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   171
fun one_line_proof_text num_chained
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   172
    ((meth, play), banner, used_facts, minimize_command, subgoal, subgoal_count) =
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   173
  let
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   174
    val (chained, extra) = split_used_facts used_facts
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   175
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   176
    val (failed, ext_time) =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   177
      (case play of
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   178
        Played time => (false, (SOME (false, time)))
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   179
      | Play_Timed_Out time => (false, SOME (true, time))
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   180
      | Play_Failed => (true, NONE)
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   181
      | Not_Played => (false, NONE))
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   182
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   183
    val try_line =
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   184
      map fst extra
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   185
      |> proof_method_command meth subgoal subgoal_count (map fst chained) num_chained
55451
ea1d9408a233 removed hint that is seldom useful in practice
blanchet
parents: 55323
diff changeset
   186
      |> (if failed then enclose "One-line proof reconstruction failed: " "."
ea1d9408a233 removed hint that is seldom useful in practice
blanchet
parents: 55323
diff changeset
   187
          else try_command_line banner ext_time)
55211
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   188
  in
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   189
    try_line ^ minimize_line minimize_command (map fst (extra @ chained))
5d027af93a08 moved ML code around
blanchet
parents: 55180
diff changeset
   190
  end
52555
6811291d1869 moved code -> easier debugging
smolkas
parents:
diff changeset
   191
55285
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   192
(* Makes proof methods as silent as possible. The "set_visible" calls suppresses "Unification bound
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   193
   exceeded" warnings and the like. *)
e88ad20035f4 merged 'reconstructors' and 'proof methods'
blanchet
parents: 55269
diff changeset
   194
fun silence_proof_methods debug =
55180
03ac74b01e49 compile
blanchet
parents: 55177
diff changeset
   195
  Try0.silence_methods debug
55170
cdb9435e3cae silenced reconstructors in Sledgehammer
blanchet
parents: 54828
diff changeset
   196
  #> Config.put SMT_Config.verbose debug
cdb9435e3cae silenced reconstructors in Sledgehammer
blanchet
parents: 54828
diff changeset
   197
54495
237d5be57277 refactored
blanchet
parents: 52590
diff changeset
   198
end;