src/HOL/Tools/Sledgehammer/sledgehammer_isar_preplay.ML
changeset 55213 dcb36a2540bc
parent 55212 5832470d956e
child 55219 6fe9fd75f9d7
equal deleted inserted replaced
55212:5832470d956e 55213:dcb36a2540bc
    12   type isar_proof = Sledgehammer_Isar_Proof.isar_proof
    12   type isar_proof = Sledgehammer_Isar_Proof.isar_proof
    13   type label = Sledgehammer_Isar_Proof.label
    13   type label = Sledgehammer_Isar_Proof.label
    14 
    14 
    15   val trace : bool Config.T
    15   val trace : bool Config.T
    16 
    16 
    17   type preplay_data =
    17   type isar_preplay_data =
    18     {get_preplay_outcome: label -> play_outcome,
    18     {get_preplay_outcome: label -> play_outcome,
    19      set_preplay_outcome: label -> play_outcome -> unit,
    19      set_preplay_outcome: label -> play_outcome -> unit,
    20      preplay_quietly: Time.time -> isar_step -> play_outcome,
    20      preplay_quietly: Time.time -> isar_step -> play_outcome,
    21      overall_preplay_outcome: isar_proof -> play_outcome}
    21      overall_preplay_outcome: isar_proof -> play_outcome}
    22 
    22 
    23   val proof_preplay_data : bool -> Proof.context -> string -> string -> bool -> Time.time ->
    23   val preplay_data_of_isar_proof : bool -> Proof.context -> string -> string -> bool -> Time.time ->
    24     isar_proof -> preplay_data
    24     isar_proof -> isar_preplay_data
    25 end;
    25 end;
    26 
    26 
    27 structure Sledgehammer_Isar_Preplay : SLEDGEHAMMER_ISAR_PREPLAY =
    27 structure Sledgehammer_Isar_Preplay : SLEDGEHAMMER_ISAR_PREPLAY =
    28 struct
    28 struct
    29 
    29 
   145     end
   145     end
   146 
   146 
   147 
   147 
   148 (*** proof preplay interface ***)
   148 (*** proof preplay interface ***)
   149 
   149 
   150 type preplay_data =
   150 type isar_preplay_data =
   151   {get_preplay_outcome: label -> play_outcome,
   151   {get_preplay_outcome: label -> play_outcome,
   152    set_preplay_outcome: label -> play_outcome -> unit,
   152    set_preplay_outcome: label -> play_outcome -> unit,
   153    preplay_quietly: Time.time -> isar_step -> play_outcome,
   153    preplay_quietly: Time.time -> isar_step -> play_outcome,
   154    overall_preplay_outcome: isar_proof -> play_outcome}
   154    overall_preplay_outcome: isar_proof -> play_outcome}
   155 
   155 
   182 (* Given a proof, produces an imperative preplay interface with a shared table mapping from labels
   182 (* Given a proof, produces an imperative preplay interface with a shared table mapping from labels
   183    to preplay results. The preplay results are caluclated lazyly and cached to avoid repeated
   183    to preplay results. The preplay results are caluclated lazyly and cached to avoid repeated
   184    calculation.
   184    calculation.
   185 
   185 
   186    Precondition: The proof must be labeled canonically; cf.
   186    Precondition: The proof must be labeled canonically; cf.
   187    "Slegehammer_Proof.relabel_proof_canonically". *)
   187    "Slegehammer_Isar_Proof.relabel_isar_proof_canonically". *)
   188 fun proof_preplay_data debug ctxt type_enc lam_trans do_preplay preplay_timeout proof =
   188 fun preplay_data_of_isar_proof debug ctxt type_enc lam_trans do_preplay preplay_timeout proof =
   189   if not do_preplay then
   189   if not do_preplay then
   190     (* the "dont_preplay" option pretends that everything works just fine *)
   190     (* the "dont_preplay" option pretends that everything works just fine *)
   191     {get_preplay_outcome = K (Played Time.zeroTime),
   191     {get_preplay_outcome = K (Played Time.zeroTime),
   192      set_preplay_outcome = K (K ()),
   192      set_preplay_outcome = K (K ()),
   193      preplay_quietly = K (K (Played Time.zeroTime)),
   193      preplay_quietly = K (K (Played Time.zeroTime)),
   194      overall_preplay_outcome = K (Played Time.zeroTime)} : preplay_data
   194      overall_preplay_outcome = K (Played Time.zeroTime)} : isar_preplay_data
   195   else
   195   else
   196     let
   196     let
   197       val ctxt = enrich_context_with_local_facts proof ctxt
   197       val ctxt = enrich_context_with_local_facts proof ctxt
   198 
   198 
   199       fun preplay quietly timeout step =
   199       fun preplay quietly timeout step =