equal
deleted
inserted
replaced
14 val proof_syntax: Proofterm.proof -> theory -> theory |
14 val proof_syntax: Proofterm.proof -> theory -> theory |
15 val proof_of: bool -> thm -> Proofterm.proof |
15 val proof_of: bool -> thm -> Proofterm.proof |
16 val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T |
16 val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T |
17 val pretty_proof_boxes_of: Proof.context -> |
17 val pretty_proof_boxes_of: Proof.context -> |
18 {full: bool, preproc: theory -> proof -> proof} -> thm -> Pretty.T |
18 {full: bool, preproc: theory -> proof -> proof} -> thm -> Pretty.T |
19 val standard_proof_of: {full: bool, expand_name: Proofterm.thm_header -> Thm_Name.T option} -> |
19 val standard_proof_of: {full: bool, expand_name: Proofterm.thm_header -> Thm_Name.P option} -> |
20 thm -> Proofterm.proof |
20 thm -> Proofterm.proof |
21 val pretty_standard_proof_of: Proof.context -> bool -> thm -> Pretty.T |
21 val pretty_standard_proof_of: Proof.context -> bool -> thm -> Pretty.T |
22 end; |
22 end; |
23 |
23 |
24 structure Proof_Syntax : PROOF_SYNTAX = |
24 structure Proof_Syntax : PROOF_SYNTAX = |
102 |
102 |
103 fun PClasst (T, c) = |
103 fun PClasst (T, c) = |
104 let val U = Term.itselfT T --> propT |
104 let val U = Term.itselfT T --> propT |
105 in Const ("Pure.PClass", U --> proofT) $ Const (Logic.const_of_class c, U) end; |
105 in Const ("Pure.PClass", U --> proofT) $ Const (Logic.const_of_class c, U) end; |
106 |
106 |
107 fun term_of _ (PThm ({serial = i, thm_name = a, types = Ts, ...}, _)) = |
107 fun term_of _ (PThm ({serial = i, thm_name = (a, _), types = Ts, ...}, _)) = |
108 fold AppT (these Ts) |
108 fold AppT (these Ts) |
109 (Const |
109 (Const |
110 (Long_Name.append "thm" |
110 (Long_Name.append "thm" |
111 (if Thm_Name.is_empty a then string_of_int i else Thm_Name.short a), proofT)) |
111 (if Thm_Name.is_empty a then string_of_int i else Thm_Name.short a), proofT)) |
112 | term_of _ (PAxm (name, _, Ts)) = |
112 | term_of _ (PAxm (name, _, Ts)) = |
225 in fn ty => fn s => proof_of_term thy ty (Logic.varify_global (rd s)) end; |
225 in fn ty => fn s => proof_of_term thy ty (Logic.varify_global (rd s)) end; |
226 |
226 |
227 fun proof_syntax prf = |
227 fun proof_syntax prf = |
228 let |
228 let |
229 val thm_names = Symset.dest (Proofterm.fold_proof_atoms true |
229 val thm_names = Symset.dest (Proofterm.fold_proof_atoms true |
230 (fn PThm ({thm_name, ...}, _) => |
230 (fn PThm ({thm_name = (thm_name, _), ...}, _) => |
231 if Thm_Name.is_empty thm_name then I else Symset.insert (Thm_Name.short thm_name) |
231 if Thm_Name.is_empty thm_name then I else Symset.insert (Thm_Name.short thm_name) |
232 | _ => I) [prf] Symset.empty); |
232 | _ => I) [prf] Symset.empty); |
233 val axm_names = Symset.dest (Proofterm.fold_proof_atoms true |
233 val axm_names = Symset.dest (Proofterm.fold_proof_atoms true |
234 (fn PAxm (name, _, _) => Symset.insert name | _ => I) [prf] Symset.empty); |
234 (fn PAxm (name, _, _) => Symset.insert name | _ => I) [prf] Symset.empty); |
235 in |
235 in |
262 val selection = |
262 val selection = |
263 {included = Proofterm.this_id (Thm.derivation_id thm), |
263 {included = Proofterm.this_id (Thm.derivation_id thm), |
264 excluded = is_some o Global_Theory.lookup_thm_id thy} |
264 excluded = is_some o Global_Theory.lookup_thm_id thy} |
265 in |
265 in |
266 Proofterm.proof_boxes selection [Thm.proof_of thm] |
266 Proofterm.proof_boxes selection [Thm.proof_of thm] |
267 |> map (fn ({serial = i, pos, prop, ...}, proof) => |
267 |> map (fn ({serial = i, command_pos, prop, thm_name = (_, thm_pos), ...}, proof) => |
268 let |
268 let |
269 val proof' = proof |
269 val proof' = proof |
270 |> Proofterm.reconstruct_proof thy prop |
270 |> Proofterm.reconstruct_proof thy prop |
271 |> preproc thy |
271 |> preproc thy |
272 |> not full ? Proofterm.shrink_proof |
272 |> not full ? Proofterm.shrink_proof |
274 val prop' = prop |
274 val prop' = prop |
275 |> Proofterm.forall_intr_variables_term; |
275 |> Proofterm.forall_intr_variables_term; |
276 val name = Long_Name.append "thm" (string_of_int i); |
276 val name = Long_Name.append "thm" (string_of_int i); |
277 in |
277 in |
278 Pretty.item |
278 Pretty.item |
279 [Pretty.str (name ^ Position.here_list pos ^ ":"), Pretty.brk 1, |
279 [Pretty.str (name ^ Position.here_list [command_pos, thm_pos] ^ ":"), Pretty.brk 1, |
280 Syntax.pretty_term ctxt prop', Pretty.fbrk, pretty_proof ctxt proof'] |
280 Syntax.pretty_term ctxt prop', Pretty.fbrk, pretty_proof ctxt proof'] |
281 end) |
281 end) |
282 |> Pretty.chunks |
282 |> Pretty.chunks |
283 end; |
283 end; |
284 |
284 |