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
+ − 8
imports Main Infinite_Set
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
uses ("nominal_library.ML")
1062
+ − 10
begin
+ − 11
+ − 12
section {* Atoms and Sorts *}
+ − 13
+ − 14
text {* A simple implementation for atom_sorts is strings. *}
+ − 15
(* types atom_sort = string *)
+ − 16
+ − 17
text {* To deal with Church-like binding we use trees of
+ − 18
strings as sorts. *}
+ − 19
+ − 20
datatype atom_sort = Sort "string" "atom_sort list"
+ − 21
+ − 22
datatype atom = Atom atom_sort nat
+ − 23
+ − 24
+ − 25
text {* Basic projection function. *}
+ − 26
+ − 27
primrec
+ − 28
sort_of :: "atom \<Rightarrow> atom_sort"
+ − 29
where
+ − 30
"sort_of (Atom s i) = s"
+ − 31
1930
+ − 32
primrec
+ − 33
nat_of :: "atom \<Rightarrow> nat"
+ − 34
where
+ − 35
"nat_of (Atom s n) = n"
+ − 36
1062
+ − 37
+ − 38
text {* There are infinitely many atoms of each sort. *}
+ − 39
lemma INFM_sort_of_eq:
+ − 40
shows "INFM a. sort_of a = s"
+ − 41
proof -
+ − 42
have "INFM i. sort_of (Atom s i) = s" by simp
+ − 43
moreover have "inj (Atom s)" by (simp add: inj_on_def)
+ − 44
ultimately show "INFM a. sort_of a = s" by (rule INFM_inj)
+ − 45
qed
+ − 46
+ − 47
lemma infinite_sort_of_eq:
+ − 48
shows "infinite {a. sort_of a = s}"
+ − 49
using INFM_sort_of_eq unfolding INFM_iff_infinite .
+ − 50
+ − 51
lemma atom_infinite [simp]:
+ − 52
shows "infinite (UNIV :: atom set)"
+ − 53
using subset_UNIV infinite_sort_of_eq
+ − 54
by (rule infinite_super)
+ − 55
+ − 56
lemma obtain_atom:
+ − 57
fixes X :: "atom set"
+ − 58
assumes X: "finite X"
+ − 59
obtains a where "a \<notin> X" "sort_of a = s"
+ − 60
proof -
+ − 61
from X have "MOST a. a \<notin> X"
+ − 62
unfolding MOST_iff_cofinite by simp
+ − 63
with INFM_sort_of_eq
+ − 64
have "INFM a. sort_of a = s \<and> a \<notin> X"
+ − 65
by (rule INFM_conjI)
+ − 66
then obtain a where "a \<notin> X" "sort_of a = s"
+ − 67
by (auto elim: INFM_E)
+ − 68
then show ?thesis ..
+ − 69
qed
+ − 70
1930
+ − 71
lemma atom_components_eq_iff:
+ − 72
fixes a b :: atom
+ − 73
shows "a = b \<longleftrightarrow> sort_of a = sort_of b \<and> nat_of a = nat_of b"
+ − 74
by (induct a, induct b, simp)
+ − 75
1062
+ − 76
section {* Sort-Respecting Permutations *}
+ − 77
+ − 78
typedef perm =
+ − 79
"{f. bij f \<and> finite {a. f a \<noteq> a} \<and> (\<forall>a. sort_of (f a) = sort_of a)}"
+ − 80
proof
+ − 81
show "id \<in> ?perm" by simp
+ − 82
qed
+ − 83
+ − 84
lemma permI:
+ − 85
assumes "bij f" and "MOST x. f x = x" and "\<And>a. sort_of (f a) = sort_of a"
+ − 86
shows "f \<in> perm"
+ − 87
using assms unfolding perm_def MOST_iff_cofinite by simp
+ − 88
+ − 89
lemma perm_is_bij: "f \<in> perm \<Longrightarrow> bij f"
+ − 90
unfolding perm_def by simp
+ − 91
+ − 92
lemma perm_is_finite: "f \<in> perm \<Longrightarrow> finite {a. f a \<noteq> a}"
+ − 93
unfolding perm_def by simp
+ − 94
+ − 95
lemma perm_is_sort_respecting: "f \<in> perm \<Longrightarrow> sort_of (f a) = sort_of a"
+ − 96
unfolding perm_def by simp
+ − 97
+ − 98
lemma perm_MOST: "f \<in> perm \<Longrightarrow> MOST x. f x = x"
+ − 99
unfolding perm_def MOST_iff_cofinite by simp
+ − 100
+ − 101
lemma perm_id: "id \<in> perm"
+ − 102
unfolding perm_def by simp
+ − 103
+ − 104
lemma perm_comp:
+ − 105
assumes f: "f \<in> perm" and g: "g \<in> perm"
+ − 106
shows "(f \<circ> g) \<in> perm"
+ − 107
apply (rule permI)
+ − 108
apply (rule bij_comp)
+ − 109
apply (rule perm_is_bij [OF g])
+ − 110
apply (rule perm_is_bij [OF f])
+ − 111
apply (rule MOST_rev_mp [OF perm_MOST [OF g]])
+ − 112
apply (rule MOST_rev_mp [OF perm_MOST [OF f]])
+ − 113
apply (simp)
+ − 114
apply (simp add: perm_is_sort_respecting [OF f])
+ − 115
apply (simp add: perm_is_sort_respecting [OF g])
+ − 116
done
+ − 117
+ − 118
lemma perm_inv:
+ − 119
assumes f: "f \<in> perm"
+ − 120
shows "(inv f) \<in> perm"
+ − 121
apply (rule permI)
+ − 122
apply (rule bij_imp_bij_inv)
+ − 123
apply (rule perm_is_bij [OF f])
+ − 124
apply (rule MOST_mono [OF perm_MOST [OF f]])
+ − 125
apply (erule subst, rule inv_f_f)
+ − 126
apply (rule bij_is_inj [OF perm_is_bij [OF f]])
+ − 127
apply (rule perm_is_sort_respecting [OF f, THEN sym, THEN trans])
+ − 128
apply (simp add: surj_f_inv_f [OF bij_is_surj [OF perm_is_bij [OF f]]])
+ − 129
done
+ − 130
+ − 131
lemma bij_Rep_perm: "bij (Rep_perm p)"
+ − 132
using Rep_perm [of p] unfolding perm_def by simp
+ − 133
+ − 134
lemma finite_Rep_perm: "finite {a. Rep_perm p a \<noteq> a}"
+ − 135
using Rep_perm [of p] unfolding perm_def by simp
+ − 136
+ − 137
lemma sort_of_Rep_perm: "sort_of (Rep_perm p a) = sort_of a"
+ − 138
using Rep_perm [of p] unfolding perm_def by simp
+ − 139
+ − 140
lemma Rep_perm_ext:
+ − 141
"Rep_perm p1 = Rep_perm p2 \<Longrightarrow> p1 = p2"
+ − 142
by (simp add: expand_fun_eq Rep_perm_inject [symmetric])
+ − 143
+ − 144
+ − 145
subsection {* Permutations form a group *}
+ − 146
+ − 147
instantiation perm :: group_add
+ − 148
begin
+ − 149
+ − 150
definition
+ − 151
"0 = Abs_perm id"
+ − 152
+ − 153
definition
+ − 154
"- p = Abs_perm (inv (Rep_perm p))"
+ − 155
+ − 156
definition
+ − 157
"p + q = Abs_perm (Rep_perm p \<circ> Rep_perm q)"
+ − 158
+ − 159
definition
+ − 160
"(p1::perm) - p2 = p1 + - p2"
+ − 161
+ − 162
lemma Rep_perm_0: "Rep_perm 0 = id"
+ − 163
unfolding zero_perm_def
+ − 164
by (simp add: Abs_perm_inverse perm_id)
+ − 165
+ − 166
lemma Rep_perm_add:
+ − 167
"Rep_perm (p1 + p2) = Rep_perm p1 \<circ> Rep_perm p2"
+ − 168
unfolding plus_perm_def
+ − 169
by (simp add: Abs_perm_inverse perm_comp Rep_perm)
+ − 170
+ − 171
lemma Rep_perm_uminus:
+ − 172
"Rep_perm (- p) = inv (Rep_perm p)"
+ − 173
unfolding uminus_perm_def
+ − 174
by (simp add: Abs_perm_inverse perm_inv Rep_perm)
+ − 175
+ − 176
instance
+ − 177
apply default
+ − 178
unfolding Rep_perm_inject [symmetric]
+ − 179
unfolding minus_perm_def
+ − 180
unfolding Rep_perm_add
+ − 181
unfolding Rep_perm_uminus
+ − 182
unfolding Rep_perm_0
+ − 183
by (simp_all add: o_assoc inv_o_cancel [OF bij_is_inj [OF bij_Rep_perm]])
+ − 184
+ − 185
end
+ − 186
+ − 187
+ − 188
section {* Implementation of swappings *}
+ − 189
+ − 190
definition
+ − 191
swap :: "atom \<Rightarrow> atom \<Rightarrow> perm" ("'(_ \<rightleftharpoons> _')")
+ − 192
where
+ − 193
"(a \<rightleftharpoons> b) =
+ − 194
Abs_perm (if sort_of a = sort_of b
+ − 195
then (\<lambda>c. if a = c then b else if b = c then a else c)
+ − 196
else id)"
+ − 197
+ − 198
lemma Rep_perm_swap:
+ − 199
"Rep_perm (a \<rightleftharpoons> b) =
+ − 200
(if sort_of a = sort_of b
+ − 201
then (\<lambda>c. if a = c then b else if b = c then a else c)
+ − 202
else id)"
+ − 203
unfolding swap_def
+ − 204
apply (rule Abs_perm_inverse)
+ − 205
apply (rule permI)
+ − 206
apply (auto simp add: bij_def inj_on_def surj_def)[1]
+ − 207
apply (rule MOST_rev_mp [OF MOST_neq(1) [of a]])
+ − 208
apply (rule MOST_rev_mp [OF MOST_neq(1) [of b]])
+ − 209
apply (simp)
+ − 210
apply (simp)
+ − 211
done
+ − 212
+ − 213
lemmas Rep_perm_simps =
+ − 214
Rep_perm_0
+ − 215
Rep_perm_add
+ − 216
Rep_perm_uminus
+ − 217
Rep_perm_swap
+ − 218
+ − 219
lemma swap_different_sorts [simp]:
+ − 220
"sort_of a \<noteq> sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) = 0"
+ − 221
by (rule Rep_perm_ext) (simp add: Rep_perm_simps)
+ − 222
+ − 223
lemma swap_cancel:
+ − 224
"(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
1879
+ − 225
by (rule Rep_perm_ext)
+ − 226
(simp add: Rep_perm_simps expand_fun_eq)
1062
+ − 227
+ − 228
lemma swap_self [simp]:
+ − 229
"(a \<rightleftharpoons> a) = 0"
+ − 230
by (rule Rep_perm_ext, simp add: Rep_perm_simps expand_fun_eq)
+ − 231
+ − 232
lemma minus_swap [simp]:
+ − 233
"- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
+ − 234
by (rule minus_unique [OF swap_cancel])
+ − 235
+ − 236
lemma swap_commute:
+ − 237
"(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
+ − 238
by (rule Rep_perm_ext)
+ − 239
(simp add: Rep_perm_swap expand_fun_eq)
+ − 240
+ − 241
lemma swap_triple:
+ − 242
assumes "a \<noteq> b" and "c \<noteq> b"
+ − 243
assumes "sort_of a = sort_of b" "sort_of b = sort_of c"
+ − 244
shows "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
+ − 245
using assms
+ − 246
by (rule_tac Rep_perm_ext)
+ − 247
(auto simp add: Rep_perm_simps expand_fun_eq)
+ − 248
+ − 249
+ − 250
section {* Permutation Types *}
+ − 251
+ − 252
text {*
+ − 253
Infix syntax for @{text permute} has higher precedence than
+ − 254
addition, but lower than unary minus.
+ − 255
*}
+ − 256
+ − 257
class pt =
+ − 258
fixes permute :: "perm \<Rightarrow> 'a \<Rightarrow> 'a" ("_ \<bullet> _" [76, 75] 75)
+ − 259
assumes permute_zero [simp]: "0 \<bullet> x = x"
+ − 260
assumes permute_plus [simp]: "(p + q) \<bullet> x = p \<bullet> (q \<bullet> x)"
+ − 261
begin
+ − 262
+ − 263
lemma permute_diff [simp]:
+ − 264
shows "(p - q) \<bullet> x = p \<bullet> - q \<bullet> x"
+ − 265
unfolding diff_minus by simp
+ − 266
+ − 267
lemma permute_minus_cancel [simp]:
+ − 268
shows "p \<bullet> - p \<bullet> x = x"
+ − 269
and "- p \<bullet> p \<bullet> x = x"
+ − 270
unfolding permute_plus [symmetric] by simp_all
+ − 271
+ − 272
lemma permute_swap_cancel [simp]:
+ − 273
shows "(a \<rightleftharpoons> b) \<bullet> (a \<rightleftharpoons> b) \<bullet> x = x"
+ − 274
unfolding permute_plus [symmetric]
+ − 275
by (simp add: swap_cancel)
+ − 276
+ − 277
lemma permute_swap_cancel2 [simp]:
+ − 278
shows "(a \<rightleftharpoons> b) \<bullet> (b \<rightleftharpoons> a) \<bullet> x = x"
+ − 279
unfolding permute_plus [symmetric]
+ − 280
by (simp add: swap_commute)
+ − 281
+ − 282
lemma inj_permute [simp]:
+ − 283
shows "inj (permute p)"
+ − 284
by (rule inj_on_inverseI)
+ − 285
(rule permute_minus_cancel)
+ − 286
+ − 287
lemma surj_permute [simp]:
+ − 288
shows "surj (permute p)"
+ − 289
by (rule surjI, rule permute_minus_cancel)
+ − 290
+ − 291
lemma bij_permute [simp]:
+ − 292
shows "bij (permute p)"
+ − 293
by (rule bijI [OF inj_permute surj_permute])
+ − 294
+ − 295
lemma inv_permute:
+ − 296
shows "inv (permute p) = permute (- p)"
+ − 297
by (rule inv_equality) (simp_all)
+ − 298
+ − 299
lemma permute_minus:
+ − 300
shows "permute (- p) = inv (permute p)"
+ − 301
by (simp add: inv_permute)
+ − 302
+ − 303
lemma permute_eq_iff [simp]:
+ − 304
shows "p \<bullet> x = p \<bullet> y \<longleftrightarrow> x = y"
+ − 305
by (rule inj_permute [THEN inj_eq])
+ − 306
+ − 307
end
+ − 308
+ − 309
subsection {* Permutations for atoms *}
+ − 310
+ − 311
instantiation atom :: pt
+ − 312
begin
+ − 313
+ − 314
definition
1879
+ − 315
"p \<bullet> a = (Rep_perm p) a"
1062
+ − 316
+ − 317
instance
+ − 318
apply(default)
+ − 319
apply(simp_all add: permute_atom_def Rep_perm_simps)
+ − 320
done
+ − 321
+ − 322
end
+ − 323
+ − 324
lemma sort_of_permute [simp]:
+ − 325
shows "sort_of (p \<bullet> a) = sort_of a"
+ − 326
unfolding permute_atom_def by (rule sort_of_Rep_perm)
+ − 327
+ − 328
lemma swap_atom:
+ − 329
shows "(a \<rightleftharpoons> b) \<bullet> c =
+ − 330
(if sort_of a = sort_of b
+ − 331
then (if c = a then b else if c = b then a else c) else c)"
+ − 332
unfolding permute_atom_def
+ − 333
by (simp add: Rep_perm_swap)
+ − 334
+ − 335
lemma swap_atom_simps [simp]:
+ − 336
"sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> a = b"
+ − 337
"sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> b = a"
+ − 338
"c \<noteq> a \<Longrightarrow> c \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> c = c"
+ − 339
unfolding swap_atom by simp_all
+ − 340
+ − 341
lemma expand_perm_eq:
+ − 342
fixes p q :: "perm"
+ − 343
shows "p = q \<longleftrightarrow> (\<forall>a::atom. p \<bullet> a = q \<bullet> a)"
+ − 344
unfolding permute_atom_def
+ − 345
by (metis Rep_perm_ext ext)
+ − 346
+ − 347
+ − 348
subsection {* Permutations for permutations *}
+ − 349
+ − 350
instantiation perm :: pt
+ − 351
begin
+ − 352
+ − 353
definition
+ − 354
"p \<bullet> q = p + q - p"
+ − 355
+ − 356
instance
+ − 357
apply default
+ − 358
apply (simp add: permute_perm_def)
+ − 359
apply (simp add: permute_perm_def diff_minus minus_add add_assoc)
+ − 360
done
+ − 361
+ − 362
end
+ − 363
1879
+ − 364
lemma permute_self:
+ − 365
shows "p \<bullet> p = p"
+ − 366
unfolding permute_perm_def
+ − 367
by (simp add: diff_minus add_assoc)
1062
+ − 368
+ − 369
lemma permute_eqvt:
+ − 370
shows "p \<bullet> (q \<bullet> x) = (p \<bullet> q) \<bullet> (p \<bullet> x)"
+ − 371
unfolding permute_perm_def by simp
+ − 372
+ − 373
lemma zero_perm_eqvt:
+ − 374
shows "p \<bullet> (0::perm) = 0"
+ − 375
unfolding permute_perm_def by simp
+ − 376
+ − 377
lemma add_perm_eqvt:
+ − 378
fixes p p1 p2 :: perm
+ − 379
shows "p \<bullet> (p1 + p2) = p \<bullet> p1 + p \<bullet> p2"
+ − 380
unfolding permute_perm_def
+ − 381
by (simp add: expand_perm_eq)
+ − 382
+ − 383
lemma swap_eqvt:
+ − 384
shows "p \<bullet> (a \<rightleftharpoons> b) = (p \<bullet> a \<rightleftharpoons> p \<bullet> b)"
+ − 385
unfolding permute_perm_def
+ − 386
by (auto simp add: swap_atom expand_perm_eq)
+ − 387
2310
+ − 388
lemma uminus_eqvt:
+ − 389
fixes p q::"perm"
+ − 390
shows "p \<bullet> (- q) = - (p \<bullet> q)"
+ − 391
unfolding permute_perm_def
+ − 392
by (simp add: diff_minus minus_add add_assoc)
1062
+ − 393
+ − 394
subsection {* Permutations for functions *}
+ − 395
+ − 396
instantiation "fun" :: (pt, pt) pt
+ − 397
begin
+ − 398
+ − 399
definition
+ − 400
"p \<bullet> f = (\<lambda>x. p \<bullet> (f (- p \<bullet> x)))"
+ − 401
+ − 402
instance
+ − 403
apply default
+ − 404
apply (simp add: permute_fun_def)
+ − 405
apply (simp add: permute_fun_def minus_add)
+ − 406
done
+ − 407
+ − 408
end
+ − 409
+ − 410
lemma permute_fun_app_eq:
+ − 411
shows "p \<bullet> (f x) = (p \<bullet> f) (p \<bullet> x)"
1879
+ − 412
unfolding permute_fun_def by simp
1062
+ − 413
+ − 414
+ − 415
subsection {* Permutations for booleans *}
+ − 416
+ − 417
instantiation bool :: pt
+ − 418
begin
+ − 419
+ − 420
definition "p \<bullet> (b::bool) = b"
+ − 421
+ − 422
instance
+ − 423
apply(default)
+ − 424
apply(simp_all add: permute_bool_def)
+ − 425
done
+ − 426
+ − 427
end
+ − 428
+ − 429
lemma Not_eqvt:
+ − 430
shows "p \<bullet> (\<not> A) = (\<not> (p \<bullet> A))"
+ − 431
by (simp add: permute_bool_def)
+ − 432
1557
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 433
lemma permute_boolE:
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 434
fixes P::"bool"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 435
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
+ − 436
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
+ − 437
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 438
lemma permute_boolI:
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 439
fixes P::"bool"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 440
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
+ − 441
by(simp add: permute_bool_def)
1062
+ − 442
+ − 443
subsection {* Permutations for sets *}
+ − 444
+ − 445
lemma permute_set_eq:
+ − 446
fixes x::"'a::pt"
+ − 447
and p::"perm"
+ − 448
shows "(p \<bullet> X) = {p \<bullet> x | x. x \<in> X}"
1879
+ − 449
unfolding permute_fun_def
+ − 450
unfolding permute_bool_def
+ − 451
apply(auto simp add: mem_def)
1062
+ − 452
apply(rule_tac x="- p \<bullet> x" in exI)
+ − 453
apply(simp)
+ − 454
done
+ − 455
+ − 456
lemma permute_set_eq_image:
+ − 457
shows "p \<bullet> X = permute p ` X"
1879
+ − 458
unfolding permute_set_eq by auto
1062
+ − 459
+ − 460
lemma permute_set_eq_vimage:
+ − 461
shows "p \<bullet> X = permute (- p) -` X"
1879
+ − 462
unfolding permute_fun_def permute_bool_def
+ − 463
unfolding vimage_def Collect_def mem_def ..
1062
+ − 464
+ − 465
lemma swap_set_not_in:
+ − 466
assumes a: "a \<notin> S" "b \<notin> S"
+ − 467
shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1879
+ − 468
unfolding permute_set_eq
+ − 469
using a by (auto simp add: swap_atom)
1062
+ − 470
+ − 471
lemma swap_set_in:
+ − 472
assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
+ − 473
shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
1879
+ − 474
unfolding permute_set_eq
+ − 475
using a by (auto simp add: swap_atom)
1062
+ − 476
+ − 477
subsection {* Permutations for units *}
+ − 478
+ − 479
instantiation unit :: pt
+ − 480
begin
+ − 481
+ − 482
definition "p \<bullet> (u::unit) = u"
+ − 483
1879
+ − 484
instance
+ − 485
by (default) (simp_all add: permute_unit_def)
1062
+ − 486
+ − 487
end
+ − 488
+ − 489
+ − 490
subsection {* Permutations for products *}
+ − 491
2378
+ − 492
instantiation prod :: (pt, pt) pt
1062
+ − 493
begin
+ − 494
+ − 495
primrec
+ − 496
permute_prod
+ − 497
where
+ − 498
Pair_eqvt: "p \<bullet> (x, y) = (p \<bullet> x, p \<bullet> y)"
+ − 499
+ − 500
instance
+ − 501
by default auto
+ − 502
+ − 503
end
+ − 504
+ − 505
subsection {* Permutations for sums *}
+ − 506
2378
+ − 507
instantiation sum :: (pt, pt) pt
1062
+ − 508
begin
+ − 509
+ − 510
primrec
+ − 511
permute_sum
+ − 512
where
+ − 513
"p \<bullet> (Inl x) = Inl (p \<bullet> x)"
+ − 514
| "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
+ − 515
1879
+ − 516
instance
+ − 517
by (default) (case_tac [!] x, simp_all)
1062
+ − 518
+ − 519
end
+ − 520
+ − 521
subsection {* Permutations for lists *}
+ − 522
+ − 523
instantiation list :: (pt) pt
+ − 524
begin
+ − 525
+ − 526
primrec
+ − 527
permute_list
+ − 528
where
+ − 529
"p \<bullet> [] = []"
+ − 530
| "p \<bullet> (x # xs) = p \<bullet> x # p \<bullet> xs"
+ − 531
1879
+ − 532
instance
+ − 533
by (default) (induct_tac [!] x, simp_all)
1062
+ − 534
+ − 535
end
+ − 536
+ − 537
subsection {* Permutations for options *}
+ − 538
+ − 539
instantiation option :: (pt) pt
+ − 540
begin
+ − 541
+ − 542
primrec
+ − 543
permute_option
+ − 544
where
+ − 545
"p \<bullet> None = None"
+ − 546
| "p \<bullet> (Some x) = Some (p \<bullet> x)"
+ − 547
1879
+ − 548
instance
+ − 549
by (default) (induct_tac [!] x, simp_all)
1062
+ − 550
+ − 551
end
+ − 552
+ − 553
subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *}
+ − 554
+ − 555
instantiation char :: pt
+ − 556
begin
+ − 557
+ − 558
definition "p \<bullet> (c::char) = c"
+ − 559
1879
+ − 560
instance
+ − 561
by (default) (simp_all add: permute_char_def)
1062
+ − 562
+ − 563
end
+ − 564
+ − 565
instantiation nat :: pt
+ − 566
begin
+ − 567
+ − 568
definition "p \<bullet> (n::nat) = n"
+ − 569
1879
+ − 570
instance
+ − 571
by (default) (simp_all add: permute_nat_def)
1062
+ − 572
+ − 573
end
+ − 574
+ − 575
instantiation int :: pt
+ − 576
begin
+ − 577
+ − 578
definition "p \<bullet> (i::int) = i"
+ − 579
1879
+ − 580
instance
+ − 581
by (default) (simp_all add: permute_int_def)
1062
+ − 582
+ − 583
end
+ − 584
+ − 585
+ − 586
section {* Pure types *}
+ − 587
+ − 588
text {* Pure types will have always empty support. *}
+ − 589
+ − 590
class pure = pt +
+ − 591
assumes permute_pure: "p \<bullet> x = x"
+ − 592
+ − 593
text {* Types @{typ unit} and @{typ bool} are pure. *}
+ − 594
+ − 595
instance unit :: pure
+ − 596
proof qed (rule permute_unit_def)
+ − 597
+ − 598
instance bool :: pure
+ − 599
proof qed (rule permute_bool_def)
+ − 600
+ − 601
text {* Other type constructors preserve purity. *}
+ − 602
+ − 603
instance "fun" :: (pure, pure) pure
+ − 604
by default (simp add: permute_fun_def permute_pure)
+ − 605
2378
+ − 606
instance prod :: (pure, pure) pure
1062
+ − 607
by default (induct_tac x, simp add: permute_pure)
+ − 608
2378
+ − 609
instance sum :: (pure, pure) pure
1062
+ − 610
by default (induct_tac x, simp_all add: permute_pure)
+ − 611
+ − 612
instance list :: (pure) pure
+ − 613
by default (induct_tac x, simp_all add: permute_pure)
+ − 614
+ − 615
instance option :: (pure) pure
+ − 616
by default (induct_tac x, simp_all add: permute_pure)
+ − 617
+ − 618
+ − 619
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
+ − 620
+ − 621
instance char :: pure
+ − 622
proof qed (rule permute_char_def)
+ − 623
+ − 624
instance nat :: pure
+ − 625
proof qed (rule permute_nat_def)
+ − 626
+ − 627
instance int :: pure
+ − 628
proof qed (rule permute_int_def)
+ − 629
+ − 630
+ − 631
subsection {* Supp, Freshness and Supports *}
+ − 632
+ − 633
context pt
+ − 634
begin
+ − 635
+ − 636
definition
+ − 637
supp :: "'a \<Rightarrow> atom set"
+ − 638
where
+ − 639
"supp x = {a. infinite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}}"
+ − 640
+ − 641
end
+ − 642
+ − 643
definition
+ − 644
fresh :: "atom \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp> _" [55, 55] 55)
+ − 645
where
+ − 646
"a \<sharp> x \<equiv> a \<notin> supp x"
+ − 647
+ − 648
lemma supp_conv_fresh:
+ − 649
shows "supp x = {a. \<not> a \<sharp> x}"
+ − 650
unfolding fresh_def by simp
+ − 651
+ − 652
lemma swap_rel_trans:
+ − 653
assumes "sort_of a = sort_of b"
+ − 654
assumes "sort_of b = sort_of c"
+ − 655
assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
+ − 656
assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
+ − 657
shows "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 658
proof (cases)
+ − 659
assume "a = b \<or> c = b"
+ − 660
with assms show "(a \<rightleftharpoons> b) \<bullet> x = x" by auto
+ − 661
next
+ − 662
assume *: "\<not> (a = b \<or> c = b)"
+ − 663
have "((a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c)) \<bullet> x = x"
+ − 664
using assms by simp
+ − 665
also have "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
+ − 666
using assms * by (simp add: swap_triple)
+ − 667
finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
+ − 668
qed
+ − 669
+ − 670
lemma swap_fresh_fresh:
+ − 671
assumes a: "a \<sharp> x"
+ − 672
and b: "b \<sharp> x"
+ − 673
shows "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 674
proof (cases)
+ − 675
assume asm: "sort_of a = sort_of b"
+ − 676
have "finite {c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x}" "finite {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x}"
+ − 677
using a b unfolding fresh_def supp_def by simp_all
+ − 678
then have "finite ({c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x} \<union> {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x})" by simp
+ − 679
then obtain c
+ − 680
where "(a \<rightleftharpoons> c) \<bullet> x = x" "(b \<rightleftharpoons> c) \<bullet> x = x" "sort_of c = sort_of b"
+ − 681
by (rule obtain_atom) (auto)
+ − 682
then show "(a \<rightleftharpoons> b) \<bullet> x = x" using asm by (rule_tac swap_rel_trans) (simp_all)
+ − 683
next
+ − 684
assume "sort_of a \<noteq> sort_of b"
+ − 685
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by simp
+ − 686
qed
+ − 687
+ − 688
+ − 689
subsection {* supp and fresh are equivariant *}
+ − 690
+ − 691
lemma finite_Collect_bij:
+ − 692
assumes a: "bij f"
+ − 693
shows "finite {x. P (f x)} = finite {x. P x}"
+ − 694
by (metis a finite_vimage_iff vimage_Collect_eq)
+ − 695
+ − 696
lemma fresh_permute_iff:
+ − 697
shows "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x"
+ − 698
proof -
+ − 699
have "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
+ − 700
unfolding fresh_def supp_def by simp
+ − 701
also have "\<dots> \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> p \<bullet> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
1879
+ − 702
using bij_permute by (rule finite_Collect_bij[symmetric])
1062
+ − 703
also have "\<dots> \<longleftrightarrow> finite {b. p \<bullet> (a \<rightleftharpoons> b) \<bullet> x \<noteq> p \<bullet> x}"
+ − 704
by (simp only: permute_eqvt [of p] swap_eqvt)
+ − 705
also have "\<dots> \<longleftrightarrow> finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"
+ − 706
by (simp only: permute_eq_iff)
+ − 707
also have "\<dots> \<longleftrightarrow> a \<sharp> x"
+ − 708
unfolding fresh_def supp_def by simp
1879
+ − 709
finally show "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x" .
1062
+ − 710
qed
+ − 711
+ − 712
lemma fresh_eqvt:
+ − 713
shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
1879
+ − 714
unfolding permute_bool_def
+ − 715
by (simp add: fresh_permute_iff)
1062
+ − 716
+ − 717
lemma supp_eqvt:
+ − 718
fixes p :: "perm"
+ − 719
and x :: "'a::pt"
+ − 720
shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
+ − 721
unfolding supp_conv_fresh
1879
+ − 722
unfolding Collect_def
+ − 723
unfolding permute_fun_def
1062
+ − 724
by (simp add: Not_eqvt fresh_eqvt)
+ − 725
+ − 726
subsection {* supports *}
+ − 727
+ − 728
definition
+ − 729
supports :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" (infixl "supports" 80)
+ − 730
where
+ − 731
"S supports x \<equiv> \<forall>a b. (a \<notin> S \<and> b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x)"
+ − 732
+ − 733
lemma supp_is_subset:
+ − 734
fixes S :: "atom set"
+ − 735
and x :: "'a::pt"
+ − 736
assumes a1: "S supports x"
+ − 737
and a2: "finite S"
+ − 738
shows "(supp x) \<subseteq> S"
+ − 739
proof (rule ccontr)
1879
+ − 740
assume "\<not> (supp x \<subseteq> S)"
1062
+ − 741
then obtain a where b1: "a \<in> supp x" and b2: "a \<notin> S" by auto
1879
+ − 742
from a1 b2 have "\<forall>b. b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x" unfolding supports_def by auto
+ − 743
then have "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x} \<subseteq> S" by auto
1062
+ − 744
with a2 have "finite {b. (a \<rightleftharpoons> b)\<bullet>x \<noteq> x}" by (simp add: finite_subset)
+ − 745
then have "a \<notin> (supp x)" unfolding supp_def by simp
+ − 746
with b1 show False by simp
+ − 747
qed
+ − 748
+ − 749
lemma supports_finite:
+ − 750
fixes S :: "atom set"
+ − 751
and x :: "'a::pt"
+ − 752
assumes a1: "S supports x"
+ − 753
and a2: "finite S"
+ − 754
shows "finite (supp x)"
+ − 755
proof -
+ − 756
have "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
+ − 757
then show "finite (supp x)" using a2 by (simp add: finite_subset)
+ − 758
qed
+ − 759
+ − 760
lemma supp_supports:
+ − 761
fixes x :: "'a::pt"
+ − 762
shows "(supp x) supports x"
1879
+ − 763
unfolding supports_def
+ − 764
proof (intro strip)
1062
+ − 765
fix a b
+ − 766
assume "a \<notin> (supp x) \<and> b \<notin> (supp x)"
+ − 767
then have "a \<sharp> x" and "b \<sharp> x" by (simp_all add: fresh_def)
1879
+ − 768
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
1062
+ − 769
qed
+ − 770
+ − 771
lemma supp_is_least_supports:
+ − 772
fixes S :: "atom set"
+ − 773
and x :: "'a::pt"
+ − 774
assumes a1: "S supports x"
+ − 775
and a2: "finite S"
+ − 776
and a3: "\<And>S'. finite S' \<Longrightarrow> (S' supports x) \<Longrightarrow> S \<subseteq> S'"
+ − 777
shows "(supp x) = S"
+ − 778
proof (rule equalityI)
+ − 779
show "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
+ − 780
with a2 have fin: "finite (supp x)" by (rule rev_finite_subset)
+ − 781
have "(supp x) supports x" by (rule supp_supports)
+ − 782
with fin a3 show "S \<subseteq> supp x" by blast
+ − 783
qed
+ − 784
+ − 785
lemma subsetCI:
+ − 786
shows "(\<And>x. x \<in> A \<Longrightarrow> x \<notin> B \<Longrightarrow> False) \<Longrightarrow> A \<subseteq> B"
+ − 787
by auto
+ − 788
+ − 789
lemma finite_supp_unique:
+ − 790
assumes a1: "S supports x"
+ − 791
assumes a2: "finite S"
+ − 792
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"
+ − 793
shows "(supp x) = S"
+ − 794
using a1 a2
+ − 795
proof (rule supp_is_least_supports)
+ − 796
fix S'
+ − 797
assume "finite S'" and "S' supports x"
+ − 798
show "S \<subseteq> S'"
+ − 799
proof (rule subsetCI)
+ − 800
fix a
+ − 801
assume "a \<in> S" and "a \<notin> S'"
+ − 802
have "finite (S \<union> S')"
+ − 803
using `finite S` `finite S'` by simp
+ − 804
then obtain b where "b \<notin> S \<union> S'" and "sort_of b = sort_of a"
+ − 805
by (rule obtain_atom)
+ − 806
then have "b \<notin> S" and "b \<notin> S'" and "sort_of a = sort_of b"
+ − 807
by simp_all
+ − 808
then have "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 809
using `a \<notin> S'` `S' supports x` by (simp add: supports_def)
+ − 810
moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
+ − 811
using `a \<in> S` `b \<notin> S` `sort_of a = sort_of b`
+ − 812
by (rule a3)
+ − 813
ultimately show "False" by simp
+ − 814
qed
+ − 815
qed
+ − 816
+ − 817
section {* Finitely-supported types *}
+ − 818
+ − 819
class fs = pt +
+ − 820
assumes finite_supp: "finite (supp x)"
+ − 821
+ − 822
lemma pure_supp:
+ − 823
shows "supp (x::'a::pure) = {}"
+ − 824
unfolding supp_def by (simp add: permute_pure)
+ − 825
+ − 826
lemma pure_fresh:
+ − 827
fixes x::"'a::pure"
+ − 828
shows "a \<sharp> x"
+ − 829
unfolding fresh_def by (simp add: pure_supp)
+ − 830
+ − 831
instance pure < fs
+ − 832
by default (simp add: pure_supp)
+ − 833
+ − 834
+ − 835
subsection {* Type @{typ atom} is finitely-supported. *}
+ − 836
+ − 837
lemma supp_atom:
+ − 838
shows "supp a = {a}"
+ − 839
apply (rule finite_supp_unique)
+ − 840
apply (clarsimp simp add: supports_def)
+ − 841
apply simp
+ − 842
apply simp
+ − 843
done
+ − 844
+ − 845
lemma fresh_atom:
+ − 846
shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
+ − 847
unfolding fresh_def supp_atom by simp
+ − 848
+ − 849
instance atom :: fs
+ − 850
by default (simp add: supp_atom)
+ − 851
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
+ − 852
section {* Support for finite sets of atoms *}
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
+ − 853
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
+ − 854
lemma supp_finite_atom_set:
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
+ − 855
fixes S::"atom set"
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
+ − 856
assumes "finite S"
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
+ − 857
shows "supp S = S"
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
+ − 858
apply(rule finite_supp_unique)
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
+ − 859
apply(simp add: supports_def)
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
+ − 860
apply(simp add: swap_set_not_in)
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
+ − 861
apply(rule assms)
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
+ − 862
apply(simp add: swap_set_in)
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
+ − 863
done
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
+ − 864
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
+ − 865
lemma supp_atom_insert:
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
+ − 866
fixes S::"atom set"
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
+ − 867
assumes a: "finite S"
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
+ − 868
shows "supp (insert a S) = supp a \<union> supp S"
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
+ − 869
using a by (simp add: supp_finite_atom_set supp_atom)
1062
+ − 870
+ − 871
section {* Type @{typ perm} is finitely-supported. *}
+ − 872
+ − 873
lemma perm_swap_eq:
+ − 874
shows "(a \<rightleftharpoons> b) \<bullet> p = p \<longleftrightarrow> (p \<bullet> (a \<rightleftharpoons> b)) = (a \<rightleftharpoons> b)"
+ − 875
unfolding permute_perm_def
+ − 876
by (metis add_diff_cancel minus_perm_def)
+ − 877
+ − 878
lemma supports_perm:
+ − 879
shows "{a. p \<bullet> a \<noteq> a} supports p"
+ − 880
unfolding supports_def
1879
+ − 881
unfolding perm_swap_eq
+ − 882
by (simp add: swap_eqvt)
1062
+ − 883
+ − 884
lemma finite_perm_lemma:
+ − 885
shows "finite {a::atom. p \<bullet> a \<noteq> a}"
+ − 886
using finite_Rep_perm [of p]
+ − 887
unfolding permute_atom_def .
+ − 888
+ − 889
lemma supp_perm:
+ − 890
shows "supp p = {a. p \<bullet> a \<noteq> a}"
+ − 891
apply (rule finite_supp_unique)
+ − 892
apply (rule supports_perm)
+ − 893
apply (rule finite_perm_lemma)
+ − 894
apply (simp add: perm_swap_eq swap_eqvt)
+ − 895
apply (auto simp add: expand_perm_eq swap_atom)
+ − 896
done
+ − 897
+ − 898
lemma fresh_perm:
+ − 899
shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
1879
+ − 900
unfolding fresh_def
+ − 901
by (simp add: supp_perm)
1062
+ − 902
+ − 903
lemma supp_swap:
+ − 904
shows "supp (a \<rightleftharpoons> b) = (if a = b \<or> sort_of a \<noteq> sort_of b then {} else {a, b})"
+ − 905
by (auto simp add: supp_perm swap_atom)
+ − 906
+ − 907
lemma fresh_zero_perm:
+ − 908
shows "a \<sharp> (0::perm)"
+ − 909
unfolding fresh_perm by simp
+ − 910
+ − 911
lemma supp_zero_perm:
+ − 912
shows "supp (0::perm) = {}"
+ − 913
unfolding supp_perm by simp
+ − 914
1087
+ − 915
lemma fresh_plus_perm:
+ − 916
fixes p q::perm
+ − 917
assumes "a \<sharp> p" "a \<sharp> q"
+ − 918
shows "a \<sharp> (p + q)"
+ − 919
using assms
+ − 920
unfolding fresh_def
+ − 921
by (auto simp add: supp_perm)
+ − 922
1062
+ − 923
lemma supp_plus_perm:
+ − 924
fixes p q::perm
+ − 925
shows "supp (p + q) \<subseteq> supp p \<union> supp q"
+ − 926
by (auto simp add: supp_perm)
+ − 927
1087
+ − 928
lemma fresh_minus_perm:
+ − 929
fixes p::perm
+ − 930
shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
+ − 931
unfolding fresh_def
1879
+ − 932
unfolding supp_perm
+ − 933
apply(simp)
+ − 934
apply(metis permute_minus_cancel)
1087
+ − 935
done
+ − 936
1062
+ − 937
lemma supp_minus_perm:
+ − 938
fixes p::perm
+ − 939
shows "supp (- p) = supp p"
1087
+ − 940
unfolding supp_conv_fresh
+ − 941
by (simp add: fresh_minus_perm)
1062
+ − 942
+ − 943
instance perm :: fs
+ − 944
by default (simp add: supp_perm finite_perm_lemma)
+ − 945
1305
+ − 946
lemma plus_perm_eq:
+ − 947
fixes p q::"perm"
1879
+ − 948
assumes asm: "supp p \<inter> supp q = {}"
1305
+ − 949
shows "p + q = q + p"
+ − 950
unfolding expand_perm_eq
+ − 951
proof
+ − 952
fix a::"atom"
+ − 953
show "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 954
proof -
+ − 955
{ assume "a \<notin> supp p" "a \<notin> supp q"
+ − 956
then have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 957
by (simp add: supp_perm)
+ − 958
}
+ − 959
moreover
+ − 960
{ assume a: "a \<in> supp p" "a \<notin> supp q"
+ − 961
then have "p \<bullet> a \<in> supp p" by (simp add: supp_perm)
+ − 962
then have "p \<bullet> a \<notin> supp q" using asm by auto
+ − 963
with a have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 964
by (simp add: supp_perm)
+ − 965
}
+ − 966
moreover
+ − 967
{ assume a: "a \<notin> supp p" "a \<in> supp q"
+ − 968
then have "q \<bullet> a \<in> supp q" by (simp add: supp_perm)
+ − 969
then have "q \<bullet> a \<notin> supp p" using asm by auto
+ − 970
with a have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 971
by (simp add: supp_perm)
+ − 972
}
+ − 973
ultimately show "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 974
using asm by blast
+ − 975
qed
+ − 976
qed
1062
+ − 977
+ − 978
section {* Finite Support instances for other types *}
+ − 979
+ − 980
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
+ − 981
+ − 982
lemma supp_Pair:
+ − 983
shows "supp (x, y) = supp x \<union> supp y"
+ − 984
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
+ − 985
+ − 986
lemma fresh_Pair:
+ − 987
shows "a \<sharp> (x, y) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> y"
+ − 988
by (simp add: fresh_def supp_Pair)
+ − 989
2378
+ − 990
instance prod :: (fs, fs) fs
1062
+ − 991
apply default
+ − 992
apply (induct_tac x)
+ − 993
apply (simp add: supp_Pair finite_supp)
+ − 994
done
+ − 995
+ − 996
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
+ − 997
+ − 998
lemma supp_Inl:
+ − 999
shows "supp (Inl x) = supp x"
+ − 1000
by (simp add: supp_def)
+ − 1001
+ − 1002
lemma supp_Inr:
+ − 1003
shows "supp (Inr x) = supp x"
+ − 1004
by (simp add: supp_def)
+ − 1005
+ − 1006
lemma fresh_Inl:
+ − 1007
shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
+ − 1008
by (simp add: fresh_def supp_Inl)
+ − 1009
+ − 1010
lemma fresh_Inr:
+ − 1011
shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
+ − 1012
by (simp add: fresh_def supp_Inr)
+ − 1013
2378
+ − 1014
instance sum :: (fs, fs) fs
1062
+ − 1015
apply default
+ − 1016
apply (induct_tac x)
+ − 1017
apply (simp_all add: supp_Inl supp_Inr finite_supp)
+ − 1018
done
+ − 1019
+ − 1020
subsection {* Type @{typ "'a option"} is finitely supported *}
+ − 1021
+ − 1022
lemma supp_None:
+ − 1023
shows "supp None = {}"
+ − 1024
by (simp add: supp_def)
+ − 1025
+ − 1026
lemma supp_Some:
+ − 1027
shows "supp (Some x) = supp x"
+ − 1028
by (simp add: supp_def)
+ − 1029
+ − 1030
lemma fresh_None:
+ − 1031
shows "a \<sharp> None"
+ − 1032
by (simp add: fresh_def supp_None)
+ − 1033
+ − 1034
lemma fresh_Some:
+ − 1035
shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
+ − 1036
by (simp add: fresh_def supp_Some)
+ − 1037
+ − 1038
instance option :: (fs) fs
+ − 1039
apply default
+ − 1040
apply (induct_tac x)
+ − 1041
apply (simp_all add: supp_None supp_Some finite_supp)
+ − 1042
done
+ − 1043
+ − 1044
subsubsection {* Type @{typ "'a list"} is finitely supported *}
+ − 1045
+ − 1046
lemma supp_Nil:
+ − 1047
shows "supp [] = {}"
+ − 1048
by (simp add: supp_def)
+ − 1049
+ − 1050
lemma supp_Cons:
+ − 1051
shows "supp (x # xs) = supp x \<union> supp xs"
+ − 1052
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
+ − 1053
+ − 1054
lemma fresh_Nil:
+ − 1055
shows "a \<sharp> []"
+ − 1056
by (simp add: fresh_def supp_Nil)
+ − 1057
+ − 1058
lemma fresh_Cons:
+ − 1059
shows "a \<sharp> (x # xs) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> xs"
+ − 1060
by (simp add: fresh_def supp_Cons)
+ − 1061
+ − 1062
instance list :: (fs) fs
+ − 1063
apply default
+ − 1064
apply (induct_tac x)
+ − 1065
apply (simp_all add: supp_Nil supp_Cons finite_supp)
+ − 1066
done
+ − 1067
+ − 1068
section {* Support and freshness for applications *}
+ − 1069
1879
+ − 1070
lemma fresh_conv_MOST:
+ − 1071
shows "a \<sharp> x \<longleftrightarrow> (MOST b. (a \<rightleftharpoons> b) \<bullet> x = x)"
+ − 1072
unfolding fresh_def supp_def
+ − 1073
unfolding MOST_iff_cofinite by simp
+ − 1074
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1075
lemma supp_subset_fresh:
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1076
assumes a: "\<And>a. a \<sharp> x \<Longrightarrow> a \<sharp> y"
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1077
shows "supp y \<subseteq> supp x"
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1078
using a
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1079
unfolding fresh_def
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1080
by blast
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1081
1879
+ − 1082
lemma fresh_fun_app:
+ − 1083
assumes "a \<sharp> f" and "a \<sharp> x"
+ − 1084
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
+ − 1085
using assms
1879
+ − 1086
unfolding fresh_conv_MOST
+ − 1087
unfolding permute_fun_app_eq
+ − 1088
by (elim MOST_rev_mp, simp)
+ − 1089
1062
+ − 1090
lemma supp_fun_app:
+ − 1091
shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
1879
+ − 1092
using fresh_fun_app
+ − 1093
unfolding fresh_def
+ − 1094
by auto
+ − 1095
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1096
text {* support of equivariant functions *}
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1097
1941
+ − 1098
lemma supp_fun_eqvt:
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1099
assumes a: "\<And>p. p \<bullet> f = f"
1941
+ − 1100
shows "supp f = {}"
+ − 1101
unfolding supp_def
+ − 1102
using a by simp
+ − 1103
1062
+ − 1104
lemma fresh_fun_eqvt_app:
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1105
assumes a: "\<And>p. p \<bullet> f = f"
1062
+ − 1106
shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
+ − 1107
proof -
1941
+ − 1108
from a have "supp f = {}" by (simp add: supp_fun_eqvt)
1879
+ − 1109
then show "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
1062
+ − 1110
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
+ − 1111
using supp_fun_app by auto
1062
+ − 1112
qed
+ − 1113
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
+ − 1114
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
+ − 1115
section {* Concrete atoms types *}
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
+ − 1116
1972
+ − 1117
text {*
+ − 1118
Class @{text at_base} allows types containing multiple sorts of atoms.
+ − 1119
Class @{text at} only allows types with a single sort.
+ − 1120
*}
+ − 1121
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
+ − 1122
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
+ − 1123
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
+ − 1124
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
+ − 1125
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
+ − 1126
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
+ − 1127
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
+ − 1128
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
+ − 1129
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
+ − 1130
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
+ − 1131
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
+ − 1132
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
+ − 1133
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
+ − 1134
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
+ − 1135
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
+ − 1136
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
+ − 1137
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
+ − 1138
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
+ − 1139
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
+ − 1140
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
+ − 1141
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
+ − 1142
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
+ − 1143
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
+ − 1144
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
+ − 1145
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
+ − 1146
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
+ − 1147
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
+ − 1148
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
+ − 1149
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
+ − 1150
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
+ − 1151
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
+ − 1152
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
+ − 1153
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
+ − 1154
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
+ − 1155
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
+ − 1156
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
+ − 1157
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
+ − 1158
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
+ − 1159
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
+ − 1160
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
+ − 1161
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
+ − 1162
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
+ − 1163
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
+ − 1164
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
+ − 1165
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
+ − 1166
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
+ − 1167
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
+ − 1168
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
+ − 1169
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
+ − 1170
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
+ − 1171
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
+ − 1172
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
+ − 1173
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
+ − 1174
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
+ − 1175
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
+ − 1176
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
+ − 1177
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
+ − 1178
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
+ − 1179
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
+ − 1180
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
+ − 1181
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1182
lemma image_eqvt:
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1183
shows "p \<bullet> (f ` A) = (p \<bullet> f) ` (p \<bullet> A)"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1184
unfolding permute_set_eq_image
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1185
unfolding permute_fun_def [where f=f]
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1186
by (simp add: image_image)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1187
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1188
lemma atom_image_cong:
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1189
shows "(atom ` X = atom ` Y) = (X = Y)"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1190
apply(rule inj_image_eq_iff)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1191
apply(simp add: inj_on_def)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1192
done
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1193
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1194
lemma atom_image_supp:
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1195
shows "supp S = supp (atom ` S)"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1196
apply(simp add: supp_def)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1197
apply(simp add: image_eqvt)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1198
apply(subst (2) permute_fun_def)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1199
apply(simp add: atom_eqvt)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1200
apply(simp add: atom_image_cong)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1201
done
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1202
1973
+ − 1203
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
+ − 1204
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
+ − 1205
shows "supp S = atom ` S"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1206
proof -
2013
+ − 1207
have fin: "finite (atom ` S)" using a by simp
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1208
have "supp S = supp (atom ` S)" by (rule atom_image_supp)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1209
also have "\<dots> = atom ` S" using fin by (simp add: supp_finite_atom_set)
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1210
finally show "supp S = atom ` S" by simp
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1211
qed
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1212
1973
+ − 1213
lemma supp_at_base_insert:
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1214
fixes a::"'a::at_base"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1215
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
+ − 1216
shows "supp (insert a S) = supp a \<union> supp S"
1973
+ − 1217
using a by (simp add: supp_finite_set_at_base supp_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
+ − 1218
1879
+ − 1219
section {* library functions for the nominal infrastructure *}
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1220
use "nominal_library.ML"
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1221
1062
+ − 1222
end