author | oheimb |
Thu, 31 May 2001 16:52:02 +0200 | |
changeset 11344 | 57b7ad51971c |
parent 11181 | d04f57b91166 |
child 11462 | cf3e7f5ad0e1 |
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 |
8469 | 6 |
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
|
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 |
10 |
addSss 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 |
|
42 |
val addIffs: clasimpset * thm list -> clasimpset |
|
43 |
val delIffs: clasimpset * thm list -> clasimpset |
|
44 |
val AddIffs: thm list -> unit |
|
45 |
val DelIffs: thm list -> unit |
|
46 |
val CLASIMPSET: (clasimpset -> tactic) -> tactic |
|
47 |
val CLASIMPSET': (clasimpset -> 'a -> tactic) -> 'a -> tactic |
|
5483 | 48 |
val clarsimp_tac: clasimpset -> int -> tactic |
9860 | 49 |
val Clarsimp_tac: int -> tactic |
50 |
val mk_auto_tac: clasimpset -> int -> int -> tactic |
|
51 |
val auto_tac: clasimpset -> tactic |
|
52 |
val Auto_tac: tactic |
|
53 |
val auto: unit -> unit |
|
54 |
val force_tac: clasimpset -> int -> tactic |
|
55 |
val Force_tac: int -> tactic |
|
56 |
val force: int -> unit |
|
57 |
val fast_simp_tac: clasimpset -> int -> tactic |
|
58 |
val slow_simp_tac: clasimpset -> int -> tactic |
|
59 |
val best_simp_tac: clasimpset -> int -> tactic |
|
8639 | 60 |
val change_global_css: (clasimpset * thm list -> clasimpset) -> theory attribute |
61 |
val change_local_css: (clasimpset * thm list -> clasimpset) -> Proof.context attribute |
|
9506 | 62 |
val get_local_clasimpset: Proof.context -> clasimpset |
9860 | 63 |
val iff_add_global: theory attribute |
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
64 |
val iff_add_global': theory attribute |
9860 | 65 |
val iff_del_global: theory attribute |
66 |
val iff_add_local: Proof.context attribute |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
67 |
val iff_add_local': Proof.context attribute |
9860 | 68 |
val iff_del_local: Proof.context attribute |
69 |
val iff_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list |
|
9506 | 70 |
val clasimp_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list |
9860 | 71 |
val setup: (theory -> theory) list |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
72 |
end; |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
73 |
|
5219 | 74 |
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
|
75 |
struct |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
76 |
|
5219 | 77 |
open Data; |
78 |
||
79 |
type claset = Classical.claset; |
|
80 |
type simpset = Simplifier.simpset; |
|
81 |
type clasimpset = claset * simpset; |
|
82 |
||
10317 | 83 |
fun clasimpset () = (Classical.claset (), Simplifier.simpset ()); |
84 |
||
5219 | 85 |
|
86 |
(* clasimpset operations *) |
|
87 |
||
88 |
(*this interface for updating a clasimpset is rudimentary and just for |
|
89 |
convenience for the most common cases*) |
|
90 |
||
91 |
fun pair_upd1 f ((a,b),x) = (f(a,x), b); |
|
92 |
fun pair_upd2 f ((a,b),x) = (a, f(b,x)); |
|
93 |
||
94 |
fun op addSIs2 arg = pair_upd1 Classical.addSIs arg; |
|
95 |
fun op addSEs2 arg = pair_upd1 Classical.addSEs arg; |
|
96 |
fun op addSDs2 arg = pair_upd1 Classical.addSDs arg; |
|
97 |
fun op addIs2 arg = pair_upd1 Classical.addIs arg; |
|
98 |
fun op addEs2 arg = pair_upd1 Classical.addEs arg; |
|
99 |
fun op addDs2 arg = pair_upd1 Classical.addDs arg; |
|
100 |
fun op addsimps2 arg = pair_upd2 Simplifier.addsimps arg; |
|
101 |
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
|
102 |
|
9402 | 103 |
(*not totally safe: may instantiate unknowns that appear also in other subgoals*) |
104 |
val safe_asm_full_simp_tac = Simplifier.generic_simp_tac true (true,true,true); |
|
105 |
||
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
106 |
(*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
|
107 |
(*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
|
108 |
fun cs addSss ss = Classical.addSafter (cs, ("safe_asm_full_simp_tac", |
9772 | 109 |
CHANGED o safe_asm_full_simp_tac ss)); |
110 |
fun cs addss ss = Classical.addbefore (cs, ("asm_full_simp_tac", |
|
111 |
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
|
112 |
|
9860 | 113 |
|
114 |
(* iffs: addition of rules to simpsets and clasets simultaneously *) |
|
115 |
||
11344 | 116 |
(*Takes (possibly conditional) theorems of the form A<->B to |
9860 | 117 |
the Safe Intr rule B==>A and |
118 |
the Safe Destruct rule A==>B. |
|
119 |
Also ~A goes to the Safe Elim rule A ==> ?R |
|
11344 | 120 |
Failing other cases, A is added as a Safe Intr rule and a warning is issued *) |
9860 | 121 |
local |
122 |
||
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
123 |
fun addIff dest elim intro simp ((cs, ss), th) = |
11344 | 124 |
( dest (intro (cs, [zero_var_indexes (th RS Data.iffD2)]), |
125 |
[zero_var_indexes (th RS Data.iffD1)]) |
|
126 |
handle THM _ => (warning ("iff add: theorem is not an equivalence\n" |
|
127 |
^ Display.string_of_thm th); |
|
128 |
elim (cs, [zero_var_indexes (th RS Data.notE )]) |
|
129 |
handle THM _ => intro (cs, [th])), |
|
130 |
simp (ss, [th])); |
|
9860 | 131 |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
132 |
fun delIff ((cs, ss), th) = |
11344 | 133 |
( Classical.delrules (cs, [zero_var_indexes (th RS Data.iffD2), |
134 |
Data.cla_make_elim (zero_var_indexes (th RS Data.iffD1))]) |
|
135 |
handle THM _ => (warning ("iff del: theorem is not an equivalence\n" |
|
136 |
^ Display.string_of_thm th); |
|
137 |
Classical.delrules (cs, [zero_var_indexes (th RS Data.notE)]) |
|
138 |
handle THM _ => Classical.delrules (cs, [th])), |
|
139 |
Simplifier.delsimps (ss, [th])); |
|
9860 | 140 |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
141 |
fun store_clasimp (cs, ss) = |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
142 |
(Classical.claset_ref () := cs; Simplifier.simpset_ref () := ss); |
9860 | 143 |
|
144 |
in |
|
145 |
||
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
146 |
val op addIffs = |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
147 |
foldl (addIff Classical.addSDs Classical.addSEs Classical.addSIs Simplifier.addsimps); |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
148 |
val addIffs' = |
10036 | 149 |
foldl (addIff Classical.addXDs Classical.addXEs Classical.addXIs |
150 |
((fn (ss, _) => ss): Simplifier.simpset * thm list -> Simplifier.simpset)); |
|
9860 | 151 |
val op delIffs = foldl delIff; |
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
152 |
|
10317 | 153 |
fun AddIffs thms = store_clasimp (clasimpset () addIffs thms); |
154 |
fun DelIffs thms = store_clasimp (clasimpset () delIffs thms); |
|
9860 | 155 |
|
156 |
end; |
|
157 |
||
158 |
||
5219 | 159 |
(* tacticals *) |
160 |
||
161 |
fun CLASIMPSET tacf state = |
|
162 |
Classical.CLASET (fn cs => Simplifier.SIMPSET (fn ss => tacf (cs, ss))) state; |
|
163 |
||
164 |
fun CLASIMPSET' tacf i state = |
|
165 |
Classical.CLASET (fn cs => Simplifier.SIMPSET (fn ss => tacf (cs, ss) i)) state; |
|
4888 | 166 |
|
167 |
||
9402 | 168 |
fun clarsimp_tac (cs, ss) = safe_asm_full_simp_tac ss THEN_ALL_NEW |
9772 | 169 |
Classical.clarify_tac (cs addSss ss); |
10317 | 170 |
fun Clarsimp_tac i = clarsimp_tac (clasimpset ()) i; |
5483 | 171 |
|
172 |
||
5219 | 173 |
(* auto_tac *) |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
174 |
|
5219 | 175 |
fun blast_depth_tac cs m i thm = |
9772 | 176 |
Blast.depth_tac cs m i thm |
5554 | 177 |
handle Blast.TRANS s => (warning ("Blast_tac: " ^ s); Seq.empty); |
9772 | 178 |
|
179 |
(* a variant of depth_tac that avoids interference of the simplifier |
|
5219 | 180 |
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
|
181 |
local |
9772 | 182 |
fun slow_step_tac' cs = Classical.appWrappers cs |
183 |
(Classical.instp_step_tac cs APPEND' Classical.haz_step_tac cs); |
|
184 |
in fun nodup_depth_tac cs m i state = SELECT_GOAL |
|
185 |
(Classical.safe_steps_tac cs 1 THEN_ELSE |
|
186 |
(DEPTH_SOLVE (nodup_depth_tac cs m 1), |
|
187 |
Classical.inst0_step_tac cs 1 APPEND COND (K (m=0)) no_tac |
|
188 |
(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
|
189 |
)) i state; |
8ef5288c24b0
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5567
diff
changeset
|
190 |
end; |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
191 |
|
9402 | 192 |
(*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
|
193 |
in some of the subgoals*) |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
194 |
fun mk_auto_tac (cs, ss) m n = |
5219 | 195 |
let val cs' = cs addss ss |
9772 | 196 |
val maintac = |
197 |
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
|
198 |
ORELSE' |
5756
8ef5288c24b0
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5567
diff
changeset
|
199 |
(CHANGED o nodup_depth_tac cs' n); (* slower but more general *) |
5219 | 200 |
in EVERY [ALLGOALS (Simplifier.asm_full_simp_tac ss), |
9772 | 201 |
TRY (Classical.safe_tac cs), |
202 |
REPEAT (FIRSTGOAL maintac), |
|
5219 | 203 |
TRY (Classical.safe_tac (cs addSss ss)), |
9772 | 204 |
prune_params_tac] |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
205 |
end; |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
206 |
|
9772 | 207 |
fun auto_tac css = mk_auto_tac css 4 2; |
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
208 |
|
10317 | 209 |
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
|
210 |
|
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
211 |
fun auto () = by Auto_tac; |
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
212 |
|
9772 | 213 |
|
5219 | 214 |
(* force_tac *) |
215 |
||
4659 | 216 |
(* 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
|
217 |
fun force_tac (cs,ss) = let val cs' = cs addss ss in SELECT_GOAL (EVERY [ |
9772 | 218 |
Classical.clarify_tac cs' 1, |
219 |
IF_UNSOLVED (Simplifier.asm_full_simp_tac ss 1), |
|
220 |
ALLGOALS (Classical.first_best_tac cs')]) end; |
|
10317 | 221 |
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
|
222 |
fun force i = by (Force_tac i); |
4659 | 223 |
|
5219 | 224 |
|
9805 | 225 |
(* basic combinations *) |
226 |
||
227 |
fun ADDSS tac (cs, ss) = let val cs' = cs addss ss in tac cs' end; |
|
9591 | 228 |
|
9805 | 229 |
val fast_simp_tac = ADDSS Classical.fast_tac; |
230 |
val slow_simp_tac = ADDSS Classical.slow_tac; |
|
231 |
val best_simp_tac = ADDSS Classical.best_tac; |
|
9591 | 232 |
|
233 |
||
9860 | 234 |
(* access clasimpset *) |
8639 | 235 |
|
236 |
fun change_global_css f (thy, th) = |
|
237 |
let |
|
238 |
val cs_ref = Classical.claset_ref_of thy; |
|
239 |
val ss_ref = Simplifier.simpset_ref_of thy; |
|
240 |
val (cs', ss') = f ((! cs_ref, ! ss_ref), [th]); |
|
241 |
in cs_ref := cs'; ss_ref := ss'; (thy, th) end; |
|
242 |
||
243 |
fun change_local_css f (ctxt, th) = |
|
244 |
let |
|
245 |
val cs = Classical.get_local_claset ctxt; |
|
246 |
val ss = Simplifier.get_local_simpset ctxt; |
|
247 |
val (cs', ss') = f ((cs, ss), [th]); |
|
248 |
val ctxt' = |
|
249 |
ctxt |
|
250 |
|> Classical.put_local_claset cs' |
|
251 |
|> Simplifier.put_local_simpset ss'; |
|
252 |
in (ctxt', th) end; |
|
253 |
||
7153 | 254 |
fun get_local_clasimpset ctxt = |
255 |
(Classical.get_local_claset ctxt, Simplifier.get_local_simpset ctxt); |
|
5926 | 256 |
|
9860 | 257 |
|
258 |
(* attributes *) |
|
259 |
||
260 |
val iff_add_global = change_global_css (op addIffs); |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
261 |
val iff_add_global' = change_global_css (op addIffs'); |
9860 | 262 |
val iff_del_global = change_global_css (op delIffs); |
263 |
val iff_add_local = change_local_css (op addIffs); |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
264 |
val iff_add_local' = change_local_css (op addIffs'); |
9860 | 265 |
val iff_del_local = change_local_css (op delIffs); |
266 |
||
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
267 |
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
|
268 |
(Args.del >> K del || |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
269 |
Scan.option Args.add -- Args.query >> K add' || |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
270 |
Scan.option Args.add >> K add)); |
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
271 |
|
9860 | 272 |
val iff_attr = |
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
273 |
(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
|
274 |
iff_att iff_add_local iff_add_local' iff_del_local); |
9860 | 275 |
|
276 |
||
277 |
(* method modifiers *) |
|
278 |
||
279 |
val iffN = "iff"; |
|
280 |
||
281 |
val iff_modifiers = |
|
10033
fc4e7432b2b1
added iff_add_global', iff_add_local' (syntax "iff?");
wenzelm
parents:
9952
diff
changeset
|
282 |
[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
|
283 |
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
|
284 |
Args.$$$ iffN -- Args.del -- Args.colon >> K (I, iff_del_local)]; |
9860 | 285 |
|
8469 | 286 |
val clasimp_modifiers = |
9860 | 287 |
Simplifier.simp_modifiers @ Splitter.split_modifiers @ |
288 |
Classical.cla_modifiers @ iff_modifiers; |
|
289 |
||
290 |
||
291 |
(* methods *) |
|
5926 | 292 |
|
7559 | 293 |
fun clasimp_meth tac prems ctxt = Method.METHOD (fn facts => |
294 |
ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (get_local_clasimpset ctxt)); |
|
7132 | 295 |
|
7559 | 296 |
fun clasimp_meth' tac prems ctxt = Method.METHOD (fn facts => |
8168 | 297 |
HEADGOAL (Method.insert_tac (prems @ facts) THEN' tac (get_local_clasimpset ctxt))); |
5926 | 298 |
|
7559 | 299 |
val clasimp_method = Method.bang_sectioned_args clasimp_modifiers o clasimp_meth; |
300 |
val clasimp_method' = Method.bang_sectioned_args clasimp_modifiers o clasimp_meth'; |
|
5926 | 301 |
|
302 |
||
9772 | 303 |
fun auto_args m = |
304 |
Method.bang_sectioned_args' clasimp_modifiers (Scan.lift (Scan.option (Args.nat -- Args.nat))) m; |
|
305 |
||
10821 | 306 |
fun auto_meth None = clasimp_meth (CHANGED_PROP o auto_tac) |
307 |
| auto_meth (Some (m, n)) = clasimp_meth (CHANGED_PROP o (fn css => mk_auto_tac css m n)); |
|
9772 | 308 |
|
309 |
||
310 |
(* theory setup *) |
|
311 |
||
5926 | 312 |
val setup = |
9860 | 313 |
[Attrib.add_attributes |
9893 | 314 |
[("iff", iff_attr, "declaration of Simplifier / Classical rules")], |
9860 | 315 |
Method.add_methods |
9591 | 316 |
[("fastsimp", clasimp_method' fast_simp_tac, "combined fast and simp"), |
9805 | 317 |
("slowsimp", clasimp_method' slow_simp_tac, "combined slow and simp"), |
318 |
("bestsimp", clasimp_method' best_simp_tac, "combined best and simp"), |
|
9591 | 319 |
("force", clasimp_method' force_tac, "force"), |
9772 | 320 |
("auto", auto_args auto_meth, "auto"), |
10821 | 321 |
("clarsimp", clasimp_method' (CHANGED_PROP oo clarsimp_tac), "clarify simplified goal")]]; |
5926 | 322 |
|
4652
d24cca140eeb
factored out common code of HOL/simpdata.ML and FOL/simpdata.ML concerning
oheimb
parents:
diff
changeset
|
323 |
end; |