src/HOL/Tools/Sledgehammer/sledgehammer_atp_reconstruct.ML
changeset 43034 18259246abb5
parent 43033 c4b9b4be90c4
child 43037 ade5c84f860f
equal deleted inserted replaced
43033:c4b9b4be90c4 43034:18259246abb5
    18     SMT of string
    18     SMT of string
    19 
    19 
    20   datatype preplay =
    20   datatype preplay =
    21     Preplayed of reconstructor * Time.time |
    21     Preplayed of reconstructor * Time.time |
    22     Trust_Playable of reconstructor * Time.time option|
    22     Trust_Playable of reconstructor * Time.time option|
    23     Preplay_Failed
    23     Failed_to_Preplay
    24 
    24 
    25   type minimize_command = string list -> string
    25   type minimize_command = string list -> string
    26   type one_line_params =
    26   type one_line_params =
    27     preplay * string * (string * locality) list * minimize_command * thm * int
    27     preplay * string * (string * locality) list * minimize_command * thm * int
    28   type isar_params =
    28   type isar_params =
    71   SMT of string
    71   SMT of string
    72 
    72 
    73 datatype preplay =
    73 datatype preplay =
    74   Preplayed of reconstructor * Time.time |
    74   Preplayed of reconstructor * Time.time |
    75   Trust_Playable of reconstructor * Time.time option |
    75   Trust_Playable of reconstructor * Time.time option |
    76   Preplay_Failed
    76   Failed_to_Preplay
    77 
    77 
    78 type minimize_command = string list -> string
    78 type minimize_command = string list -> string
    79 type one_line_params =
    79 type one_line_params =
    80   preplay * string * (string * locality) list * minimize_command * thm * int
    80   preplay * string * (string * locality) list * minimize_command * thm * int
    81 type isar_params =
    81 type isar_params =
   259   | reconstructor_settings _ = ""
   259   | reconstructor_settings _ = ""
   260 
   260 
   261 fun string_for_label (s, num) = s ^ string_of_int num
   261 fun string_for_label (s, num) = s ^ string_of_int num
   262 
   262 
   263 fun show_time NONE = ""
   263 fun show_time NONE = ""
   264   | show_time (SOME ext_time) = " ~ " ^ string_from_ext_time ext_time
   264   | show_time (SOME ext_time) = " (" ^ string_from_ext_time ext_time ^ ")"
   265 
   265 
   266 fun set_settings "" = ""
   266 fun set_settings "" = ""
   267   | set_settings settings = "using [[" ^ settings ^ "]] "
   267   | set_settings settings = "using [[" ^ settings ^ "]] "
   268 fun apply_on_subgoal settings _ 1 = set_settings settings ^ "by "
   268 fun apply_on_subgoal settings _ 1 = set_settings settings ^ "by "
   269   | apply_on_subgoal settings 1 _ = set_settings settings ^ "apply "
   269   | apply_on_subgoal settings 1 _ = set_settings settings ^ "apply "
   302         (SOME reconstructor,
   302         (SOME reconstructor,
   303          case time of
   303          case time of
   304            NONE => NONE
   304            NONE => NONE
   305          | SOME time =>
   305          | SOME time =>
   306            if time = Time.zeroTime then NONE else SOME (true, time))
   306            if time = Time.zeroTime then NONE else SOME (true, time))
   307       | Preplay_Failed => (NONE, NONE)
   307       | Failed_to_Preplay => (NONE, NONE)
   308     val n = Logic.count_prems (prop_of goal)
   308     val n = Logic.count_prems (prop_of goal)
   309     val try_line =
   309     val try_line =
   310       case reconstructor of
   310       case reconstructor of
   311         SOME r => reconstructor_command r i n ([], map fst extra)
   311         SOME r => reconstructor_command r i n ([], map fst extra)
   312                   |> try_command_line banner ext_time
   312                   |> try_command_line banner ext_time
  1083         |> the_default "\nWarning: The Isar proof construction failed."
  1083         |> the_default "\nWarning: The Isar proof construction failed."
  1084   in one_line_proof ^ isar_proof end
  1084   in one_line_proof ^ isar_proof end
  1085 
  1085 
  1086 fun proof_text ctxt isar_proof isar_params
  1086 fun proof_text ctxt isar_proof isar_params
  1087                (one_line_params as (preplay, _, _, _, _, _)) =
  1087                (one_line_params as (preplay, _, _, _, _, _)) =
  1088   (if isar_proof orelse preplay = Preplay_Failed then
  1088   (if isar_proof orelse preplay = Failed_to_Preplay then
  1089      isar_proof_text ctxt isar_params
  1089      isar_proof_text ctxt isar_params
  1090    else
  1090    else
  1091      one_line_proof_text) one_line_params
  1091      one_line_proof_text) one_line_params
  1092 
  1092 
  1093 end;
  1093 end;