src/HOL/Tools/Sledgehammer/sledgehammer_reconstruct.ML
changeset 52697 6fb98a20c349
parent 52632 23393c31c7fe
child 52756 1ac8a0d0ddb1
equal deleted inserted replaced
52696:38466f4f3483 52697:6fb98a20c349
    23     (string * stature) list
    23     (string * stature) list
    24   val used_facts_in_unsound_atp_proof :
    24   val used_facts_in_unsound_atp_proof :
    25     Proof.context -> (string * stature) list vector -> 'a proof ->
    25     Proof.context -> (string * stature) list vector -> 'a proof ->
    26     string list option
    26     string list option
    27   val isar_proof_text :
    27   val isar_proof_text :
    28     Proof.context -> bool option -> isar_params -> one_line_params -> string
    28     Proof.context -> bool -> bool option -> isar_params -> one_line_params -> string
    29   val proof_text :
    29   val proof_text :
    30     Proof.context -> bool option -> isar_params -> int -> one_line_params
    30     Proof.context -> bool -> bool option -> isar_params -> int -> one_line_params
    31     -> string
    31     -> string
    32 end;
    32 end;
    33 
    33 
    34 structure Sledgehammer_Reconstruct : SLEDGEHAMMER_RECONSTRUCT =
    34 structure Sledgehammer_Reconstruct : SLEDGEHAMMER_RECONSTRUCT =
    35 struct
    35 struct
   411 type isar_params =
   411 type isar_params =
   412   bool * bool * Time.time option * bool * real * int * real * bool * bool
   412   bool * bool * Time.time option * bool * real * int * real * bool * bool
   413   * string Symtab.table * (string * stature) list vector
   413   * string Symtab.table * (string * stature) list vector
   414   * (string * term) list * int Symtab.table * string proof * thm
   414   * (string * term) list * int Symtab.table * string proof * thm
   415 
   415 
   416 fun isar_proof_text ctxt isar_proofs
   416 fun isar_proof_text ctxt auto isar_proofs
   417     (debug, verbose, preplay_timeout, preplay_trace, isar_compress,
   417     (debug, verbose, preplay_timeout, preplay_trace, isar_compress,
   418      isar_compress_degree, merge_timeout_slack, isar_try0, isar_minimize, pool,
   418      isar_compress_degree, merge_timeout_slack, isar_try0, isar_minimize, pool,
   419      fact_names, lifted, sym_tab, atp_proof, goal)
   419      fact_names, lifted, sym_tab, atp_proof, goal)
   420     (one_line_params as (_, _, _, _, subgoal, subgoal_count)) =
   420     (one_line_params as (_, _, _, _, subgoal, subgoal_count)) =
   421   let
   421   let
   424       params
   424       params
   425       |> map (fn (s, T) => (Binding.name s, SOME T, NoSyn))
   425       |> map (fn (s, T) => (Binding.name s, SOME T, NoSyn))
   426       |> (fn fixes =>
   426       |> (fn fixes =>
   427              ctxt |> Variable.set_body false
   427              ctxt |> Variable.set_body false
   428                   |> Proof_Context.add_fixes fixes)
   428                   |> Proof_Context.add_fixes fixes)
   429     val one_line_proof = one_line_proof_text 0 one_line_params
   429     val one_line_proof = one_line_proof_text auto 0 one_line_params
   430     val type_enc =
   430     val type_enc =
   431       if is_typed_helper_used_in_atp_proof atp_proof then full_typesN
   431       if is_typed_helper_used_in_atp_proof atp_proof then full_typesN
   432       else partial_typesN
   432       else partial_typesN
   433     val lam_trans = lam_trans_of_atp_proof atp_proof metis_default_lam_trans
   433     val lam_trans = lam_trans_of_atp_proof atp_proof metis_default_lam_trans
   434     val do_preplay = preplay_timeout <> SOME Time.zeroTime
   434     val do_preplay = preplay_timeout <> SOME Time.zeroTime
   623                else
   623                else
   624                  [])
   624                  [])
   625           in
   625           in
   626             "\n\nStructured proof"
   626             "\n\nStructured proof"
   627               ^ (commas msg |> not (null msg) ? enclose " (" ")")
   627               ^ (commas msg |> not (null msg) ? enclose " (" ")")
   628               ^ ":\n" ^ Active.sendback_markup isar_text
   628               ^ ":\n" ^
       
   629               Active.sendback_markup (if auto then [Markup.padding_command] else []) isar_text
   629           end
   630           end
   630       end
   631       end
   631     val isar_proof =
   632     val isar_proof =
   632       if debug then
   633       if debug then
   633         isar_proof_of ()
   634         isar_proof_of ()
   643   case preplay of
   644   case preplay of
   644     Played (reconstr, _) => reconstr = SMT
   645     Played (reconstr, _) => reconstr = SMT
   645   | Trust_Playable _ => true
   646   | Trust_Playable _ => true
   646   | Failed_to_Play _ => true
   647   | Failed_to_Play _ => true
   647 
   648 
   648 fun proof_text ctxt isar_proofs isar_params num_chained
   649 fun proof_text ctxt auto isar_proofs isar_params num_chained
   649                (one_line_params as (preplay, _, _, _, _, _)) =
   650                (one_line_params as (preplay, _, _, _, _, _)) =
   650   (if isar_proofs = SOME true orelse
   651   (if isar_proofs = SOME true orelse
   651       (isar_proofs = NONE andalso isar_proof_would_be_a_good_idea preplay) then
   652       (isar_proofs = NONE andalso isar_proof_would_be_a_good_idea preplay) then
   652      isar_proof_text ctxt isar_proofs isar_params
   653      isar_proof_text ctxt auto isar_proofs isar_params
   653    else
   654    else
   654      one_line_proof_text num_chained) one_line_params
   655      one_line_proof_text auto num_chained) one_line_params
   655 
   656 
   656 end;
   657 end;