src/Pure/Proof/proof_syntax.ML
changeset 70979 7abe5abb4c05
parent 70915 bd4d37edfee4
child 70980 9dab828cbbc1
equal deleted inserted replaced
70978:a1c137961c12 70979:7abe5abb4c05
    12   val read_proof: theory -> bool -> bool -> string -> Proofterm.proof
    12   val read_proof: theory -> bool -> bool -> string -> Proofterm.proof
    13   val proof_syntax: Proofterm.proof -> theory -> theory
    13   val proof_syntax: Proofterm.proof -> theory -> theory
    14   val proof_of: bool -> thm -> Proofterm.proof
    14   val proof_of: bool -> thm -> Proofterm.proof
    15   val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T
    15   val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T
    16   val pretty_standard_proof_of: Proof.context -> bool -> thm -> Pretty.T
    16   val pretty_standard_proof_of: Proof.context -> bool -> thm -> Pretty.T
       
    17   val pretty_proof_boxes_of: Proof.context -> bool -> thm -> Pretty.T
    17 end;
    18 end;
    18 
    19 
    19 structure Proof_Syntax : PROOF_SYNTAX =
    20 structure Proof_Syntax : PROOF_SYNTAX =
    20 struct
    21 struct
    21 
    22 
   196     (Proofterm.term_of_proof prf);
   197     (Proofterm.term_of_proof prf);
   197 
   198 
   198 fun pretty_standard_proof_of ctxt full thm =
   199 fun pretty_standard_proof_of ctxt full thm =
   199   pretty_proof ctxt (Thm.standard_proof_of {full = full, expand_name = Thm.expand_name thm} thm);
   200   pretty_proof ctxt (Thm.standard_proof_of {full = full, expand_name = Thm.expand_name thm} thm);
   200 
   201 
       
   202 fun pretty_proof_boxes_of ctxt full thm =
       
   203   let
       
   204     val thy = Proof_Context.theory_of ctxt;
       
   205     val selection =
       
   206       {included = Proofterm.this_id (Thm.derivation_id thm),
       
   207        excluded = is_some o Global_Theory.lookup_thm_id thy}
       
   208   in
       
   209     Proofterm.proof_boxes selection [Thm.proof_of thm]
       
   210     |> map (fn ({serial = i, pos, prop, ...}, proof) =>
       
   211         let
       
   212           val proof' = proof
       
   213             |> full ? Proofterm.reconstruct_proof thy prop
       
   214             |> Proofterm.forall_intr_variables prop;
       
   215           val prop' = prop
       
   216             |> Proofterm.forall_intr_variables_term;
       
   217           val name = Long_Name.append "thm" (string_of_int i);
       
   218         in
       
   219           Pretty.item
       
   220            [Pretty.str (name ^ Position.here_list pos ^ ":"), Pretty.brk 1,
       
   221             Syntax.pretty_term ctxt prop', Pretty.fbrk, pretty_proof ctxt proof']
       
   222         end)
       
   223     |> Pretty.chunks
       
   224   end;
       
   225 
   201 end;
   226 end;