13 |
13 |
14 signature METHOD = |
14 signature METHOD = |
15 sig |
15 sig |
16 include BASIC_METHOD |
16 include BASIC_METHOD |
17 type method |
17 type method |
18 val apply: Position.T -> (Proof.context -> method) -> Proof.context -> thm list -> cases_tactic |
18 val apply: (Proof.context -> method) -> Proof.context -> thm list -> cases_tactic |
19 val RAW_METHOD_CASES: (thm list -> cases_tactic) -> method |
19 val RAW_METHOD_CASES: (thm list -> cases_tactic) -> method |
20 val RAW_METHOD: (thm list -> tactic) -> method |
20 val RAW_METHOD: (thm list -> tactic) -> method |
21 val METHOD_CASES: (thm list -> cases_tactic) -> method |
21 val METHOD_CASES: (thm list -> cases_tactic) -> method |
22 val METHOD: (thm list -> tactic) -> method |
22 val METHOD: (thm list -> tactic) -> method |
23 val fail: method |
23 val fail: method |
67 val succeed_text: text |
67 val succeed_text: text |
68 val default_text: text |
68 val default_text: text |
69 val this_text: text |
69 val this_text: text |
70 val done_text: text |
70 val done_text: text |
71 val sorry_text: bool -> text |
71 val sorry_text: bool -> text |
72 val finish_text: text option * bool -> Position.T -> text |
72 val finish_text: text option * bool -> text |
73 val print_methods: theory -> unit |
73 val print_methods: theory -> unit |
74 val intern: theory -> xstring -> string |
74 val intern: theory -> xstring -> string |
75 val defined: theory -> string -> bool |
75 val defined: theory -> string -> bool |
76 val method: theory -> src -> Proof.context -> method |
76 val method: theory -> src -> Proof.context -> method |
77 val method_i: theory -> src -> Proof.context -> method |
77 val method_i: theory -> src -> Proof.context -> method |
104 |
104 |
105 (* datatype method *) |
105 (* datatype method *) |
106 |
106 |
107 datatype method = Meth of thm list -> cases_tactic; |
107 datatype method = Meth of thm list -> cases_tactic; |
108 |
108 |
109 fun apply pos meth_fun ctxt facts goal = Position.setmp_thread_data_seq pos |
109 fun apply meth ctxt = let val Meth m = meth ctxt in m end; |
110 (fn () => let val Meth meth = meth_fun ctxt in meth facts goal end) (); |
|
111 |
110 |
112 val RAW_METHOD_CASES = Meth; |
111 val RAW_METHOD_CASES = Meth; |
113 |
112 |
114 fun RAW_METHOD tac = RAW_METHOD_CASES (NO_CASES o tac); |
113 fun RAW_METHOD tac = RAW_METHOD_CASES (NO_CASES o tac); |
115 |
114 |
295 (* method text *) |
294 (* method text *) |
296 |
295 |
297 type src = Args.src; |
296 type src = Args.src; |
298 |
297 |
299 datatype text = |
298 datatype text = |
300 Basic of (Proof.context -> method) * Position.T | |
299 Basic of Proof.context -> method | |
301 Source of src | |
300 Source of src | |
302 Source_i of src | |
301 Source_i of src | |
303 Then of text list | |
302 Then of text list | |
304 Orelse of text list | |
303 Orelse of text list | |
305 Try of text | |
304 Try of text | |
306 Repeat1 of text | |
305 Repeat1 of text | |
307 SelectGoals of int * text; |
306 SelectGoals of int * text; |
308 |
307 |
309 fun primitive_text r = Basic (K (SIMPLE_METHOD (PRIMITIVE r)), Position.none); |
308 fun primitive_text r = Basic (K (SIMPLE_METHOD (PRIMITIVE r))); |
310 val succeed_text = Basic (K succeed, Position.none); |
309 val succeed_text = Basic (K succeed); |
311 val default_text = Source (Args.src (("default", []), Position.none)); |
310 val default_text = Source (Args.src (("default", []), Position.none)); |
312 val this_text = Basic (K this, Position.none); |
311 val this_text = Basic (K this); |
313 val done_text = Basic (K (SIMPLE_METHOD all_tac), Position.none); |
312 val done_text = Basic (K (SIMPLE_METHOD all_tac)); |
314 fun sorry_text int = Basic (cheating int, Position.none); |
313 fun sorry_text int = Basic (cheating int); |
315 |
314 |
316 fun finish_text (NONE, immed) pos = Basic (close immed, pos) |
315 fun finish_text (NONE, immed) = Basic (close immed) |
317 | finish_text (SOME txt, immed) pos = Then [txt, Basic (close immed, pos)]; |
316 | finish_text (SOME txt, immed) = Then [txt, Basic (close immed)]; |
318 |
317 |
319 |
318 |
320 (* method definitions *) |
319 (* method definitions *) |
321 |
320 |
322 structure Methods = TheoryDataFun |
321 structure Methods = TheoryDataFun |
475 val unfold = unfold_meth; |
474 val unfold = unfold_meth; |
476 val fold = fold_meth; |
475 val fold = fold_meth; |
477 |
476 |
478 end; |
477 end; |
479 |
478 |
480 structure BasicMethod: BASIC_METHOD = Method; |
479 structure Basic_Method: BASIC_METHOD = Method; |
481 open BasicMethod; |
480 open Basic_Method; |
482 |
481 |
483 val RAW_METHOD_CASES = Method.RAW_METHOD_CASES; |
482 val RAW_METHOD_CASES = Method.RAW_METHOD_CASES; |
484 val RAW_METHOD = Method.RAW_METHOD; |
483 val RAW_METHOD = Method.RAW_METHOD; |
485 val METHOD_CASES = Method.METHOD_CASES; |
484 val METHOD_CASES = Method.METHOD_CASES; |
486 val METHOD = Method.METHOD; |
485 val METHOD = Method.METHOD; |