author | wenzelm |
Wed, 27 Dec 2000 18:27:49 +0100 | |
changeset 10744 | 5d142ca01b8e |
parent 10541 | fdec07d4f047 |
child 10821 | dcb75538f542 |
permissions | -rw-r--r-- |
5824 | 1 |
(* Title: Pure/Isar/method.ML |
2 |
ID: $Id$ |
|
3 |
Author: Markus Wenzel, TU Muenchen |
|
8807 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
5824 | 5 |
|
6 |
Proof methods. |
|
7 |
*) |
|
8 |
||
9 |
signature BASIC_METHOD = |
|
10 |
sig |
|
11 |
val print_methods: theory -> unit |
|
12 |
val Method: bstring -> (Args.src -> Proof.context -> Proof.method) -> string -> unit |
|
13 |
end; |
|
14 |
||
15 |
signature METHOD = |
|
16 |
sig |
|
17 |
include BASIC_METHOD |
|
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
18 |
val print_global_rules: theory -> unit |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
19 |
val print_local_rules: Proof.context -> unit |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
20 |
val dest_global: theory attribute |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
21 |
val elim_global: theory attribute |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
22 |
val intro_global: theory attribute |
9938 | 23 |
val rule_del_global: theory attribute |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
24 |
val dest_local: Proof.context attribute |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
25 |
val elim_local: Proof.context attribute |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
26 |
val intro_local: Proof.context attribute |
9938 | 27 |
val rule_del_local: Proof.context attribute |
6091 | 28 |
val METHOD: (thm list -> tactic) -> Proof.method |
8372 | 29 |
val METHOD_CASES: |
30 |
(thm list -> thm -> (thm * (string * RuleCases.T) list) Seq.seq) -> Proof.method |
|
9706 | 31 |
val SIMPLE_METHOD: tactic -> Proof.method |
32 |
val SIMPLE_METHOD': ((int -> tactic) -> tactic) -> (int -> tactic) -> Proof.method |
|
5824 | 33 |
val fail: Proof.method |
34 |
val succeed: Proof.method |
|
8167 | 35 |
val defer: int option -> Proof.method |
36 |
val prefer: int -> Proof.method |
|
7419 | 37 |
val insert_tac: thm list -> int -> tactic |
7574 | 38 |
val insert: thm list -> Proof.method |
7555 | 39 |
val insert_facts: Proof.method |
7601 | 40 |
val unfold: thm list -> Proof.method |
7419 | 41 |
val fold: thm list -> Proof.method |
9484 | 42 |
val atomize_tac: thm list -> int -> tactic |
9485 | 43 |
val atomize_goal: thm list -> int -> thm -> thm |
7419 | 44 |
val multi_resolve: thm list -> thm -> thm Seq.seq |
45 |
val multi_resolves: thm list -> thm list -> thm Seq.seq |
|
6091 | 46 |
val rule_tac: thm list -> thm list -> int -> tactic |
10309 | 47 |
val some_rule_tac: thm list -> Proof.context -> thm list -> int -> tactic |
6091 | 48 |
val rule: thm list -> Proof.method |
10744 | 49 |
val erule: int -> thm list -> Proof.method |
50 |
val drule: int -> thm list -> Proof.method |
|
51 |
val frule: int -> thm list -> Proof.method |
|
8195 | 52 |
val this: Proof.method |
7555 | 53 |
val assumption: Proof.context -> Proof.method |
8351 | 54 |
val set_tactic: (Proof.context -> thm list -> tactic) -> unit |
55 |
val tactic: string -> Proof.context -> Proof.method |
|
5916 | 56 |
exception METHOD_FAIL of (string * Position.T) * exn |
5824 | 57 |
val method: theory -> Args.src -> Proof.context -> Proof.method |
9539 | 58 |
val add_method: bstring * (Args.src -> Proof.context -> Proof.method) * string |
59 |
-> theory -> theory |
|
5824 | 60 |
val add_methods: (bstring * (Args.src -> Proof.context -> Proof.method) * string) list |
61 |
-> theory -> theory |
|
5884 | 62 |
val syntax: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) -> |
8282 | 63 |
Args.src -> Proof.context -> Proof.context * 'a |
8351 | 64 |
val simple_args: (Args.T list -> 'a * Args.T list) |
65 |
-> ('a -> Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method |
|
7555 | 66 |
val ctxt_args: (Proof.context -> Proof.method) -> Args.src -> Proof.context -> Proof.method |
5884 | 67 |
val no_args: Proof.method -> Args.src -> Proof.context -> Proof.method |
7268 | 68 |
type modifier |
7601 | 69 |
val sectioned_args: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) -> |
7268 | 70 |
(Args.T list -> modifier * Args.T list) list -> |
9864 | 71 |
('a -> Proof.context -> 'b) -> Args.src -> Proof.context -> 'b |
7601 | 72 |
val bang_sectioned_args: |
73 |
(Args.T list -> modifier * Args.T list) list -> |
|
9864 | 74 |
(thm list -> Proof.context -> 'a) -> Args.src -> Proof.context -> 'a |
9777 | 75 |
val bang_sectioned_args': |
76 |
(Args.T list -> modifier * Args.T list) list -> |
|
77 |
(Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) -> |
|
9864 | 78 |
('a -> thm list -> Proof.context -> 'b) -> Args.src -> Proof.context -> 'b |
7601 | 79 |
val only_sectioned_args: |
80 |
(Args.T list -> modifier * Args.T list) list -> |
|
9864 | 81 |
(Proof.context -> 'a) -> Args.src -> Proof.context -> 'a |
82 |
val thms_ctxt_args: (thm list -> Proof.context -> 'a) -> Args.src -> Proof.context -> 'a |
|
83 |
val thms_args: (thm list -> 'a) -> Args.src -> Proof.context -> 'a |
|
84 |
val thm_args: (thm -> 'a) -> Args.src -> Proof.context -> 'a |
|
5824 | 85 |
datatype text = |
86 |
Basic of (Proof.context -> Proof.method) | |
|
87 |
Source of Args.src | |
|
88 |
Then of text list | |
|
89 |
Orelse of text list | |
|
90 |
Try of text | |
|
91 |
Repeat1 of text |
|
92 |
val refine: text -> Proof.state -> Proof.state Seq.seq |
|
8238 | 93 |
val refine_end: text -> Proof.state -> Proof.state Seq.seq |
5824 | 94 |
val proof: text option -> Proof.state -> Proof.state Seq.seq |
8966 | 95 |
val local_qed: bool -> text option |
6981 | 96 |
-> ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit) |
6736 | 97 |
-> Proof.state -> Proof.state Seq.seq |
6981 | 98 |
val local_terminal_proof: text * text option |
99 |
-> ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit) |
|
6736 | 100 |
-> Proof.state -> Proof.state Seq.seq |
6981 | 101 |
val local_default_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit) |
6736 | 102 |
-> Proof.state -> Proof.state Seq.seq |
8966 | 103 |
val local_immediate_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit) |
104 |
-> Proof.state -> Proof.state Seq.seq |
|
105 |
val local_done_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit) |
|
106 |
-> Proof.state -> Proof.state Seq.seq |
|
107 |
val global_qed: bool -> text option |
|
108 |
-> Proof.state -> theory * {kind: string, name: string, thm: thm} |
|
6934 | 109 |
val global_terminal_proof: text * text option |
110 |
-> Proof.state -> theory * {kind: string, name: string, thm: thm} |
|
8966 | 111 |
val global_default_proof: Proof.state -> theory * {kind: string, name: string, thm: thm} |
6532 | 112 |
val global_immediate_proof: Proof.state -> theory * {kind: string, name: string, thm: thm} |
8966 | 113 |
val global_done_proof: Proof.state -> theory * {kind: string, name: string, thm: thm} |
9539 | 114 |
val goal_args: (Args.T list -> 'a * Args.T list) -> ('a -> int -> tactic) |
115 |
-> Args.src -> Proof.context -> Proof.method |
|
116 |
val goal_args': (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list)) |
|
117 |
-> ('a -> int -> tactic) -> Args.src -> Proof.context -> Proof.method |
|
5824 | 118 |
val setup: (theory -> theory) list |
119 |
end; |
|
120 |
||
121 |
structure Method: METHOD = |
|
122 |
struct |
|
123 |
||
124 |
||
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
125 |
(** global and local rule data **) |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
126 |
|
10008 | 127 |
local |
128 |
fun prt_rules kind sg ths = |
|
129 |
Pretty.writeln (Pretty.big_list ("standard " ^ kind ^ " rules:") |
|
130 |
(map (Display.pretty_thm_sg sg) ths)); |
|
131 |
in |
|
132 |
fun print_rules sg (intro, elim) = |
|
133 |
(prt_rules "introduction" sg intro; prt_rules "elimination" sg elim); |
|
134 |
end; |
|
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
135 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
136 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
137 |
(* theory data kind 'Isar/rules' *) |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
138 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
139 |
structure GlobalRulesArgs = |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
140 |
struct |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
141 |
val name = "Isar/rules"; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
142 |
type T = thm list * thm list; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
143 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
144 |
val empty = ([], []); |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
145 |
val copy = I; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
146 |
val prep_ext = I; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
147 |
fun merge ((intro1, elim1), (intro2, elim2)) = |
9418 | 148 |
(Drule.merge_rules (intro1, intro2), Drule.merge_rules (elim1, elim2)); |
10008 | 149 |
val print = print_rules; |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
150 |
end; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
151 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
152 |
structure GlobalRules = TheoryDataFun(GlobalRulesArgs); |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
153 |
val print_global_rules = GlobalRules.print; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
154 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
155 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
156 |
(* proof data kind 'Isar/rules' *) |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
157 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
158 |
structure LocalRulesArgs = |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
159 |
struct |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
160 |
val name = "Isar/rules"; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
161 |
type T = thm list * thm list; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
162 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
163 |
val init = GlobalRules.get; |
10008 | 164 |
val print = print_rules o ProofContext.sign_of; |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
165 |
end; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
166 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
167 |
structure LocalRules = ProofDataFun(LocalRulesArgs); |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
168 |
val print_local_rules = LocalRules.print; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
169 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
170 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
171 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
172 |
(** attributes **) |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
173 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
174 |
(* add rules *) |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
175 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
176 |
local |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
177 |
|
9938 | 178 |
fun add_dest th (intro, elim) = (intro, Drule.add_rules [Tactic.make_elim th] elim); |
179 |
fun add_elim th (intro, elim) = (intro, Drule.add_rules [th] elim); |
|
180 |
fun add_intro th (intro, elim) = (Drule.add_rules [th] intro, elim); |
|
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
181 |
|
9938 | 182 |
fun del_rule th (intro, elim) = |
183 |
let |
|
184 |
val th' = Tactic.make_elim th; |
|
185 |
val del = Drule.del_rules [th'] o Drule.del_rules [th]; |
|
186 |
in (del intro, del elim) end; |
|
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
187 |
|
9938 | 188 |
fun mk_att f g (x, th) = (f (g th) x, th); |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
189 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
190 |
in |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
191 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
192 |
val dest_global = mk_att GlobalRules.map add_dest; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
193 |
val elim_global = mk_att GlobalRules.map add_elim; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
194 |
val intro_global = mk_att GlobalRules.map add_intro; |
9938 | 195 |
val rule_del_global = mk_att GlobalRules.map del_rule; |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
196 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
197 |
val dest_local = mk_att LocalRules.map add_dest; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
198 |
val elim_local = mk_att LocalRules.map add_elim; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
199 |
val intro_local = mk_att LocalRules.map add_intro; |
9938 | 200 |
val rule_del_local = mk_att LocalRules.map del_rule; |
201 |
||
10034 | 202 |
fun del_args att = Attrib.syntax (Scan.lift Args.del >> K att); |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
203 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
204 |
end; |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
205 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
206 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
207 |
(* concrete syntax *) |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
208 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
209 |
val rule_atts = |
9900 | 210 |
[("dest", (Attrib.no_args dest_global, Attrib.no_args dest_local), |
211 |
"declaration of destruction rule"), |
|
212 |
("elim", (Attrib.no_args elim_global, Attrib.no_args elim_local), |
|
213 |
"declaration of elimination rule"), |
|
214 |
("intro", (Attrib.no_args intro_global, Attrib.no_args intro_local), |
|
215 |
"declaration of introduction rule"), |
|
9938 | 216 |
("rule", (del_args rule_del_global, del_args rule_del_local), |
9900 | 217 |
"remove declaration of elim/intro rule")]; |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
218 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
219 |
|
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
220 |
|
5824 | 221 |
(** proof methods **) |
222 |
||
8372 | 223 |
(* make methods *) |
5824 | 224 |
|
6849 | 225 |
val METHOD = Proof.method; |
8372 | 226 |
val METHOD_CASES = Proof.method_cases; |
227 |
||
5824 | 228 |
|
229 |
(* primitive *) |
|
230 |
||
231 |
val fail = METHOD (K no_tac); |
|
232 |
val succeed = METHOD (K all_tac); |
|
233 |
||
234 |
||
8167 | 235 |
(* shuffle *) |
236 |
||
8240 | 237 |
fun prefer i = METHOD (K (Tactic.defer_tac i THEN PRIMITIVE (Thm.permute_prems 0 ~1))); |
8167 | 238 |
fun defer opt_i = METHOD (K (Tactic.defer_tac (if_none opt_i 1))); |
239 |
||
240 |
||
7419 | 241 |
(* insert *) |
242 |
||
243 |
local |
|
5824 | 244 |
|
6981 | 245 |
fun cut_rule_tac raw_rule = |
246 |
let |
|
247 |
val rule = Drule.forall_intr_vars raw_rule; |
|
248 |
val revcut_rl = Drule.incr_indexes_wrt [] [] [] [rule] Drule.revcut_rl; |
|
7555 | 249 |
in Tactic.rtac (rule COMP revcut_rl) end; |
6981 | 250 |
|
7419 | 251 |
in |
5824 | 252 |
|
7419 | 253 |
fun insert_tac [] i = all_tac |
254 |
| insert_tac facts i = EVERY (map (fn th => cut_rule_tac th i) facts); |
|
6981 | 255 |
|
7555 | 256 |
val insert_facts = METHOD (ALLGOALS o insert_tac); |
7664 | 257 |
fun insert thms = METHOD (fn _ => ALLGOALS (insert_tac thms)); |
7419 | 258 |
|
259 |
end; |
|
5824 | 260 |
|
261 |
||
9706 | 262 |
(* simple methods *) |
263 |
||
264 |
fun SIMPLE_METHOD tac = METHOD (fn facts => ALLGOALS (insert_tac facts) THEN tac); |
|
265 |
fun SIMPLE_METHOD' quant tac = METHOD (fn facts => quant (insert_tac facts THEN' tac)); |
|
266 |
||
267 |
||
7601 | 268 |
(* unfold / fold definitions *) |
6532 | 269 |
|
9706 | 270 |
fun unfold thms = SIMPLE_METHOD (CHANGED (rewrite_goals_tac thms)); |
271 |
fun fold thms = SIMPLE_METHOD (CHANGED (fold_goals_tac thms)); |
|
9484 | 272 |
|
273 |
||
274 |
(* atomize meta-connectives *) |
|
275 |
||
10405 | 276 |
fun atomize_tac rews = |
277 |
let val rew_tac = rewrite_goal_tac rews in |
|
278 |
fn i => fn thm => |
|
279 |
if Logic.has_meta_prems (#prop (Thm.rep_thm thm)) i then rew_tac i thm |
|
280 |
else all_tac thm |
|
281 |
end; |
|
282 |
||
283 |
fun atomize_goal rews = |
|
284 |
let val tac = atomize_tac rews |
|
285 |
in fn i => fn thm => (case Seq.pull (tac i thm) of None => thm | Some (thm', _) => thm') end; |
|
6532 | 286 |
|
287 |
||
7419 | 288 |
(* multi_resolve *) |
289 |
||
290 |
local |
|
291 |
||
292 |
fun res th i rule = |
|
293 |
Thm.biresolution false [(false, th)] i rule handle THM _ => Seq.empty; |
|
294 |
||
295 |
fun multi_res _ [] rule = Seq.single rule |
|
296 |
| multi_res i (th :: ths) rule = Seq.flat (Seq.map (res th i) (multi_res (i + 1) ths rule)); |
|
297 |
||
298 |
in |
|
299 |
||
300 |
val multi_resolve = multi_res 1; |
|
8372 | 301 |
fun multi_resolves facts rules = Seq.flat (Seq.map (multi_resolve facts) (Seq.of_list rules)); |
7419 | 302 |
|
303 |
end; |
|
304 |
||
305 |
||
10744 | 306 |
(* basic rules *) |
8372 | 307 |
|
7419 | 308 |
local |
5824 | 309 |
|
10541
fdec07d4f047
resolveq(_cases)_tac moved to HOL/Tools/induct_method.ML;
wenzelm
parents:
10529
diff
changeset
|
310 |
fun gen_rule_tac tac rules [] i st = tac rules i st |
fdec07d4f047
resolveq(_cases)_tac moved to HOL/Tools/induct_method.ML;
wenzelm
parents:
10529
diff
changeset
|
311 |
| gen_rule_tac tac erules facts i st = |
fdec07d4f047
resolveq(_cases)_tac moved to HOL/Tools/induct_method.ML;
wenzelm
parents:
10529
diff
changeset
|
312 |
Seq.flat (Seq.map (fn rule => (tac o single) rule i st) (multi_resolves facts erules)); |
7130 | 313 |
|
10744 | 314 |
fun gen_arule_tac tac j rules facts = |
315 |
EVERY' (gen_rule_tac tac rules facts :: replicate j Tactic.assume_tac); |
|
316 |
||
10309 | 317 |
fun gen_some_rule_tac tac arg_rules ctxt facts = |
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
318 |
let val rules = |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
319 |
if not (null arg_rules) then arg_rules |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
320 |
else if null facts then #1 (LocalRules.get ctxt) |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
321 |
else op @ (LocalRules.get ctxt); |
10309 | 322 |
in tac rules facts end; |
323 |
||
10744 | 324 |
fun meth tac x = METHOD (HEADGOAL o tac x); |
325 |
fun meth' tac x y = METHOD (HEADGOAL o tac x y); |
|
8220 | 326 |
|
7419 | 327 |
in |
328 |
||
10744 | 329 |
val rule_tac = gen_rule_tac Tactic.resolve_tac; |
330 |
val rule = meth rule_tac; |
|
331 |
val some_rule_tac = gen_some_rule_tac rule_tac; |
|
332 |
val some_rule = meth' some_rule_tac; |
|
333 |
||
334 |
val erule = meth' (gen_arule_tac Tactic.eresolve_tac); |
|
335 |
val drule = meth' (gen_arule_tac Tactic.dresolve_tac); |
|
336 |
val frule = meth' (gen_arule_tac Tactic.forward_tac); |
|
5824 | 337 |
|
7419 | 338 |
end; |
339 |
||
340 |
||
8195 | 341 |
(* this *) |
342 |
||
8671 | 343 |
val this = METHOD (EVERY o map (HEADGOAL o Tactic.rtac)); |
8195 | 344 |
|
345 |
||
346 |
(* assumption *) |
|
7555 | 347 |
|
10378
98c95ebf804f
assumption / finish: handle non-atomic assumptions from context as well;
wenzelm
parents:
10309
diff
changeset
|
348 |
fun asm_tac ths = |
98c95ebf804f
assumption / finish: handle non-atomic assumptions from context as well;
wenzelm
parents:
10309
diff
changeset
|
349 |
foldr (op APPEND') (map (fn th => Tactic.rtac th THEN_ALL_NEW assume_tac) ths, K no_tac); |
98c95ebf804f
assumption / finish: handle non-atomic assumptions from context as well;
wenzelm
parents:
10309
diff
changeset
|
350 |
|
10405 | 351 |
fun assm_tac ctxt = |
352 |
assume_tac APPEND' |
|
353 |
asm_tac (ProofContext.prems_of ctxt) APPEND' |
|
354 |
Tactic.rtac Drule.reflexive_thm; |
|
7419 | 355 |
|
7555 | 356 |
fun assumption_tac ctxt [] = assm_tac ctxt |
10378
98c95ebf804f
assumption / finish: handle non-atomic assumptions from context as well;
wenzelm
parents:
10309
diff
changeset
|
357 |
| assumption_tac _ [fact] = asm_tac [fact] |
7555 | 358 |
| assumption_tac _ _ = K no_tac; |
7419 | 359 |
|
8671 | 360 |
fun assumption ctxt = METHOD (HEADGOAL o assumption_tac ctxt); |
7419 | 361 |
|
362 |
||
9539 | 363 |
(* res_inst_tac etc. *) |
8238 | 364 |
|
9539 | 365 |
(*Note: insts refer to the implicit (!!) goal context; use at your own risk*) |
9565
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
366 |
fun gen_res_inst _ tac (quant, ([], thms)) = |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
367 |
METHOD (fn facts => (quant (insert_tac facts THEN' tac thms))) |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
368 |
| gen_res_inst tac _ (quant, (insts, [thm])) = |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
369 |
METHOD (fn facts => (quant (insert_tac facts THEN' tac insts thm))) |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
370 |
| gen_res_inst _ _ _ = error "Cannot have instantiations with multiple rules"; |
8238 | 371 |
|
9565
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
372 |
val res_inst = gen_res_inst Tactic.res_inst_tac Tactic.resolve_tac; |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
373 |
val eres_inst = gen_res_inst Tactic.eres_inst_tac Tactic.eresolve_tac; |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
374 |
val dres_inst = gen_res_inst Tactic.dres_inst_tac Tactic.dresolve_tac; |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
375 |
val forw_inst = gen_res_inst Tactic.forw_inst_tac Tactic.forward_tac; |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
376 |
val cut_inst = gen_res_inst Tactic.cut_inst_tac Tactic.cut_facts_tac; |
8238 | 377 |
|
378 |
||
8329 | 379 |
(* simple Prolog interpreter *) |
380 |
||
381 |
fun prolog_tac rules facts = |
|
382 |
DEPTH_SOLVE_1 (HEADGOAL (Tactic.assume_tac APPEND' Tactic.resolve_tac (facts @ rules))); |
|
383 |
||
384 |
val prolog = METHOD o prolog_tac; |
|
385 |
||
386 |
||
8351 | 387 |
(* ML tactics *) |
388 |
||
389 |
val tactic_ref = ref ((fn _ => raise Match): Proof.context -> thm list -> tactic); |
|
390 |
fun set_tactic f = tactic_ref := f; |
|
391 |
||
392 |
fun tactic txt ctxt = METHOD (fn facts => |
|
9631 | 393 |
(Context.use_mltext |
394 |
("let fun tactic (ctxt: PureIsar.Proof.context) (facts: thm list) : tactic = \ |
|
395 |
\let val thm = PureIsar.ProofContext.get_thm_closure ctxt\n\ |
|
396 |
\ and thms = PureIsar.ProofContext.get_thms_closure ctxt in\n" |
|
397 |
^ txt ^ |
|
398 |
"\nend in PureIsar.Method.set_tactic tactic end") |
|
399 |
false None; |
|
400 |
Context.setmp (Some (ProofContext.theory_of ctxt)) (! tactic_ref ctxt) facts)); |
|
8351 | 401 |
|
402 |
||
5824 | 403 |
|
404 |
(** methods theory data **) |
|
405 |
||
406 |
(* data kind 'Isar/methods' *) |
|
407 |
||
408 |
structure MethodsDataArgs = |
|
409 |
struct |
|
410 |
val name = "Isar/methods"; |
|
411 |
type T = |
|
412 |
{space: NameSpace.T, |
|
413 |
meths: (((Args.src -> Proof.context -> Proof.method) * string) * stamp) Symtab.table}; |
|
414 |
||
415 |
val empty = {space = NameSpace.empty, meths = Symtab.empty}; |
|
6546 | 416 |
val copy = I; |
5824 | 417 |
val prep_ext = I; |
418 |
fun merge ({space = space1, meths = meths1}, {space = space2, meths = meths2}) = |
|
419 |
{space = NameSpace.merge (space1, space2), |
|
420 |
meths = Symtab.merge eq_snd (meths1, meths2) handle Symtab.DUPS dups => |
|
421 |
error ("Attempt to merge different versions of methods " ^ commas_quote dups)}; |
|
422 |
||
9222 | 423 |
fun print _ {space, meths} = |
5824 | 424 |
let |
425 |
fun prt_meth (name, ((_, comment), _)) = Pretty.block |
|
6849 | 426 |
[Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment]; |
5824 | 427 |
in |
8720 | 428 |
[Pretty.big_list "methods:" (map prt_meth (NameSpace.cond_extern_table space meths))] |
9222 | 429 |
|> Pretty.chunks |> Pretty.writeln |
5824 | 430 |
end; |
431 |
end; |
|
432 |
||
433 |
structure MethodsData = TheoryDataFun(MethodsDataArgs); |
|
434 |
val print_methods = MethodsData.print; |
|
7611 | 435 |
|
5824 | 436 |
|
437 |
(* get methods *) |
|
438 |
||
5916 | 439 |
exception METHOD_FAIL of (string * Position.T) * exn; |
440 |
||
5824 | 441 |
fun method thy = |
442 |
let |
|
443 |
val {space, meths} = MethodsData.get thy; |
|
444 |
||
5884 | 445 |
fun meth src = |
446 |
let |
|
447 |
val ((raw_name, _), pos) = Args.dest_src src; |
|
448 |
val name = NameSpace.intern space raw_name; |
|
449 |
in |
|
5824 | 450 |
(case Symtab.lookup (meths, name) of |
451 |
None => error ("Unknown proof method: " ^ quote name ^ Position.str_of pos) |
|
5916 | 452 |
| Some ((mth, _), _) => transform_failure (curry METHOD_FAIL (name, pos)) (mth src)) |
5824 | 453 |
end; |
454 |
in meth end; |
|
455 |
||
456 |
||
9194 | 457 |
(* add_method(s) *) |
5824 | 458 |
|
459 |
fun add_methods raw_meths thy = |
|
460 |
let |
|
461 |
val full = Sign.full_name (Theory.sign_of thy); |
|
462 |
val new_meths = |
|
463 |
map (fn (name, f, comment) => (full name, ((f, comment), stamp ()))) raw_meths; |
|
464 |
||
465 |
val {space, meths} = MethodsData.get thy; |
|
466 |
val space' = NameSpace.extend (space, map fst new_meths); |
|
467 |
val meths' = Symtab.extend (meths, new_meths) handle Symtab.DUPS dups => |
|
468 |
error ("Duplicate declaration of method(s) " ^ commas_quote dups); |
|
469 |
in |
|
470 |
thy |> MethodsData.put {space = space', meths = meths'} |
|
471 |
end; |
|
472 |
||
9194 | 473 |
val add_method = add_methods o Library.single; |
474 |
||
5824 | 475 |
(*implicit version*) |
476 |
fun Method name meth cmt = Context.>> (add_methods [(name, meth, cmt)]); |
|
477 |
||
478 |
||
5884 | 479 |
|
480 |
(** method syntax **) |
|
5824 | 481 |
|
5884 | 482 |
(* basic *) |
483 |
||
484 |
fun syntax (scan: (Proof.context * Args.T list -> 'a * (Proof.context * Args.T list))) = |
|
485 |
Args.syntax "method" scan; |
|
5824 | 486 |
|
8351 | 487 |
fun simple_args scan f src ctxt : Proof.method = |
488 |
#2 (syntax (Scan.lift (scan >> (fn x => f x ctxt))) src ctxt); |
|
489 |
||
7555 | 490 |
fun ctxt_args (f: Proof.context -> Proof.method) src ctxt = |
8282 | 491 |
#2 (syntax (Scan.succeed (f ctxt)) src ctxt); |
7555 | 492 |
|
493 |
fun no_args m = ctxt_args (K m); |
|
5884 | 494 |
|
495 |
||
8351 | 496 |
|
5884 | 497 |
(* sections *) |
5824 | 498 |
|
7268 | 499 |
type modifier = (Proof.context -> Proof.context) * Proof.context attribute; |
500 |
||
501 |
local |
|
502 |
||
8381 | 503 |
fun sect ss = Scan.first (map Scan.lift ss); |
5884 | 504 |
fun thms ss = Scan.unless (sect ss) Attrib.local_thms; |
505 |
fun thmss ss = Scan.repeat (thms ss) >> flat; |
|
506 |
||
7268 | 507 |
fun apply (f, att) (ctxt, ths) = Thm.applys_attributes ((f ctxt, ths), [att]); |
5824 | 508 |
|
7268 | 509 |
fun section ss = (sect ss -- thmss ss) :-- (fn (m, ths) => Scan.depend (fn ctxt => |
510 |
Scan.succeed (apply m (ctxt, ths)))) >> #2; |
|
5884 | 511 |
|
7601 | 512 |
fun sectioned args ss = args -- Scan.repeat (section ss); |
5884 | 513 |
|
7268 | 514 |
in |
5824 | 515 |
|
5884 | 516 |
fun sectioned_args args ss f src ctxt = |
8282 | 517 |
let val (ctxt', (x, _)) = syntax (sectioned args ss) src ctxt |
5921 | 518 |
in f x ctxt' end; |
5884 | 519 |
|
7601 | 520 |
fun bang_sectioned_args ss f = sectioned_args Args.bang_facts ss f; |
9777 | 521 |
fun bang_sectioned_args' ss scan f = |
522 |
sectioned_args (Args.bang_facts -- scan >> swap) ss (uncurry f); |
|
7601 | 523 |
fun only_sectioned_args ss f = sectioned_args (Scan.succeed ()) ss (fn () => f); |
7268 | 524 |
|
8093 | 525 |
fun thms_ctxt_args f = sectioned_args (thmss []) [] f; |
526 |
fun thms_args f = thms_ctxt_args (K o f); |
|
9706 | 527 |
fun thm_args f = thms_args (fn [thm] => f thm | _ => error "Single theorem expected"); |
5824 | 528 |
|
7268 | 529 |
end; |
530 |
||
5824 | 531 |
|
9539 | 532 |
(* tactic syntax *) |
8238 | 533 |
|
10744 | 534 |
fun nat_thms_args f = uncurry f oo |
535 |
(#2 oo syntax (Scan.lift (Scan.optional (Args.parens Args.nat) 0) -- Attrib.local_thmss)); |
|
536 |
||
8238 | 537 |
val insts = |
9539 | 538 |
Scan.optional |
9565
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
539 |
(Args.enum1 "and" (Scan.lift (Args.name -- (Args.$$$ "=" |-- Args.!!! Args.name))) --| |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
540 |
Scan.lift (Args.$$$ "in")) [] -- Attrib.local_thmss; |
8238 | 541 |
|
8537 | 542 |
fun inst_args f = f oo (#2 oo syntax (Args.goal_spec HEADGOAL -- insts)); |
543 |
||
544 |
||
9539 | 545 |
fun goal_args' args tac = #2 oo syntax (Args.goal_spec HEADGOAL -- args >> |
9706 | 546 |
(fn (quant, s) => SIMPLE_METHOD' quant (tac s))); |
8537 | 547 |
|
9539 | 548 |
fun goal_args args tac = goal_args' (Scan.lift args) tac; |
8238 | 549 |
|
550 |
||
5824 | 551 |
|
552 |
(** method text **) |
|
553 |
||
554 |
(* datatype text *) |
|
555 |
||
556 |
datatype text = |
|
557 |
Basic of (Proof.context -> Proof.method) | |
|
558 |
Source of Args.src | |
|
559 |
Then of text list | |
|
560 |
Orelse of text list | |
|
561 |
Try of text | |
|
562 |
Repeat1 of text; |
|
563 |
||
564 |
||
565 |
(* refine *) |
|
566 |
||
8238 | 567 |
fun gen_refine f text state = |
5824 | 568 |
let |
569 |
val thy = Proof.theory_of state; |
|
570 |
||
8238 | 571 |
fun eval (Basic mth) = f mth |
572 |
| eval (Source src) = f (method thy src) |
|
5824 | 573 |
| eval (Then txts) = Seq.EVERY (map eval txts) |
574 |
| eval (Orelse txts) = Seq.FIRST (map eval txts) |
|
575 |
| eval (Try txt) = Seq.TRY (eval txt) |
|
576 |
| eval (Repeat1 txt) = Seq.REPEAT1 (eval txt); |
|
577 |
in eval text state end; |
|
578 |
||
8238 | 579 |
val refine = gen_refine Proof.refine; |
580 |
val refine_end = gen_refine Proof.refine_end; |
|
6404 | 581 |
|
5824 | 582 |
|
6404 | 583 |
(* structured proof steps *) |
5824 | 584 |
|
7506 | 585 |
val default_text = Source (Args.src (("default", []), Position.none)); |
8195 | 586 |
val this_text = Basic (K this); |
9706 | 587 |
val done_text = Basic (K (SIMPLE_METHOD all_tac)); |
7555 | 588 |
|
8966 | 589 |
fun close_text asm = Basic (fn ctxt => METHOD (K |
590 |
(FILTER Thm.no_prems ((if asm then ALLGOALS (assm_tac ctxt) else all_tac) THEN flexflex_tac)))); |
|
591 |
||
592 |
fun finish_text asm None = close_text asm |
|
593 |
| finish_text asm (Some txt) = Then [txt, close_text asm]; |
|
6872 | 594 |
|
5824 | 595 |
fun proof opt_text state = |
596 |
state |
|
597 |
|> Proof.assert_backward |
|
6404 | 598 |
|> refine (if_none opt_text default_text) |
8242 | 599 |
|> Seq.map (Proof.goal_facts (K [])) |
5824 | 600 |
|> Seq.map Proof.enter_forward; |
601 |
||
8966 | 602 |
fun local_qed asm opt_text = Proof.local_qed (refine (finish_text asm opt_text)); |
603 |
fun local_terminal_proof (text, opt_text) pr = |
|
604 |
Seq.THEN (proof (Some text), local_qed true opt_text pr); |
|
605 |
val local_default_proof = local_terminal_proof (default_text, None); |
|
8195 | 606 |
val local_immediate_proof = local_terminal_proof (this_text, None); |
8966 | 607 |
fun local_done_proof pr = Seq.THEN (proof (Some done_text), local_qed false None pr); |
5824 | 608 |
|
6872 | 609 |
|
8966 | 610 |
fun global_qeds asm opt_text = Proof.global_qed (refine (finish_text asm opt_text)); |
5824 | 611 |
|
8966 | 612 |
fun global_qed asm opt_text state = |
6872 | 613 |
state |
8966 | 614 |
|> global_qeds asm opt_text |
6872 | 615 |
|> Proof.check_result "Failed to finish proof" state |
616 |
|> Seq.hd; |
|
617 |
||
8966 | 618 |
fun global_term_proof asm (text, opt_text) state = |
6872 | 619 |
state |
620 |
|> proof (Some text) |
|
621 |
|> Proof.check_result "Terminal proof method failed" state |
|
8966 | 622 |
|> (Seq.flat o Seq.map (global_qeds asm opt_text)) |
6872 | 623 |
|> Proof.check_result "Failed to finish proof (after successful terminal method)" state |
624 |
|> Seq.hd; |
|
625 |
||
8966 | 626 |
val global_terminal_proof = global_term_proof true; |
6934 | 627 |
val global_default_proof = global_terminal_proof (default_text, None); |
8966 | 628 |
val global_immediate_proof = global_terminal_proof (this_text, None); |
629 |
val global_done_proof = global_term_proof false (done_text, None); |
|
5824 | 630 |
|
631 |
||
632 |
(** theory setup **) |
|
633 |
||
9539 | 634 |
(* misc tactic emulations *) |
635 |
||
636 |
val subgoal_meth = goal_args (Scan.repeat1 Args.name) Tactic.subgoals_tac; |
|
637 |
val thin_meth = goal_args Args.name Tactic.thin_tac; |
|
638 |
val rename_meth = goal_args (Scan.repeat1 Args.name) Tactic.rename_params_tac; |
|
9631 | 639 |
val rotate_meth = goal_args (Scan.optional Args.int 1) Tactic.rotate_tac; |
9539 | 640 |
|
641 |
||
5824 | 642 |
(* pure_methods *) |
643 |
||
644 |
val pure_methods = |
|
645 |
[("fail", no_args fail, "force failure"), |
|
646 |
("succeed", no_args succeed, "succeed"), |
|
9587 | 647 |
("-", no_args insert_facts, "do nothing (insert current facts only)"), |
9539 | 648 |
("insert", thms_args insert, "insert theorems, ignoring facts (improper)"), |
7601 | 649 |
("unfold", thms_args unfold, "unfold definitions"), |
650 |
("fold", thms_args fold, "fold definitions"), |
|
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
651 |
("rule", thms_ctxt_args some_rule, "apply some rule"), |
10744 | 652 |
("erule", nat_thms_args erule, "apply rule in elimination manner (improper)"), |
653 |
("drule", nat_thms_args drule, "apply rule in destruct manner (improper)"), |
|
654 |
("frule", nat_thms_args frule, "apply rule in forward manner (improper)"), |
|
8195 | 655 |
("this", no_args this, "apply current facts as rules"), |
8238 | 656 |
("assumption", ctxt_args assumption, "proof by assumption, preferring facts"), |
9539 | 657 |
("rule_tac", inst_args res_inst, "apply rule (dynamic instantiation!)"), |
658 |
("erule_tac", inst_args eres_inst, "apply rule in elimination manner (dynamic instantiation!)"), |
|
659 |
("drule_tac", inst_args dres_inst, "apply rule in destruct manner (dynamic instantiation!)"), |
|
660 |
("frule_tac", inst_args forw_inst, "apply rule in forward manner (dynamic instantiation!)"), |
|
661 |
("cut_tac", inst_args cut_inst, "cut rule (dynamic instantiation!)"), |
|
9565
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
662 |
("subgoal_tac", subgoal_meth, "insert subgoal (dynamic instantiation!)"), |
3eb2ea15cc69
res_inst: include non-inst versions with multiple thms;
wenzelm
parents:
9539
diff
changeset
|
663 |
("thin_tac", thin_meth, "remove premise (dynamic instantiation!)"), |
9631 | 664 |
("rename_tac", rename_meth, "rename parameters of goal (dynamic instantiation!)"), |
665 |
("rotate_tac", rotate_meth, "rotate assumptions of goal"), |
|
8351 | 666 |
("prolog", thms_args prolog, "simple prolog interpreter"), |
667 |
("tactic", simple_args Args.name tactic, "ML tactic as proof method")]; |
|
5824 | 668 |
|
669 |
||
670 |
(* setup *) |
|
671 |
||
8153
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
672 |
val setup = |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
673 |
[GlobalRules.init, LocalRules.init, Attrib.add_attributes rule_atts, |
9bdbcb71dc56
maintain standard rules (beware: classical provers provides another version!);
wenzelm
parents:
8093
diff
changeset
|
674 |
MethodsData.init, add_methods pure_methods]; |
5824 | 675 |
|
676 |
||
677 |
end; |
|
678 |
||
679 |
||
680 |
structure BasicMethod: BASIC_METHOD = Method; |
|
681 |
open BasicMethod; |