299 | assumption_tac _ _ = K no_tac; |
299 | assumption_tac _ _ = K no_tac; |
300 |
300 |
301 fun assumption ctxt = METHOD (FINDGOAL o assumption_tac ctxt); |
301 fun assumption ctxt = METHOD (FINDGOAL o assumption_tac ctxt); |
302 |
302 |
303 |
303 |
304 (* res_inst tactic emulation *) |
304 (* res_inst_tac emulations *) |
305 |
305 |
306 (*Note: insts refer to the hidden (!) goal context; use with care*) |
306 (*Note: insts refer to the implicit (!) goal context; use at your own risk*) |
307 fun gen_res_inst tac ((i, insts), thm) = |
307 fun gen_res_inst tac ((i, insts), thm) = |
308 METHOD (fn facts => (insert_tac facts THEN' tac insts thm) i); |
308 METHOD (fn facts => (insert_tac facts THEN' tac insts thm) i); |
309 |
309 |
310 val res_inst = gen_res_inst Tactic.res_inst_tac; |
310 val res_inst = gen_res_inst Tactic.res_inst_tac; |
311 val eres_inst = gen_res_inst Tactic.eres_inst_tac; |
311 val eres_inst = gen_res_inst Tactic.eres_inst_tac; |
312 val dres_inst = gen_res_inst Tactic.dres_inst_tac; |
312 val dres_inst = gen_res_inst Tactic.dres_inst_tac; |
313 val forw_inst = gen_res_inst Tactic.forw_inst_tac; |
313 val forw_inst = gen_res_inst Tactic.forw_inst_tac; |
|
314 |
|
315 |
|
316 (* simple Prolog interpreter *) |
|
317 |
|
318 fun prolog_tac rules facts = |
|
319 DEPTH_SOLVE_1 (HEADGOAL (Tactic.assume_tac APPEND' Tactic.resolve_tac (facts @ rules))); |
|
320 |
|
321 val prolog = METHOD o prolog_tac; |
314 |
322 |
315 |
323 |
316 |
324 |
317 (** methods theory data **) |
325 (** methods theory data **) |
318 |
326 |
545 ("this", no_args this, "apply current facts as rules"), |
553 ("this", no_args this, "apply current facts as rules"), |
546 ("assumption", ctxt_args assumption, "proof by assumption, preferring facts"), |
554 ("assumption", ctxt_args assumption, "proof by assumption, preferring facts"), |
547 ("res_inst_tac", inst_args res_inst, "res_inst_tac emulation (beware!)"), |
555 ("res_inst_tac", inst_args res_inst, "res_inst_tac emulation (beware!)"), |
548 ("eres_inst_tac", inst_args eres_inst, "eres_inst_tac emulation (beware!)"), |
556 ("eres_inst_tac", inst_args eres_inst, "eres_inst_tac emulation (beware!)"), |
549 ("dres_inst_tac", inst_args dres_inst, "dres_inst_tac emulation (beware!)"), |
557 ("dres_inst_tac", inst_args dres_inst, "dres_inst_tac emulation (beware!)"), |
550 ("forw_inst_tac", inst_args forw_inst, "forw_inst_tac emulation (beware!)")]; |
558 ("forw_inst_tac", inst_args forw_inst, "forw_inst_tac emulation (beware!)"), |
|
559 ("prolog", thms_args prolog, "simple prolog interpreter")]; |
551 |
560 |
552 |
561 |
553 (* setup *) |
562 (* setup *) |
554 |
563 |
555 val setup = |
564 val setup = |