60 val have_facts_i: ((string * Proof.context attribute list) * |
60 val have_facts_i: ((string * Proof.context attribute list) * |
61 (thm * Proof.context attribute list) list) * Comment.text -> ProofHistory.T -> ProofHistory.T |
61 (thm * Proof.context attribute list) list) * Comment.text -> ProofHistory.T -> ProofHistory.T |
62 val from_facts: (string * Args.src list) list * Comment.text -> ProofHistory.T -> ProofHistory.T |
62 val from_facts: (string * Args.src list) list * Comment.text -> ProofHistory.T -> ProofHistory.T |
63 val from_facts_i: (thm * Proof.context attribute list) list * Comment.text |
63 val from_facts_i: (thm * Proof.context attribute list) list * Comment.text |
64 -> ProofHistory.T -> ProofHistory.T |
64 -> ProofHistory.T -> ProofHistory.T |
|
65 val with_facts: (string * Args.src list) list * Comment.text -> ProofHistory.T -> ProofHistory.T |
|
66 val with_facts_i: (thm * Proof.context attribute list) list * Comment.text |
|
67 -> ProofHistory.T -> ProofHistory.T |
65 val chain: Comment.text -> ProofHistory.T -> ProofHistory.T |
68 val chain: Comment.text -> ProofHistory.T -> ProofHistory.T |
66 val fix: (string * string option) list * Comment.text -> ProofHistory.T -> ProofHistory.T |
69 val fix: (string * string option) list * Comment.text -> ProofHistory.T -> ProofHistory.T |
67 val fix_i: (string * typ) list * Comment.text -> ProofHistory.T -> ProofHistory.T |
70 val fix_i: (string * typ) list * Comment.text -> ProofHistory.T -> ProofHistory.T |
68 val match_bind: ((string list * string) * Comment.text) list -> ProofHistory.T -> ProofHistory.T |
71 val match_bind: ((string list * string) * Comment.text) list -> ProofHistory.T -> ProofHistory.T |
69 val match_bind_i: ((term list * term) * Comment.text) list -> ProofHistory.T -> ProofHistory.T |
72 val match_bind_i: ((term list * term) * Comment.text) list -> ProofHistory.T -> ProofHistory.T |
115 -> Toplevel.transition -> Toplevel.transition |
118 -> Toplevel.transition -> Toplevel.transition |
116 val qed: (Method.text * Comment.interest) option -> Toplevel.transition -> Toplevel.transition |
119 val qed: (Method.text * Comment.interest) option -> Toplevel.transition -> Toplevel.transition |
117 val terminal_proof: Method.text * Comment.interest -> Toplevel.transition -> Toplevel.transition |
120 val terminal_proof: Method.text * Comment.interest -> Toplevel.transition -> Toplevel.transition |
118 val immediate_proof: Toplevel.transition -> Toplevel.transition |
121 val immediate_proof: Toplevel.transition -> Toplevel.transition |
119 val default_proof: Toplevel.transition -> Toplevel.transition |
122 val default_proof: Toplevel.transition -> Toplevel.transition |
120 val also: Comment.text -> Toplevel.transition -> Toplevel.transition |
123 val also: ((string * Args.src list) list * Comment.interest) option * Comment.text |
121 val finally: Comment.text -> Toplevel.transition -> Toplevel.transition |
124 -> Toplevel.transition -> Toplevel.transition |
|
125 val also_i: (thm list * Comment.interest) option * Comment.text |
|
126 -> Toplevel.transition -> Toplevel.transition |
|
127 val finally: ((string * Args.src list) list * Comment.interest) option * Comment.text |
|
128 -> Toplevel.transition -> Toplevel.transition |
|
129 val finally_i: (thm list * Comment.interest) option * Comment.text |
|
130 -> Toplevel.transition -> Toplevel.transition |
122 val use_mltext: string -> theory option -> theory option |
131 val use_mltext: string -> theory option -> theory option |
123 val use_mltext_theory: string -> theory -> theory |
132 val use_mltext_theory: string -> theory -> theory |
124 val use_setup: string -> theory -> theory |
133 val use_setup: string -> theory -> theory |
125 val parse_ast_translation: string -> theory -> theory |
134 val parse_ast_translation: string -> theory -> theory |
126 val parse_translation: string -> theory -> theory |
135 val parse_translation: string -> theory -> theory |
221 fun apply_theorems_i th_srcs = have_thmss_i PureThy.have_thmss ((None, []), th_srcs); |
230 fun apply_theorems_i th_srcs = have_thmss_i PureThy.have_thmss ((None, []), th_srcs); |
222 val have_theorems = #1 oo (global_have_thmss (PureThy.have_thmss o Some) o Comment.ignore); |
231 val have_theorems = #1 oo (global_have_thmss (PureThy.have_thmss o Some) o Comment.ignore); |
223 val have_theorems_i = #1 oo (have_thmss_i (PureThy.have_thmss o Some) o Comment.ignore); |
232 val have_theorems_i = #1 oo (have_thmss_i (PureThy.have_thmss o Some) o Comment.ignore); |
224 val have_lemmas = #1 oo (global_have_thmss (have_lemss o Some) o Comment.ignore); |
233 val have_lemmas = #1 oo (global_have_thmss (have_lemss o Some) o Comment.ignore); |
225 val have_lemmas_i = #1 oo (have_thmss_i (have_lemss o Some) o Comment.ignore); |
234 val have_lemmas_i = #1 oo (have_thmss_i (have_lemss o Some) o Comment.ignore); |
226 val have_facts = ProofHistory.apply o local_have_thmss Proof.have_thmss o Comment.ignore; |
235 val have_facts = ProofHistory.apply o local_have_thmss (Proof.have_thmss []) o Comment.ignore; |
227 val have_facts_i = ProofHistory.apply o have_thmss_i Proof.have_thmss o Comment.ignore; |
236 val have_facts_i = ProofHistory.apply o have_thmss_i (Proof.have_thmss []) o Comment.ignore; |
228 |
237 |
229 |
238 |
230 (* forward chaining *) |
239 (* forward chaining *) |
231 |
240 |
232 fun gen_from_facts f = ProofHistory.apply o (Proof.chain oo curry (f Proof.have_thmss) ("", [])); |
241 fun gen_from_facts f = ProofHistory.apply o (Proof.chain oo curry f ("", [])); |
233 |
242 |
234 val from_facts = gen_from_facts local_have_thmss o Comment.ignore; |
243 fun add_thmss name atts ths_atts state = |
235 val from_facts_i = gen_from_facts have_thmss_i o Comment.ignore; |
244 Proof.have_thmss (Proof.the_facts state) name atts ths_atts state; |
|
245 |
|
246 val from_facts = gen_from_facts (local_have_thmss (Proof.have_thmss [])) o Comment.ignore; |
|
247 val from_facts_i = gen_from_facts (have_thmss_i (Proof.have_thmss [])) o Comment.ignore; |
|
248 val with_facts = gen_from_facts (local_have_thmss add_thmss) o Comment.ignore; |
|
249 val with_facts_i = gen_from_facts (have_thmss_i add_thmss) o Comment.ignore; |
|
250 |
236 fun chain comment_ignore = ProofHistory.apply Proof.chain; |
251 fun chain comment_ignore = ProofHistory.apply Proof.chain; |
237 |
252 |
238 |
253 |
239 (* context *) |
254 (* context *) |
240 |
255 |
350 val default_proof = local_default_proof o global_default_proof; |
365 val default_proof = local_default_proof o global_default_proof; |
351 |
366 |
352 |
367 |
353 (* calculational proof commands *) |
368 (* calculational proof commands *) |
354 |
369 |
|
370 local |
|
371 |
355 fun cond_print_calc int thm = |
372 fun cond_print_calc int thm = |
356 if int then Pretty.writeln (Pretty.big_list "calculation:" [Display.pretty_thm thm]) |
373 if int then Pretty.writeln (Pretty.big_list "calculation:" [Display.pretty_thm thm]) |
357 else (); |
374 else (); |
358 |
375 |
359 fun proof''' f = Toplevel.proof' (f o cond_print_calc); |
376 fun proof''' f = Toplevel.proof' (f o cond_print_calc); |
360 |
377 |
361 fun also _ = proof''' (ProofHistory.applys o Calculation.also); |
378 fun get_thmss srcs = Proof.the_facts o local_have_thmss (Proof.have_thmss []) (("", []), srcs); |
362 fun finally _ = proof''' (ProofHistory.applys o Calculation.finally); |
379 fun get_thmss_i thms _ = thms; |
|
380 |
|
381 fun gen_calc get f (args, _) prt state = |
|
382 f (apsome (fn (srcs, _) => get srcs state) args) prt state; |
|
383 |
|
384 in |
|
385 |
|
386 fun also x = proof''' (ProofHistory.applys o gen_calc get_thmss Calculation.also x); |
|
387 fun also_i x = proof''' (ProofHistory.applys o gen_calc get_thmss_i Calculation.also x); |
|
388 fun finally x = proof''' (ProofHistory.applys o gen_calc get_thmss Calculation.finally x); |
|
389 fun finally_i x = proof''' (ProofHistory.applys o gen_calc get_thmss_i Calculation.finally x); |
|
390 |
|
391 end; |
363 |
392 |
364 |
393 |
365 (* use ML text *) |
394 (* use ML text *) |
366 |
395 |
367 fun use_mltext txt opt_thy = #2 (Context.pass opt_thy (use_text false) txt); |
396 fun use_mltext txt opt_thy = #2 (Context.pass opt_thy (use_text false) txt); |