author | Christian Urban <urbanc@in.tum.de> |
Wed, 23 Jun 2010 15:21:04 +0100 | |
changeset 2329 | df3a952c6a67 |
parent 2324 | 9038c9549073 |
permissions | -rw-r--r-- |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1 |
theory Equivp |
2296 | 2 |
imports "Abs" "Perm" "Tacs" "Rsp" |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
4 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
5 |
lemma not_in_union: "c \<notin> a \<union> b \<equiv> (c \<notin> a \<and> c \<notin> b)" |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
6 |
by auto |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
7 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
8 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
9 |
fun supports_tac perm = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
10 |
simp_tac (HOL_ss addsimps @{thms supports_def not_in_union} @ perm) THEN_ALL_NEW ( |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
11 |
REPEAT o rtac allI THEN' REPEAT o rtac impI THEN' split_conj_tac THEN' |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
12 |
asm_full_simp_tac (HOL_ss addsimps @{thms fresh_def[symmetric] |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
13 |
swap_fresh_fresh fresh_atom swap_at_base_simps(3) swap_atom_image_fresh |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
14 |
supp_fset_to_set supp_fmap_atom})) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
15 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
16 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
18 |
fun mk_supp ty x = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
19 |
Const (@{const_name supp}, ty --> @{typ "atom set"}) $ x |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
20 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
21 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
22 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
23 |
fun mk_supports_eq thy cnstr = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
24 |
let |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
25 |
val (tys, ty) = (strip_type o fastype_of) cnstr |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
26 |
val names = Datatype_Prop.make_tnames tys |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
27 |
val frees = map Free (names ~~ tys) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
28 |
val rhs = list_comb (cnstr, frees) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
29 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
30 |
fun mk_supp_arg (x, ty) = |
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
1898
diff
changeset
|
31 |
if is_atom thy ty then mk_supp @{typ atom} (mk_atom_ty ty x) else |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
32 |
if is_atom_set thy ty then mk_supp @{typ "atom set"} (mk_atom_set x) else |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
33 |
if is_atom_fset thy ty then mk_supp @{typ "atom set"} (mk_atom_fset x) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
34 |
else mk_supp ty x |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
35 |
val lhss = map mk_supp_arg (frees ~~ tys) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
36 |
val supports = Const(@{const_name "supports"}, @{typ "atom set"} --> ty --> @{typ bool}) |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
2108
diff
changeset
|
37 |
val eq = HOLogic.mk_Trueprop (supports $ fold_union lhss $ rhs) |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
38 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
39 |
(names, eq) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
40 |
end |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
41 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
42 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
43 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
44 |
fun prove_supports ctxt perms cnst = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
45 |
let |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
2108
diff
changeset
|
46 |
val (names, eq) = mk_supports_eq ctxt cnst |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
47 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
48 |
Goal.prove ctxt names [] eq (fn _ => supports_tac perms 1) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
49 |
end |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
50 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
51 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
52 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
53 |
fun mk_fs tys = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
54 |
let |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
55 |
val names = Datatype_Prop.make_tnames tys |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
56 |
val frees = map Free (names ~~ tys) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
57 |
val supps = map2 mk_supp tys frees |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
58 |
val fin_supps = map (fn x => @{term "finite :: atom set \<Rightarrow> bool"} $ x) supps |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
59 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
60 |
(names, HOLogic.mk_Trueprop (mk_conjl fin_supps)) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
61 |
end |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
62 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
63 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
64 |
ML {* |
2108
c5b7be27f105
Use raw_induct instead of induct
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2070
diff
changeset
|
65 |
fun fs_tac induct supports = rtac induct THEN_ALL_NEW ( |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
66 |
rtac @{thm supports_finite} THEN' resolve_tac supports) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
67 |
asm_full_simp_tac (HOL_ss addsimps @{thms supp_atom supp_atom_image supp_fset_to_set |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
68 |
supp_fmap_atom finite_insert finite.emptyI finite_Un finite_supp}) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
69 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
70 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
71 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
72 |
fun prove_fs ctxt induct supports tys = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
73 |
let |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
74 |
val (names, eq) = mk_fs tys |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
75 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
76 |
Goal.prove ctxt names [] eq (fn _ => fs_tac induct supports 1) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
77 |
end |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
78 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
79 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
80 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
81 |
fun mk_supp x = Const (@{const_name supp}, fastype_of x --> @{typ "atom set"}) $ x; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
82 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
83 |
fun mk_supp_neq arg (fv, alpha) = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
84 |
let |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
85 |
val collect = Const ("Collect", @{typ "(atom \<Rightarrow> bool) \<Rightarrow> atom \<Rightarrow> bool"}); |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
86 |
val ty = fastype_of arg; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
87 |
val perm = Const ("Nominal2_Base.pt_class.permute", @{typ perm} --> ty --> ty); |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
88 |
val finite = @{term "finite :: atom set \<Rightarrow> bool"} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
89 |
val rhs = collect $ Abs ("a", @{typ atom}, |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
90 |
HOLogic.mk_not (finite $ |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
91 |
(collect $ Abs ("b", @{typ atom}, |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
92 |
HOLogic.mk_not (alpha $ (perm $ (@{term swap} $ Bound 1 $ Bound 0) $ arg) $ arg))))) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
93 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
94 |
HOLogic.mk_eq (fv $ arg, rhs) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
95 |
end; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
96 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
97 |
fun supp_eq fv_alphas_lst = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
98 |
let |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
99 |
val (fvs_alphas, ls) = split_list fv_alphas_lst; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
100 |
val (fv_ts, _) = split_list fvs_alphas; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
101 |
val tys = map (domain_type o fastype_of) fv_ts; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
102 |
val names = Datatype_Prop.make_tnames tys; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
103 |
val args = map Free (names ~~ tys); |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
104 |
fun supp_eq_arg ((fv, arg), l) = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
105 |
mk_conjl |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
106 |
((HOLogic.mk_eq (fv $ arg, mk_supp arg)) :: |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
107 |
(map (mk_supp_neq arg) l)) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
108 |
val eqs = mk_conjl (map supp_eq_arg ((fv_ts ~~ args) ~~ ls)) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
109 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
110 |
(names, HOLogic.mk_Trueprop eqs) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
111 |
end |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
112 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
113 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
114 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
115 |
fun combine_fv_alpha_bns (fv_ts_nobn, fv_ts_bn) (alpha_ts_nobn, alpha_ts_bn) bn_nos = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
116 |
if length fv_ts_bn < length alpha_ts_bn then |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
117 |
(fv_ts_nobn ~~ alpha_ts_nobn) ~~ (replicate (length fv_ts_nobn) []) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
118 |
else let |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
119 |
val fv_alpha_nos = 0 upto (length fv_ts_nobn - 1); |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
120 |
fun filter_fn i (x, j) = if j = i then SOME x else NONE; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
121 |
val fv_alpha_bn_nos = (fv_ts_bn ~~ alpha_ts_bn) ~~ bn_nos; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
122 |
val fv_alpha_bn_all = map (fn i => map_filter (filter_fn i) fv_alpha_bn_nos) fv_alpha_nos; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
123 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
124 |
(fv_ts_nobn ~~ alpha_ts_nobn) ~~ fv_alpha_bn_all |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
125 |
end |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
126 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
127 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
128 |
(* TODO: this is a hack, it assumes that only one type of Abs's is present |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
129 |
in the type and chooses this supp_abs. Additionally single atoms are |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
130 |
treated properly. *) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
131 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
132 |
fun choose_alpha_abs eqiff = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
133 |
let |
2070
ff69913e2608
prod_rel.simps and Fixed for new isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2019
diff
changeset
|
134 |
fun exists_subterms f ts = member (op =) (map (exists_subterm f) ts) true; |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
135 |
val terms = map prop_of eqiff; |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
136 |
fun check cname = exists_subterms (fn x => fst(dest_Const x) = cname handle _ => false) terms |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
137 |
val no = |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
138 |
if check @{const_name alpha_lst} then 2 else |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
139 |
if check @{const_name alpha_res} then 1 else |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
140 |
if check @{const_name alpha_gen} then 0 else |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
141 |
error "Failure choosing supp_abs" |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
142 |
in |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
143 |
nth @{thms supp_abs[symmetric]} no |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
144 |
end |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
145 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
146 |
lemma supp_abs_atom: "supp (Abs {atom a} (x :: 'a :: fs)) = supp x - {atom a}" |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
147 |
by (rule supp_abs(1)) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
148 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
149 |
lemma supp_abs_sum: |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
150 |
"supp (Abs x (a :: 'a :: fs)) \<union> supp (Abs x (b :: 'b :: fs)) = supp (Abs x (a, b))" |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
151 |
"supp (Abs_res x (a :: 'a :: fs)) \<union> supp (Abs_res x (b :: 'b :: fs)) = supp (Abs_res x (a, b))" |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
152 |
"supp (Abs_lst y (a :: 'a :: fs)) \<union> supp (Abs_lst y (b :: 'b :: fs)) = supp (Abs_lst y (a, b))" |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
153 |
apply (simp_all add: supp_abs supp_Pair) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
154 |
apply blast+ |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
155 |
done |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
156 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
157 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
158 |
ML {* |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
159 |
fun supp_eq_tac ind fv perm eqiff ctxt = |
2108
c5b7be27f105
Use raw_induct instead of induct
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2070
diff
changeset
|
160 |
rtac ind THEN_ALL_NEW |
1830
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
161 |
asm_full_simp_tac (HOL_basic_ss addsimps fv) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
162 |
asm_full_simp_tac (HOL_basic_ss addsimps @{thms supp_abs_atom[symmetric]}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
163 |
asm_full_simp_tac (HOL_basic_ss addsimps [choose_alpha_abs eqiff]) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
164 |
simp_tac (HOL_basic_ss addsimps @{thms supp_abs_sum}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
165 |
simp_tac (HOL_basic_ss addsimps @{thms supp_def}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
166 |
simp_tac (HOL_basic_ss addsimps (@{thms permute_abs} @ perm)) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
167 |
simp_tac (HOL_basic_ss addsimps (@{thms Abs_eq_iff} @ eqiff)) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
168 |
simp_tac (HOL_basic_ss addsimps @{thms alphas3 alphas2}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
169 |
simp_tac (HOL_basic_ss addsimps @{thms alphas}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
170 |
asm_full_simp_tac (HOL_basic_ss addsimps (@{thm supp_Pair} :: sym_eqvts ctxt)) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
171 |
asm_full_simp_tac (HOL_basic_ss addsimps (@{thm Pair_eq} :: all_eqvts ctxt)) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
172 |
simp_tac (HOL_basic_ss addsimps @{thms supp_at_base[symmetric,simplified supp_def]}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
173 |
simp_tac (HOL_basic_ss addsimps @{thms Collect_disj_eq[symmetric]}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
174 |
simp_tac (HOL_basic_ss addsimps @{thms infinite_Un[symmetric]}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
175 |
simp_tac (HOL_basic_ss addsimps @{thms Collect_disj_eq[symmetric]}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
176 |
simp_tac (HOL_basic_ss addsimps @{thms de_Morgan_conj[symmetric]}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
177 |
simp_tac (HOL_basic_ss addsimps @{thms ex_simps(1,2)[symmetric]}) THEN_ALL_NEW |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
178 |
simp_tac (HOL_ss addsimps @{thms Collect_const finite.emptyI}) |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
179 |
*} |
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
180 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
181 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
182 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
183 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
184 |
|
8db45a106569
Initial cleaning/reorganization in Fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
185 |
end |