216 ["Nominal.perm pi1 (Nominal.perm pi2 t)"] perm_compose_simproc'; |
216 ["Nominal.perm pi1 (Nominal.perm pi2 t)"] perm_compose_simproc'; |
217 |
217 |
218 fun perm_compose_tac ctxt i = |
218 fun perm_compose_tac ctxt i = |
219 ("analysing permutation compositions on the lhs", |
219 ("analysing permutation compositions on the lhs", |
220 fn st => EVERY |
220 fn st => EVERY |
221 [rtac trans i, |
221 [resolve_tac ctxt [trans] i, |
222 asm_full_simp_tac (empty_simpset ctxt addsimprocs [perm_compose_simproc]) i, |
222 asm_full_simp_tac (empty_simpset ctxt addsimprocs [perm_compose_simproc]) i, |
223 asm_full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps [perm_aux_fold]) i] st); |
223 asm_full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps [perm_aux_fold]) i] st); |
224 |
224 |
225 fun apply_cong_tac ctxt i = ("application of congruence", cong_tac ctxt i); |
225 fun apply_cong_tac ctxt i = ("application of congruence", cong_tac ctxt i); |
226 |
226 |
228 (* unfolds the definition of permutations *) |
228 (* unfolds the definition of permutations *) |
229 (* applied to functions such that *) |
229 (* applied to functions such that *) |
230 (* pi o f = rhs *) |
230 (* pi o f = rhs *) |
231 (* is transformed to *) |
231 (* is transformed to *) |
232 (* %x. pi o (f ((rev pi) o x)) = rhs *) |
232 (* %x. pi o (f ((rev pi) o x)) = rhs *) |
233 fun unfold_perm_fun_def_tac i = |
233 fun unfold_perm_fun_def_tac ctxt i = |
234 ("unfolding of permutations on functions", |
234 ("unfolding of permutations on functions", |
235 rtac (perm_fun_def RS meta_eq_to_obj_eq RS trans) i) |
235 resolve_tac ctxt [perm_fun_def RS meta_eq_to_obj_eq RS trans] i) |
236 |
236 |
237 (* applies the ext-rule such that *) |
237 (* applies the ext-rule such that *) |
238 (* *) |
238 (* *) |
239 (* f = g goes to /\x. f x = g x *) |
239 (* f = g goes to /\x. f x = g x *) |
240 fun ext_fun_tac i = ("extensionality expansion of functions", rtac @{thm ext} i); |
240 fun ext_fun_tac ctxt i = |
|
241 ("extensionality expansion of functions", resolve_tac ctxt @{thms ext} i); |
241 |
242 |
242 |
243 |
243 (* perm_extend_simp_tac_i is perm_simp plus additional tactics *) |
244 (* perm_extend_simp_tac_i is perm_simp plus additional tactics *) |
244 (* to decide equation that come from support problems *) |
245 (* to decide equation that come from support problems *) |
245 (* since it contains looping rules the "recursion" - depth is set *) |
246 (* since it contains looping rules the "recursion" - depth is set *) |
246 (* to 10 - this seems to be sufficient in most cases *) |
247 (* to 10 - this seems to be sufficient in most cases *) |
247 fun perm_extend_simp_tac_i tactical ctxt = |
248 fun perm_extend_simp_tac_i tactical ctxt = |
248 let fun perm_extend_simp_tac_aux tactical ctxt n = |
249 let fun perm_extend_simp_tac_aux tactical ctxt n = |
249 if n=0 then K all_tac |
250 if n=0 then K all_tac |
250 else DETERM o |
251 else DETERM o |
251 (FIRST'[fn i => tactical ctxt ("splitting conjunctions on the rhs", rtac conjI i), |
252 (FIRST' |
252 fn i => tactical ctxt (perm_simp asm_full_simp_tac ctxt i), |
253 [fn i => tactical ctxt ("splitting conjunctions on the rhs", resolve_tac ctxt [conjI] i), |
253 fn i => tactical ctxt (perm_compose_tac ctxt i), |
254 fn i => tactical ctxt (perm_simp asm_full_simp_tac ctxt i), |
254 fn i => tactical ctxt (apply_cong_tac ctxt i), |
255 fn i => tactical ctxt (perm_compose_tac ctxt i), |
255 fn i => tactical ctxt (unfold_perm_fun_def_tac i), |
256 fn i => tactical ctxt (apply_cong_tac ctxt i), |
256 fn i => tactical ctxt (ext_fun_tac i)] |
257 fn i => tactical ctxt (unfold_perm_fun_def_tac ctxt i), |
257 THEN_ALL_NEW (TRY o (perm_extend_simp_tac_aux tactical ctxt (n-1)))) |
258 fn i => tactical ctxt (ext_fun_tac ctxt i)] |
|
259 THEN_ALL_NEW (TRY o (perm_extend_simp_tac_aux tactical ctxt (n-1)))) |
258 in perm_extend_simp_tac_aux tactical ctxt 10 end; |
260 in perm_extend_simp_tac_aux tactical ctxt 10 end; |
259 |
261 |
260 |
262 |
261 (* tactic that tries to solve "supports"-goals; first it *) |
263 (* tactic that tries to solve "supports"-goals; first it *) |
262 (* unfolds the support definition and strips off the *) |
264 (* unfolds the support definition and strips off the *) |
264 fun supports_tac_i tactical ctxt i = |
266 fun supports_tac_i tactical ctxt i = |
265 let |
267 let |
266 val simps = [supports_def, Thm.symmetric fresh_def, fresh_prod] |
268 val simps = [supports_def, Thm.symmetric fresh_def, fresh_prod] |
267 in |
269 in |
268 EVERY [tactical ctxt ("unfolding of supports ", simp_tac (put_simpset HOL_basic_ss ctxt addsimps simps) i), |
270 EVERY [tactical ctxt ("unfolding of supports ", simp_tac (put_simpset HOL_basic_ss ctxt addsimps simps) i), |
269 tactical ctxt ("stripping of foralls ", REPEAT_DETERM (rtac allI i)), |
271 tactical ctxt ("stripping of foralls ", REPEAT_DETERM (resolve_tac ctxt [allI] i)), |
270 tactical ctxt ("geting rid of the imps ", rtac impI i), |
272 tactical ctxt ("geting rid of the imps ", resolve_tac ctxt [impI] i), |
271 tactical ctxt ("eliminating conjuncts ", REPEAT_DETERM (etac conjE i)), |
273 tactical ctxt ("eliminating conjuncts ", REPEAT_DETERM (eresolve_tac ctxt [conjE] i)), |
272 tactical ctxt ("applying eqvt_simp ", eqvt_simp_tac_gen_i asm_full_simp_tac tactical ctxt i )] |
274 tactical ctxt ("applying eqvt_simp ", eqvt_simp_tac_gen_i asm_full_simp_tac tactical ctxt i)] |
273 end; |
275 end; |
274 |
276 |
275 |
277 |
276 (* tactic that guesses the finite-support of a goal *) |
278 (* tactic that guesses the finite-support of a goal *) |
277 (* it first collects all free variables and tries to show *) |
279 (* it first collects all free variables and tries to show *) |