author | wenzelm |
Tue, 05 Mar 2002 20:55:20 +0100 | |
changeset 13026 | e45ebbb2e18e |
parent 12375 | 539a32568db3 |
child 13603 | 57f364d1d3b2 |
permissions | -rw-r--r-- |
9772 | 1 |
(* Title: Provers/clasimp.ML |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
2 |
ID: $Id$ |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
3 |
Author: David von Oheimb, TU Muenchen |
12375 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
5 |
|
5219 | 6 |
Combination of classical reasoner and simplifier (depends on |
8469 | 7 |
simplifier.ML, splitter.ML classical.ML, blast.ML). |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
8 |
*) |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
9 |
|
9860 | 10 |
infix 4 addSIs2 addSEs2 addSDs2 addIs2 addEs2 addDs2 addsimps2 delsimps2 |
11 |
addSss addss addIffs delIffs; |
|
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
12 |
|
5219 | 13 |
signature CLASIMP_DATA = |
14 |
sig |
|
15 |
structure Simplifier: SIMPLIFIER |
|
8469 | 16 |
structure Splitter: SPLITTER |
5219 | 17 |
structure Classical: CLASSICAL |
18 |
structure Blast: BLAST |
|
19 |
sharing type Classical.claset = Blast.claset |
|
9860 | 20 |
val notE: thm |
21 |
val iffD1: thm |
|
22 |
val iffD2: thm |
|
23 |
val cla_make_elim: thm -> thm |
|
5219 | 24 |
end |
25 |
||
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
26 |
signature CLASIMP = |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
27 |
sig |
5219 | 28 |
include CLASIMP_DATA |
29 |
type claset |
|
30 |
type simpset |
|
31 |
type clasimpset |
|
10317 | 32 |
val clasimpset: unit -> clasimpset |
9860 | 33 |
val addSIs2: clasimpset * thm list -> clasimpset |
34 |
val addSEs2: clasimpset * thm list -> clasimpset |
|
35 |
val addSDs2: clasimpset * thm list -> clasimpset |
|
36 |
val addIs2: clasimpset * thm list -> clasimpset |
|
37 |
val addEs2: clasimpset * thm list -> clasimpset |
|
38 |
val addDs2: clasimpset * thm list -> clasimpset |
|
39 |
val addsimps2: clasimpset * thm list -> clasimpset |
|
40 |
val delsimps2: clasimpset * thm list -> clasimpset |
|
41 |
val addSss: claset * simpset -> claset |
|
42 |
val addss: claset * simpset -> claset |
|
43 |
val addIffs: clasimpset * thm list -> clasimpset |
|
44 |
val delIffs: clasimpset * thm list -> clasimpset |
|
45 |
val AddIffs: thm list -> unit |
|
46 |
val DelIffs: thm list -> unit |
|
47 |
val CLASIMPSET: (clasimpset -> tactic) -> tactic |
|
48 |
val CLASIMPSET': (clasimpset -> 'a -> tactic) -> 'a -> tactic |
|
5483 | 49 |
val clarsimp_tac: clasimpset -> int -> tactic |
9860 | 50 |
val Clarsimp_tac: int -> tactic |
51 |
val mk_auto_tac: clasimpset -> int -> int -> tactic |
|
52 |
val auto_tac: clasimpset -> tactic |
|
53 |
val Auto_tac: tactic |
|
54 |
val auto: unit -> unit |
|
55 |
val force_tac: clasimpset -> int -> tactic |
|
56 |
val Force_tac: int -> tactic |
|
57 |
val force: int -> unit |
|
58 |
val fast_simp_tac: clasimpset -> int -> tactic |
|
59 |
val slow_simp_tac: clasimpset -> int -> tactic |
|
60 |
val best_simp_tac: clasimpset -> int -> tactic |
|
8639 | 61 |
val change_global_css: (clasimpset * thm list -> clasimpset) -> theory attribute |
62 |
val change_local_css: (clasimpset * thm list -> clasimpset) -> Proof.context attribute |
|
9506 | 63 |
val get_local_clasimpset: Proof.context -> clasimpset |
9860 | 64 |
val iff_add_global: theory attribute |
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
65 |
val iff_add_global': theory attribute |
9860 | 66 |
val iff_del_global: theory attribute |
67 |
val iff_add_local: Proof.context attribute |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
68 |
val iff_add_local': Proof.context attribute |
9860 | 69 |
val iff_del_local: Proof.context attribute |
70 |
val iff_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list |
|
9506 | 71 |
val clasimp_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list |
9860 | 72 |
val setup: (theory -> theory) list |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
73 |
end; |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
74 |
|
5219 | 75 |
functor ClasimpFun(Data: CLASIMP_DATA): CLASIMP = |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
76 |
struct |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
77 |
|
5219 | 78 |
open Data; |
79 |
||
80 |
type claset = Classical.claset; |
|
81 |
type simpset = Simplifier.simpset; |
|
82 |
type clasimpset = claset * simpset; |
|
83 |
||
10317 | 84 |
fun clasimpset () = (Classical.claset (), Simplifier.simpset ()); |
85 |
||
5219 | 86 |
|
87 |
(* clasimpset operations *) |
|
88 |
||
89 |
(*this interface for updating a clasimpset is rudimentary and just for |
|
90 |
convenience for the most common cases*) |
|
91 |
||
92 |
fun pair_upd1 f ((a,b),x) = (f(a,x), b); |
|
93 |
fun pair_upd2 f ((a,b),x) = (a, f(b,x)); |
|
94 |
||
95 |
fun op addSIs2 arg = pair_upd1 Classical.addSIs arg; |
|
96 |
fun op addSEs2 arg = pair_upd1 Classical.addSEs arg; |
|
97 |
fun op addSDs2 arg = pair_upd1 Classical.addSDs arg; |
|
98 |
fun op addIs2 arg = pair_upd1 Classical.addIs arg; |
|
99 |
fun op addEs2 arg = pair_upd1 Classical.addEs arg; |
|
100 |
fun op addDs2 arg = pair_upd1 Classical.addDs arg; |
|
101 |
fun op addsimps2 arg = pair_upd2 Simplifier.addsimps arg; |
|
102 |
fun op delsimps2 arg = pair_upd2 Simplifier.delsimps arg; |
|
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
103 |
|
9402 | 104 |
(*not totally safe: may instantiate unknowns that appear also in other subgoals*) |
105 |
val safe_asm_full_simp_tac = Simplifier.generic_simp_tac true (true,true,true); |
|
106 |
||
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
107 |
(*Add a simpset to a classical set!*) |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
108 |
(*Caution: only one simpset added can be added by each of addSss and addss*) |
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
10821
diff
changeset
|
109 |
fun cs addSss ss = Classical.addSafter (cs, ("safe_asm_full_simp_tac", |
9772 | 110 |
CHANGED o safe_asm_full_simp_tac ss)); |
111 |
fun cs addss ss = Classical.addbefore (cs, ("asm_full_simp_tac", |
|
112 |
CHANGED o Simplifier.asm_full_simp_tac ss)); |
|
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
113 |
|
9860 | 114 |
|
115 |
(* iffs: addition of rules to simpsets and clasets simultaneously *) |
|
116 |
||
11344 | 117 |
(*Takes (possibly conditional) theorems of the form A<->B to |
9860 | 118 |
the Safe Intr rule B==>A and |
119 |
the Safe Destruct rule A==>B. |
|
120 |
Also ~A goes to the Safe Elim rule A ==> ?R |
|
11462 | 121 |
Failing other cases, A is added as a Safe Intr rule*) |
9860 | 122 |
local |
123 |
||
13026 | 124 |
fun addIff decls1 decls2 simp ((cs, ss), th) = |
125 |
let |
|
126 |
val n = nprems_of th; |
|
127 |
val (dest, elim, intro) = if n = 0 then decls1 else decls2; |
|
128 |
val zero_rotate = zero_var_indexes o rotate_prems n; |
|
129 |
in |
|
11902 | 130 |
(dest (intro (cs, [zero_rotate (th RS Data.iffD2)]), [zero_rotate (th RS Data.iffD1)]) |
131 |
handle THM _ => (elim (cs, [zero_rotate (th RS Data.notE)]) |
|
132 |
handle THM _ => intro (cs, [th])), |
|
133 |
simp (ss, [th])) |
|
134 |
end; |
|
9860 | 135 |
|
12375 | 136 |
fun delIff delcs delss ((cs, ss), th) = |
11902 | 137 |
let val zero_rotate = zero_var_indexes o rotate_prems (nprems_of th) in |
12375 | 138 |
(delcs (cs, [zero_rotate (th RS Data.iffD2), |
11902 | 139 |
Data.cla_make_elim (zero_rotate (th RS Data.iffD1))]) |
12375 | 140 |
handle THM _ => (delcs (cs, [zero_rotate (th RS Data.notE)]) |
141 |
handle THM _ => delcs (cs, [th])), |
|
142 |
delss (ss, [th])) |
|
11902 | 143 |
end; |
9860 | 144 |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
145 |
fun store_clasimp (cs, ss) = |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
146 |
(Classical.claset_ref () := cs; Simplifier.simpset_ref () := ss); |
9860 | 147 |
|
148 |
in |
|
149 |
||
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
150 |
val op addIffs = |
13026 | 151 |
foldl (addIff (Classical.addSDs, Classical.addSEs, Classical.addSIs) |
152 |
(Classical.addDs, Classical.addEs, Classical.addIs) Simplifier.addsimps); |
|
12375 | 153 |
val op delIffs = foldl (delIff Classical.delrules Simplifier.delsimps); |
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
154 |
|
10317 | 155 |
fun AddIffs thms = store_clasimp (clasimpset () addIffs thms); |
156 |
fun DelIffs thms = store_clasimp (clasimpset () delIffs thms); |
|
9860 | 157 |
|
12375 | 158 |
fun addIffs_global (thy, ths) = |
13026 | 159 |
foldl (addIff |
160 |
(ContextRules.addXDs_global, ContextRules.addXEs_global, ContextRules.addXIs_global) |
|
161 |
(ContextRules.addXDs_global, ContextRules.addXEs_global, ContextRules.addXIs_global) #1) |
|
162 |
((thy, ()), ths) |> #1; |
|
12375 | 163 |
|
164 |
fun addIffs_local (ctxt, ths) = |
|
13026 | 165 |
foldl (addIff |
166 |
(ContextRules.addXDs_local, ContextRules.addXEs_local, ContextRules.addXIs_local) |
|
167 |
(ContextRules.addXDs_local, ContextRules.addXEs_local, ContextRules.addXIs_local) #1) |
|
168 |
((ctxt, ()), ths) |> #1; |
|
12375 | 169 |
|
170 |
fun delIffs_global (thy, ths) = |
|
171 |
foldl (delIff ContextRules.delrules_global #1) ((thy, ()), ths) |> #1; |
|
172 |
||
173 |
fun delIffs_local (ctxt, ths) = |
|
174 |
foldl (delIff ContextRules.delrules_local #1) ((ctxt, ()), ths) |> #1; |
|
175 |
||
9860 | 176 |
end; |
177 |
||
178 |
||
5219 | 179 |
(* tacticals *) |
180 |
||
181 |
fun CLASIMPSET tacf state = |
|
182 |
Classical.CLASET (fn cs => Simplifier.SIMPSET (fn ss => tacf (cs, ss))) state; |
|
183 |
||
184 |
fun CLASIMPSET' tacf i state = |
|
185 |
Classical.CLASET (fn cs => Simplifier.SIMPSET (fn ss => tacf (cs, ss) i)) state; |
|
4888 | 186 |
|
187 |
||
12375 | 188 |
fun clarsimp_tac (cs, ss) = |
189 |
safe_asm_full_simp_tac ss THEN_ALL_NEW |
|
190 |
Classical.clarify_tac (cs addSss ss); |
|
191 |
||
10317 | 192 |
fun Clarsimp_tac i = clarsimp_tac (clasimpset ()) i; |
5483 | 193 |
|
194 |
||
5219 | 195 |
(* auto_tac *) |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
196 |
|
5219 | 197 |
fun blast_depth_tac cs m i thm = |
9772 | 198 |
Blast.depth_tac cs m i thm |
5554 | 199 |
handle Blast.TRANS s => (warning ("Blast_tac: " ^ s); Seq.empty); |
9772 | 200 |
|
201 |
(* a variant of depth_tac that avoids interference of the simplifier |
|
5219 | 202 |
with dup_step_tac when they are combined by auto_tac *) |
5756
8ef5288c24b0
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5567
diff
changeset
|
203 |
local |
9772 | 204 |
fun slow_step_tac' cs = Classical.appWrappers cs |
205 |
(Classical.instp_step_tac cs APPEND' Classical.haz_step_tac cs); |
|
206 |
in fun nodup_depth_tac cs m i state = SELECT_GOAL |
|
207 |
(Classical.safe_steps_tac cs 1 THEN_ELSE |
|
208 |
(DEPTH_SOLVE (nodup_depth_tac cs m 1), |
|
209 |
Classical.inst0_step_tac cs 1 APPEND COND (K (m=0)) no_tac |
|
210 |
(slow_step_tac' cs 1 THEN DEPTH_SOLVE (nodup_depth_tac cs (m-1) 1)) |
|
5756
8ef5288c24b0
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5567
diff
changeset
|
211 |
)) i state; |
8ef5288c24b0
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5567
diff
changeset
|
212 |
end; |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
213 |
|
9402 | 214 |
(*Designed to be idempotent, except if blast_depth_tac instantiates variables |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
215 |
in some of the subgoals*) |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
216 |
fun mk_auto_tac (cs, ss) m n = |
5219 | 217 |
let val cs' = cs addss ss |
9772 | 218 |
val maintac = |
219 |
blast_depth_tac cs m (* fast but can't use wrappers *) |
|
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
220 |
ORELSE' |
5756
8ef5288c24b0
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5567
diff
changeset
|
221 |
(CHANGED o nodup_depth_tac cs' n); (* slower but more general *) |
5219 | 222 |
in EVERY [ALLGOALS (Simplifier.asm_full_simp_tac ss), |
9772 | 223 |
TRY (Classical.safe_tac cs), |
224 |
REPEAT (FIRSTGOAL maintac), |
|
5219 | 225 |
TRY (Classical.safe_tac (cs addSss ss)), |
9772 | 226 |
prune_params_tac] |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
227 |
end; |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
228 |
|
9772 | 229 |
fun auto_tac css = mk_auto_tac css 4 2; |
10317 | 230 |
fun Auto_tac st = auto_tac (clasimpset ()) st; |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
231 |
fun auto () = by Auto_tac; |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
232 |
|
9772 | 233 |
|
5219 | 234 |
(* force_tac *) |
235 |
||
4659 | 236 |
(* aimed to solve the given subgoal totally, using whatever tools possible *) |
4717
1370ad043564
renamed smart_tac to force_tac, slight improvement of force_tac
oheimb
parents:
4659
diff
changeset
|
237 |
fun force_tac (cs,ss) = let val cs' = cs addss ss in SELECT_GOAL (EVERY [ |
9772 | 238 |
Classical.clarify_tac cs' 1, |
239 |
IF_UNSOLVED (Simplifier.asm_full_simp_tac ss 1), |
|
240 |
ALLGOALS (Classical.first_best_tac cs')]) end; |
|
10317 | 241 |
fun Force_tac i = force_tac (clasimpset ()) i; |
4717
1370ad043564
renamed smart_tac to force_tac, slight improvement of force_tac
oheimb
parents:
4659
diff
changeset
|
242 |
fun force i = by (Force_tac i); |
4659 | 243 |
|
5219 | 244 |
|
9805 | 245 |
(* basic combinations *) |
246 |
||
247 |
fun ADDSS tac (cs, ss) = let val cs' = cs addss ss in tac cs' end; |
|
9591 | 248 |
|
9805 | 249 |
val fast_simp_tac = ADDSS Classical.fast_tac; |
250 |
val slow_simp_tac = ADDSS Classical.slow_tac; |
|
251 |
val best_simp_tac = ADDSS Classical.best_tac; |
|
9591 | 252 |
|
253 |
||
9860 | 254 |
(* access clasimpset *) |
8639 | 255 |
|
256 |
fun change_global_css f (thy, th) = |
|
257 |
let |
|
258 |
val cs_ref = Classical.claset_ref_of thy; |
|
259 |
val ss_ref = Simplifier.simpset_ref_of thy; |
|
260 |
val (cs', ss') = f ((! cs_ref, ! ss_ref), [th]); |
|
261 |
in cs_ref := cs'; ss_ref := ss'; (thy, th) end; |
|
262 |
||
263 |
fun change_local_css f (ctxt, th) = |
|
264 |
let |
|
265 |
val cs = Classical.get_local_claset ctxt; |
|
266 |
val ss = Simplifier.get_local_simpset ctxt; |
|
267 |
val (cs', ss') = f ((cs, ss), [th]); |
|
268 |
val ctxt' = |
|
269 |
ctxt |
|
270 |
|> Classical.put_local_claset cs' |
|
271 |
|> Simplifier.put_local_simpset ss'; |
|
272 |
in (ctxt', th) end; |
|
273 |
||
7153 | 274 |
fun get_local_clasimpset ctxt = |
275 |
(Classical.get_local_claset ctxt, Simplifier.get_local_simpset ctxt); |
|
5926 | 276 |
|
9860 | 277 |
|
278 |
(* attributes *) |
|
279 |
||
12375 | 280 |
fun change_rules f (x, th) = (f (x, [th]), th); |
281 |
||
9860 | 282 |
val iff_add_global = change_global_css (op addIffs); |
12375 | 283 |
val iff_add_global' = change_rules addIffs_global; |
284 |
val iff_del_global = change_global_css (op delIffs) o change_rules delIffs_global; |
|
9860 | 285 |
val iff_add_local = change_local_css (op addIffs); |
12375 | 286 |
val iff_add_local' = change_rules addIffs_local; |
287 |
val iff_del_local = change_local_css (op delIffs) o change_rules delIffs_local; |
|
9860 | 288 |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
289 |
fun iff_att add add' del = Attrib.syntax (Scan.lift |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
290 |
(Args.del >> K del || |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
291 |
Scan.option Args.add -- Args.query >> K add' || |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
292 |
Scan.option Args.add >> K add)); |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
293 |
|
9860 | 294 |
val iff_attr = |
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
295 |
(iff_att iff_add_global iff_add_global' iff_del_global, |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
296 |
iff_att iff_add_local iff_add_local' iff_del_local); |
9860 | 297 |
|
298 |
||
299 |
(* method modifiers *) |
|
300 |
||
301 |
val iffN = "iff"; |
|
302 |
||
303 |
val iff_modifiers = |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
304 |
[Args.$$$ iffN -- Scan.option Args.add -- Args.colon >> K ((I, iff_add_local): Method.modifier), |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
305 |
Args.$$$ iffN -- Scan.option Args.add -- Args.query_colon >> K (I, iff_add_local'), |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
306 |
Args.$$$ iffN -- Args.del -- Args.colon >> K (I, iff_del_local)]; |
9860 | 307 |
|
8469 | 308 |
val clasimp_modifiers = |
9860 | 309 |
Simplifier.simp_modifiers @ Splitter.split_modifiers @ |
310 |
Classical.cla_modifiers @ iff_modifiers; |
|
311 |
||
312 |
||
313 |
(* methods *) |
|
5926 | 314 |
|
7559 | 315 |
fun clasimp_meth tac prems ctxt = Method.METHOD (fn facts => |
316 |
ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (get_local_clasimpset ctxt)); |
|
7132 | 317 |
|
7559 | 318 |
fun clasimp_meth' tac prems ctxt = Method.METHOD (fn facts => |
8168 | 319 |
HEADGOAL (Method.insert_tac (prems @ facts) THEN' tac (get_local_clasimpset ctxt))); |
5926 | 320 |
|
7559 | 321 |
val clasimp_method = Method.bang_sectioned_args clasimp_modifiers o clasimp_meth; |
322 |
val clasimp_method' = Method.bang_sectioned_args clasimp_modifiers o clasimp_meth'; |
|
5926 | 323 |
|
324 |
||
9772 | 325 |
fun auto_args m = |
326 |
Method.bang_sectioned_args' clasimp_modifiers (Scan.lift (Scan.option (Args.nat -- Args.nat))) m; |
|
327 |
||
10821 | 328 |
fun auto_meth None = clasimp_meth (CHANGED_PROP o auto_tac) |
329 |
| auto_meth (Some (m, n)) = clasimp_meth (CHANGED_PROP o (fn css => mk_auto_tac css m n)); |
|
9772 | 330 |
|
331 |
||
332 |
(* theory setup *) |
|
333 |
||
5926 | 334 |
val setup = |
9860 | 335 |
[Attrib.add_attributes |
9893 | 336 |
[("iff", iff_attr, "declaration of Simplifier / Classical rules")], |
9860 | 337 |
Method.add_methods |
9591 | 338 |
[("fastsimp", clasimp_method' fast_simp_tac, "combined fast and simp"), |
9805 | 339 |
("slowsimp", clasimp_method' slow_simp_tac, "combined slow and simp"), |
340 |
("bestsimp", clasimp_method' best_simp_tac, "combined best and simp"), |
|
9591 | 341 |
("force", clasimp_method' force_tac, "force"), |
9772 | 342 |
("auto", auto_args auto_meth, "auto"), |
10821 | 343 |
("clarsimp", clasimp_method' (CHANGED_PROP oo clarsimp_tac), "clarify simplified goal")]]; |
5926 | 344 |
|
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
345 |
end; |