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