1062
+ − 1
(* Title: Nominal2_Base
+ − 2
Authors: Brian Huffman, Christian Urban
+ − 3
+ − 4
Basic definitions and lemma infrastructure for
+ − 5
Nominal Isabelle.
+ − 6
*)
+ − 7
theory Nominal2_Base
2635
+ − 8
imports Main
+ − 9
"~~/src/HOL/Library/Infinite_Set"
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 10
"~~/src/HOL/Quotient_Examples/FSet"
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 11
uses ("nominal_basics.ML")
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 12
("nominal_thmdecls.ML")
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 13
("nominal_permeq.ML")
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 14
("nominal_library.ML")
2467
+ − 15
("nominal_atoms.ML")
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 16
("nominal_eqvt.ML")
1062
+ − 17
begin
+ − 18
+ − 19
section {* Atoms and Sorts *}
+ − 20
+ − 21
text {* A simple implementation for atom_sorts is strings. *}
+ − 22
(* types atom_sort = string *)
+ − 23
+ − 24
text {* To deal with Church-like binding we use trees of
+ − 25
strings as sorts. *}
+ − 26
+ − 27
datatype atom_sort = Sort "string" "atom_sort list"
+ − 28
+ − 29
datatype atom = Atom atom_sort nat
+ − 30
+ − 31
+ − 32
text {* Basic projection function. *}
+ − 33
+ − 34
primrec
+ − 35
sort_of :: "atom \<Rightarrow> atom_sort"
+ − 36
where
+ − 37
"sort_of (Atom s i) = s"
+ − 38
1930
+ − 39
primrec
+ − 40
nat_of :: "atom \<Rightarrow> nat"
+ − 41
where
+ − 42
"nat_of (Atom s n) = n"
+ − 43
1062
+ − 44
+ − 45
text {* There are infinitely many atoms of each sort. *}
+ − 46
lemma INFM_sort_of_eq:
+ − 47
shows "INFM a. sort_of a = s"
+ − 48
proof -
+ − 49
have "INFM i. sort_of (Atom s i) = s" by simp
+ − 50
moreover have "inj (Atom s)" by (simp add: inj_on_def)
+ − 51
ultimately show "INFM a. sort_of a = s" by (rule INFM_inj)
+ − 52
qed
+ − 53
+ − 54
lemma infinite_sort_of_eq:
+ − 55
shows "infinite {a. sort_of a = s}"
+ − 56
using INFM_sort_of_eq unfolding INFM_iff_infinite .
+ − 57
+ − 58
lemma atom_infinite [simp]:
+ − 59
shows "infinite (UNIV :: atom set)"
+ − 60
using subset_UNIV infinite_sort_of_eq
+ − 61
by (rule infinite_super)
+ − 62
+ − 63
lemma obtain_atom:
+ − 64
fixes X :: "atom set"
+ − 65
assumes X: "finite X"
+ − 66
obtains a where "a \<notin> X" "sort_of a = s"
+ − 67
proof -
+ − 68
from X have "MOST a. a \<notin> X"
+ − 69
unfolding MOST_iff_cofinite by simp
+ − 70
with INFM_sort_of_eq
+ − 71
have "INFM a. sort_of a = s \<and> a \<notin> X"
+ − 72
by (rule INFM_conjI)
+ − 73
then obtain a where "a \<notin> X" "sort_of a = s"
+ − 74
by (auto elim: INFM_E)
+ − 75
then show ?thesis ..
+ − 76
qed
+ − 77
1930
+ − 78
lemma atom_components_eq_iff:
+ − 79
fixes a b :: atom
+ − 80
shows "a = b \<longleftrightarrow> sort_of a = sort_of b \<and> nat_of a = nat_of b"
+ − 81
by (induct a, induct b, simp)
+ − 82
2735
+ − 83
1062
+ − 84
section {* Sort-Respecting Permutations *}
+ − 85
+ − 86
typedef perm =
+ − 87
"{f. bij f \<and> finite {a. f a \<noteq> a} \<and> (\<forall>a. sort_of (f a) = sort_of a)}"
+ − 88
proof
+ − 89
show "id \<in> ?perm" by simp
+ − 90
qed
+ − 91
+ − 92
lemma permI:
+ − 93
assumes "bij f" and "MOST x. f x = x" and "\<And>a. sort_of (f a) = sort_of a"
+ − 94
shows "f \<in> perm"
+ − 95
using assms unfolding perm_def MOST_iff_cofinite by simp
+ − 96
+ − 97
lemma perm_is_bij: "f \<in> perm \<Longrightarrow> bij f"
+ − 98
unfolding perm_def by simp
+ − 99
+ − 100
lemma perm_is_finite: "f \<in> perm \<Longrightarrow> finite {a. f a \<noteq> a}"
+ − 101
unfolding perm_def by simp
+ − 102
+ − 103
lemma perm_is_sort_respecting: "f \<in> perm \<Longrightarrow> sort_of (f a) = sort_of a"
+ − 104
unfolding perm_def by simp
+ − 105
+ − 106
lemma perm_MOST: "f \<in> perm \<Longrightarrow> MOST x. f x = x"
+ − 107
unfolding perm_def MOST_iff_cofinite by simp
+ − 108
+ − 109
lemma perm_id: "id \<in> perm"
+ − 110
unfolding perm_def by simp
+ − 111
+ − 112
lemma perm_comp:
+ − 113
assumes f: "f \<in> perm" and g: "g \<in> perm"
+ − 114
shows "(f \<circ> g) \<in> perm"
+ − 115
apply (rule permI)
+ − 116
apply (rule bij_comp)
+ − 117
apply (rule perm_is_bij [OF g])
+ − 118
apply (rule perm_is_bij [OF f])
+ − 119
apply (rule MOST_rev_mp [OF perm_MOST [OF g]])
+ − 120
apply (rule MOST_rev_mp [OF perm_MOST [OF f]])
+ − 121
apply (simp)
+ − 122
apply (simp add: perm_is_sort_respecting [OF f])
+ − 123
apply (simp add: perm_is_sort_respecting [OF g])
+ − 124
done
+ − 125
+ − 126
lemma perm_inv:
+ − 127
assumes f: "f \<in> perm"
+ − 128
shows "(inv f) \<in> perm"
+ − 129
apply (rule permI)
+ − 130
apply (rule bij_imp_bij_inv)
+ − 131
apply (rule perm_is_bij [OF f])
+ − 132
apply (rule MOST_mono [OF perm_MOST [OF f]])
+ − 133
apply (erule subst, rule inv_f_f)
+ − 134
apply (rule bij_is_inj [OF perm_is_bij [OF f]])
+ − 135
apply (rule perm_is_sort_respecting [OF f, THEN sym, THEN trans])
+ − 136
apply (simp add: surj_f_inv_f [OF bij_is_surj [OF perm_is_bij [OF f]]])
+ − 137
done
+ − 138
+ − 139
lemma bij_Rep_perm: "bij (Rep_perm p)"
+ − 140
using Rep_perm [of p] unfolding perm_def by simp
+ − 141
+ − 142
lemma finite_Rep_perm: "finite {a. Rep_perm p a \<noteq> a}"
+ − 143
using Rep_perm [of p] unfolding perm_def by simp
+ − 144
+ − 145
lemma sort_of_Rep_perm: "sort_of (Rep_perm p a) = sort_of a"
+ − 146
using Rep_perm [of p] unfolding perm_def by simp
+ − 147
+ − 148
lemma Rep_perm_ext:
+ − 149
"Rep_perm p1 = Rep_perm p2 \<Longrightarrow> p1 = p2"
2479
+ − 150
by (simp add: fun_eq_iff Rep_perm_inject [symmetric])
1062
+ − 151
2560
+ − 152
instance perm :: size ..
1062
+ − 153
2735
+ − 154
2732
+ − 155
subsection {* Permutations form a (multiplicative) group *}
+ − 156
1062
+ − 157
instantiation perm :: group_add
+ − 158
begin
+ − 159
+ − 160
definition
+ − 161
"0 = Abs_perm id"
+ − 162
+ − 163
definition
+ − 164
"- p = Abs_perm (inv (Rep_perm p))"
+ − 165
+ − 166
definition
+ − 167
"p + q = Abs_perm (Rep_perm p \<circ> Rep_perm q)"
+ − 168
+ − 169
definition
+ − 170
"(p1::perm) - p2 = p1 + - p2"
+ − 171
+ − 172
lemma Rep_perm_0: "Rep_perm 0 = id"
+ − 173
unfolding zero_perm_def
+ − 174
by (simp add: Abs_perm_inverse perm_id)
+ − 175
+ − 176
lemma Rep_perm_add:
+ − 177
"Rep_perm (p1 + p2) = Rep_perm p1 \<circ> Rep_perm p2"
+ − 178
unfolding plus_perm_def
+ − 179
by (simp add: Abs_perm_inverse perm_comp Rep_perm)
+ − 180
+ − 181
lemma Rep_perm_uminus:
+ − 182
"Rep_perm (- p) = inv (Rep_perm p)"
+ − 183
unfolding uminus_perm_def
+ − 184
by (simp add: Abs_perm_inverse perm_inv Rep_perm)
+ − 185
+ − 186
instance
+ − 187
apply default
+ − 188
unfolding Rep_perm_inject [symmetric]
+ − 189
unfolding minus_perm_def
+ − 190
unfolding Rep_perm_add
+ − 191
unfolding Rep_perm_uminus
+ − 192
unfolding Rep_perm_0
+ − 193
by (simp_all add: o_assoc inv_o_cancel [OF bij_is_inj [OF bij_Rep_perm]])
+ − 194
+ − 195
end
+ − 196
+ − 197
+ − 198
section {* Implementation of swappings *}
+ − 199
+ − 200
definition
+ − 201
swap :: "atom \<Rightarrow> atom \<Rightarrow> perm" ("'(_ \<rightleftharpoons> _')")
+ − 202
where
+ − 203
"(a \<rightleftharpoons> b) =
+ − 204
Abs_perm (if sort_of a = sort_of b
+ − 205
then (\<lambda>c. if a = c then b else if b = c then a else c)
+ − 206
else id)"
+ − 207
+ − 208
lemma Rep_perm_swap:
+ − 209
"Rep_perm (a \<rightleftharpoons> b) =
+ − 210
(if sort_of a = sort_of b
+ − 211
then (\<lambda>c. if a = c then b else if b = c then a else c)
+ − 212
else id)"
+ − 213
unfolding swap_def
+ − 214
apply (rule Abs_perm_inverse)
+ − 215
apply (rule permI)
+ − 216
apply (auto simp add: bij_def inj_on_def surj_def)[1]
+ − 217
apply (rule MOST_rev_mp [OF MOST_neq(1) [of a]])
+ − 218
apply (rule MOST_rev_mp [OF MOST_neq(1) [of b]])
+ − 219
apply (simp)
+ − 220
apply (simp)
+ − 221
done
+ − 222
+ − 223
lemmas Rep_perm_simps =
+ − 224
Rep_perm_0
+ − 225
Rep_perm_add
+ − 226
Rep_perm_uminus
+ − 227
Rep_perm_swap
+ − 228
+ − 229
lemma swap_different_sorts [simp]:
+ − 230
"sort_of a \<noteq> sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) = 0"
+ − 231
by (rule Rep_perm_ext) (simp add: Rep_perm_simps)
+ − 232
+ − 233
lemma swap_cancel:
2679
+ − 234
shows "(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
+ − 235
and "(a \<rightleftharpoons> b) + (b \<rightleftharpoons> a) = 0"
+ − 236
by (rule_tac [!] Rep_perm_ext)
+ − 237
(simp_all add: Rep_perm_simps fun_eq_iff)
1062
+ − 238
+ − 239
lemma swap_self [simp]:
+ − 240
"(a \<rightleftharpoons> a) = 0"
2479
+ − 241
by (rule Rep_perm_ext, simp add: Rep_perm_simps fun_eq_iff)
1062
+ − 242
+ − 243
lemma minus_swap [simp]:
+ − 244
"- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
2679
+ − 245
by (rule minus_unique [OF swap_cancel(1)])
1062
+ − 246
+ − 247
lemma swap_commute:
+ − 248
"(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
+ − 249
by (rule Rep_perm_ext)
2479
+ − 250
(simp add: Rep_perm_swap fun_eq_iff)
1062
+ − 251
+ − 252
lemma swap_triple:
+ − 253
assumes "a \<noteq> b" and "c \<noteq> b"
+ − 254
assumes "sort_of a = sort_of b" "sort_of b = sort_of c"
+ − 255
shows "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
+ − 256
using assms
+ − 257
by (rule_tac Rep_perm_ext)
2479
+ − 258
(auto simp add: Rep_perm_simps fun_eq_iff)
1062
+ − 259
+ − 260
+ − 261
section {* Permutation Types *}
+ − 262
+ − 263
text {*
+ − 264
Infix syntax for @{text permute} has higher precedence than
+ − 265
addition, but lower than unary minus.
+ − 266
*}
+ − 267
+ − 268
class pt =
+ − 269
fixes permute :: "perm \<Rightarrow> 'a \<Rightarrow> 'a" ("_ \<bullet> _" [76, 75] 75)
+ − 270
assumes permute_zero [simp]: "0 \<bullet> x = x"
+ − 271
assumes permute_plus [simp]: "(p + q) \<bullet> x = p \<bullet> (q \<bullet> x)"
+ − 272
begin
+ − 273
+ − 274
lemma permute_diff [simp]:
+ − 275
shows "(p - q) \<bullet> x = p \<bullet> - q \<bullet> x"
+ − 276
unfolding diff_minus by simp
+ − 277
+ − 278
lemma permute_minus_cancel [simp]:
+ − 279
shows "p \<bullet> - p \<bullet> x = x"
+ − 280
and "- p \<bullet> p \<bullet> x = x"
+ − 281
unfolding permute_plus [symmetric] by simp_all
+ − 282
+ − 283
lemma permute_swap_cancel [simp]:
+ − 284
shows "(a \<rightleftharpoons> b) \<bullet> (a \<rightleftharpoons> b) \<bullet> x = x"
+ − 285
unfolding permute_plus [symmetric]
+ − 286
by (simp add: swap_cancel)
+ − 287
+ − 288
lemma permute_swap_cancel2 [simp]:
+ − 289
shows "(a \<rightleftharpoons> b) \<bullet> (b \<rightleftharpoons> a) \<bullet> x = x"
+ − 290
unfolding permute_plus [symmetric]
+ − 291
by (simp add: swap_commute)
+ − 292
+ − 293
lemma inj_permute [simp]:
+ − 294
shows "inj (permute p)"
+ − 295
by (rule inj_on_inverseI)
+ − 296
(rule permute_minus_cancel)
+ − 297
+ − 298
lemma surj_permute [simp]:
+ − 299
shows "surj (permute p)"
+ − 300
by (rule surjI, rule permute_minus_cancel)
+ − 301
+ − 302
lemma bij_permute [simp]:
+ − 303
shows "bij (permute p)"
+ − 304
by (rule bijI [OF inj_permute surj_permute])
+ − 305
+ − 306
lemma inv_permute:
+ − 307
shows "inv (permute p) = permute (- p)"
+ − 308
by (rule inv_equality) (simp_all)
+ − 309
+ − 310
lemma permute_minus:
+ − 311
shows "permute (- p) = inv (permute p)"
+ − 312
by (simp add: inv_permute)
+ − 313
+ − 314
lemma permute_eq_iff [simp]:
+ − 315
shows "p \<bullet> x = p \<bullet> y \<longleftrightarrow> x = y"
+ − 316
by (rule inj_permute [THEN inj_eq])
+ − 317
+ − 318
end
+ − 319
+ − 320
subsection {* Permutations for atoms *}
+ − 321
+ − 322
instantiation atom :: pt
+ − 323
begin
+ − 324
+ − 325
definition
1879
+ − 326
"p \<bullet> a = (Rep_perm p) a"
1062
+ − 327
+ − 328
instance
+ − 329
apply(default)
+ − 330
apply(simp_all add: permute_atom_def Rep_perm_simps)
+ − 331
done
+ − 332
+ − 333
end
+ − 334
+ − 335
lemma sort_of_permute [simp]:
+ − 336
shows "sort_of (p \<bullet> a) = sort_of a"
+ − 337
unfolding permute_atom_def by (rule sort_of_Rep_perm)
+ − 338
+ − 339
lemma swap_atom:
+ − 340
shows "(a \<rightleftharpoons> b) \<bullet> c =
+ − 341
(if sort_of a = sort_of b
+ − 342
then (if c = a then b else if c = b then a else c) else c)"
+ − 343
unfolding permute_atom_def
+ − 344
by (simp add: Rep_perm_swap)
+ − 345
+ − 346
lemma swap_atom_simps [simp]:
+ − 347
"sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> a = b"
+ − 348
"sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> b = a"
+ − 349
"c \<noteq> a \<Longrightarrow> c \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> c = c"
+ − 350
unfolding swap_atom by simp_all
+ − 351
2732
+ − 352
lemma perm_eq_iff:
1062
+ − 353
fixes p q :: "perm"
+ − 354
shows "p = q \<longleftrightarrow> (\<forall>a::atom. p \<bullet> a = q \<bullet> a)"
+ − 355
unfolding permute_atom_def
+ − 356
by (metis Rep_perm_ext ext)
+ − 357
+ − 358
+ − 359
subsection {* Permutations for permutations *}
+ − 360
+ − 361
instantiation perm :: pt
+ − 362
begin
+ − 363
+ − 364
definition
+ − 365
"p \<bullet> q = p + q - p"
+ − 366
+ − 367
instance
+ − 368
apply default
+ − 369
apply (simp add: permute_perm_def)
+ − 370
apply (simp add: permute_perm_def diff_minus minus_add add_assoc)
+ − 371
done
+ − 372
+ − 373
end
+ − 374
1879
+ − 375
lemma permute_self:
+ − 376
shows "p \<bullet> p = p"
+ − 377
unfolding permute_perm_def
+ − 378
by (simp add: diff_minus add_assoc)
1062
+ − 379
2732
+ − 380
lemma pemute_minus_self:
+ − 381
shows "- p \<bullet> p = p"
+ − 382
unfolding permute_perm_def
+ − 383
by (simp add: diff_minus add_assoc)
+ − 384
1062
+ − 385
+ − 386
subsection {* Permutations for functions *}
+ − 387
+ − 388
instantiation "fun" :: (pt, pt) pt
+ − 389
begin
+ − 390
+ − 391
definition
+ − 392
"p \<bullet> f = (\<lambda>x. p \<bullet> (f (- p \<bullet> x)))"
+ − 393
+ − 394
instance
+ − 395
apply default
+ − 396
apply (simp add: permute_fun_def)
+ − 397
apply (simp add: permute_fun_def minus_add)
+ − 398
done
+ − 399
+ − 400
end
+ − 401
+ − 402
lemma permute_fun_app_eq:
+ − 403
shows "p \<bullet> (f x) = (p \<bullet> f) (p \<bullet> x)"
1879
+ − 404
unfolding permute_fun_def by simp
1062
+ − 405
2663
+ − 406
1062
+ − 407
subsection {* Permutations for booleans *}
+ − 408
+ − 409
instantiation bool :: pt
+ − 410
begin
+ − 411
+ − 412
definition "p \<bullet> (b::bool) = b"
+ − 413
+ − 414
instance
+ − 415
apply(default)
+ − 416
apply(simp_all add: permute_bool_def)
+ − 417
done
+ − 418
+ − 419
end
+ − 420
1557
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 421
lemma permute_boolE:
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 422
fixes P::"bool"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 423
shows "p \<bullet> P \<Longrightarrow> P"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 424
by (simp add: permute_bool_def)
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 425
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 426
lemma permute_boolI:
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 427
fixes P::"bool"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 428
shows "P \<Longrightarrow> p \<bullet> P"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 429
by(simp add: permute_bool_def)
1062
+ − 430
+ − 431
subsection {* Permutations for sets *}
+ − 432
+ − 433
lemma permute_set_eq:
+ − 434
fixes x::"'a::pt"
+ − 435
shows "(p \<bullet> X) = {p \<bullet> x | x. x \<in> X}"
1879
+ − 436
unfolding permute_fun_def
+ − 437
unfolding permute_bool_def
+ − 438
apply(auto simp add: mem_def)
1062
+ − 439
apply(rule_tac x="- p \<bullet> x" in exI)
+ − 440
apply(simp)
+ − 441
done
+ − 442
+ − 443
lemma permute_set_eq_image:
+ − 444
shows "p \<bullet> X = permute p ` X"
1879
+ − 445
unfolding permute_set_eq by auto
1062
+ − 446
+ − 447
lemma permute_set_eq_vimage:
+ − 448
shows "p \<bullet> X = permute (- p) -` X"
1879
+ − 449
unfolding permute_fun_def permute_bool_def
+ − 450
unfolding vimage_def Collect_def mem_def ..
1062
+ − 451
2588
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 452
lemma permute_finite [simp]:
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 453
shows "finite (p \<bullet> X) = finite X"
2735
+ − 454
unfolding permute_set_eq_vimage
+ − 455
using bij_permute by (rule finite_vimage_iff)
2588
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 456
1062
+ − 457
lemma swap_set_not_in:
+ − 458
assumes a: "a \<notin> S" "b \<notin> S"
+ − 459
shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1879
+ − 460
unfolding permute_set_eq
+ − 461
using a by (auto simp add: swap_atom)
1062
+ − 462
+ − 463
lemma swap_set_in:
+ − 464
assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
+ − 465
shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
1879
+ − 466
unfolding permute_set_eq
+ − 467
using a by (auto simp add: swap_atom)
1062
+ − 468
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 469
lemma swap_set_in_eq:
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 470
assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 471
shows "(a \<rightleftharpoons> b) \<bullet> S = (S - {a}) \<union> {b}"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 472
unfolding permute_set_eq
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 473
using a by (auto simp add: swap_atom)
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 474
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 475
lemma swap_set_both_in:
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 476
assumes a: "a \<in> S" "b \<in> S"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 477
shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 478
unfolding permute_set_eq
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 479
using a by (auto simp add: swap_atom)
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 480
2470
+ − 481
lemma mem_permute_iff:
+ − 482
shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X"
+ − 483
unfolding mem_def permute_fun_def permute_bool_def
+ − 484
by simp
+ − 485
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 486
lemma empty_eqvt:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 487
shows "p \<bullet> {} = {}"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 488
unfolding empty_def Collect_def
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 489
by (simp add: permute_fun_def permute_bool_def)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 490
2470
+ − 491
lemma insert_eqvt:
+ − 492
shows "p \<bullet> (insert x A) = insert (p \<bullet> x) (p \<bullet> A)"
+ − 493
unfolding permute_set_eq_image image_insert ..
+ − 494
2735
+ − 495
+ − 496
subsection {* Permutations for @{typ unit} *}
1062
+ − 497
+ − 498
instantiation unit :: pt
+ − 499
begin
+ − 500
+ − 501
definition "p \<bullet> (u::unit) = u"
+ − 502
1879
+ − 503
instance
+ − 504
by (default) (simp_all add: permute_unit_def)
1062
+ − 505
+ − 506
end
+ − 507
+ − 508
+ − 509
subsection {* Permutations for products *}
+ − 510
2378
+ − 511
instantiation prod :: (pt, pt) pt
1062
+ − 512
begin
+ − 513
+ − 514
primrec
+ − 515
permute_prod
+ − 516
where
+ − 517
Pair_eqvt: "p \<bullet> (x, y) = (p \<bullet> x, p \<bullet> y)"
+ − 518
+ − 519
instance
+ − 520
by default auto
+ − 521
+ − 522
end
+ − 523
+ − 524
subsection {* Permutations for sums *}
+ − 525
2378
+ − 526
instantiation sum :: (pt, pt) pt
1062
+ − 527
begin
+ − 528
+ − 529
primrec
+ − 530
permute_sum
+ − 531
where
+ − 532
"p \<bullet> (Inl x) = Inl (p \<bullet> x)"
+ − 533
| "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
+ − 534
1879
+ − 535
instance
+ − 536
by (default) (case_tac [!] x, simp_all)
1062
+ − 537
+ − 538
end
+ − 539
2735
+ − 540
subsection {* Permutations for @{typ "'a list"} *}
1062
+ − 541
+ − 542
instantiation list :: (pt) pt
+ − 543
begin
+ − 544
+ − 545
primrec
+ − 546
permute_list
+ − 547
where
+ − 548
"p \<bullet> [] = []"
+ − 549
| "p \<bullet> (x # xs) = p \<bullet> x # p \<bullet> xs"
+ − 550
1879
+ − 551
instance
+ − 552
by (default) (induct_tac [!] x, simp_all)
1062
+ − 553
+ − 554
end
+ − 555
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 556
lemma set_eqvt:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 557
shows "p \<bullet> (set xs) = set (p \<bullet> xs)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 558
by (induct xs) (simp_all add: empty_eqvt insert_eqvt)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 559
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 560
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 561
2735
+ − 562
subsection {* Permutations for @{typ "'a option"} *}
1062
+ − 563
+ − 564
instantiation option :: (pt) pt
+ − 565
begin
+ − 566
+ − 567
primrec
+ − 568
permute_option
+ − 569
where
+ − 570
"p \<bullet> None = None"
+ − 571
| "p \<bullet> (Some x) = Some (p \<bullet> x)"
+ − 572
1879
+ − 573
instance
+ − 574
by (default) (induct_tac [!] x, simp_all)
1062
+ − 575
+ − 576
end
+ − 577
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 578
2735
+ − 579
subsection {* Permutations for @{typ "'a fset"} *}
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 580
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 581
lemma permute_fset_rsp[quot_respect]:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 582
shows "(op = ===> list_eq ===> list_eq) permute permute"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 583
unfolding fun_rel_def
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 584
by (simp add: set_eqvt[symmetric])
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 585
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 586
instantiation fset :: (pt) pt
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 587
begin
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 588
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 589
quotient_definition
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 590
"permute_fset :: perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 591
is
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 592
"permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 593
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 594
instance
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 595
proof
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 596
fix x :: "'a fset" and p q :: "perm"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 597
show "0 \<bullet> x = x" by (descending) (simp)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 598
show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x" by (descending) (simp)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 599
qed
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 600
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 601
end
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 602
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 603
lemma permute_fset [simp]:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 604
fixes S::"('a::pt) fset"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 605
shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 606
and "(p \<bullet> insert_fset x S) = insert_fset (p \<bullet> x) (p \<bullet> S)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 607
by (lifting permute_list.simps)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 608
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 609
lemma fset_eqvt:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 610
shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 611
by (lifting set_eqvt)
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 612
2735
+ − 613
1062
+ − 614
subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *}
+ − 615
+ − 616
instantiation char :: pt
+ − 617
begin
+ − 618
+ − 619
definition "p \<bullet> (c::char) = c"
+ − 620
1879
+ − 621
instance
+ − 622
by (default) (simp_all add: permute_char_def)
1062
+ − 623
+ − 624
end
+ − 625
+ − 626
instantiation nat :: pt
+ − 627
begin
+ − 628
+ − 629
definition "p \<bullet> (n::nat) = n"
+ − 630
1879
+ − 631
instance
+ − 632
by (default) (simp_all add: permute_nat_def)
1062
+ − 633
+ − 634
end
+ − 635
+ − 636
instantiation int :: pt
+ − 637
begin
+ − 638
+ − 639
definition "p \<bullet> (i::int) = i"
+ − 640
1879
+ − 641
instance
+ − 642
by (default) (simp_all add: permute_int_def)
1062
+ − 643
+ − 644
end
+ − 645
+ − 646
+ − 647
section {* Pure types *}
+ − 648
+ − 649
text {* Pure types will have always empty support. *}
+ − 650
+ − 651
class pure = pt +
+ − 652
assumes permute_pure: "p \<bullet> x = x"
+ − 653
+ − 654
text {* Types @{typ unit} and @{typ bool} are pure. *}
+ − 655
+ − 656
instance unit :: pure
+ − 657
proof qed (rule permute_unit_def)
+ − 658
+ − 659
instance bool :: pure
+ − 660
proof qed (rule permute_bool_def)
+ − 661
2635
+ − 662
1062
+ − 663
text {* Other type constructors preserve purity. *}
+ − 664
+ − 665
instance "fun" :: (pure, pure) pure
+ − 666
by default (simp add: permute_fun_def permute_pure)
+ − 667
2378
+ − 668
instance prod :: (pure, pure) pure
1062
+ − 669
by default (induct_tac x, simp add: permute_pure)
+ − 670
2378
+ − 671
instance sum :: (pure, pure) pure
1062
+ − 672
by default (induct_tac x, simp_all add: permute_pure)
+ − 673
+ − 674
instance list :: (pure) pure
+ − 675
by default (induct_tac x, simp_all add: permute_pure)
+ − 676
+ − 677
instance option :: (pure) pure
+ − 678
by default (induct_tac x, simp_all add: permute_pure)
+ − 679
+ − 680
+ − 681
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
+ − 682
+ − 683
instance char :: pure
+ − 684
proof qed (rule permute_char_def)
+ − 685
+ − 686
instance nat :: pure
+ − 687
proof qed (rule permute_nat_def)
+ − 688
+ − 689
instance int :: pure
+ − 690
proof qed (rule permute_int_def)
+ − 691
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 692
2735
+ − 693
section {* Infrastructure for Equivariance and Perm_simp *}
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 694
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 695
subsection {* Basic functions about permutations *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 696
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 697
use "nominal_basics.ML"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 698
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 699
2735
+ − 700
subsection {* Eqvt infrastructure *}
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 701
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 702
text {* Setup of the theorem attributes @{text eqvt} and @{text eqvt_raw} *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 703
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 704
use "nominal_thmdecls.ML"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 705
setup "Nominal_ThmDecls.setup"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 706
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 707
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 708
lemmas [eqvt] =
2735
+ − 709
(* pt types *)
+ − 710
permute_prod.simps
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 711
permute_list.simps
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 712
permute_option.simps
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 713
permute_sum.simps
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 714
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 715
(* sets *)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 716
empty_eqvt insert_eqvt set_eqvt
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 717
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 718
(* fsets *)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 719
permute_fset fset_eqvt
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 720
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 721
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 722
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 723
subsection {* perm_simp infrastructure *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 724
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 725
definition
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 726
"unpermute p = permute (- p)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 727
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 728
lemma eqvt_apply:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 729
fixes f :: "'a::pt \<Rightarrow> 'b::pt"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 730
and x :: "'a::pt"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 731
shows "p \<bullet> (f x) \<equiv> (p \<bullet> f) (p \<bullet> x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 732
unfolding permute_fun_def by simp
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 734
lemma eqvt_lambda:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 735
fixes f :: "'a::pt \<Rightarrow> 'b::pt"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 736
shows "p \<bullet> (\<lambda>x. f x) \<equiv> (\<lambda>x. p \<bullet> (f (unpermute p x)))"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 737
unfolding permute_fun_def unpermute_def by simp
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 738
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 739
lemma eqvt_bound:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 740
shows "p \<bullet> unpermute p x \<equiv> x"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 741
unfolding unpermute_def by simp
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 742
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 743
text {* provides perm_simp methods *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 744
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 745
use "nominal_permeq.ML"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 746
setup Nominal_Permeq.setup
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 747
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 748
method_setup perm_simp =
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 749
{* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_simp_meth *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 750
{* pushes permutations inside. *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 751
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 752
method_setup perm_strict_simp =
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 753
{* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_strict_simp_meth *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 754
{* pushes permutations inside, raises an error if it cannot solve all permutations. *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 755
2735
+ − 756
+ − 757
subsubsection {* Equivariance for permutations and swapping *}
+ − 758
+ − 759
lemma permute_eqvt:
+ − 760
shows "p \<bullet> (q \<bullet> x) = (p \<bullet> q) \<bullet> (p \<bullet> x)"
+ − 761
unfolding permute_perm_def by simp
+ − 762
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 763
(* the normal version of this lemma would cause loops *)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 764
lemma permute_eqvt_raw[eqvt_raw]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 765
shows "p \<bullet> permute \<equiv> permute"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 766
apply(simp add: fun_eq_iff permute_fun_def)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 767
apply(subst permute_eqvt)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 768
apply(simp)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 769
done
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 770
2735
+ − 771
lemma zero_perm_eqvt [eqvt]:
+ − 772
shows "p \<bullet> (0::perm) = 0"
+ − 773
unfolding permute_perm_def by simp
+ − 774
+ − 775
lemma add_perm_eqvt [eqvt]:
+ − 776
fixes p p1 p2 :: perm
+ − 777
shows "p \<bullet> (p1 + p2) = p \<bullet> p1 + p \<bullet> p2"
+ − 778
unfolding permute_perm_def
+ − 779
by (simp add: perm_eq_iff)
+ − 780
+ − 781
lemma swap_eqvt [eqvt]:
+ − 782
shows "p \<bullet> (a \<rightleftharpoons> b) = (p \<bullet> a \<rightleftharpoons> p \<bullet> b)"
+ − 783
unfolding permute_perm_def
+ − 784
by (auto simp add: swap_atom perm_eq_iff)
+ − 785
+ − 786
lemma uminus_eqvt [eqvt]:
+ − 787
fixes p q::"perm"
+ − 788
shows "p \<bullet> (- q) = - (p \<bullet> q)"
+ − 789
unfolding permute_perm_def
+ − 790
by (simp add: diff_minus minus_add add_assoc)
+ − 791
+ − 792
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 793
subsubsection {* Equivariance of Logical Operators *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 794
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 795
lemma eq_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 796
shows "p \<bullet> (x = y) \<longleftrightarrow> (p \<bullet> x) = (p \<bullet> y)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 797
unfolding permute_eq_iff permute_bool_def ..
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 798
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 799
lemma Not_eqvt [eqvt]:
2735
+ − 800
shows "p \<bullet> (\<not> A) \<longleftrightarrow> \<not> (p \<bullet> A)"
+ − 801
by (simp add: permute_bool_def)
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 802
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 803
lemma conj_eqvt [eqvt]:
2735
+ − 804
shows "p \<bullet> (A \<and> B) \<longleftrightarrow> (p \<bullet> A) \<and> (p \<bullet> B)"
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 805
by (simp add: permute_bool_def)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 806
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 807
lemma imp_eqvt [eqvt]:
2735
+ − 808
shows "p \<bullet> (A \<longrightarrow> B) \<longleftrightarrow> (p \<bullet> A) \<longrightarrow> (p \<bullet> B)"
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 809
by (simp add: permute_bool_def)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 810
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 811
declare imp_eqvt[folded induct_implies_def, eqvt]
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 812
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 813
lemma ex_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 814
shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. (p \<bullet> P) x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 815
unfolding permute_fun_def permute_bool_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 816
by (auto, rule_tac x="p \<bullet> x" in exI, simp)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 817
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 818
lemma all_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 819
shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. (p \<bullet> P) x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 820
unfolding permute_fun_def permute_bool_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 821
by (auto, drule_tac x="p \<bullet> x" in spec, simp)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 822
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 823
declare all_eqvt[folded induct_forall_def, eqvt]
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 824
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 825
lemma ex1_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 826
shows "p \<bullet> (\<exists>!x. P x) = (\<exists>!x. (p \<bullet> P) x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 827
unfolding Ex1_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 828
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 829
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 830
lemma mem_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 831
shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 832
unfolding mem_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 833
by (simp add: permute_fun_app_eq)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 834
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 835
lemma Collect_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 836
shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 837
unfolding Collect_def permute_fun_def ..
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 838
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 839
lemma inter_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 840
shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 841
unfolding Int_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 842
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 843
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 844
lemma image_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 845
shows "p \<bullet> (f ` A) = (p \<bullet> f) ` (p \<bullet> A)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 846
unfolding permute_set_eq_image
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 847
unfolding permute_fun_def [where f=f]
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 848
by (simp add: image_image)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 849
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 850
lemma if_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 851
shows "p \<bullet> (if b then x else y) = (if p \<bullet> b then p \<bullet> x else p \<bullet> y)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 852
by (simp add: permute_fun_def permute_bool_def)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 853
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 854
lemma True_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 855
shows "p \<bullet> True = True"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 856
unfolding permute_bool_def ..
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 857
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 858
lemma False_eqvt [eqvt]:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 859
shows "p \<bullet> False = False"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 860
unfolding permute_bool_def ..
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 861
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 862
lemma disj_eqvt [eqvt]:
2735
+ − 863
shows "p \<bullet> (A \<or> B) \<longleftrightarrow> (p \<bullet> A) \<or> (p \<bullet> B)"
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 864
by (simp add: permute_bool_def)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 865
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 866
lemma all_eqvt2:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 867
shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 868
by (perm_simp add: permute_minus_cancel) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 869
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 870
lemma ex_eqvt2:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 871
shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 872
by (perm_simp add: permute_minus_cancel) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 873
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 874
lemma ex1_eqvt2:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 875
shows "p \<bullet> (\<exists>!x. P x) = (\<exists>!x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 876
by (perm_simp add: permute_minus_cancel) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 877
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 878
lemma the_eqvt:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 879
assumes unique: "\<exists>!x. P x"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 880
shows "(p \<bullet> (THE x. P x)) = (THE x. (p \<bullet> P) x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 881
apply(rule the1_equality [symmetric])
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 882
apply(rule_tac p="-p" in permute_boolE)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 883
apply(perm_simp add: permute_minus_cancel)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 884
apply(rule unique)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 885
apply(rule_tac p="-p" in permute_boolE)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 886
apply(perm_simp add: permute_minus_cancel)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 887
apply(rule theI'[OF unique])
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 888
done
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 889
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 890
lemma the_eqvt2:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 891
assumes unique: "\<exists>!x. P x"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 892
shows "(p \<bullet> (THE x. P x)) = (THE x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 893
apply(rule the1_equality [symmetric])
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 894
apply(simp add: ex1_eqvt2[symmetric])
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 895
apply(simp add: permute_bool_def unique)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 896
apply(simp add: permute_bool_def)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 897
apply(rule theI'[OF unique])
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 898
done
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 899
2735
+ − 900
subsubsection {* Equivariance set operations *}
+ − 901
+ − 902
lemma Bex_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 903
shows "p \<bullet> (\<exists>x \<in> S. P x) = (\<exists>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 904
unfolding Bex_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 905
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 906
2735
+ − 907
lemma Ball_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 908
shows "p \<bullet> (\<forall>x \<in> S. P x) = (\<forall>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 909
unfolding Ball_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 910
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 911
2735
+ − 912
lemma UNIV_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 913
shows "p \<bullet> UNIV = UNIV"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 914
unfolding UNIV_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 915
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 916
2735
+ − 917
lemma union_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 918
shows "p \<bullet> (A \<union> B) = (p \<bullet> A) \<union> (p \<bullet> B)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 919
unfolding Un_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 920
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 921
2735
+ − 922
lemma Diff_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 923
fixes A B :: "'a::pt set"
2735
+ − 924
shows "p \<bullet> (A - B) = (p \<bullet> A) - (p \<bullet> B)"
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 925
unfolding set_diff_eq
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 926
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 927
2735
+ − 928
lemma Compl_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 929
fixes A :: "'a::pt set"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 930
shows "p \<bullet> (- A) = - (p \<bullet> A)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 931
unfolding Compl_eq_Diff_UNIV
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 932
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 933
2735
+ − 934
lemma subset_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 935
shows "p \<bullet> (S \<subseteq> T) \<longleftrightarrow> (p \<bullet> S) \<subseteq> (p \<bullet> T)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 936
unfolding subset_eq
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 937
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 938
2735
+ − 939
lemma psubset_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 940
shows "p \<bullet> (S \<subset> T) \<longleftrightarrow> (p \<bullet> S) \<subset> (p \<bullet> T)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 941
unfolding psubset_eq
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 942
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 943
2735
+ − 944
lemma vimage_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 945
shows "p \<bullet> (f -` A) = (p \<bullet> f) -` (p \<bullet> A)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 946
unfolding vimage_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 947
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 948
2735
+ − 949
lemma Union_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 950
shows "p \<bullet> (\<Union> S) = \<Union> (p \<bullet> S)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 951
unfolding Union_eq
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 952
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 953
2735
+ − 954
(* FIXME: eqvt attribute *)
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 955
lemma Sigma_eqvt:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 956
shows "(p \<bullet> (X \<times> Y)) = (p \<bullet> X) \<times> (p \<bullet> Y)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 957
unfolding Sigma_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 958
unfolding UNION_eq_Union_image
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 959
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 960
2735
+ − 961
lemma finite_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 962
shows "p \<bullet> finite A = finite (p \<bullet> A)"
2735
+ − 963
unfolding permute_finite permute_bool_def ..
+ − 964
+ − 965
subsubsection {* Equivariance for product operations *}
+ − 966
+ − 967
lemma fst_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 968
"p \<bullet> (fst x) = fst (p \<bullet> x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 969
by (cases x) simp
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 970
2735
+ − 971
lemma snd_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 972
"p \<bullet> (snd x) = snd (p \<bullet> x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 973
by (cases x) simp
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 974
2735
+ − 975
lemma split_eqvt [eqvt]:
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 976
shows "p \<bullet> (split P x) = split (p \<bullet> P) (p \<bullet> x)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 977
unfolding split_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 978
by (perm_simp) (rule refl)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 979
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 980
2735
+ − 981
subsubsection {* Equivariance for list operations *}
+ − 982
+ − 983
lemma append_eqvt [eqvt]:
+ − 984
shows "p \<bullet> (xs @ ys) = (p \<bullet> xs) @ (p \<bullet> ys)"
+ − 985
by (induct xs) auto
+ − 986
+ − 987
lemma rev_eqvt [eqvt]:
+ − 988
shows "p \<bullet> (rev xs) = rev (p \<bullet> xs)"
+ − 989
by (induct xs) (simp_all add: append_eqvt)
+ − 990
+ − 991
lemma map_eqvt [eqvt]:
+ − 992
shows "p \<bullet> (map f xs) = map (p \<bullet> f) (p \<bullet> xs)"
+ − 993
by (induct xs) (simp_all, simp only: permute_fun_app_eq)
+ − 994
+ − 995
lemma removeAll_eqvt [eqvt]:
+ − 996
shows "p \<bullet> (removeAll x xs) = removeAll (p \<bullet> x) (p \<bullet> xs)"
+ − 997
by (induct xs) (auto)
+ − 998
+ − 999
lemma filter_eqvt [eqvt]:
+ − 1000
shows "p \<bullet> (filter f xs) = filter (p \<bullet> f) (p \<bullet> xs)"
+ − 1001
apply(induct xs)
+ − 1002
apply(simp)
+ − 1003
apply(simp only: filter.simps permute_list.simps if_eqvt)
+ − 1004
apply(simp only: permute_fun_app_eq)
+ − 1005
done
+ − 1006
+ − 1007
lemma distinct_eqvt [eqvt]:
+ − 1008
shows "p \<bullet> (distinct xs) = distinct (p \<bullet> xs)"
+ − 1009
apply(induct xs)
+ − 1010
apply(simp add: permute_bool_def)
+ − 1011
apply(simp add: conj_eqvt Not_eqvt mem_eqvt set_eqvt)
+ − 1012
done
+ − 1013
+ − 1014
lemma length_eqvt [eqvt]:
+ − 1015
shows "p \<bullet> (length xs) = length (p \<bullet> xs)"
+ − 1016
by (induct xs) (simp_all add: permute_pure)
+ − 1017
+ − 1018
+ − 1019
subsubsection {* Equivariance for @{typ "'a fset"} *}
+ − 1020
+ − 1021
lemma in_fset_eqvt [eqvt]:
+ − 1022
shows "(p \<bullet> (x |\<in>| S)) = ((p \<bullet> x) |\<in>| (p \<bullet> S))"
+ − 1023
unfolding in_fset
+ − 1024
by (perm_simp) (simp)
+ − 1025
+ − 1026
lemma union_fset_eqvt [eqvt]:
+ − 1027
shows "(p \<bullet> (S |\<union>| T)) = ((p \<bullet> S) |\<union>| (p \<bullet> T))"
+ − 1028
by (induct S) (simp_all)
+ − 1029
+ − 1030
lemma map_fset_eqvt [eqvt]:
+ − 1031
shows "p \<bullet> (map_fset f S) = map_fset (p \<bullet> f) (p \<bullet> S)"
+ − 1032
by (lifting map_eqvt)
+ − 1033
+ − 1034
+ − 1035
section {* Supp, Freshness and Supports *}
1062
+ − 1036
+ − 1037
context pt
+ − 1038
begin
+ − 1039
+ − 1040
definition
+ − 1041
supp :: "'a \<Rightarrow> atom set"
+ − 1042
where
+ − 1043
"supp x = {a. infinite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}}"
+ − 1044
+ − 1045
definition
2732
+ − 1046
fresh :: "atom \<Rightarrow> 'a \<Rightarrow> bool" ("_ \<sharp> _" [55, 55] 55)
1062
+ − 1047
where
+ − 1048
"a \<sharp> x \<equiv> a \<notin> supp x"
+ − 1049
2732
+ − 1050
end
+ − 1051
1062
+ − 1052
lemma supp_conv_fresh:
+ − 1053
shows "supp x = {a. \<not> a \<sharp> x}"
+ − 1054
unfolding fresh_def by simp
+ − 1055
+ − 1056
lemma swap_rel_trans:
+ − 1057
assumes "sort_of a = sort_of b"
+ − 1058
assumes "sort_of b = sort_of c"
+ − 1059
assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
+ − 1060
assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
+ − 1061
shows "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 1062
proof (cases)
+ − 1063
assume "a = b \<or> c = b"
+ − 1064
with assms show "(a \<rightleftharpoons> b) \<bullet> x = x" by auto
+ − 1065
next
+ − 1066
assume *: "\<not> (a = b \<or> c = b)"
+ − 1067
have "((a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c)) \<bullet> x = x"
+ − 1068
using assms by simp
+ − 1069
also have "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
+ − 1070
using assms * by (simp add: swap_triple)
+ − 1071
finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
+ − 1072
qed
+ − 1073
+ − 1074
lemma swap_fresh_fresh:
+ − 1075
assumes a: "a \<sharp> x"
+ − 1076
and b: "b \<sharp> x"
+ − 1077
shows "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 1078
proof (cases)
+ − 1079
assume asm: "sort_of a = sort_of b"
+ − 1080
have "finite {c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x}" "finite {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x}"
+ − 1081
using a b unfolding fresh_def supp_def by simp_all
+ − 1082
then have "finite ({c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x} \<union> {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x})" by simp
+ − 1083
then obtain c
+ − 1084
where "(a \<rightleftharpoons> c) \<bullet> x = x" "(b \<rightleftharpoons> c) \<bullet> x = x" "sort_of c = sort_of b"
+ − 1085
by (rule obtain_atom) (auto)
+ − 1086
then show "(a \<rightleftharpoons> b) \<bullet> x = x" using asm by (rule_tac swap_rel_trans) (simp_all)
+ − 1087
next
+ − 1088
assume "sort_of a \<noteq> sort_of b"
+ − 1089
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by simp
+ − 1090
qed
+ − 1091
+ − 1092
+ − 1093
subsection {* supp and fresh are equivariant *}
+ − 1094
+ − 1095
lemma finite_Collect_bij:
+ − 1096
assumes a: "bij f"
+ − 1097
shows "finite {x. P (f x)} = finite {x. P x}"
+ − 1098
by (metis a finite_vimage_iff vimage_Collect_eq)
+ − 1099
+ − 1100
lemma fresh_permute_iff:
+ − 1101
shows "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x"
+ − 1102
proof -
+ − 1103
have "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
+ − 1104
unfolding fresh_def supp_def by simp
+ − 1105
also have "\<dots> \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> p \<bullet> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
1879
+ − 1106
using bij_permute by (rule finite_Collect_bij[symmetric])
1062
+ − 1107
also have "\<dots> \<longleftrightarrow> finite {b. p \<bullet> (a \<rightleftharpoons> b) \<bullet> x \<noteq> p \<bullet> x}"
+ − 1108
by (simp only: permute_eqvt [of p] swap_eqvt)
+ − 1109
also have "\<dots> \<longleftrightarrow> finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"
+ − 1110
by (simp only: permute_eq_iff)
+ − 1111
also have "\<dots> \<longleftrightarrow> a \<sharp> x"
+ − 1112
unfolding fresh_def supp_def by simp
1879
+ − 1113
finally show "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x" .
1062
+ − 1114
qed
+ − 1115
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1116
lemma fresh_eqvt [eqvt]:
1062
+ − 1117
shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
1879
+ − 1118
unfolding permute_bool_def
+ − 1119
by (simp add: fresh_permute_iff)
1062
+ − 1120
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1121
lemma supp_eqvt [eqvt]:
1062
+ − 1122
shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
+ − 1123
unfolding supp_conv_fresh
1879
+ − 1124
unfolding Collect_def
+ − 1125
unfolding permute_fun_def
1062
+ − 1126
by (simp add: Not_eqvt fresh_eqvt)
+ − 1127
2683
+ − 1128
lemma fresh_permute_left:
+ − 1129
shows "a \<sharp> p \<bullet> x \<longleftrightarrow> - p \<bullet> a \<sharp> x"
+ − 1130
proof
+ − 1131
assume "a \<sharp> p \<bullet> x"
+ − 1132
then have "- p \<bullet> a \<sharp> - p \<bullet> p \<bullet> x" by (simp only: fresh_permute_iff)
+ − 1133
then show "- p \<bullet> a \<sharp> x" by simp
+ − 1134
next
+ − 1135
assume "- p \<bullet> a \<sharp> x"
+ − 1136
then have "p \<bullet> - p \<bullet> a \<sharp> p \<bullet> x" by (simp only: fresh_permute_iff)
+ − 1137
then show "a \<sharp> p \<bullet> x" by simp
+ − 1138
qed
+ − 1139
+ − 1140
2735
+ − 1141
section {* supports *}
1062
+ − 1142
+ − 1143
definition
+ − 1144
supports :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" (infixl "supports" 80)
+ − 1145
where
+ − 1146
"S supports x \<equiv> \<forall>a b. (a \<notin> S \<and> b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x)"
+ − 1147
+ − 1148
lemma supp_is_subset:
+ − 1149
fixes S :: "atom set"
+ − 1150
and x :: "'a::pt"
+ − 1151
assumes a1: "S supports x"
+ − 1152
and a2: "finite S"
+ − 1153
shows "(supp x) \<subseteq> S"
+ − 1154
proof (rule ccontr)
1879
+ − 1155
assume "\<not> (supp x \<subseteq> S)"
1062
+ − 1156
then obtain a where b1: "a \<in> supp x" and b2: "a \<notin> S" by auto
1879
+ − 1157
from a1 b2 have "\<forall>b. b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x" unfolding supports_def by auto
+ − 1158
then have "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x} \<subseteq> S" by auto
2732
+ − 1159
with a2 have "finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}" by (simp add: finite_subset)
1062
+ − 1160
then have "a \<notin> (supp x)" unfolding supp_def by simp
+ − 1161
with b1 show False by simp
+ − 1162
qed
+ − 1163
+ − 1164
lemma supports_finite:
+ − 1165
fixes S :: "atom set"
+ − 1166
and x :: "'a::pt"
+ − 1167
assumes a1: "S supports x"
+ − 1168
and a2: "finite S"
+ − 1169
shows "finite (supp x)"
+ − 1170
proof -
+ − 1171
have "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
+ − 1172
then show "finite (supp x)" using a2 by (simp add: finite_subset)
+ − 1173
qed
+ − 1174
+ − 1175
lemma supp_supports:
+ − 1176
fixes x :: "'a::pt"
+ − 1177
shows "(supp x) supports x"
1879
+ − 1178
unfolding supports_def
+ − 1179
proof (intro strip)
1062
+ − 1180
fix a b
+ − 1181
assume "a \<notin> (supp x) \<and> b \<notin> (supp x)"
+ − 1182
then have "a \<sharp> x" and "b \<sharp> x" by (simp_all add: fresh_def)
1879
+ − 1183
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
1062
+ − 1184
qed
+ − 1185
+ − 1186
lemma supp_is_least_supports:
+ − 1187
fixes S :: "atom set"
+ − 1188
and x :: "'a::pt"
+ − 1189
assumes a1: "S supports x"
+ − 1190
and a2: "finite S"
+ − 1191
and a3: "\<And>S'. finite S' \<Longrightarrow> (S' supports x) \<Longrightarrow> S \<subseteq> S'"
+ − 1192
shows "(supp x) = S"
+ − 1193
proof (rule equalityI)
+ − 1194
show "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
+ − 1195
with a2 have fin: "finite (supp x)" by (rule rev_finite_subset)
+ − 1196
have "(supp x) supports x" by (rule supp_supports)
+ − 1197
with fin a3 show "S \<subseteq> supp x" by blast
+ − 1198
qed
+ − 1199
+ − 1200
lemma subsetCI:
+ − 1201
shows "(\<And>x. x \<in> A \<Longrightarrow> x \<notin> B \<Longrightarrow> False) \<Longrightarrow> A \<subseteq> B"
+ − 1202
by auto
+ − 1203
+ − 1204
lemma finite_supp_unique:
+ − 1205
assumes a1: "S supports x"
+ − 1206
assumes a2: "finite S"
+ − 1207
assumes a3: "\<And>a b. \<lbrakk>a \<in> S; b \<notin> S; sort_of a = sort_of b\<rbrakk> \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
+ − 1208
shows "(supp x) = S"
+ − 1209
using a1 a2
+ − 1210
proof (rule supp_is_least_supports)
+ − 1211
fix S'
+ − 1212
assume "finite S'" and "S' supports x"
+ − 1213
show "S \<subseteq> S'"
+ − 1214
proof (rule subsetCI)
+ − 1215
fix a
+ − 1216
assume "a \<in> S" and "a \<notin> S'"
+ − 1217
have "finite (S \<union> S')"
+ − 1218
using `finite S` `finite S'` by simp
+ − 1219
then obtain b where "b \<notin> S \<union> S'" and "sort_of b = sort_of a"
+ − 1220
by (rule obtain_atom)
+ − 1221
then have "b \<notin> S" and "b \<notin> S'" and "sort_of a = sort_of b"
+ − 1222
by simp_all
+ − 1223
then have "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 1224
using `a \<notin> S'` `S' supports x` by (simp add: supports_def)
+ − 1225
moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
+ − 1226
using `a \<in> S` `b \<notin> S` `sort_of a = sort_of b`
+ − 1227
by (rule a3)
+ − 1228
ultimately show "False" by simp
+ − 1229
qed
+ − 1230
qed
+ − 1231
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1232
section {* Support w.r.t. relations *}
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1233
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1234
text {*
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1235
This definition is used for unquotient types, where
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1236
alpha-equivalence does not coincide with equality.
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1237
*}
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1238
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1239
definition
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1240
"supp_rel R x = {a. infinite {b. \<not>(R ((a \<rightleftharpoons> b) \<bullet> x) x)}}"
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1241
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1242
2735
+ − 1243
1062
+ − 1244
section {* Finitely-supported types *}
+ − 1245
+ − 1246
class fs = pt +
+ − 1247
assumes finite_supp: "finite (supp x)"
+ − 1248
+ − 1249
lemma pure_supp:
2735
+ − 1250
fixes x::"'a::pure"
+ − 1251
shows "supp x = {}"
1062
+ − 1252
unfolding supp_def by (simp add: permute_pure)
+ − 1253
+ − 1254
lemma pure_fresh:
+ − 1255
fixes x::"'a::pure"
+ − 1256
shows "a \<sharp> x"
+ − 1257
unfolding fresh_def by (simp add: pure_supp)
+ − 1258
+ − 1259
instance pure < fs
+ − 1260
by default (simp add: pure_supp)
+ − 1261
+ − 1262
+ − 1263
subsection {* Type @{typ atom} is finitely-supported. *}
+ − 1264
+ − 1265
lemma supp_atom:
+ − 1266
shows "supp a = {a}"
+ − 1267
apply (rule finite_supp_unique)
+ − 1268
apply (clarsimp simp add: supports_def)
+ − 1269
apply simp
+ − 1270
apply simp
+ − 1271
done
+ − 1272
+ − 1273
lemma fresh_atom:
+ − 1274
shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
+ − 1275
unfolding fresh_def supp_atom by simp
+ − 1276
+ − 1277
instance atom :: fs
+ − 1278
by default (simp add: supp_atom)
+ − 1279
1933
9eab1dfc14d2
moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1280
1062
+ − 1281
section {* Type @{typ perm} is finitely-supported. *}
+ − 1282
+ − 1283
lemma perm_swap_eq:
+ − 1284
shows "(a \<rightleftharpoons> b) \<bullet> p = p \<longleftrightarrow> (p \<bullet> (a \<rightleftharpoons> b)) = (a \<rightleftharpoons> b)"
+ − 1285
unfolding permute_perm_def
+ − 1286
by (metis add_diff_cancel minus_perm_def)
+ − 1287
+ − 1288
lemma supports_perm:
+ − 1289
shows "{a. p \<bullet> a \<noteq> a} supports p"
+ − 1290
unfolding supports_def
1879
+ − 1291
unfolding perm_swap_eq
+ − 1292
by (simp add: swap_eqvt)
1062
+ − 1293
+ − 1294
lemma finite_perm_lemma:
+ − 1295
shows "finite {a::atom. p \<bullet> a \<noteq> a}"
+ − 1296
using finite_Rep_perm [of p]
+ − 1297
unfolding permute_atom_def .
+ − 1298
+ − 1299
lemma supp_perm:
+ − 1300
shows "supp p = {a. p \<bullet> a \<noteq> a}"
+ − 1301
apply (rule finite_supp_unique)
+ − 1302
apply (rule supports_perm)
+ − 1303
apply (rule finite_perm_lemma)
+ − 1304
apply (simp add: perm_swap_eq swap_eqvt)
2732
+ − 1305
apply (auto simp add: perm_eq_iff swap_atom)
1062
+ − 1306
done
+ − 1307
+ − 1308
lemma fresh_perm:
+ − 1309
shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
1879
+ − 1310
unfolding fresh_def
+ − 1311
by (simp add: supp_perm)
1062
+ − 1312
+ − 1313
lemma supp_swap:
+ − 1314
shows "supp (a \<rightleftharpoons> b) = (if a = b \<or> sort_of a \<noteq> sort_of b then {} else {a, b})"
+ − 1315
by (auto simp add: supp_perm swap_atom)
+ − 1316
+ − 1317
lemma fresh_zero_perm:
+ − 1318
shows "a \<sharp> (0::perm)"
+ − 1319
unfolding fresh_perm by simp
+ − 1320
+ − 1321
lemma supp_zero_perm:
+ − 1322
shows "supp (0::perm) = {}"
+ − 1323
unfolding supp_perm by simp
+ − 1324
1087
+ − 1325
lemma fresh_plus_perm:
+ − 1326
fixes p q::perm
+ − 1327
assumes "a \<sharp> p" "a \<sharp> q"
+ − 1328
shows "a \<sharp> (p + q)"
+ − 1329
using assms
+ − 1330
unfolding fresh_def
+ − 1331
by (auto simp add: supp_perm)
+ − 1332
1062
+ − 1333
lemma supp_plus_perm:
+ − 1334
fixes p q::perm
+ − 1335
shows "supp (p + q) \<subseteq> supp p \<union> supp q"
+ − 1336
by (auto simp add: supp_perm)
+ − 1337
1087
+ − 1338
lemma fresh_minus_perm:
+ − 1339
fixes p::perm
+ − 1340
shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
+ − 1341
unfolding fresh_def
1879
+ − 1342
unfolding supp_perm
+ − 1343
apply(simp)
+ − 1344
apply(metis permute_minus_cancel)
1087
+ − 1345
done
+ − 1346
1062
+ − 1347
lemma supp_minus_perm:
+ − 1348
fixes p::perm
+ − 1349
shows "supp (- p) = supp p"
1087
+ − 1350
unfolding supp_conv_fresh
+ − 1351
by (simp add: fresh_minus_perm)
1062
+ − 1352
1305
+ − 1353
lemma plus_perm_eq:
+ − 1354
fixes p q::"perm"
1879
+ − 1355
assumes asm: "supp p \<inter> supp q = {}"
1305
+ − 1356
shows "p + q = q + p"
2732
+ − 1357
unfolding perm_eq_iff
1305
+ − 1358
proof
+ − 1359
fix a::"atom"
+ − 1360
show "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1361
proof -
+ − 1362
{ assume "a \<notin> supp p" "a \<notin> supp q"
+ − 1363
then have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1364
by (simp add: supp_perm)
+ − 1365
}
+ − 1366
moreover
+ − 1367
{ assume a: "a \<in> supp p" "a \<notin> supp q"
+ − 1368
then have "p \<bullet> a \<in> supp p" by (simp add: supp_perm)
+ − 1369
then have "p \<bullet> a \<notin> supp q" using asm by auto
+ − 1370
with a have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1371
by (simp add: supp_perm)
+ − 1372
}
+ − 1373
moreover
+ − 1374
{ assume a: "a \<notin> supp p" "a \<in> supp q"
+ − 1375
then have "q \<bullet> a \<in> supp q" by (simp add: supp_perm)
+ − 1376
then have "q \<bullet> a \<notin> supp p" using asm by auto
+ − 1377
with a have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1378
by (simp add: supp_perm)
+ − 1379
}
+ − 1380
ultimately show "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1381
using asm by blast
+ − 1382
qed
+ − 1383
qed
1062
+ − 1384
2614
+ − 1385
lemma supp_plus_perm_eq:
+ − 1386
fixes p q::perm
+ − 1387
assumes asm: "supp p \<inter> supp q = {}"
+ − 1388
shows "supp (p + q) = supp p \<union> supp q"
+ − 1389
proof -
+ − 1390
{ fix a::"atom"
+ − 1391
assume "a \<in> supp p"
+ − 1392
then have "a \<notin> supp q" using asm by auto
+ − 1393
then have "a \<in> supp (p + q)" using `a \<in> supp p`
+ − 1394
by (simp add: supp_perm)
+ − 1395
}
+ − 1396
moreover
+ − 1397
{ fix a::"atom"
+ − 1398
assume "a \<in> supp q"
+ − 1399
then have "a \<notin> supp p" using asm by auto
+ − 1400
then have "a \<in> supp (q + p)" using `a \<in> supp q`
+ − 1401
by (simp add: supp_perm)
+ − 1402
then have "a \<in> supp (p + q)" using asm plus_perm_eq
+ − 1403
by metis
+ − 1404
}
+ − 1405
ultimately have "supp p \<union> supp q \<subseteq> supp (p + q)"
+ − 1406
by blast
+ − 1407
then show "supp (p + q) = supp p \<union> supp q" using supp_plus_perm
+ − 1408
by blast
+ − 1409
qed
+ − 1410
2735
+ − 1411
instance perm :: fs
+ − 1412
by default (simp add: supp_perm finite_perm_lemma)
+ − 1413
+ − 1414
2614
+ − 1415
1062
+ − 1416
section {* Finite Support instances for other types *}
+ − 1417
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1418
1062
+ − 1419
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
+ − 1420
+ − 1421
lemma supp_Pair:
+ − 1422
shows "supp (x, y) = supp x \<union> supp y"
+ − 1423
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
+ − 1424
+ − 1425
lemma fresh_Pair:
+ − 1426
shows "a \<sharp> (x, y) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> y"
+ − 1427
by (simp add: fresh_def supp_Pair)
+ − 1428
2470
+ − 1429
lemma supp_Unit:
+ − 1430
shows "supp () = {}"
+ − 1431
by (simp add: supp_def)
+ − 1432
+ − 1433
lemma fresh_Unit:
+ − 1434
shows "a \<sharp> ()"
+ − 1435
by (simp add: fresh_def supp_Unit)
+ − 1436
2378
+ − 1437
instance prod :: (fs, fs) fs
1062
+ − 1438
apply default
+ − 1439
apply (induct_tac x)
+ − 1440
apply (simp add: supp_Pair finite_supp)
+ − 1441
done
+ − 1442
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1443
1062
+ − 1444
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
+ − 1445
+ − 1446
lemma supp_Inl:
+ − 1447
shows "supp (Inl x) = supp x"
+ − 1448
by (simp add: supp_def)
+ − 1449
+ − 1450
lemma supp_Inr:
+ − 1451
shows "supp (Inr x) = supp x"
+ − 1452
by (simp add: supp_def)
+ − 1453
+ − 1454
lemma fresh_Inl:
+ − 1455
shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
+ − 1456
by (simp add: fresh_def supp_Inl)
+ − 1457
+ − 1458
lemma fresh_Inr:
+ − 1459
shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
+ − 1460
by (simp add: fresh_def supp_Inr)
+ − 1461
2378
+ − 1462
instance sum :: (fs, fs) fs
1062
+ − 1463
apply default
+ − 1464
apply (induct_tac x)
+ − 1465
apply (simp_all add: supp_Inl supp_Inr finite_supp)
+ − 1466
done
+ − 1467
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1468
1062
+ − 1469
subsection {* Type @{typ "'a option"} is finitely supported *}
+ − 1470
+ − 1471
lemma supp_None:
+ − 1472
shows "supp None = {}"
+ − 1473
by (simp add: supp_def)
+ − 1474
+ − 1475
lemma supp_Some:
+ − 1476
shows "supp (Some x) = supp x"
+ − 1477
by (simp add: supp_def)
+ − 1478
+ − 1479
lemma fresh_None:
+ − 1480
shows "a \<sharp> None"
+ − 1481
by (simp add: fresh_def supp_None)
+ − 1482
+ − 1483
lemma fresh_Some:
+ − 1484
shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
+ − 1485
by (simp add: fresh_def supp_Some)
+ − 1486
+ − 1487
instance option :: (fs) fs
+ − 1488
apply default
+ − 1489
apply (induct_tac x)
+ − 1490
apply (simp_all add: supp_None supp_Some finite_supp)
+ − 1491
done
+ − 1492
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1493
1062
+ − 1494
subsubsection {* Type @{typ "'a list"} is finitely supported *}
+ − 1495
+ − 1496
lemma supp_Nil:
+ − 1497
shows "supp [] = {}"
+ − 1498
by (simp add: supp_def)
+ − 1499
+ − 1500
lemma supp_Cons:
+ − 1501
shows "supp (x # xs) = supp x \<union> supp xs"
+ − 1502
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
+ − 1503
2591
+ − 1504
lemma supp_append:
+ − 1505
shows "supp (xs @ ys) = supp xs \<union> supp ys"
+ − 1506
by (induct xs) (auto simp add: supp_Nil supp_Cons)
+ − 1507
1062
+ − 1508
lemma fresh_Nil:
+ − 1509
shows "a \<sharp> []"
+ − 1510
by (simp add: fresh_def supp_Nil)
+ − 1511
+ − 1512
lemma fresh_Cons:
+ − 1513
shows "a \<sharp> (x # xs) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> xs"
+ − 1514
by (simp add: fresh_def supp_Cons)
+ − 1515
2591
+ − 1516
lemma fresh_append:
+ − 1517
shows "a \<sharp> (xs @ ys) \<longleftrightarrow> a \<sharp> xs \<and> a \<sharp> ys"
+ − 1518
by (induct xs) (simp_all add: fresh_Nil fresh_Cons)
+ − 1519
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1520
lemma supp_rev:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1521
shows "supp (rev xs) = supp xs"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1522
by (induct xs) (auto simp add: supp_append supp_Cons supp_Nil)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1523
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1524
lemma fresh_rev:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1525
shows "a \<sharp> rev xs \<longleftrightarrow> a \<sharp> xs"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1526
by (induct xs) (auto simp add: fresh_append fresh_Cons fresh_Nil)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1527
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1528
lemma supp_removeAll:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1529
fixes x::"atom"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1530
shows "supp (removeAll x xs) = supp xs - {x}"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1531
by (induct xs)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1532
(auto simp add: supp_Nil supp_Cons supp_atom)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1533
2735
+ − 1534
lemma supp_of_atom_list:
+ − 1535
fixes as::"atom list"
+ − 1536
shows "supp as = set as"
+ − 1537
by (induct as)
+ − 1538
(simp_all add: supp_Nil supp_Cons supp_atom)
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1539
1062
+ − 1540
instance list :: (fs) fs
+ − 1541
apply default
+ − 1542
apply (induct_tac x)
+ − 1543
apply (simp_all add: supp_Nil supp_Cons finite_supp)
+ − 1544
done
+ − 1545
2466
+ − 1546
2470
+ − 1547
section {* Support and Freshness for Applications *}
1062
+ − 1548
1879
+ − 1549
lemma fresh_conv_MOST:
+ − 1550
shows "a \<sharp> x \<longleftrightarrow> (MOST b. (a \<rightleftharpoons> b) \<bullet> x = x)"
+ − 1551
unfolding fresh_def supp_def
+ − 1552
unfolding MOST_iff_cofinite by simp
+ − 1553
+ − 1554
lemma fresh_fun_app:
+ − 1555
assumes "a \<sharp> f" and "a \<sharp> x"
+ − 1556
shows "a \<sharp> f x"
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1557
using assms
1879
+ − 1558
unfolding fresh_conv_MOST
2732
+ − 1559
unfolding permute_fun_app_eq
1879
+ − 1560
by (elim MOST_rev_mp, simp)
+ − 1561
1062
+ − 1562
lemma supp_fun_app:
+ − 1563
shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
1879
+ − 1564
using fresh_fun_app
+ − 1565
unfolding fresh_def
+ − 1566
by auto
+ − 1567
2732
+ − 1568
2735
+ − 1569
subsection {* Equivariance Predicate @{text eqvt} and @{text eqvt_at}*}
2663
+ − 1570
+ − 1571
definition
+ − 1572
"eqvt f \<equiv> \<forall>p. p \<bullet> f = f"
+ − 1573
2735
+ − 1574
+ − 1575
text {* equivariance of a function at a given argument *}
+ − 1576
+ − 1577
definition
+ − 1578
"eqvt_at f x \<equiv> \<forall>p. p \<bullet> (f x) = f (p \<bullet> x)"
+ − 1579
+ − 1580
2663
+ − 1581
lemma eqvtI:
+ − 1582
shows "(\<And>p. p \<bullet> f \<equiv> f) \<Longrightarrow> eqvt f"
+ − 1583
unfolding eqvt_def
+ − 1584
by simp
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1585
1941
+ − 1586
lemma supp_fun_eqvt:
2663
+ − 1587
assumes a: "eqvt f"
1941
+ − 1588
shows "supp f = {}"
2663
+ − 1589
using a
+ − 1590
unfolding eqvt_def
1941
+ − 1591
unfolding supp_def
2663
+ − 1592
by simp
1941
+ − 1593
1062
+ − 1594
lemma fresh_fun_eqvt_app:
2663
+ − 1595
assumes a: "eqvt f"
1062
+ − 1596
shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
+ − 1597
proof -
1941
+ − 1598
from a have "supp f = {}" by (simp add: supp_fun_eqvt)
1879
+ − 1599
then show "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
1062
+ − 1600
unfolding fresh_def
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1601
using supp_fun_app by auto
1062
+ − 1602
qed
+ − 1603
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1604
lemma supp_fun_app_eqvt:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1605
assumes a: "eqvt f"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1606
shows "supp (f x) \<subseteq> supp x"
2735
+ − 1607
using fresh_fun_eqvt_app[OF a]
+ − 1608
unfolding fresh_def
+ − 1609
by auto
2663
+ − 1610
+ − 1611
lemma supp_eqvt_at:
+ − 1612
assumes asm: "eqvt_at f x"
+ − 1613
and fin: "finite (supp x)"
+ − 1614
shows "supp (f x) \<subseteq> supp x"
+ − 1615
apply(rule supp_is_subset)
+ − 1616
unfolding supports_def
+ − 1617
unfolding fresh_def[symmetric]
+ − 1618
using asm
+ − 1619
apply(simp add: eqvt_at_def)
+ − 1620
apply(simp add: swap_fresh_fresh)
+ − 1621
apply(rule fin)
+ − 1622
done
+ − 1623
+ − 1624
lemma finite_supp_eqvt_at:
+ − 1625
assumes asm: "eqvt_at f x"
+ − 1626
and fin: "finite (supp x)"
+ − 1627
shows "finite (supp (f x))"
+ − 1628
apply(rule finite_subset)
+ − 1629
apply(rule supp_eqvt_at[OF asm fin])
+ − 1630
apply(rule fin)
+ − 1631
done
+ − 1632
+ − 1633
lemma fresh_eqvt_at:
+ − 1634
assumes asm: "eqvt_at f x"
+ − 1635
and fin: "finite (supp x)"
+ − 1636
and fresh: "a \<sharp> x"
+ − 1637
shows "a \<sharp> f x"
+ − 1638
using fresh
+ − 1639
unfolding fresh_def
+ − 1640
using supp_eqvt_at[OF asm fin]
+ − 1641
by auto
+ − 1642
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1643
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1644
subsection {* helper functions for nominal_functions *}
2663
+ − 1645
+ − 1646
lemma the_default_eqvt:
+ − 1647
assumes unique: "\<exists>!x. P x"
+ − 1648
shows "(p \<bullet> (THE_default d P)) = (THE_default d (p \<bullet> P))"
+ − 1649
apply(rule THE_default1_equality [symmetric])
+ − 1650
apply(rule_tac p="-p" in permute_boolE)
+ − 1651
apply(simp add: ex1_eqvt)
+ − 1652
apply(rule unique)
+ − 1653
apply(rule_tac p="-p" in permute_boolE)
+ − 1654
apply(rule subst[OF permute_fun_app_eq])
+ − 1655
apply(simp)
+ − 1656
apply(rule THE_defaultI'[OF unique])
+ − 1657
done
+ − 1658
2708
+ − 1659
lemma fundef_ex1_eqvt2:
+ − 1660
fixes x::"'a::pt"
+ − 1661
assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
+ − 1662
assumes eqvt: "eqvt_at G x"
+ − 1663
assumes ex1: "\<exists>!y. G x y"
+ − 1664
shows "(p \<bullet> (f x)) = f (p \<bullet> x)"
+ − 1665
apply(simp only: f_def)
+ − 1666
apply(subst the_default_eqvt)
+ − 1667
apply(rule ex1)
+ − 1668
using eqvt
+ − 1669
unfolding eqvt_at_def
+ − 1670
apply(simp)
+ − 1671
done
+ − 1672
2663
+ − 1673
lemma fundef_ex1_eqvt:
+ − 1674
fixes x::"'a::pt"
+ − 1675
assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
+ − 1676
assumes eqvt: "eqvt G"
+ − 1677
assumes ex1: "\<exists>!y. G x y"
+ − 1678
shows "(p \<bullet> (f x)) = f (p \<bullet> x)"
+ − 1679
apply(simp only: f_def)
+ − 1680
apply(subst the_default_eqvt)
+ − 1681
apply(rule ex1)
+ − 1682
using eqvt
+ − 1683
unfolding eqvt_def
+ − 1684
apply(simp add: permute_fun_app_eq)
+ − 1685
done
+ − 1686
2708
+ − 1687
lemma fundef_ex1_eqvt_at2:
+ − 1688
fixes x::"'a::pt"
+ − 1689
assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
+ − 1690
assumes eqvt: "eqvt_at G x"
+ − 1691
assumes ex1: "\<exists>!y. G x y"
+ − 1692
shows "eqvt_at f x"
+ − 1693
unfolding eqvt_at_def
+ − 1694
using assms
+ − 1695
by (auto intro: fundef_ex1_eqvt2)
+ − 1696
2663
+ − 1697
lemma fundef_ex1_eqvt_at:
+ − 1698
fixes x::"'a::pt"
+ − 1699
assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
+ − 1700
assumes eqvt: "eqvt G"
+ − 1701
assumes ex1: "\<exists>!y. G x y"
+ − 1702
shows "eqvt_at f x"
+ − 1703
unfolding eqvt_at_def
+ − 1704
using assms
+ − 1705
by (auto intro: fundef_ex1_eqvt)
+ − 1706
2735
+ − 1707
2466
+ − 1708
section {* Support of Finite Sets of Finitely Supported Elements *}
+ − 1709
2657
+ − 1710
text {* support and freshness for atom sets *}
+ − 1711
+ − 1712
lemma supp_finite_atom_set:
+ − 1713
fixes S::"atom set"
+ − 1714
assumes "finite S"
+ − 1715
shows "supp S = S"
+ − 1716
apply(rule finite_supp_unique)
+ − 1717
apply(simp add: supports_def)
+ − 1718
apply(simp add: swap_set_not_in)
+ − 1719
apply(rule assms)
+ − 1720
apply(simp add: swap_set_in)
+ − 1721
done
+ − 1722
+ − 1723
lemma fresh_finite_atom_set:
+ − 1724
fixes S::"atom set"
+ − 1725
assumes "finite S"
+ − 1726
shows "a \<sharp> S \<longleftrightarrow> a \<notin> S"
+ − 1727
unfolding fresh_def
+ − 1728
by (simp add: supp_finite_atom_set[OF assms])
+ − 1729
2679
+ − 1730
lemma fresh_minus_atom_set:
+ − 1731
fixes S::"atom set"
+ − 1732
assumes "finite S"
+ − 1733
shows "a \<sharp> S - T \<longleftrightarrow> (a \<notin> T \<longrightarrow> a \<sharp> S)"
+ − 1734
unfolding fresh_def
+ − 1735
by (auto simp add: supp_finite_atom_set assms)
+ − 1736
2466
+ − 1737
lemma Union_supports_set:
+ − 1738
shows "(\<Union>x \<in> S. supp x) supports S"
+ − 1739
proof -
+ − 1740
{ fix a b
+ − 1741
have "\<forall>x \<in> S. (a \<rightleftharpoons> b) \<bullet> x = x \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> S = S"
+ − 1742
unfolding permute_set_eq by force
+ − 1743
}
+ − 1744
then show "(\<Union>x \<in> S. supp x) supports S"
+ − 1745
unfolding supports_def
+ − 1746
by (simp add: fresh_def[symmetric] swap_fresh_fresh)
+ − 1747
qed
+ − 1748
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1749
lemma Union_of_finite_supp_sets:
2466
+ − 1750
fixes S::"('a::fs set)"
+ − 1751
assumes fin: "finite S"
+ − 1752
shows "finite (\<Union>x\<in>S. supp x)"
+ − 1753
using fin by (induct) (auto simp add: finite_supp)
+ − 1754
+ − 1755
lemma Union_included_in_supp:
+ − 1756
fixes S::"('a::fs set)"
+ − 1757
assumes fin: "finite S"
+ − 1758
shows "(\<Union>x\<in>S. supp x) \<subseteq> supp S"
+ − 1759
proof -
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1760
have eqvt: "eqvt (\<lambda>S. \<Union> supp ` S)"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1761
unfolding eqvt_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1762
by (perm_simp) (simp)
2466
+ − 1763
have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)"
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1764
by (rule supp_finite_atom_set[symmetric]) (rule Union_of_finite_supp_sets[OF fin])
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1765
also have "\<dots> = supp ((\<lambda>S. \<Union> supp ` S) S)" by simp
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1766
also have "\<dots> \<subseteq> supp S" using eqvt
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1767
by (rule supp_fun_app_eqvt)
2466
+ − 1768
finally show "(\<Union>x\<in>S. supp x) \<subseteq> supp S" .
+ − 1769
qed
+ − 1770
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1771
lemma supp_of_finite_sets:
2466
+ − 1772
fixes S::"('a::fs set)"
+ − 1773
assumes fin: "finite S"
+ − 1774
shows "(supp S) = (\<Union>x\<in>S. supp x)"
+ − 1775
apply(rule subset_antisym)
+ − 1776
apply(rule supp_is_subset)
+ − 1777
apply(rule Union_supports_set)
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1778
apply(rule Union_of_finite_supp_sets[OF fin])
2466
+ − 1779
apply(rule Union_included_in_supp[OF fin])
+ − 1780
done
+ − 1781
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1782
lemma finite_sets_supp:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1783
fixes S::"('a::fs set)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1784
assumes "finite S"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1785
shows "finite (supp S)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1786
using assms
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1787
by (simp only: supp_of_finite_sets Union_of_finite_supp_sets)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1788
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1789
lemma supp_of_finite_union:
2466
+ − 1790
fixes S T::"('a::fs) set"
+ − 1791
assumes fin1: "finite S"
+ − 1792
and fin2: "finite T"
+ − 1793
shows "supp (S \<union> T) = supp S \<union> supp T"
+ − 1794
using fin1 fin2
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1795
by (simp add: supp_of_finite_sets)
2466
+ − 1796
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1797
lemma supp_of_finite_insert:
2466
+ − 1798
fixes S::"('a::fs) set"
+ − 1799
assumes fin: "finite S"
+ − 1800
shows "supp (insert x S) = supp x \<union> supp S"
+ − 1801
using fin
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1802
by (simp add: supp_of_finite_sets)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1803
2588
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1804
lemma fresh_finite_insert:
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1805
fixes S::"('a::fs) set"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1806
assumes fin: "finite S"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1807
shows "a \<sharp> (insert x S) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1808
using fin unfolding fresh_def
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1809
by (simp add: supp_of_finite_insert)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1810
2591
+ − 1811
lemma supp_set_empty:
+ − 1812
shows "supp {} = {}"
+ − 1813
unfolding supp_def
+ − 1814
by (simp add: empty_eqvt)
+ − 1815
+ − 1816
lemma fresh_set_empty:
+ − 1817
shows "a \<sharp> {}"
+ − 1818
by (simp add: fresh_def supp_set_empty)
+ − 1819
+ − 1820
lemma supp_set:
+ − 1821
fixes xs :: "('a::fs) list"
+ − 1822
shows "supp (set xs) = supp xs"
+ − 1823
apply(induct xs)
+ − 1824
apply(simp add: supp_set_empty supp_Nil)
+ − 1825
apply(simp add: supp_Cons supp_of_finite_insert)
+ − 1826
done
+ − 1827
+ − 1828
lemma fresh_set:
+ − 1829
fixes xs :: "('a::fs) list"
+ − 1830
shows "a \<sharp> (set xs) \<longleftrightarrow> a \<sharp> xs"
+ − 1831
unfolding fresh_def
+ − 1832
by (simp add: supp_set)
+ − 1833
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1834
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1835
subsection {* Type @{typ "'a fset"} is finitely supported *}
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1836
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1837
lemma supp_fset [simp]:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1838
shows "supp (fset S) = supp S"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1839
unfolding supp_def
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1840
by (simp add: fset_eqvt fset_cong)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1841
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1842
lemma supp_empty_fset [simp]:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1843
shows "supp {||} = {}"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1844
unfolding supp_def
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1845
by simp
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1846
2641
+ − 1847
lemma fresh_empty_fset:
+ − 1848
shows "a \<sharp> {||}"
+ − 1849
unfolding fresh_def
+ − 1850
by (simp)
+ − 1851
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1852
lemma supp_insert_fset [simp]:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1853
fixes x::"'a::fs"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1854
and S::"'a fset"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1855
shows "supp (insert_fset x S) = supp x \<union> supp S"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1856
apply(subst supp_fset[symmetric])
2587
+ − 1857
apply(simp add: supp_of_finite_insert)
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1858
done
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1859
2641
+ − 1860
lemma fresh_insert_fset:
+ − 1861
fixes x::"'a::fs"
+ − 1862
and S::"'a fset"
+ − 1863
shows "a \<sharp> insert_fset x S \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
+ − 1864
unfolding fresh_def
+ − 1865
by (simp)
+ − 1866
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1867
lemma fset_finite_supp:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1868
fixes S::"('a::fs) fset"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1869
shows "finite (supp S)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1870
by (induct S) (simp_all add: finite_supp)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1871
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1872
lemma supp_union_fset:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1873
fixes S T::"'a::fs fset"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1874
shows "supp (S |\<union>| T) = supp S \<union> supp T"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1875
by (induct S) (auto)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1876
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1877
lemma fresh_union_fset:
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1878
fixes S T::"'a::fs fset"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1879
shows "a \<sharp> S |\<union>| T \<longleftrightarrow> a \<sharp> S \<and> a \<sharp> T"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1880
unfolding fresh_def
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1881
by (simp add: supp_union_fset)
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1882
2735
+ − 1883
instance fset :: (fs) fs
+ − 1884
apply (default)
+ − 1885
apply (rule fset_finite_supp)
+ − 1886
done
+ − 1887
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1888
2632
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1889
section {* Freshness and Fresh-Star *}
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1890
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1891
lemma fresh_Unit_elim:
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1892
shows "(a \<sharp> () \<Longrightarrow> PROP C) \<equiv> PROP C"
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1893
by (simp add: fresh_Unit)
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1894
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1895
lemma fresh_Pair_elim:
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1896
shows "(a \<sharp> (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> a \<sharp> y \<Longrightarrow> PROP C)"
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1897
by rule (simp_all add: fresh_Pair)
2470
+ − 1898
2632
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1899
(* this rule needs to be added before the fresh_prodD is *)
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1900
(* added to the simplifier with mksimps *)
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1901
lemma [simp]:
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1902
shows "a \<sharp> x1 \<Longrightarrow> a \<sharp> x2 \<Longrightarrow> a \<sharp> (x1, x2)"
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1903
by (simp add: fresh_Pair)
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1904
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1905
lemma fresh_PairD:
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1906
shows "a \<sharp> (x, y) \<Longrightarrow> a \<sharp> x"
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1907
and "a \<sharp> (x, y) \<Longrightarrow> a \<sharp> y"
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1908
by (simp_all add: fresh_Pair)
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1909
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1910
ML {*
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1911
val mksimps_pairs = (@{const_name Nominal2_Base.fresh}, @{thms fresh_PairD}) :: mksimps_pairs;
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1912
*}
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1913
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1914
declaration {* fn _ =>
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1915
Simplifier.map_ss (fn ss => ss setmksimps (mksimps mksimps_pairs))
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1916
*}
2470
+ − 1917
+ − 1918
text {* The fresh-star generalisation of fresh is used in strong
+ − 1919
induction principles. *}
+ − 1920
+ − 1921
definition
+ − 1922
fresh_star :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp>* _" [80,80] 80)
+ − 1923
where
+ − 1924
"as \<sharp>* x \<equiv> \<forall>a \<in> as. a \<sharp> x"
+ − 1925
2507
+ − 1926
lemma fresh_star_supp_conv:
+ − 1927
shows "supp x \<sharp>* y \<Longrightarrow> supp y \<sharp>* x"
+ − 1928
by (auto simp add: fresh_star_def fresh_def)
+ − 1929
2675
+ − 1930
lemma fresh_star_perm_set_conv:
+ − 1931
fixes p::"perm"
+ − 1932
assumes fresh: "as \<sharp>* p"
+ − 1933
and fin: "finite as"
+ − 1934
shows "supp p \<sharp>* as"
+ − 1935
apply(rule fresh_star_supp_conv)
+ − 1936
apply(simp add: supp_finite_atom_set fin fresh)
+ − 1937
done
+ − 1938
2679
+ − 1939
lemma fresh_star_atom_set_conv:
+ − 1940
assumes fresh: "as \<sharp>* bs"
+ − 1941
and fin: "finite as" "finite bs"
+ − 1942
shows "bs \<sharp>* as"
+ − 1943
using fresh
+ − 1944
unfolding fresh_star_def fresh_def
+ − 1945
by (auto simp add: supp_finite_atom_set fin)
+ − 1946
2730
+ − 1947
lemma atom_fresh_star_disjoint:
+ − 1948
assumes fin: "finite bs"
+ − 1949
shows "as \<sharp>* bs \<longleftrightarrow> (as \<inter> bs = {})"
+ − 1950
+ − 1951
unfolding fresh_star_def fresh_def
+ − 1952
by (auto simp add: supp_finite_atom_set fin)
+ − 1953
2675
+ − 1954
2591
+ − 1955
lemma fresh_star_Pair:
2470
+ − 1956
shows "as \<sharp>* (x, y) = (as \<sharp>* x \<and> as \<sharp>* y)"
+ − 1957
by (auto simp add: fresh_star_def fresh_Pair)
+ − 1958
2591
+ − 1959
lemma fresh_star_list:
+ − 1960
shows "as \<sharp>* (xs @ ys) \<longleftrightarrow> as \<sharp>* xs \<and> as \<sharp>* ys"
+ − 1961
and "as \<sharp>* (x # xs) \<longleftrightarrow> as \<sharp>* x \<and> as \<sharp>* xs"
+ − 1962
and "as \<sharp>* []"
+ − 1963
by (auto simp add: fresh_star_def fresh_Nil fresh_Cons fresh_append)
+ − 1964
+ − 1965
lemma fresh_star_set:
+ − 1966
fixes xs::"('a::fs) list"
+ − 1967
shows "as \<sharp>* set xs \<longleftrightarrow> as \<sharp>* xs"
+ − 1968
unfolding fresh_star_def
+ − 1969
by (simp add: fresh_set)
+ − 1970
2611
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1971
lemma fresh_star_singleton:
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1972
fixes a::"atom"
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1973
shows "as \<sharp>* {a} \<longleftrightarrow> as \<sharp>* a"
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1974
by (simp add: fresh_star_def fresh_finite_insert fresh_set_empty)
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1975
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1976
lemma fresh_star_fset:
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1977
fixes xs::"('a::fs) list"
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1978
shows "as \<sharp>* fset S \<longleftrightarrow> as \<sharp>* S"
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1979
by (simp add: fresh_star_def fresh_def)
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1980
2591
+ − 1981
lemma fresh_star_Un:
2470
+ − 1982
shows "(as \<union> bs) \<sharp>* x = (as \<sharp>* x \<and> bs \<sharp>* x)"
+ − 1983
by (auto simp add: fresh_star_def)
+ − 1984
+ − 1985
lemma fresh_star_insert:
+ − 1986
shows "(insert a as) \<sharp>* x = (a \<sharp> x \<and> as \<sharp>* x)"
+ − 1987
by (auto simp add: fresh_star_def)
+ − 1988
+ − 1989
lemma fresh_star_Un_elim:
+ − 1990
"((as \<union> bs) \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (as \<sharp>* x \<Longrightarrow> bs \<sharp>* x \<Longrightarrow> PROP C)"
+ − 1991
unfolding fresh_star_def
+ − 1992
apply(rule)
+ − 1993
apply(erule meta_mp)
+ − 1994
apply(auto)
+ − 1995
done
+ − 1996
+ − 1997
lemma fresh_star_insert_elim:
+ − 1998
"(insert a as \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> as \<sharp>* x \<Longrightarrow> PROP C)"
+ − 1999
unfolding fresh_star_def
+ − 2000
by rule (simp_all add: fresh_star_def)
+ − 2001
+ − 2002
lemma fresh_star_empty_elim:
+ − 2003
"({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
+ − 2004
by (simp add: fresh_star_def)
+ − 2005
2632
e8732350a29f
added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2006
lemma fresh_star_Unit_elim:
2470
+ − 2007
shows "(a \<sharp>* () \<Longrightarrow> PROP C) \<equiv> PROP C"
+ − 2008
by (simp add: fresh_star_def fresh_Unit)
+ − 2009
2591
+ − 2010
lemma fresh_star_Pair_elim:
2470
+ − 2011
shows "(a \<sharp>* (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp>* x \<Longrightarrow> a \<sharp>* y \<Longrightarrow> PROP C)"
2591
+ − 2012
by (rule, simp_all add: fresh_star_Pair)
2470
+ − 2013
+ − 2014
lemma fresh_star_zero:
+ − 2015
shows "as \<sharp>* (0::perm)"
+ − 2016
unfolding fresh_star_def
+ − 2017
by (simp add: fresh_zero_perm)
+ − 2018
+ − 2019
lemma fresh_star_plus:
+ − 2020
fixes p q::perm
+ − 2021
shows "\<lbrakk>a \<sharp>* p; a \<sharp>* q\<rbrakk> \<Longrightarrow> a \<sharp>* (p + q)"
+ − 2022
unfolding fresh_star_def
+ − 2023
by (simp add: fresh_plus_perm)
+ − 2024
+ − 2025
lemma fresh_star_permute_iff:
+ − 2026
shows "(p \<bullet> a) \<sharp>* (p \<bullet> x) \<longleftrightarrow> a \<sharp>* x"
+ − 2027
unfolding fresh_star_def
+ − 2028
by (metis mem_permute_iff permute_minus_cancel(1) fresh_permute_iff)
+ − 2029
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2030
lemma fresh_star_eqvt [eqvt]:
2663
+ − 2031
shows "p \<bullet> (as \<sharp>* x) \<longleftrightarrow> (p \<bullet> as) \<sharp>* (p \<bullet> x)"
2470
+ − 2032
unfolding fresh_star_def
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2033
by (perm_simp) (rule refl)
2591
+ − 2034
2470
+ − 2035
2735
+ − 2036
2470
+ − 2037
section {* Induction principle for permutations *}
+ − 2038
+ − 2039
+ − 2040
lemma perm_struct_induct[consumes 1, case_names zero swap]:
+ − 2041
assumes S: "supp p \<subseteq> S"
+ − 2042
and zero: "P 0"
+ − 2043
and 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> \<Longrightarrow> P ((a \<rightleftharpoons> b) + p)"
+ − 2044
shows "P p"
+ − 2045
proof -
+ − 2046
have "finite (supp p)" by (simp add: finite_supp)
+ − 2047
then show "P p" using S
+ − 2048
proof(induct A\<equiv>"supp p" arbitrary: p rule: finite_psubset_induct)
+ − 2049
case (psubset p)
+ − 2050
then have ih: "\<And>q. supp q \<subset> supp p \<Longrightarrow> P q" by auto
+ − 2051
have as: "supp p \<subseteq> S" by fact
+ − 2052
{ assume "supp p = {}"
2732
+ − 2053
then have "p = 0" by (simp add: supp_perm perm_eq_iff)
2470
+ − 2054
then have "P p" using zero by simp
+ − 2055
}
+ − 2056
moreover
+ − 2057
{ assume "supp p \<noteq> {}"
+ − 2058
then obtain a where a0: "a \<in> supp p" by blast
+ − 2059
then have a1: "p \<bullet> a \<in> S" "a \<in> S" "sort_of (p \<bullet> a) = sort_of a" "p \<bullet> a \<noteq> a"
+ − 2060
using as by (auto simp add: supp_atom supp_perm swap_atom)
+ − 2061
let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
+ − 2062
have a2: "supp ?q \<subseteq> supp p" unfolding supp_perm by (auto simp add: swap_atom)
+ − 2063
moreover
+ − 2064
have "a \<notin> supp ?q" by (simp add: supp_perm)
+ − 2065
then have "supp ?q \<noteq> supp p" using a0 by auto
+ − 2066
ultimately have "supp ?q \<subset> supp p" using a2 by auto
+ − 2067
then have "P ?q" using ih by simp
+ − 2068
moreover
+ − 2069
have "supp ?q \<subseteq> S" using as a2 by simp
+ − 2070
ultimately have "P ((p \<bullet> a \<rightleftharpoons> a) + ?q)" using as a1 swap by simp
+ − 2071
moreover
2732
+ − 2072
have "p = (p \<bullet> a \<rightleftharpoons> a) + ?q" by (simp add: perm_eq_iff)
2470
+ − 2073
ultimately have "P p" by simp
+ − 2074
}
+ − 2075
ultimately show "P p" by blast
+ − 2076
qed
+ − 2077
qed
+ − 2078
+ − 2079
lemma perm_simple_struct_induct[case_names zero swap]:
+ − 2080
assumes zero: "P 0"
+ − 2081
and swap: "\<And>p a b. \<lbrakk>P p; a \<noteq> b; sort_of a = sort_of b\<rbrakk> \<Longrightarrow> P ((a \<rightleftharpoons> b) + p)"
+ − 2082
shows "P p"
+ − 2083
by (rule_tac S="supp p" in perm_struct_induct)
+ − 2084
(auto intro: zero swap)
+ − 2085
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2086
lemma perm_struct_induct2[consumes 1, case_names zero swap plus]:
2470
+ − 2087
assumes S: "supp p \<subseteq> S"
+ − 2088
assumes zero: "P 0"
+ − 2089
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)"
+ − 2090
assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2; supp p1 \<subseteq> S; supp p2 \<subseteq> S\<rbrakk> \<Longrightarrow> P (p1 + p2)"
+ − 2091
shows "P p"
+ − 2092
using S
+ − 2093
by (induct p rule: perm_struct_induct)
+ − 2094
(auto intro: zero plus swap simp add: supp_swap)
+ − 2095
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2096
lemma perm_simple_struct_induct2[case_names zero swap plus]:
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2097
assumes zero: "P 0"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2098
assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2099
assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2\<rbrakk> \<Longrightarrow> P (p1 + p2)"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2100
shows "P p"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2101
by (rule_tac S="supp p" in perm_struct_induct2)
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2102
(auto intro: zero swap plus)
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2103
2679
+ − 2104
lemma supp_perm_singleton:
+ − 2105
fixes p::"perm"
+ − 2106
shows "supp p \<subseteq> {b} \<longleftrightarrow> p = 0"
+ − 2107
proof -
+ − 2108
{ assume "supp p \<subseteq> {b}"
+ − 2109
then have "p = 0"
+ − 2110
by (induct p rule: perm_struct_induct) (simp_all)
+ − 2111
}
+ − 2112
then show "supp p \<subseteq> {b} \<longleftrightarrow> p = 0" by (auto simp add: supp_zero_perm)
+ − 2113
qed
+ − 2114
+ − 2115
lemma supp_perm_pair:
+ − 2116
fixes p::"perm"
+ − 2117
shows "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)"
+ − 2118
proof -
+ − 2119
{ assume "supp p \<subseteq> {a, b}"
+ − 2120
then have "p = 0 \<or> p = (b \<rightleftharpoons> a)"
+ − 2121
apply (induct p rule: perm_struct_induct)
+ − 2122
apply (auto simp add: swap_cancel supp_zero_perm supp_swap)
+ − 2123
apply (simp add: swap_commute)
+ − 2124
done
+ − 2125
}
+ − 2126
then show "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)"
+ − 2127
by (auto simp add: supp_zero_perm supp_swap split: if_splits)
+ − 2128
qed
+ − 2129
2470
+ − 2130
lemma supp_perm_eq:
+ − 2131
assumes "(supp x) \<sharp>* p"
+ − 2132
shows "p \<bullet> x = x"
+ − 2133
proof -
+ − 2134
from assms have "supp p \<subseteq> {a. a \<sharp> x}"
+ − 2135
unfolding supp_perm fresh_star_def fresh_def by auto
+ − 2136
then show "p \<bullet> x = x"
+ − 2137
proof (induct p rule: perm_struct_induct)
+ − 2138
case zero
+ − 2139
show "0 \<bullet> x = x" by simp
+ − 2140
next
+ − 2141
case (swap p a b)
+ − 2142
then have "a \<sharp> x" "b \<sharp> x" "p \<bullet> x = x" by simp_all
+ − 2143
then show "((a \<rightleftharpoons> b) + p) \<bullet> x = x" by (simp add: swap_fresh_fresh)
+ − 2144
qed
+ − 2145
qed
+ − 2146
+ − 2147
lemma supp_perm_eq_test:
+ − 2148
assumes "(supp x) \<sharp>* p"
+ − 2149
shows "p \<bullet> x = x"
+ − 2150
proof -
+ − 2151
from assms have "supp p \<subseteq> {a. a \<sharp> x}"
+ − 2152
unfolding supp_perm fresh_star_def fresh_def by auto
+ − 2153
then show "p \<bullet> x = x"
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2154
proof (induct p rule: perm_struct_induct2)
2470
+ − 2155
case zero
+ − 2156
show "0 \<bullet> x = x" by simp
+ − 2157
next
+ − 2158
case (swap a b)
+ − 2159
then have "a \<sharp> x" "b \<sharp> x" by simp_all
+ − 2160
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
+ − 2161
next
+ − 2162
case (plus p1 p2)
+ − 2163
have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
+ − 2164
then show "(p1 + p2) \<bullet> x = x" by simp
+ − 2165
qed
+ − 2166
qed
+ − 2167
2591
+ − 2168
lemma perm_supp_eq:
+ − 2169
assumes a: "(supp p) \<sharp>* x"
+ − 2170
shows "p \<bullet> x = x"
+ − 2171
by (rule supp_perm_eq)
+ − 2172
(simp add: fresh_star_supp_conv a)
+ − 2173
2659
+ − 2174
lemma supp_perm_perm_eq:
+ − 2175
assumes a: "\<forall>a \<in> supp x. p \<bullet> a = q \<bullet> a"
+ − 2176
shows "p \<bullet> x = q \<bullet> x"
+ − 2177
proof -
+ − 2178
from a have "\<forall>a \<in> supp x. (-q + p) \<bullet> a = a" by simp
+ − 2179
then have "\<forall>a \<in> supp x. a \<notin> supp (-q + p)"
+ − 2180
unfolding supp_perm by simp
+ − 2181
then have "supp x \<sharp>* (-q + p)"
+ − 2182
unfolding fresh_star_def fresh_def by simp
+ − 2183
then have "(-q + p) \<bullet> x = x" by (simp only: supp_perm_eq)
+ − 2184
then show "p \<bullet> x = q \<bullet> x"
+ − 2185
by (metis permute_minus_cancel permute_plus)
+ − 2186
qed
+ − 2187
2668
+ − 2188
lemma atom_set_perm_eq:
+ − 2189
assumes a: "as \<sharp>* p"
+ − 2190
shows "p \<bullet> as = as"
+ − 2191
proof -
+ − 2192
from a have "supp p \<subseteq> {a. a \<notin> as}"
+ − 2193
unfolding supp_perm fresh_star_def fresh_def by auto
+ − 2194
then show "p \<bullet> as = as"
+ − 2195
proof (induct p rule: perm_struct_induct)
+ − 2196
case zero
+ − 2197
show "0 \<bullet> as = as" by simp
+ − 2198
next
+ − 2199
case (swap p a b)
+ − 2200
then have "a \<notin> as" "b \<notin> as" "p \<bullet> as = as" by simp_all
+ − 2201
then show "((a \<rightleftharpoons> b) + p) \<bullet> as = as" by (simp add: swap_set_not_in)
+ − 2202
qed
+ − 2203
qed
2470
+ − 2204
+ − 2205
section {* Avoiding of atom sets *}
+ − 2206
+ − 2207
text {*
+ − 2208
For every set of atoms, there is another set of atoms
+ − 2209
avoiding a finitely supported c and there is a permutation
+ − 2210
which 'translates' between both sets.
+ − 2211
*}
+ − 2212
+ − 2213
lemma at_set_avoiding_aux:
+ − 2214
fixes Xs::"atom set"
+ − 2215
and As::"atom set"
+ − 2216
assumes b: "Xs \<subseteq> As"
+ − 2217
and c: "finite As"
2614
+ − 2218
shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) = (Xs \<union> (p \<bullet> Xs))"
2470
+ − 2219
proof -
+ − 2220
from b c have "finite Xs" by (rule finite_subset)
+ − 2221
then show ?thesis using b
+ − 2222
proof (induct rule: finite_subset_induct)
+ − 2223
case empty
+ − 2224
have "0 \<bullet> {} \<inter> As = {}" by simp
+ − 2225
moreover
2614
+ − 2226
have "supp (0::perm) = {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
2470
+ − 2227
ultimately show ?case by blast
+ − 2228
next
+ − 2229
case (insert x Xs)
+ − 2230
then obtain p where
+ − 2231
p1: "(p \<bullet> Xs) \<inter> As = {}" and
2614
+ − 2232
p2: "supp p = (Xs \<union> (p \<bullet> Xs))" by blast
2470
+ − 2233
from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
+ − 2234
with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
+ − 2235
hence px: "p \<bullet> x = x" unfolding supp_perm by simp
2614
+ − 2236
have "finite (As \<union> p \<bullet> Xs \<union> supp p)"
2470
+ − 2237
using `finite As` `finite Xs`
2614
+ − 2238
by (simp add: permute_set_eq_image finite_supp)
+ − 2239
then obtain y where "y \<notin> (As \<union> p \<bullet> Xs \<union> supp p)" "sort_of y = sort_of x"
2470
+ − 2240
by (rule obtain_atom)
2614
+ − 2241
hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "y \<notin> supp p" "sort_of y = sort_of x"
2470
+ − 2242
by simp_all
2614
+ − 2243
hence py: "p \<bullet> y = y" "x \<noteq> y" using `x \<in> As`
+ − 2244
by (auto simp add: supp_perm)
2470
+ − 2245
let ?q = "(x \<rightleftharpoons> y) + p"
+ − 2246
have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
+ − 2247
unfolding insert_eqvt
+ − 2248
using `p \<bullet> x = x` `sort_of y = sort_of x`
+ − 2249
using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
+ − 2250
by (simp add: swap_atom swap_set_not_in)
+ − 2251
have "?q \<bullet> insert x Xs \<inter> As = {}"
+ − 2252
using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
+ − 2253
unfolding q by simp
+ − 2254
moreover
2614
+ − 2255
have "supp (x \<rightleftharpoons> y) \<inter> supp p = {}" using px py `sort_of y = sort_of x`
+ − 2256
unfolding supp_swap by (simp add: supp_perm)
+ − 2257
then have "supp ?q = (supp (x \<rightleftharpoons> y) \<union> supp p)"
+ − 2258
by (simp add: supp_plus_perm_eq)
+ − 2259
then have "supp ?q = insert x Xs \<union> ?q \<bullet> insert x Xs"
+ − 2260
using p2 `sort_of y = sort_of x` `x \<noteq> y` unfolding q supp_swap
+ − 2261
by auto
2470
+ − 2262
ultimately show ?case by blast
+ − 2263
qed
+ − 2264
qed
+ − 2265
+ − 2266
lemma at_set_avoiding:
+ − 2267
assumes a: "finite Xs"
+ − 2268
and b: "finite (supp c)"
2614
+ − 2269
obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) = (Xs \<union> (p \<bullet> Xs))"
2470
+ − 2270
using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
+ − 2271
unfolding fresh_star_def fresh_def by blast
+ − 2272
2589
+ − 2273
lemma at_set_avoiding1:
+ − 2274
assumes "finite xs"
+ − 2275
and "finite (supp c)"
+ − 2276
shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
+ − 2277
using assms
+ − 2278
apply(erule_tac c="c" in at_set_avoiding)
+ − 2279
apply(auto)
+ − 2280
done
+ − 2281
2470
+ − 2282
lemma at_set_avoiding2:
+ − 2283
assumes "finite xs"
+ − 2284
and "finite (supp c)" "finite (supp x)"
+ − 2285
and "xs \<sharp>* x"
+ − 2286
shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p"
+ − 2287
using assms
+ − 2288
apply(erule_tac c="(c, x)" in at_set_avoiding)
+ − 2289
apply(simp add: supp_Pair)
+ − 2290
apply(rule_tac x="p" in exI)
2591
+ − 2291
apply(simp add: fresh_star_Pair)
2507
+ − 2292
apply(rule fresh_star_supp_conv)
+ − 2293
apply(auto simp add: fresh_star_def)
2470
+ − 2294
done
+ − 2295
2573
+ − 2296
lemma at_set_avoiding3:
+ − 2297
assumes "finite xs"
+ − 2298
and "finite (supp c)" "finite (supp x)"
+ − 2299
and "xs \<sharp>* x"
2614
+ − 2300
shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p \<and> supp p = xs \<union> (p \<bullet> xs)"
2586
+ − 2301
using assms
+ − 2302
apply(erule_tac c="(c, x)" in at_set_avoiding)
+ − 2303
apply(simp add: supp_Pair)
+ − 2304
apply(rule_tac x="p" in exI)
2591
+ − 2305
apply(simp add: fresh_star_Pair)
2586
+ − 2306
apply(rule fresh_star_supp_conv)
+ − 2307
apply(auto simp add: fresh_star_def)
+ − 2308
done
2573
+ − 2309
2470
+ − 2310
lemma at_set_avoiding2_atom:
+ − 2311
assumes "finite (supp c)" "finite (supp x)"
+ − 2312
and b: "a \<sharp> x"
+ − 2313
shows "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p"
+ − 2314
proof -
+ − 2315
have a: "{a} \<sharp>* x" unfolding fresh_star_def by (simp add: b)
+ − 2316
obtain p where p1: "(p \<bullet> {a}) \<sharp>* c" and p2: "supp x \<sharp>* p"
+ − 2317
using at_set_avoiding2[of "{a}" "c" "x"] assms a by blast
+ − 2318
have c: "(p \<bullet> a) \<sharp> c" using p1
+ − 2319
unfolding fresh_star_def Ball_def
+ − 2320
by(erule_tac x="p \<bullet> a" in allE) (simp add: permute_set_eq)
+ − 2321
hence "p \<bullet> a \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
+ − 2322
then show "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p" by blast
+ − 2323
qed
+ − 2324
2614
+ − 2325
2599
+ − 2326
section {* Renaming permutations *}
+ − 2327
+ − 2328
lemma set_renaming_perm:
2659
+ − 2329
assumes b: "finite bs"
2668
+ − 2330
shows "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)"
2659
+ − 2331
using b
2599
+ − 2332
proof (induct)
+ − 2333
case empty
2668
+ − 2334
have "(\<forall>b \<in> {}. 0 \<bullet> b = p \<bullet> b) \<and> supp (0::perm) \<subseteq> {} \<union> p \<bullet> {}"
2599
+ − 2335
by (simp add: permute_set_eq supp_perm)
2668
+ − 2336
then show "\<exists>q. (\<forall>b \<in> {}. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> {} \<union> p \<bullet> {}" by blast
2599
+ − 2337
next
+ − 2338
case (insert a bs)
2668
+ − 2339
then have " \<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> p \<bullet> bs" by simp
+ − 2340
then obtain q where *: "\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> bs \<union> p \<bullet> bs"
+ − 2341
by (metis empty_subsetI insert(3) supp_swap)
2599
+ − 2342
{ assume 1: "q \<bullet> a = p \<bullet> a"
2668
+ − 2343
have "\<forall>b \<in> (insert a bs). q \<bullet> b = p \<bullet> b" using 1 * by simp
2599
+ − 2344
moreover
+ − 2345
have "supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
+ − 2346
using ** by (auto simp add: insert_eqvt)
+ − 2347
ultimately
2668
+ − 2348
have "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by blast
2599
+ − 2349
}
+ − 2350
moreover
+ − 2351
{ assume 2: "q \<bullet> a \<noteq> p \<bullet> a"
+ − 2352
def q' \<equiv> "((q \<bullet> a) \<rightleftharpoons> (p \<bullet> a)) + q"
2668
+ − 2353
have "\<forall>b \<in> insert a bs. q' \<bullet> b = p \<bullet> b" using 2 * `a \<notin> bs` unfolding q'_def
+ − 2354
by (auto simp add: swap_atom)
2599
+ − 2355
moreover
+ − 2356
{ have "{q \<bullet> a, p \<bullet> a} \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
2659
+ − 2357
using **
+ − 2358
apply (auto simp add: supp_perm insert_eqvt)
+ − 2359
apply (subgoal_tac "q \<bullet> a \<in> bs \<union> p \<bullet> bs")
+ − 2360
apply(auto)[1]
+ − 2361
apply(subgoal_tac "q \<bullet> a \<in> {a. q \<bullet> a \<noteq> a}")
+ − 2362
apply(blast)
+ − 2363
apply(simp)
+ − 2364
done
2599
+ − 2365
then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by (simp add: supp_swap)
+ − 2366
moreover
+ − 2367
have "supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
+ − 2368
using ** by (auto simp add: insert_eqvt)
+ − 2369
ultimately
+ − 2370
have "supp q' \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
+ − 2371
unfolding q'_def using supp_plus_perm by blast
+ − 2372
}
+ − 2373
ultimately
2668
+ − 2374
have "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by blast
2599
+ − 2375
}
2668
+ − 2376
ultimately show "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
2599
+ − 2377
by blast
+ − 2378
qed
+ − 2379
2672
+ − 2380
lemma set_renaming_perm2:
+ − 2381
shows "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)"
+ − 2382
proof -
+ − 2383
have "finite (bs \<inter> supp p)" by (simp add: finite_supp)
+ − 2384
then obtain q
+ − 2385
where *: "\<forall>b \<in> bs \<inter> supp p. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> (bs \<inter> supp p) \<union> (p \<bullet> (bs \<inter> supp p))"
+ − 2386
using set_renaming_perm by blast
+ − 2387
from ** have "supp q \<subseteq> bs \<union> (p \<bullet> bs)" by (auto simp add: inter_eqvt)
+ − 2388
moreover
+ − 2389
have "\<forall>b \<in> bs - supp p. q \<bullet> b = p \<bullet> b"
+ − 2390
apply(auto)
+ − 2391
apply(subgoal_tac "b \<notin> supp q")
+ − 2392
apply(simp add: fresh_def[symmetric])
+ − 2393
apply(simp add: fresh_perm)
+ − 2394
apply(clarify)
+ − 2395
apply(rotate_tac 2)
+ − 2396
apply(drule subsetD[OF **])
+ − 2397
apply(simp add: inter_eqvt supp_eqvt permute_self)
+ − 2398
done
+ − 2399
ultimately have "(\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)" using * by auto
+ − 2400
then show "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)" by blast
+ − 2401
qed
+ − 2402
2599
+ − 2403
lemma list_renaming_perm:
2668
+ − 2404
shows "\<exists>q. (\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set bs \<union> (p \<bullet> set bs)"
2599
+ − 2405
proof (induct bs)
+ − 2406
case Nil
2668
+ − 2407
have "(\<forall>b \<in> set []. 0 \<bullet> b = p \<bullet> b) \<and> supp (0::perm) \<subseteq> set [] \<union> p \<bullet> set []"
+ − 2408
by (simp add: supp_zero_perm)
+ − 2409
then show "\<exists>q. (\<forall>b \<in> set []. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set [] \<union> p \<bullet> (set [])" by blast
2599
+ − 2410
next
+ − 2411
case (Cons a bs)
2668
+ − 2412
then have " \<exists>q. (\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set bs \<union> p \<bullet> (set bs)" by simp
+ − 2413
then obtain q where *: "\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> set bs \<union> p \<bullet> (set bs)"
+ − 2414
by (blast)
2599
+ − 2415
{ assume 1: "a \<in> set bs"
+ − 2416
have "q \<bullet> a = p \<bullet> a" using * 1 by (induct bs) (auto)
2668
+ − 2417
then have "\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b" using * by simp
2599
+ − 2418
moreover
+ − 2419
have "supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" using ** by (auto simp add: insert_eqvt)
+ − 2420
ultimately
2668
+ − 2421
have "\<exists>q. (\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" by blast
2599
+ − 2422
}
+ − 2423
moreover
+ − 2424
{ assume 2: "a \<notin> set bs"
+ − 2425
def q' \<equiv> "((q \<bullet> a) \<rightleftharpoons> (p \<bullet> a)) + q"
2668
+ − 2426
have "\<forall>b \<in> set (a # bs). q' \<bullet> b = p \<bullet> b"
+ − 2427
unfolding q'_def using 2 * `a \<notin> set bs` by (auto simp add: swap_atom)
2599
+ − 2428
moreover
+ − 2429
{ have "{q \<bullet> a, p \<bullet> a} \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
2659
+ − 2430
using **
+ − 2431
apply (auto simp add: supp_perm insert_eqvt)
+ − 2432
apply (subgoal_tac "q \<bullet> a \<in> set bs \<union> p \<bullet> set bs")
+ − 2433
apply(auto)[1]
+ − 2434
apply(subgoal_tac "q \<bullet> a \<in> {a. q \<bullet> a \<noteq> a}")
+ − 2435
apply(blast)
+ − 2436
apply(simp)
+ − 2437
done
2599
+ − 2438
then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> set (a # bs) \<union> p \<bullet> set (a # bs)" by (simp add: supp_swap)
+ − 2439
moreover
+ − 2440
have "supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
+ − 2441
using ** by (auto simp add: insert_eqvt)
+ − 2442
ultimately
+ − 2443
have "supp q' \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
+ − 2444
unfolding q'_def using supp_plus_perm by blast
+ − 2445
}
+ − 2446
ultimately
2668
+ − 2447
have "\<exists>q. (\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" by blast
2599
+ − 2448
}
2668
+ − 2449
ultimately show "\<exists>q. (\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
2599
+ − 2450
by blast
+ − 2451
qed
+ − 2452
+ − 2453
2470
+ − 2454
section {* Concrete Atoms Types *}
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2455
1972
+ − 2456
text {*
+ − 2457
Class @{text at_base} allows types containing multiple sorts of atoms.
+ − 2458
Class @{text at} only allows types with a single sort.
+ − 2459
*}
+ − 2460
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2461
class at_base = pt +
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2462
fixes atom :: "'a \<Rightarrow> atom"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2463
assumes atom_eq_iff [simp]: "atom a = atom b \<longleftrightarrow> a = b"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2464
assumes atom_eqvt: "p \<bullet> (atom a) = atom (p \<bullet> a)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2465
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2466
declare atom_eqvt[eqvt]
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2467
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2468
class at = at_base +
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2469
assumes sort_of_atom_eq [simp]: "sort_of (atom a) = sort_of (atom b)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2470
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2471
lemma supp_at_base:
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2472
fixes a::"'a::at_base"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2473
shows "supp a = {atom a}"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2474
by (simp add: supp_atom [symmetric] supp_def atom_eqvt)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2475
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2476
lemma fresh_at_base:
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2477
shows "a \<sharp> b \<longleftrightarrow> a \<noteq> atom b"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2478
unfolding fresh_def by (simp add: supp_at_base)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2479
2609
666ffc8a92a9
freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2480
lemma fresh_atom_at_base:
666ffc8a92a9
freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2481
fixes b::"'a::at_base"
666ffc8a92a9
freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2482
shows "a \<sharp> atom b \<longleftrightarrow> a \<sharp> b"
666ffc8a92a9
freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2483
by (simp add: fresh_def supp_at_base supp_atom)
666ffc8a92a9
freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2484
2611
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2485
lemma fresh_star_atom_at_base:
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2486
fixes b::"'a::at_base"
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2487
shows "as \<sharp>* atom b \<longleftrightarrow> as \<sharp>* b"
3d101f2f817c
simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2488
by (simp add: fresh_star_def fresh_atom_at_base)
2609
666ffc8a92a9
freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2489
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2490
instance at_base < fs
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2491
proof qed (simp add: supp_at_base)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2492
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2493
lemma at_base_infinite [simp]:
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2494
shows "infinite (UNIV :: 'a::at_base set)" (is "infinite ?U")
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2495
proof
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2496
obtain a :: 'a where "True" by auto
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2497
assume "finite ?U"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2498
hence "finite (atom ` ?U)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2499
by (rule finite_imageI)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2500
then obtain b where b: "b \<notin> atom ` ?U" "sort_of b = sort_of (atom a)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2501
by (rule obtain_atom)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2502
from b(2) have "b = atom ((atom a \<rightleftharpoons> b) \<bullet> a)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2503
unfolding atom_eqvt [symmetric]
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2504
by (simp add: swap_atom)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2505
hence "b \<in> atom ` ?U" by simp
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2506
with b(1) show "False" by simp
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2507
qed
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2508
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2509
lemma swap_at_base_simps [simp]:
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2510
fixes x y::"'a::at_base"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2511
shows "sort_of (atom x) = sort_of (atom y) \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> x = y"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2512
and "sort_of (atom x) = sort_of (atom y) \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> y = x"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2513
and "atom x \<noteq> a \<Longrightarrow> atom x \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2514
unfolding atom_eq_iff [symmetric]
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2515
unfolding atom_eqvt [symmetric]
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2516
by simp_all
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2517
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2518
lemma obtain_at_base:
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2519
assumes X: "finite X"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2520
obtains a::"'a::at_base" where "atom a \<notin> X"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2521
proof -
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2522
have "inj (atom :: 'a \<Rightarrow> atom)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2523
by (simp add: inj_on_def)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2524
with X have "finite (atom -` X :: 'a set)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2525
by (rule finite_vimageI)
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2526
with at_base_infinite have "atom -` X \<noteq> (UNIV :: 'a set)"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2527
by auto
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2528
then obtain a :: 'a where "atom a \<notin> X"
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2529
by auto
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2530
thus ?thesis ..
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2531
qed
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2532
2685
+ − 2533
lemma obtain_fresh':
+ − 2534
assumes fin: "finite (supp x)"
+ − 2535
obtains a::"'a::at_base" where "atom a \<sharp> x"
+ − 2536
using obtain_at_base[where X="supp x"]
+ − 2537
by (auto simp add: fresh_def fin)
+ − 2538
+ − 2539
lemma obtain_fresh:
+ − 2540
fixes x::"'b::fs"
+ − 2541
obtains a::"'a::at_base" where "atom a \<sharp> x"
+ − 2542
by (rule obtain_fresh') (auto simp add: finite_supp)
+ − 2543
1973
+ − 2544
lemma supp_finite_set_at_base:
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2545
assumes a: "finite S"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2546
shows "supp S = atom ` S"
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2547
apply(simp add: supp_of_finite_sets[OF a])
2466
+ − 2548
apply(simp add: supp_at_base)
+ − 2549
apply(auto)
+ − 2550
done
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2551
2657
+ − 2552
lemma fresh_finite_set_at_base:
+ − 2553
fixes a::"'a::at_base"
+ − 2554
assumes a: "finite S"
+ − 2555
shows "atom a \<sharp> S \<longleftrightarrow> a \<notin> S"
+ − 2556
unfolding fresh_def
+ − 2557
apply(simp add: supp_finite_set_at_base[OF a])
+ − 2558
apply(subst inj_image_mem_iff)
+ − 2559
apply(simp add: inj_on_def)
+ − 2560
apply(simp)
+ − 2561
done
+ − 2562
2683
+ − 2563
lemma fresh_at_base_permute_iff[simp]:
+ − 2564
fixes a::"'a::at_base"
+ − 2565
shows "atom (p \<bullet> a) \<sharp> p \<bullet> x \<longleftrightarrow> atom a \<sharp> x"
+ − 2566
unfolding atom_eqvt[symmetric]
+ − 2567
by (simp add: fresh_permute_iff)
+ − 2568
2657
+ − 2569
2467
+ − 2570
section {* Infrastructure for concrete atom types *}
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2571
2467
+ − 2572
definition
+ − 2573
flip :: "'a::at_base \<Rightarrow> 'a \<Rightarrow> perm" ("'(_ \<leftrightarrow> _')")
+ − 2574
where
+ − 2575
"(a \<leftrightarrow> b) = (atom a \<rightleftharpoons> atom b)"
+ − 2576
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2577
2467
+ − 2578
lemma flip_self [simp]: "(a \<leftrightarrow> a) = 0"
+ − 2579
unfolding flip_def by (rule swap_self)
+ − 2580
+ − 2581
lemma flip_commute: "(a \<leftrightarrow> b) = (b \<leftrightarrow> a)"
+ − 2582
unfolding flip_def by (rule swap_commute)
+ − 2583
+ − 2584
lemma minus_flip [simp]: "- (a \<leftrightarrow> b) = (a \<leftrightarrow> b)"
+ − 2585
unfolding flip_def by (rule minus_swap)
+ − 2586
+ − 2587
lemma add_flip_cancel: "(a \<leftrightarrow> b) + (a \<leftrightarrow> b) = 0"
+ − 2588
unfolding flip_def by (rule swap_cancel)
+ − 2589
+ − 2590
lemma permute_flip_cancel [simp]: "(a \<leftrightarrow> b) \<bullet> (a \<leftrightarrow> b) \<bullet> x = x"
+ − 2591
unfolding permute_plus [symmetric] add_flip_cancel by simp
+ − 2592
+ − 2593
lemma permute_flip_cancel2 [simp]: "(a \<leftrightarrow> b) \<bullet> (b \<leftrightarrow> a) \<bullet> x = x"
+ − 2594
by (simp add: flip_commute)
+ − 2595
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2596
lemma flip_eqvt [eqvt]:
2467
+ − 2597
fixes a b c::"'a::at_base"
+ − 2598
shows "p \<bullet> (a \<leftrightarrow> b) = (p \<bullet> a \<leftrightarrow> p \<bullet> b)"
+ − 2599
unfolding flip_def
+ − 2600
by (simp add: swap_eqvt atom_eqvt)
+ − 2601
+ − 2602
lemma flip_at_base_simps [simp]:
+ − 2603
shows "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> a = b"
+ − 2604
and "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> b = a"
+ − 2605
and "\<lbrakk>a \<noteq> c; b \<noteq> c\<rbrakk> \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> c = c"
+ − 2606
and "sort_of (atom a) \<noteq> sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> x = x"
+ − 2607
unfolding flip_def
+ − 2608
unfolding atom_eq_iff [symmetric]
+ − 2609
unfolding atom_eqvt [symmetric]
+ − 2610
by simp_all
+ − 2611
+ − 2612
text {* the following two lemmas do not hold for at_base,
+ − 2613
only for single sort atoms from at *}
+ − 2614
+ − 2615
lemma permute_flip_at:
+ − 2616
fixes a b c::"'a::at"
+ − 2617
shows "(a \<leftrightarrow> b) \<bullet> c = (if c = a then b else if c = b then a else c)"
+ − 2618
unfolding flip_def
+ − 2619
apply (rule atom_eq_iff [THEN iffD1])
+ − 2620
apply (subst atom_eqvt [symmetric])
+ − 2621
apply (simp add: swap_atom)
+ − 2622
done
+ − 2623
+ − 2624
lemma flip_at_simps [simp]:
+ − 2625
fixes a b::"'a::at"
+ − 2626
shows "(a \<leftrightarrow> b) \<bullet> a = b"
+ − 2627
and "(a \<leftrightarrow> b) \<bullet> b = a"
+ − 2628
unfolding permute_flip_at by simp_all
+ − 2629
+ − 2630
lemma flip_fresh_fresh:
+ − 2631
fixes a b::"'a::at_base"
+ − 2632
assumes "atom a \<sharp> x" "atom b \<sharp> x"
+ − 2633
shows "(a \<leftrightarrow> b) \<bullet> x = x"
+ − 2634
using assms
+ − 2635
by (simp add: flip_def swap_fresh_fresh)
+ − 2636
2683
+ − 2637
+ − 2638
2467
+ − 2639
subsection {* Syntax for coercing at-elements to the atom-type *}
+ − 2640
+ − 2641
syntax
+ − 2642
"_atom_constrain" :: "logic \<Rightarrow> type \<Rightarrow> logic" ("_:::_" [4, 0] 3)
+ − 2643
+ − 2644
translations
+ − 2645
"_atom_constrain a t" => "CONST atom (_constrain a t)"
+ − 2646
+ − 2647
+ − 2648
subsection {* A lemma for proving instances of class @{text at}. *}
+ − 2649
+ − 2650
setup {* Sign.add_const_constraint (@{const_name "permute"}, NONE) *}
+ − 2651
setup {* Sign.add_const_constraint (@{const_name "atom"}, NONE) *}
+ − 2652
+ − 2653
text {*
+ − 2654
New atom types are defined as subtypes of @{typ atom}.
+ − 2655
*}
+ − 2656
+ − 2657
lemma exists_eq_simple_sort:
+ − 2658
shows "\<exists>a. a \<in> {a. sort_of a = s}"
+ − 2659
by (rule_tac x="Atom s 0" in exI, simp)
+ − 2660
+ − 2661
lemma exists_eq_sort:
+ − 2662
shows "\<exists>a. a \<in> {a. sort_of a \<in> range sort_fun}"
+ − 2663
by (rule_tac x="Atom (sort_fun x) y" in exI, simp)
+ − 2664
+ − 2665
lemma at_base_class:
+ − 2666
fixes sort_fun :: "'b \<Rightarrow>atom_sort"
+ − 2667
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
+ − 2668
assumes type: "type_definition Rep Abs {a. sort_of a \<in> range sort_fun}"
+ − 2669
assumes atom_def: "\<And>a. atom a = Rep a"
+ − 2670
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
+ − 2671
shows "OFCLASS('a, at_base_class)"
+ − 2672
proof
+ − 2673
interpret type_definition Rep Abs "{a. sort_of a \<in> range sort_fun}" by (rule type)
+ − 2674
have sort_of_Rep: "\<And>a. sort_of (Rep a) \<in> range sort_fun" using Rep by simp
+ − 2675
fix a b :: 'a and p p1 p2 :: perm
+ − 2676
show "0 \<bullet> a = a"
+ − 2677
unfolding permute_def by (simp add: Rep_inverse)
+ − 2678
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
+ − 2679
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
+ − 2680
show "atom a = atom b \<longleftrightarrow> a = b"
+ − 2681
unfolding atom_def by (simp add: Rep_inject)
+ − 2682
show "p \<bullet> atom a = atom (p \<bullet> a)"
+ − 2683
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
+ − 2684
qed
+ − 2685
+ − 2686
(*
+ − 2687
lemma at_class:
+ − 2688
fixes s :: atom_sort
+ − 2689
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
+ − 2690
assumes type: "type_definition Rep Abs {a. sort_of a \<in> range (\<lambda>x::unit. s)}"
+ − 2691
assumes atom_def: "\<And>a. atom a = Rep a"
+ − 2692
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
+ − 2693
shows "OFCLASS('a, at_class)"
+ − 2694
proof
+ − 2695
interpret type_definition Rep Abs "{a. sort_of a \<in> range (\<lambda>x::unit. s)}" by (rule type)
+ − 2696
have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
+ − 2697
fix a b :: 'a and p p1 p2 :: perm
+ − 2698
show "0 \<bullet> a = a"
+ − 2699
unfolding permute_def by (simp add: Rep_inverse)
+ − 2700
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
+ − 2701
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
+ − 2702
show "sort_of (atom a) = sort_of (atom b)"
+ − 2703
unfolding atom_def by (simp add: sort_of_Rep)
+ − 2704
show "atom a = atom b \<longleftrightarrow> a = b"
+ − 2705
unfolding atom_def by (simp add: Rep_inject)
+ − 2706
show "p \<bullet> atom a = atom (p \<bullet> a)"
+ − 2707
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
+ − 2708
qed
+ − 2709
*)
+ − 2710
+ − 2711
lemma at_class:
+ − 2712
fixes s :: atom_sort
+ − 2713
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
+ − 2714
assumes type: "type_definition Rep Abs {a. sort_of a = s}"
+ − 2715
assumes atom_def: "\<And>a. atom a = Rep a"
+ − 2716
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
+ − 2717
shows "OFCLASS('a, at_class)"
+ − 2718
proof
+ − 2719
interpret type_definition Rep Abs "{a. sort_of a = s}" by (rule type)
+ − 2720
have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
+ − 2721
fix a b :: 'a and p p1 p2 :: perm
+ − 2722
show "0 \<bullet> a = a"
+ − 2723
unfolding permute_def by (simp add: Rep_inverse)
+ − 2724
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
+ − 2725
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
+ − 2726
show "sort_of (atom a) = sort_of (atom b)"
+ − 2727
unfolding atom_def by (simp add: sort_of_Rep)
+ − 2728
show "atom a = atom b \<longleftrightarrow> a = b"
+ − 2729
unfolding atom_def by (simp add: Rep_inject)
+ − 2730
show "p \<bullet> atom a = atom (p \<bullet> a)"
+ − 2731
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
+ − 2732
qed
+ − 2733
+ − 2734
setup {* Sign.add_const_constraint
+ − 2735
(@{const_name "permute"}, SOME @{typ "perm \<Rightarrow> 'a::pt \<Rightarrow> 'a"}) *}
+ − 2736
setup {* Sign.add_const_constraint
+ − 2737
(@{const_name "atom"}, SOME @{typ "'a::at_base \<Rightarrow> atom"}) *}
+ − 2738
+ − 2739
2470
+ − 2740
+ − 2741
section {* The freshness lemma according to Andy Pitts *}
+ − 2742
+ − 2743
lemma freshness_lemma:
+ − 2744
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2745
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2746
shows "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 2747
proof -
+ − 2748
from a obtain b where a1: "atom b \<sharp> h" and a2: "atom b \<sharp> h b"
+ − 2749
by (auto simp add: fresh_Pair)
+ − 2750
show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 2751
proof (intro exI allI impI)
+ − 2752
fix a :: 'a
+ − 2753
assume a3: "atom a \<sharp> h"
+ − 2754
show "h a = h b"
+ − 2755
proof (cases "a = b")
+ − 2756
assume "a = b"
+ − 2757
thus "h a = h b" by simp
+ − 2758
next
+ − 2759
assume "a \<noteq> b"
+ − 2760
hence "atom a \<sharp> b" by (simp add: fresh_at_base)
+ − 2761
with a3 have "atom a \<sharp> h b"
+ − 2762
by (rule fresh_fun_app)
+ − 2763
with a2 have d1: "(atom b \<rightleftharpoons> atom a) \<bullet> (h b) = (h b)"
+ − 2764
by (rule swap_fresh_fresh)
+ − 2765
from a1 a3 have d2: "(atom b \<rightleftharpoons> atom a) \<bullet> h = h"
+ − 2766
by (rule swap_fresh_fresh)
+ − 2767
from d1 have "h b = (atom b \<rightleftharpoons> atom a) \<bullet> (h b)" by simp
+ − 2768
also have "\<dots> = ((atom b \<rightleftharpoons> atom a) \<bullet> h) ((atom b \<rightleftharpoons> atom a) \<bullet> b)"
+ − 2769
by (rule permute_fun_app_eq)
+ − 2770
also have "\<dots> = h a"
+ − 2771
using d2 by simp
+ − 2772
finally show "h a = h b" by simp
+ − 2773
qed
+ − 2774
qed
+ − 2775
qed
+ − 2776
+ − 2777
lemma freshness_lemma_unique:
+ − 2778
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2779
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2780
shows "\<exists>!x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 2781
proof (rule ex_ex1I)
+ − 2782
from a show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 2783
by (rule freshness_lemma)
+ − 2784
next
+ − 2785
fix x y
+ − 2786
assume x: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 2787
assume y: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = y"
+ − 2788
from a x y show "x = y"
+ − 2789
by (auto simp add: fresh_Pair)
+ − 2790
qed
+ − 2791
+ − 2792
text {* packaging the freshness lemma into a function *}
+ − 2793
+ − 2794
definition
+ − 2795
fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
+ − 2796
where
+ − 2797
"fresh_fun h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
+ − 2798
+ − 2799
lemma fresh_fun_apply:
+ − 2800
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2801
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2802
assumes b: "atom a \<sharp> h"
+ − 2803
shows "fresh_fun h = h a"
+ − 2804
unfolding fresh_fun_def
+ − 2805
proof (rule the_equality)
+ − 2806
show "\<forall>a'. atom a' \<sharp> h \<longrightarrow> h a' = h a"
+ − 2807
proof (intro strip)
+ − 2808
fix a':: 'a
+ − 2809
assume c: "atom a' \<sharp> h"
+ − 2810
from a have "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x" by (rule freshness_lemma)
+ − 2811
with b c show "h a' = h a" by auto
+ − 2812
qed
+ − 2813
next
+ − 2814
fix fr :: 'b
+ − 2815
assume "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = fr"
+ − 2816
with b show "fr = h a" by auto
+ − 2817
qed
+ − 2818
+ − 2819
lemma fresh_fun_apply':
+ − 2820
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2821
assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
+ − 2822
shows "fresh_fun h = h a"
+ − 2823
apply (rule fresh_fun_apply)
+ − 2824
apply (auto simp add: fresh_Pair intro: a)
+ − 2825
done
+ − 2826
+ − 2827
lemma fresh_fun_eqvt:
+ − 2828
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2829
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2830
shows "p \<bullet> (fresh_fun h) = fresh_fun (p \<bullet> h)"
+ − 2831
using a
+ − 2832
apply (clarsimp simp add: fresh_Pair)
+ − 2833
apply (subst fresh_fun_apply', assumption+)
+ − 2834
apply (drule fresh_permute_iff [where p=p, THEN iffD2])
+ − 2835
apply (drule fresh_permute_iff [where p=p, THEN iffD2])
2683
+ − 2836
apply (simp only: atom_eqvt permute_fun_app_eq [where f=h])
2470
+ − 2837
apply (erule (1) fresh_fun_apply' [symmetric])
+ − 2838
done
+ − 2839
+ − 2840
lemma fresh_fun_supports:
+ − 2841
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2842
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2843
shows "(supp h) supports (fresh_fun h)"
+ − 2844
apply (simp add: supports_def fresh_def [symmetric])
+ − 2845
apply (simp add: fresh_fun_eqvt [OF a] swap_fresh_fresh)
+ − 2846
done
+ − 2847
+ − 2848
notation fresh_fun (binder "FRESH " 10)
+ − 2849
+ − 2850
lemma FRESH_f_iff:
+ − 2851
fixes P :: "'a::at \<Rightarrow> 'b::pure"
+ − 2852
fixes f :: "'b \<Rightarrow> 'c::pure"
+ − 2853
assumes P: "finite (supp P)"
+ − 2854
shows "(FRESH x. f (P x)) = f (FRESH x. P x)"
+ − 2855
proof -
2685
+ − 2856
obtain a::'a where "atom a \<sharp> P" using P by (rule obtain_fresh')
2470
+ − 2857
show "(FRESH x. f (P x)) = f (FRESH x. P x)"
+ − 2858
apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
+ − 2859
apply (cut_tac `atom a \<sharp> P`)
+ − 2860
apply (simp add: fresh_conv_MOST)
+ − 2861
apply (elim MOST_rev_mp, rule MOST_I, clarify)
2479
+ − 2862
apply (simp add: permute_fun_def permute_pure fun_eq_iff)
2470
+ − 2863
apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
+ − 2864
apply (rule refl)
+ − 2865
done
+ − 2866
qed
+ − 2867
+ − 2868
lemma FRESH_binop_iff:
+ − 2869
fixes P :: "'a::at \<Rightarrow> 'b::pure"
+ − 2870
fixes Q :: "'a::at \<Rightarrow> 'c::pure"
+ − 2871
fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
+ − 2872
assumes P: "finite (supp P)"
+ − 2873
and Q: "finite (supp Q)"
+ − 2874
shows "(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)"
+ − 2875
proof -
2685
+ − 2876
from assms have "finite (supp (P, Q))" by (simp add: supp_Pair)
+ − 2877
then obtain a::'a where "atom a \<sharp> (P, Q)" by (rule obtain_fresh')
+ − 2878
then have "atom a \<sharp> P" and "atom a \<sharp> Q" by (simp_all add: fresh_Pair)
2470
+ − 2879
show ?thesis
+ − 2880
apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
+ − 2881
apply (cut_tac `atom a \<sharp> P` `atom a \<sharp> Q`)
+ − 2882
apply (simp add: fresh_conv_MOST)
+ − 2883
apply (elim MOST_rev_mp, rule MOST_I, clarify)
2479
+ − 2884
apply (simp add: permute_fun_def permute_pure fun_eq_iff)
2470
+ − 2885
apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
+ − 2886
apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
+ − 2887
apply (rule refl)
+ − 2888
done
+ − 2889
qed
+ − 2890
+ − 2891
lemma FRESH_conj_iff:
+ − 2892
fixes P Q :: "'a::at \<Rightarrow> bool"
+ − 2893
assumes P: "finite (supp P)" and Q: "finite (supp Q)"
+ − 2894
shows "(FRESH x. P x \<and> Q x) \<longleftrightarrow> (FRESH x. P x) \<and> (FRESH x. Q x)"
+ − 2895
using P Q by (rule FRESH_binop_iff)
+ − 2896
+ − 2897
lemma FRESH_disj_iff:
+ − 2898
fixes P Q :: "'a::at \<Rightarrow> bool"
+ − 2899
assumes P: "finite (supp P)" and Q: "finite (supp Q)"
+ − 2900
shows "(FRESH x. P x \<or> Q x) \<longleftrightarrow> (FRESH x. P x) \<or> (FRESH x. Q x)"
+ − 2901
using P Q by (rule FRESH_binop_iff)
+ − 2902
+ − 2903
2467
+ − 2904
section {* Library functions for the nominal infrastructure *}
+ − 2905
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2906
use "nominal_library.ML"
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2907
2466
+ − 2908
2467
+ − 2909
section {* Automation for creating concrete atom types *}
+ − 2910
+ − 2911
text {* at the moment only single-sort concrete atoms are supported *}
+ − 2912
+ − 2913
use "nominal_atoms.ML"
+ − 2914
+ − 2915
2733
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2916
section {* automatic equivariance procedure for inductive definitions *}
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2917
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2918
use "nominal_eqvt.ML"
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2919
5f6fefdbf055
split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2920
2466
+ − 2921
1062
+ − 2922
end