44 val erule: thm list -> Proof.method |
44 val erule: thm list -> Proof.method |
45 val drule: thm list -> Proof.method |
45 val drule: thm list -> Proof.method |
46 val frule: thm list -> Proof.method |
46 val frule: thm list -> Proof.method |
47 val this: Proof.method |
47 val this: Proof.method |
48 val assumption: Proof.context -> Proof.method |
48 val assumption: Proof.context -> Proof.method |
|
49 val set_tactic: (Proof.context -> thm list -> tactic) -> unit |
|
50 val tactic: string -> Proof.context -> Proof.method |
49 exception METHOD_FAIL of (string * Position.T) * exn |
51 exception METHOD_FAIL of (string * Position.T) * exn |
50 val help_methods: theory option -> unit |
52 val help_methods: theory option -> unit |
51 val method: theory -> Args.src -> Proof.context -> Proof.method |
53 val method: theory -> Args.src -> Proof.context -> Proof.method |
52 val add_methods: (bstring * (Args.src -> Proof.context -> Proof.method) * string) list |
54 val add_methods: (bstring * (Args.src -> Proof.context -> Proof.method) * string) list |
53 -> theory -> theory |
55 -> theory -> theory |
54 val syntax: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) -> |
56 val syntax: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) -> |
55 Args.src -> Proof.context -> Proof.context * 'a |
57 Args.src -> Proof.context -> Proof.context * 'a |
|
58 val simple_args: (Args.T list -> 'a * Args.T list) |
|
59 -> ('a -> Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method |
56 val ctxt_args: (Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method |
60 val ctxt_args: (Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method |
57 val no_args: Proof.method -> Args.src -> Proof.context -> Proof.method |
61 val no_args: Proof.method -> Args.src -> Proof.context -> Proof.method |
58 type modifier |
62 type modifier |
59 val sectioned_args: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) -> |
63 val sectioned_args: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) -> |
60 (Args.T list -> modifier * Args.T list) list -> |
64 (Args.T list -> modifier * Args.T list) list -> |
324 DEPTH_SOLVE_1 (HEADGOAL (Tactic.assume_tac APPEND' Tactic.resolve_tac (facts @ rules))); |
328 DEPTH_SOLVE_1 (HEADGOAL (Tactic.assume_tac APPEND' Tactic.resolve_tac (facts @ rules))); |
325 |
329 |
326 val prolog = METHOD o prolog_tac; |
330 val prolog = METHOD o prolog_tac; |
327 |
331 |
328 |
332 |
|
333 (* ML tactics *) |
|
334 |
|
335 val tactic_ref = ref ((fn _ => raise Match): Proof.context -> thm list -> tactic); |
|
336 fun set_tactic f = tactic_ref := f; |
|
337 |
|
338 fun tactic txt ctxt = METHOD (fn facts => |
|
339 (Context.use_mltext |
|
340 ("let fun (tactic: Proof.context -> thm list -> tactic) ctxt facts = " ^ txt ^ |
|
341 "in Method.set_tactic tactic end") |
|
342 false (Some (ProofContext.theory_of ctxt)); ! tactic_ref ctxt facts)); |
|
343 |
|
344 |
329 |
345 |
330 (** methods theory data **) |
346 (** methods theory data **) |
331 |
347 |
332 (* data kind 'Isar/methods' *) |
348 (* data kind 'Isar/methods' *) |
333 |
349 |
413 (* basic *) |
429 (* basic *) |
414 |
430 |
415 fun syntax (scan: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list))) = |
431 fun syntax (scan: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list))) = |
416 Args.syntax "method" scan; |
432 Args.syntax "method" scan; |
417 |
433 |
|
434 fun simple_args scan f src ctxt : Proof.method = |
|
435 #2 (syntax (Scan.lift (scan >> (fn x => f x ctxt))) src ctxt); |
|
436 |
418 fun ctxt_args (f: Proof.context -> Proof.method) src ctxt = |
437 fun ctxt_args (f: Proof.context -> Proof.method) src ctxt = |
419 #2 (syntax (Scan.succeed (f ctxt)) src ctxt); |
438 #2 (syntax (Scan.succeed (f ctxt)) src ctxt); |
420 |
439 |
421 fun no_args m = ctxt_args (K m); |
440 fun no_args m = ctxt_args (K m); |
|
441 |
422 |
442 |
423 |
443 |
424 (* sections *) |
444 (* sections *) |
425 |
445 |
426 type modifier = (Proof.context -> Proof.context) * Proof.context attribute; |
446 type modifier = (Proof.context -> Proof.context) * Proof.context attribute; |
559 ("assumption", ctxt_args assumption, "proof by assumption, preferring facts"), |
579 ("assumption", ctxt_args assumption, "proof by assumption, preferring facts"), |
560 ("res_inst_tac", inst_args res_inst, "res_inst_tac emulation (beware!)"), |
580 ("res_inst_tac", inst_args res_inst, "res_inst_tac emulation (beware!)"), |
561 ("eres_inst_tac", inst_args eres_inst, "eres_inst_tac emulation (beware!)"), |
581 ("eres_inst_tac", inst_args eres_inst, "eres_inst_tac emulation (beware!)"), |
562 ("dres_inst_tac", inst_args dres_inst, "dres_inst_tac emulation (beware!)"), |
582 ("dres_inst_tac", inst_args dres_inst, "dres_inst_tac emulation (beware!)"), |
563 ("forw_inst_tac", inst_args forw_inst, "forw_inst_tac emulation (beware!)"), |
583 ("forw_inst_tac", inst_args forw_inst, "forw_inst_tac emulation (beware!)"), |
564 ("prolog", thms_args prolog, "simple prolog interpreter")]; |
584 ("prolog", thms_args prolog, "simple prolog interpreter"), |
|
585 ("tactic", simple_args Args.name tactic, "ML tactic as proof method")]; |
565 |
586 |
566 |
587 |
567 (* setup *) |
588 (* setup *) |
568 |
589 |
569 val setup = |
590 val setup = |