equal
deleted
inserted
replaced
4 Isar proof methods. |
4 Isar proof methods. |
5 *) |
5 *) |
6 |
6 |
7 signature METHOD = |
7 signature METHOD = |
8 sig |
8 sig |
9 type method |
9 type method = thm list -> cases_tactic |
10 val apply: (Proof.context -> method) -> Proof.context -> thm list -> cases_tactic |
|
11 val RAW_METHOD_CASES: (thm list -> cases_tactic) -> method |
|
12 val RAW_METHOD: (thm list -> tactic) -> method |
|
13 val METHOD_CASES: (thm list -> cases_tactic) -> method |
10 val METHOD_CASES: (thm list -> cases_tactic) -> method |
14 val METHOD: (thm list -> tactic) -> method |
11 val METHOD: (thm list -> tactic) -> method |
15 val fail: method |
12 val fail: method |
16 val succeed: method |
13 val succeed: method |
17 val insert_tac: thm list -> int -> tactic |
14 val insert_tac: thm list -> int -> tactic |
88 |
85 |
89 (** proof methods **) |
86 (** proof methods **) |
90 |
87 |
91 (* datatype method *) |
88 (* datatype method *) |
92 |
89 |
93 datatype method = Meth of thm list -> cases_tactic; |
90 type method = thm list -> cases_tactic; |
94 |
91 |
95 fun apply meth ctxt = let val Meth m = meth ctxt in m end; |
92 fun METHOD_CASES tac facts = Seq.THEN (ALLGOALS Goal.conjunction_tac, tac facts); |
96 |
93 fun METHOD tac facts = NO_CASES (ALLGOALS Goal.conjunction_tac THEN tac facts); |
97 val RAW_METHOD_CASES = Meth; |
|
98 |
|
99 fun RAW_METHOD tac = RAW_METHOD_CASES (NO_CASES o tac); |
|
100 |
|
101 fun METHOD_CASES tac = RAW_METHOD_CASES (fn facts => |
|
102 Seq.THEN (ALLGOALS Goal.conjunction_tac, tac facts)); |
|
103 |
|
104 fun METHOD tac = RAW_METHOD (fn facts => ALLGOALS Goal.conjunction_tac THEN tac facts); |
|
105 |
94 |
106 val fail = METHOD (K no_tac); |
95 val fail = METHOD (K no_tac); |
107 val succeed = METHOD (K all_tac); |
96 val succeed = METHOD (K all_tac); |
108 |
97 |
109 |
98 |
152 (* atomize rule statements *) |
141 (* atomize rule statements *) |
153 |
142 |
154 fun atomize false ctxt = |
143 fun atomize false ctxt = |
155 SIMPLE_METHOD' (CHANGED_PROP o Object_Logic.atomize_prems_tac ctxt) |
144 SIMPLE_METHOD' (CHANGED_PROP o Object_Logic.atomize_prems_tac ctxt) |
156 | atomize true ctxt = |
145 | atomize true ctxt = |
157 RAW_METHOD (K (HEADGOAL (CHANGED_PROP o Object_Logic.full_atomize_tac ctxt))); |
146 NO_CASES o K (HEADGOAL (CHANGED_PROP o Object_Logic.full_atomize_tac ctxt)); |
158 |
147 |
159 |
148 |
160 (* this -- resolve facts directly *) |
149 (* this -- resolve facts directly *) |
161 |
150 |
162 val this = METHOD (EVERY o map (HEADGOAL o rtac)); |
151 val this = METHOD (EVERY o map (HEADGOAL o rtac)); |
275 "fun tactic (facts: thm list) : tactic" |
264 "fun tactic (facts: thm list) : tactic" |
276 "Context.map_proof (Method.set_tactic tactic)" (ML_Lex.read_source false source)); |
265 "Context.map_proof (Method.set_tactic tactic)" (ML_Lex.read_source false source)); |
277 in Context.setmp_thread_data (SOME (Context.Proof ctxt)) (ML_Tactic.get ctxt') end; |
266 in Context.setmp_thread_data (SOME (Context.Proof ctxt)) (ML_Tactic.get ctxt') end; |
278 |
267 |
279 fun tactic source ctxt = METHOD (ml_tactic source ctxt); |
268 fun tactic source ctxt = METHOD (ml_tactic source ctxt); |
280 fun raw_tactic source ctxt = RAW_METHOD (ml_tactic source ctxt); |
269 fun raw_tactic source ctxt = NO_CASES o ml_tactic source ctxt; |
281 |
270 |
282 |
271 |
283 |
272 |
284 (** method syntax **) |
273 (** method syntax **) |
285 |
274 |
374 fun method_closure ctxt0 src0 = |
363 fun method_closure ctxt0 src0 = |
375 let |
364 let |
376 val (src1, meth) = check_src ctxt0 src0; |
365 val (src1, meth) = check_src ctxt0 src0; |
377 val src2 = Args.init_assignable src1; |
366 val src2 = Args.init_assignable src1; |
378 val ctxt = Context_Position.not_really ctxt0; |
367 val ctxt = Context_Position.not_really ctxt0; |
379 val _ = Seq.pull (apply (method ctxt src2) ctxt [] (Goal.protect 0 Drule.dummy_thm)); |
368 val _ = Seq.pull (method ctxt src2 ctxt [] (Goal.protect 0 Drule.dummy_thm)); |
380 in Args.closure src2 end; |
369 in Args.closure src2 end; |
381 |
370 |
382 fun method_cmd ctxt = method ctxt o method_closure ctxt; |
371 fun method_cmd ctxt = method ctxt o method_closure ctxt; |
383 |
372 |
384 |
373 |
551 val unfold = unfold_meth; |
540 val unfold = unfold_meth; |
552 val fold = fold_meth; |
541 val fold = fold_meth; |
553 |
542 |
554 end; |
543 end; |
555 |
544 |
556 val RAW_METHOD_CASES = Method.RAW_METHOD_CASES; |
|
557 val RAW_METHOD = Method.RAW_METHOD; |
|
558 val METHOD_CASES = Method.METHOD_CASES; |
545 val METHOD_CASES = Method.METHOD_CASES; |
559 val METHOD = Method.METHOD; |
546 val METHOD = Method.METHOD; |
560 val SIMPLE_METHOD = Method.SIMPLE_METHOD; |
547 val SIMPLE_METHOD = Method.SIMPLE_METHOD; |
561 val SIMPLE_METHOD' = Method.SIMPLE_METHOD'; |
548 val SIMPLE_METHOD' = Method.SIMPLE_METHOD'; |
562 val SIMPLE_METHOD'' = Method.SIMPLE_METHOD''; |
549 val SIMPLE_METHOD'' = Method.SIMPLE_METHOD''; |