12 val term_of_proof: Proofterm.proof -> term |
12 val term_of_proof: Proofterm.proof -> term |
13 val cterm_of_proof: theory -> Proofterm.proof -> cterm * (cterm -> Proofterm.proof) |
13 val cterm_of_proof: theory -> Proofterm.proof -> cterm * (cterm -> Proofterm.proof) |
14 val read_term: theory -> bool -> typ -> string -> term |
14 val read_term: theory -> bool -> typ -> string -> term |
15 val read_proof: theory -> bool -> bool -> string -> Proofterm.proof |
15 val read_proof: theory -> bool -> bool -> string -> Proofterm.proof |
16 val proof_syntax: Proofterm.proof -> theory -> theory |
16 val proof_syntax: Proofterm.proof -> theory -> theory |
17 val proof_of: theory -> bool -> thm -> Proofterm.proof |
17 val proof_of: Proof.context -> bool -> thm -> Proofterm.proof |
18 val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T |
18 val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T |
19 val pretty_proof_of: Proof.context -> bool -> thm -> Pretty.T |
19 val pretty_proof_of: Proof.context -> bool -> thm -> Pretty.T |
20 end; |
20 end; |
21 |
21 |
22 structure Proof_Syntax : PROOF_SYNTAX = |
22 structure Proof_Syntax : PROOF_SYNTAX = |
237 add_proof_syntax #> |
237 add_proof_syntax #> |
238 add_proof_atom_consts |
238 add_proof_atom_consts |
239 (map (Long_Name.append "thm") thm_names @ map (Long_Name.append "axm") axm_names) |
239 (map (Long_Name.append "thm") thm_names @ map (Long_Name.append "axm") axm_names) |
240 end; |
240 end; |
241 |
241 |
242 fun proof_of thy full raw_thm = |
242 fun proof_of ctxt full raw_thm = |
243 let |
243 let |
244 val thm = Thm.transfer thy raw_thm; |
244 val thm = Thm.transfer (Proof_Context.theory_of ctxt) raw_thm; |
245 val prop = Thm.full_prop_of thm; |
245 val prop = Thm.full_prop_of thm; |
246 val prf = Thm.proof_of thm; |
246 val prf = Thm.proof_of thm; |
247 val prf' = |
247 val prf' = |
248 (case Proofterm.strip_combt (fst (Proofterm.strip_combP prf)) of |
248 (case Proofterm.strip_combt (fst (Proofterm.strip_combP prf)) of |
249 (PThm (_, ((_, prop', _), body)), _) => |
249 (PThm (_, ((_, prop', _), body)), _) => |
250 if prop = prop' then Proofterm.join_proof body else prf |
250 if prop = prop' then Proofterm.join_proof body else prf |
251 | _ => prf) |
251 | _ => prf) |
252 in if full then Reconstruct.reconstruct_proof thy prop prf' else prf' end; |
252 in if full then Reconstruct.reconstruct_proof ctxt prop prf' else prf' end; |
253 |
253 |
254 fun pretty_proof ctxt prf = |
254 fun pretty_proof ctxt prf = |
255 Proof_Context.pretty_term_abbrev |
255 Proof_Context.pretty_term_abbrev |
256 (Proof_Context.transfer (proof_syntax prf (Proof_Context.theory_of ctxt)) ctxt) |
256 (Proof_Context.transfer (proof_syntax prf (Proof_Context.theory_of ctxt)) ctxt) |
257 (term_of_proof prf); |
257 (term_of_proof prf); |
258 |
258 |
259 fun pretty_proof_of ctxt full th = |
259 fun pretty_proof_of ctxt full th = |
260 pretty_proof ctxt (proof_of (Proof_Context.theory_of ctxt) full th); |
260 pretty_proof ctxt (proof_of ctxt full th); |
261 |
261 |
262 end; |
262 end; |