1062
|
1 |
(* Title: Nominal2_Supp
|
|
2 |
Authors: Brian Huffman, Christian Urban
|
|
3 |
|
|
4 |
Supplementary Lemmas and Definitions for
|
|
5 |
Nominal Isabelle.
|
|
6 |
*)
|
|
7 |
theory Nominal2_Supp
|
|
8 |
imports Nominal2_Base Nominal2_Eqvt Nominal2_Atoms
|
|
9 |
begin
|
|
10 |
|
|
11 |
|
|
12 |
section {* Fresh-Star *}
|
|
13 |
|
|
14 |
text {* The fresh-star generalisation of fresh is used in strong
|
|
15 |
induction principles. *}
|
|
16 |
|
|
17 |
definition
|
|
18 |
fresh_star :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp>* _" [80,80] 80)
|
|
19 |
where
|
1506
|
20 |
"as \<sharp>* x \<equiv> \<forall>a \<in> as. a \<sharp> x"
|
1062
|
21 |
|
|
22 |
lemma fresh_star_prod:
|
1506
|
23 |
fixes as::"atom set"
|
|
24 |
shows "as \<sharp>* (x, y) = (as \<sharp>* x \<and> as \<sharp>* y)"
|
1062
|
25 |
by (auto simp add: fresh_star_def fresh_Pair)
|
|
26 |
|
|
27 |
lemma fresh_star_union:
|
1506
|
28 |
shows "(as \<union> bs) \<sharp>* x = (as \<sharp>* x \<and> bs \<sharp>* x)"
|
1062
|
29 |
by (auto simp add: fresh_star_def)
|
|
30 |
|
|
31 |
lemma fresh_star_insert:
|
1506
|
32 |
shows "(insert a as) \<sharp>* x = (a \<sharp> x \<and> as \<sharp>* x)"
|
1062
|
33 |
by (auto simp add: fresh_star_def)
|
|
34 |
|
|
35 |
lemma fresh_star_Un_elim:
|
1506
|
36 |
"((as \<union> bs) \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (as \<sharp>* x \<Longrightarrow> bs \<sharp>* x \<Longrightarrow> PROP C)"
|
1062
|
37 |
unfolding fresh_star_def
|
|
38 |
apply(rule)
|
|
39 |
apply(erule meta_mp)
|
|
40 |
apply(auto)
|
|
41 |
done
|
|
42 |
|
|
43 |
lemma fresh_star_insert_elim:
|
1506
|
44 |
"(insert a as \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> as \<sharp>* x \<Longrightarrow> PROP C)"
|
1062
|
45 |
unfolding fresh_star_def
|
|
46 |
by rule (simp_all add: fresh_star_def)
|
|
47 |
|
|
48 |
lemma fresh_star_empty_elim:
|
1506
|
49 |
"({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
|
1062
|
50 |
by (simp add: fresh_star_def)
|
|
51 |
|
|
52 |
lemma fresh_star_unit_elim:
|
|
53 |
shows "(a \<sharp>* () \<Longrightarrow> PROP C) \<equiv> PROP C"
|
|
54 |
by (simp add: fresh_star_def fresh_unit)
|
|
55 |
|
|
56 |
lemma fresh_star_prod_elim:
|
|
57 |
shows "(a \<sharp>* (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp>* x \<Longrightarrow> a \<sharp>* y \<Longrightarrow> PROP C)"
|
|
58 |
by (rule, simp_all add: fresh_star_prod)
|
|
59 |
|
1436
|
60 |
lemma fresh_star_plus:
|
|
61 |
fixes p q::perm
|
|
62 |
shows "\<lbrakk>a \<sharp>* p; a \<sharp>* q\<rbrakk> \<Longrightarrow> a \<sharp>* (p + q)"
|
|
63 |
unfolding fresh_star_def
|
|
64 |
by (simp add: fresh_plus_perm)
|
|
65 |
|
|
66 |
lemma fresh_star_permute_iff:
|
|
67 |
shows "(p \<bullet> a) \<sharp>* (p \<bullet> x) \<longleftrightarrow> a \<sharp>* x"
|
|
68 |
unfolding fresh_star_def
|
|
69 |
by (metis mem_permute_iff permute_minus_cancel fresh_permute_iff)
|
|
70 |
|
1861
|
71 |
lemma fresh_star_eqvt[eqvt]:
|
1436
|
72 |
shows "(p \<bullet> (as \<sharp>* x)) = (p \<bullet> as) \<sharp>* (p \<bullet> x)"
|
|
73 |
unfolding fresh_star_def
|
|
74 |
unfolding Ball_def
|
|
75 |
apply(simp add: all_eqvt)
|
|
76 |
apply(subst permute_fun_def)
|
|
77 |
apply(simp add: imp_eqvt fresh_eqvt mem_eqvt)
|
|
78 |
done
|
1062
|
79 |
|
|
80 |
section {* Avoiding of atom sets *}
|
|
81 |
|
|
82 |
text {*
|
|
83 |
For every set of atoms, there is another set of atoms
|
|
84 |
avoiding a finitely supported c and there is a permutation
|
|
85 |
which 'translates' between both sets.
|
|
86 |
*}
|
|
87 |
|
|
88 |
lemma at_set_avoiding_aux:
|
|
89 |
fixes Xs::"atom set"
|
|
90 |
and As::"atom set"
|
|
91 |
assumes b: "Xs \<subseteq> As"
|
|
92 |
and c: "finite As"
|
|
93 |
shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
|
|
94 |
proof -
|
|
95 |
from b c have "finite Xs" by (rule finite_subset)
|
|
96 |
then show ?thesis using b
|
|
97 |
proof (induct rule: finite_subset_induct)
|
|
98 |
case empty
|
|
99 |
have "0 \<bullet> {} \<inter> As = {}" by simp
|
|
100 |
moreover
|
|
101 |
have "supp (0::perm) \<subseteq> {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
|
|
102 |
ultimately show ?case by blast
|
|
103 |
next
|
|
104 |
case (insert x Xs)
|
|
105 |
then obtain p where
|
|
106 |
p1: "(p \<bullet> Xs) \<inter> As = {}" and
|
|
107 |
p2: "supp p \<subseteq> (Xs \<union> (p \<bullet> Xs))" by blast
|
|
108 |
from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
|
|
109 |
with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
|
|
110 |
hence px: "p \<bullet> x = x" unfolding supp_perm by simp
|
|
111 |
have "finite (As \<union> p \<bullet> Xs)"
|
|
112 |
using `finite As` `finite Xs`
|
|
113 |
by (simp add: permute_set_eq_image)
|
|
114 |
then obtain y where "y \<notin> (As \<union> p \<bullet> Xs)" "sort_of y = sort_of x"
|
|
115 |
by (rule obtain_atom)
|
|
116 |
hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "sort_of y = sort_of x"
|
|
117 |
by simp_all
|
|
118 |
let ?q = "(x \<rightleftharpoons> y) + p"
|
|
119 |
have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
|
|
120 |
unfolding insert_eqvt
|
|
121 |
using `p \<bullet> x = x` `sort_of y = sort_of x`
|
|
122 |
using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
|
|
123 |
by (simp add: swap_atom swap_set_not_in)
|
|
124 |
have "?q \<bullet> insert x Xs \<inter> As = {}"
|
|
125 |
using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
|
|
126 |
unfolding q by simp
|
|
127 |
moreover
|
|
128 |
have "supp ?q \<subseteq> insert x Xs \<union> ?q \<bullet> insert x Xs"
|
|
129 |
using p2 unfolding q
|
|
130 |
apply (intro subset_trans [OF supp_plus_perm])
|
|
131 |
apply (auto simp add: supp_swap)
|
|
132 |
done
|
|
133 |
ultimately show ?case by blast
|
|
134 |
qed
|
|
135 |
qed
|
|
136 |
|
|
137 |
lemma at_set_avoiding:
|
|
138 |
assumes a: "finite Xs"
|
|
139 |
and b: "finite (supp c)"
|
|
140 |
obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
|
|
141 |
using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
|
|
142 |
unfolding fresh_star_def fresh_def by blast
|
|
143 |
|
1879
|
144 |
lemma at_set_avoiding2:
|
|
145 |
assumes "finite xs"
|
|
146 |
and "finite (supp c)" "finite (supp x)"
|
|
147 |
and "xs \<sharp>* x"
|
|
148 |
shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p"
|
|
149 |
using assms
|
|
150 |
apply(erule_tac c="(c, x)" in at_set_avoiding)
|
|
151 |
apply(simp add: supp_Pair)
|
|
152 |
apply(rule_tac x="p" in exI)
|
|
153 |
apply(simp add: fresh_star_prod)
|
|
154 |
apply(subgoal_tac "\<forall>a \<in> supp p. a \<sharp> x")
|
|
155 |
apply(auto simp add: fresh_star_def fresh_def supp_perm)[1]
|
|
156 |
apply(auto simp add: fresh_star_def fresh_def)
|
|
157 |
done
|
|
158 |
|
|
159 |
lemma at_set_avoiding2_atom:
|
|
160 |
assumes "finite (supp c)" "finite (supp x)"
|
|
161 |
and b: "xa \<sharp> x"
|
|
162 |
shows "\<exists>p. (p \<bullet> xa) \<sharp> c \<and> supp x \<sharp>* p"
|
|
163 |
proof -
|
|
164 |
have a: "{xa} \<sharp>* x" unfolding fresh_star_def by (simp add: b)
|
|
165 |
obtain p where p1: "(p \<bullet> {xa}) \<sharp>* c" and p2: "supp x \<sharp>* p"
|
|
166 |
using at_set_avoiding2[of "{xa}" "c" "x"] assms a by blast
|
|
167 |
have c: "(p \<bullet> xa) \<sharp> c" using p1
|
|
168 |
unfolding fresh_star_def Ball_def
|
|
169 |
by (erule_tac x="p \<bullet> xa" in allE) (simp add: eqvts)
|
|
170 |
hence "p \<bullet> xa \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
|
|
171 |
then show ?thesis by blast
|
|
172 |
qed
|
1062
|
173 |
|
|
174 |
section {* The freshness lemma according to Andrew Pitts *}
|
|
175 |
|
|
176 |
lemma freshness_lemma:
|
|
177 |
fixes h :: "'a::at \<Rightarrow> 'b::pt"
|
|
178 |
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
|
|
179 |
shows "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
|
|
180 |
proof -
|
|
181 |
from a obtain b where a1: "atom b \<sharp> h" and a2: "atom b \<sharp> h b"
|
|
182 |
by (auto simp add: fresh_Pair)
|
|
183 |
show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
|
|
184 |
proof (intro exI allI impI)
|
|
185 |
fix a :: 'a
|
|
186 |
assume a3: "atom a \<sharp> h"
|
|
187 |
show "h a = h b"
|
|
188 |
proof (cases "a = b")
|
|
189 |
assume "a = b"
|
|
190 |
thus "h a = h b" by simp
|
|
191 |
next
|
|
192 |
assume "a \<noteq> b"
|
1080
|
193 |
hence "atom a \<sharp> b" by (simp add: fresh_at_base)
|
1879
|
194 |
with a3 have "atom a \<sharp> h b"
|
|
195 |
by (rule fresh_fun_app)
|
1062
|
196 |
with a2 have d1: "(atom b \<rightleftharpoons> atom a) \<bullet> (h b) = (h b)"
|
|
197 |
by (rule swap_fresh_fresh)
|
|
198 |
from a1 a3 have d2: "(atom b \<rightleftharpoons> atom a) \<bullet> h = h"
|
|
199 |
by (rule swap_fresh_fresh)
|
|
200 |
from d1 have "h b = (atom b \<rightleftharpoons> atom a) \<bullet> (h b)" by simp
|
|
201 |
also have "\<dots> = ((atom b \<rightleftharpoons> atom a) \<bullet> h) ((atom b \<rightleftharpoons> atom a) \<bullet> b)"
|
|
202 |
by (rule permute_fun_app_eq)
|
|
203 |
also have "\<dots> = h a"
|
|
204 |
using d2 by simp
|
|
205 |
finally show "h a = h b" by simp
|
|
206 |
qed
|
|
207 |
qed
|
|
208 |
qed
|
|
209 |
|
|
210 |
lemma freshness_lemma_unique:
|
|
211 |
fixes h :: "'a::at \<Rightarrow> 'b::pt"
|
|
212 |
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
|
|
213 |
shows "\<exists>!x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
|
|
214 |
proof (rule ex_ex1I)
|
|
215 |
from a show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
|
|
216 |
by (rule freshness_lemma)
|
|
217 |
next
|
|
218 |
fix x y
|
|
219 |
assume x: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
|
|
220 |
assume y: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = y"
|
|
221 |
from a x y show "x = y"
|
|
222 |
by (auto simp add: fresh_Pair)
|
|
223 |
qed
|
|
224 |
|
|
225 |
text {* packaging the freshness lemma into a function *}
|
|
226 |
|
|
227 |
definition
|
|
228 |
fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
|
|
229 |
where
|
|
230 |
"fresh_fun h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
|
|
231 |
|
|
232 |
lemma fresh_fun_app:
|
|
233 |
fixes h :: "'a::at \<Rightarrow> 'b::pt"
|
|
234 |
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
|
|
235 |
assumes b: "atom a \<sharp> h"
|
|
236 |
shows "fresh_fun h = h a"
|
|
237 |
unfolding fresh_fun_def
|
|
238 |
proof (rule the_equality)
|
|
239 |
show "\<forall>a'. atom a' \<sharp> h \<longrightarrow> h a' = h a"
|
|
240 |
proof (intro strip)
|
|
241 |
fix a':: 'a
|
|
242 |
assume c: "atom a' \<sharp> h"
|
|
243 |
from a have "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x" by (rule freshness_lemma)
|
|
244 |
with b c show "h a' = h a" by auto
|
|
245 |
qed
|
|
246 |
next
|
|
247 |
fix fr :: 'b
|
|
248 |
assume "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = fr"
|
|
249 |
with b show "fr = h a" by auto
|
|
250 |
qed
|
|
251 |
|
|
252 |
lemma fresh_fun_app':
|
|
253 |
fixes h :: "'a::at \<Rightarrow> 'b::pt"
|
|
254 |
assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
|
|
255 |
shows "fresh_fun h = h a"
|
|
256 |
apply (rule fresh_fun_app)
|
|
257 |
apply (auto simp add: fresh_Pair intro: a)
|
|
258 |
done
|
|
259 |
|
|
260 |
lemma fresh_fun_eqvt:
|
|
261 |
fixes h :: "'a::at \<Rightarrow> 'b::pt"
|
|
262 |
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
|
|
263 |
shows "p \<bullet> (fresh_fun h) = fresh_fun (p \<bullet> h)"
|
|
264 |
using a
|
|
265 |
apply (clarsimp simp add: fresh_Pair)
|
|
266 |
apply (subst fresh_fun_app', assumption+)
|
|
267 |
apply (drule fresh_permute_iff [where p=p, THEN iffD2])
|
|
268 |
apply (drule fresh_permute_iff [where p=p, THEN iffD2])
|
|
269 |
apply (simp add: atom_eqvt permute_fun_app_eq [where f=h])
|
|
270 |
apply (erule (1) fresh_fun_app' [symmetric])
|
|
271 |
done
|
|
272 |
|
|
273 |
lemma fresh_fun_supports:
|
|
274 |
fixes h :: "'a::at \<Rightarrow> 'b::pt"
|
|
275 |
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
|
|
276 |
shows "(supp h) supports (fresh_fun h)"
|
|
277 |
apply (simp add: supports_def fresh_def [symmetric])
|
|
278 |
apply (simp add: fresh_fun_eqvt [OF a] swap_fresh_fresh)
|
|
279 |
done
|
|
280 |
|
|
281 |
notation fresh_fun (binder "FRESH " 10)
|
|
282 |
|
|
283 |
lemma FRESH_f_iff:
|
|
284 |
fixes P :: "'a::at \<Rightarrow> 'b::pure"
|
|
285 |
fixes f :: "'b \<Rightarrow> 'c::pure"
|
|
286 |
assumes P: "finite (supp P)"
|
|
287 |
shows "(FRESH x. f (P x)) = f (FRESH x. P x)"
|
|
288 |
proof -
|
|
289 |
obtain a::'a where "atom a \<notin> supp P"
|
|
290 |
using P by (rule obtain_at_base)
|
|
291 |
hence "atom a \<sharp> P"
|
|
292 |
by (simp add: fresh_def)
|
|
293 |
show "(FRESH x. f (P x)) = f (FRESH x. P x)"
|
|
294 |
apply (subst fresh_fun_app' [where a=a, OF _ pure_fresh])
|
|
295 |
apply (cut_tac `atom a \<sharp> P`)
|
|
296 |
apply (simp add: fresh_conv_MOST)
|
|
297 |
apply (elim MOST_rev_mp, rule MOST_I, clarify)
|
|
298 |
apply (simp add: permute_fun_def permute_pure expand_fun_eq)
|
|
299 |
apply (subst fresh_fun_app' [where a=a, OF `atom a \<sharp> P` pure_fresh])
|
|
300 |
apply (rule refl)
|
|
301 |
done
|
|
302 |
qed
|
|
303 |
|
|
304 |
lemma FRESH_binop_iff:
|
|
305 |
fixes P :: "'a::at \<Rightarrow> 'b::pure"
|
|
306 |
fixes Q :: "'a::at \<Rightarrow> 'c::pure"
|
|
307 |
fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
|
|
308 |
assumes P: "finite (supp P)"
|
|
309 |
and Q: "finite (supp Q)"
|
|
310 |
shows "(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)"
|
|
311 |
proof -
|
|
312 |
from assms have "finite (supp P \<union> supp Q)" by simp
|
|
313 |
then obtain a::'a where "atom a \<notin> (supp P \<union> supp Q)"
|
|
314 |
by (rule obtain_at_base)
|
|
315 |
hence "atom a \<sharp> P" and "atom a \<sharp> Q"
|
|
316 |
by (simp_all add: fresh_def)
|
|
317 |
show ?thesis
|
|
318 |
apply (subst fresh_fun_app' [where a=a, OF _ pure_fresh])
|
|
319 |
apply (cut_tac `atom a \<sharp> P` `atom a \<sharp> Q`)
|
|
320 |
apply (simp add: fresh_conv_MOST)
|
|
321 |
apply (elim MOST_rev_mp, rule MOST_I, clarify)
|
|
322 |
apply (simp add: permute_fun_def permute_pure expand_fun_eq)
|
|
323 |
apply (subst fresh_fun_app' [where a=a, OF `atom a \<sharp> P` pure_fresh])
|
|
324 |
apply (subst fresh_fun_app' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
|
|
325 |
apply (rule refl)
|
|
326 |
done
|
|
327 |
qed
|
|
328 |
|
|
329 |
lemma FRESH_conj_iff:
|
|
330 |
fixes P Q :: "'a::at \<Rightarrow> bool"
|
|
331 |
assumes P: "finite (supp P)" and Q: "finite (supp Q)"
|
|
332 |
shows "(FRESH x. P x \<and> Q x) \<longleftrightarrow> (FRESH x. P x) \<and> (FRESH x. Q x)"
|
|
333 |
using P Q by (rule FRESH_binop_iff)
|
|
334 |
|
|
335 |
lemma FRESH_disj_iff:
|
|
336 |
fixes P Q :: "'a::at \<Rightarrow> bool"
|
|
337 |
assumes P: "finite (supp P)" and Q: "finite (supp Q)"
|
|
338 |
shows "(FRESH x. P x \<or> Q x) \<longleftrightarrow> (FRESH x. P x) \<or> (FRESH x. Q x)"
|
|
339 |
using P Q by (rule FRESH_binop_iff)
|
|
340 |
|
|
341 |
|
|
342 |
section {* An example of a function without finite support *}
|
|
343 |
|
|
344 |
primrec
|
|
345 |
nat_of :: "atom \<Rightarrow> nat"
|
|
346 |
where
|
|
347 |
"nat_of (Atom s n) = n"
|
|
348 |
|
|
349 |
lemma atom_eq_iff:
|
|
350 |
fixes a b :: atom
|
|
351 |
shows "a = b \<longleftrightarrow> sort_of a = sort_of b \<and> nat_of a = nat_of b"
|
|
352 |
by (induct a, induct b, simp)
|
|
353 |
|
|
354 |
lemma not_fresh_nat_of:
|
|
355 |
shows "\<not> a \<sharp> nat_of"
|
|
356 |
unfolding fresh_def supp_def
|
|
357 |
proof (clarsimp)
|
|
358 |
assume "finite {b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of}"
|
|
359 |
hence "finite ({a} \<union> {b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of})"
|
|
360 |
by simp
|
|
361 |
then obtain b where
|
|
362 |
b1: "b \<noteq> a" and
|
|
363 |
b2: "sort_of b = sort_of a" and
|
|
364 |
b3: "(a \<rightleftharpoons> b) \<bullet> nat_of = nat_of"
|
|
365 |
by (rule obtain_atom) auto
|
|
366 |
have "nat_of a = (a \<rightleftharpoons> b) \<bullet> (nat_of a)" by (simp add: permute_nat_def)
|
|
367 |
also have "\<dots> = ((a \<rightleftharpoons> b) \<bullet> nat_of) ((a \<rightleftharpoons> b) \<bullet> a)" by (simp add: permute_fun_app_eq)
|
|
368 |
also have "\<dots> = nat_of ((a \<rightleftharpoons> b) \<bullet> a)" using b3 by simp
|
|
369 |
also have "\<dots> = nat_of b" using b2 by simp
|
|
370 |
finally have "nat_of a = nat_of b" by simp
|
|
371 |
with b2 have "a = b" by (simp add: atom_eq_iff)
|
|
372 |
with b1 show "False" by simp
|
|
373 |
qed
|
|
374 |
|
|
375 |
lemma supp_nat_of:
|
|
376 |
shows "supp nat_of = UNIV"
|
|
377 |
using not_fresh_nat_of [unfolded fresh_def] by auto
|
|
378 |
|
|
379 |
|
1879
|
380 |
section {* Support for finite sets of atoms *}
|
1062
|
381 |
|
|
382 |
lemma supp_finite_atom_set:
|
|
383 |
fixes S::"atom set"
|
|
384 |
assumes "finite S"
|
|
385 |
shows "supp S = S"
|
|
386 |
apply(rule finite_supp_unique)
|
|
387 |
apply(simp add: supports_def)
|
|
388 |
apply(simp add: swap_set_not_in)
|
|
389 |
apply(rule assms)
|
|
390 |
apply(simp add: swap_set_in)
|
|
391 |
done
|
|
392 |
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
393 |
text {* Induction principle for permutations *}
|
1563
|
394 |
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
395 |
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
396 |
lemma perm_struct_induct[consumes 1, case_names zero swap]:
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
397 |
assumes S: "supp p \<subseteq> S"
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
398 |
assumes zero: "P 0"
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
399 |
assumes swap: "\<And>p a b. \<lbrakk>P p; supp p \<subseteq> S; a \<in> S; b \<in> S; a \<noteq> b; sort_of a = sort_of b\<rbrakk>
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
400 |
\<Longrightarrow> P ((a \<rightleftharpoons> b) + p)"
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
401 |
shows "P p"
|
1777
|
402 |
proof -
|
|
403 |
have "finite (supp p)" by (simp add: finite_supp)
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
404 |
then show "P p" using S
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
405 |
proof(induct A\<equiv>"supp p" arbitrary: p rule: finite_psubset_induct)
|
1777
|
406 |
case (psubset p)
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
407 |
then have ih: "\<And>q. supp q \<subset> supp p \<Longrightarrow> P q" by auto
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
408 |
have as: "supp p \<subseteq> S" by fact
|
1777
|
409 |
{ assume "supp p = {}"
|
|
410 |
then have "p = 0" by (simp add: supp_perm expand_perm_eq)
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
411 |
then have "P p" using zero by simp
|
1777
|
412 |
}
|
|
413 |
moreover
|
|
414 |
{ assume "supp p \<noteq> {}"
|
|
415 |
then obtain a where a0: "a \<in> supp p" by blast
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
416 |
then have a1: "p \<bullet> a \<in> S" "a \<in> S" "sort_of (p \<bullet> a) = sort_of a" "p \<bullet> a \<noteq> a" using as
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
417 |
by (auto simp add: supp_atom supp_perm swap_atom)
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
418 |
let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
419 |
have a2: "supp ?q \<subseteq> supp p" unfolding supp_perm by (auto simp add: swap_atom)
|
1777
|
420 |
moreover
|
|
421 |
have "a \<notin> supp ?q" by (simp add: supp_perm)
|
|
422 |
then have "supp ?q \<noteq> supp p" using a0 by auto
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
423 |
ultimately have "supp ?q \<subset> supp p" using a2 by auto
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
424 |
then have "P ?q" using ih by simp
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
425 |
moreover
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
426 |
have "supp ?q \<subseteq> S" using as a2 by simp
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
427 |
ultimately have "P ((p \<bullet> a \<rightleftharpoons> a) + ?q)" using as a1 swap by simp
|
1777
|
428 |
moreover
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
429 |
have "p = (p \<bullet> a \<rightleftharpoons> a) + ?q" by (simp add: expand_perm_eq)
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
430 |
ultimately have "P p" by simp
|
1777
|
431 |
}
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
432 |
ultimately show "P p" by blast
|
1777
|
433 |
qed
|
|
434 |
qed
|
1062
|
435 |
|
1923
|
436 |
lemma perm_struct_induct2[case_names zero swap]:
|
|
437 |
assumes zero: "P 0"
|
|
438 |
assumes swap: "\<And>p a b. \<lbrakk>P p; a \<noteq> b; sort_of a = sort_of b\<rbrakk> \<Longrightarrow> P ((a \<rightleftharpoons> b) + p)"
|
|
439 |
shows "P p"
|
|
440 |
by (rule_tac S="supp p" in perm_struct_induct)
|
|
441 |
(auto intro: zero swap)
|
|
442 |
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
443 |
lemma perm_subset_induct [consumes 1, case_names zero swap plus]:
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
444 |
assumes S: "supp p \<subseteq> S"
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
445 |
assumes zero: "P 0"
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
446 |
assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b; a \<in> S; b \<in> S\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
447 |
assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2; supp p1 \<subseteq> S; supp p2 \<subseteq> S\<rbrakk> \<Longrightarrow> P (p1 + p2)"
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
448 |
shows "P p"
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
449 |
using S
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
450 |
by (induct p rule: perm_struct_induct)
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
451 |
(auto intro: zero plus swap simp add: supp_swap)
|
1563
|
452 |
|
|
453 |
lemma supp_perm_eq:
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
454 |
assumes "(supp x) \<sharp>* p"
|
1563
|
455 |
shows "p \<bullet> x = x"
|
|
456 |
proof -
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
457 |
from assms have "supp p \<subseteq> {a. a \<sharp> x}"
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
458 |
unfolding supp_perm fresh_star_def fresh_def by auto
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
459 |
then show "p \<bullet> x = x"
|
1918
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
460 |
proof (induct p rule: perm_struct_induct)
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
461 |
case zero
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
462 |
show "0 \<bullet> x = x" by simp
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
463 |
next
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
464 |
case (swap p a b)
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
465 |
then have "a \<sharp> x" "b \<sharp> x" "p \<bullet> x = x" by simp_all
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
466 |
then show "((a \<rightleftharpoons> b) + p) \<bullet> x = x" by (simp add: swap_fresh_fresh)
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
467 |
qed
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
468 |
qed
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
469 |
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
470 |
lemma supp_perm_eq_test:
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
471 |
assumes "(supp x) \<sharp>* p"
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
472 |
shows "p \<bullet> x = x"
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
473 |
proof -
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
474 |
from assms have "supp p \<subseteq> {a. a \<sharp> x}"
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
475 |
unfolding supp_perm fresh_star_def fresh_def by auto
|
e2e963f4e90d
added an improved version of the induction principle for permutations
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
476 |
then show "p \<bullet> x = x"
|
1778
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
477 |
proof (induct p rule: perm_subset_induct)
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
478 |
case zero
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
479 |
show "0 \<bullet> x = x" by simp
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
480 |
next
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
481 |
case (swap a b)
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
482 |
then have "a \<sharp> x" "b \<sharp> x" by simp_all
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
483 |
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
484 |
next
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
485 |
case (plus p1 p2)
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
486 |
have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
487 |
then show "(p1 + p2) \<bullet> x = x" by simp
|
88ec05a09772
added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
488 |
qed
|
1563
|
489 |
qed
|
|
490 |
|
1567
|
491 |
end
|