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