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
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
"~~/src/HOL/Quotient_Examples/FSet"
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 10
uses ("nominal_library.ML")
2467
+ − 11
("nominal_atoms.ML")
1062
+ − 12
begin
+ − 13
+ − 14
section {* Atoms and Sorts *}
+ − 15
+ − 16
text {* A simple implementation for atom_sorts is strings. *}
+ − 17
(* types atom_sort = string *)
+ − 18
+ − 19
text {* To deal with Church-like binding we use trees of
+ − 20
strings as sorts. *}
+ − 21
+ − 22
datatype atom_sort = Sort "string" "atom_sort list"
+ − 23
+ − 24
datatype atom = Atom atom_sort nat
+ − 25
+ − 26
+ − 27
text {* Basic projection function. *}
+ − 28
+ − 29
primrec
+ − 30
sort_of :: "atom \<Rightarrow> atom_sort"
+ − 31
where
+ − 32
"sort_of (Atom s i) = s"
+ − 33
1930
+ − 34
primrec
+ − 35
nat_of :: "atom \<Rightarrow> nat"
+ − 36
where
+ − 37
"nat_of (Atom s n) = n"
+ − 38
1062
+ − 39
+ − 40
text {* There are infinitely many atoms of each sort. *}
+ − 41
lemma INFM_sort_of_eq:
+ − 42
shows "INFM a. sort_of a = s"
+ − 43
proof -
+ − 44
have "INFM i. sort_of (Atom s i) = s" by simp
+ − 45
moreover have "inj (Atom s)" by (simp add: inj_on_def)
+ − 46
ultimately show "INFM a. sort_of a = s" by (rule INFM_inj)
+ − 47
qed
+ − 48
+ − 49
lemma infinite_sort_of_eq:
+ − 50
shows "infinite {a. sort_of a = s}"
+ − 51
using INFM_sort_of_eq unfolding INFM_iff_infinite .
+ − 52
+ − 53
lemma atom_infinite [simp]:
+ − 54
shows "infinite (UNIV :: atom set)"
+ − 55
using subset_UNIV infinite_sort_of_eq
+ − 56
by (rule infinite_super)
+ − 57
+ − 58
lemma obtain_atom:
+ − 59
fixes X :: "atom set"
+ − 60
assumes X: "finite X"
+ − 61
obtains a where "a \<notin> X" "sort_of a = s"
+ − 62
proof -
+ − 63
from X have "MOST a. a \<notin> X"
+ − 64
unfolding MOST_iff_cofinite by simp
+ − 65
with INFM_sort_of_eq
+ − 66
have "INFM a. sort_of a = s \<and> a \<notin> X"
+ − 67
by (rule INFM_conjI)
+ − 68
then obtain a where "a \<notin> X" "sort_of a = s"
+ − 69
by (auto elim: INFM_E)
+ − 70
then show ?thesis ..
+ − 71
qed
+ − 72
1930
+ − 73
lemma atom_components_eq_iff:
+ − 74
fixes a b :: atom
+ − 75
shows "a = b \<longleftrightarrow> sort_of a = sort_of b \<and> nat_of a = nat_of b"
+ − 76
by (induct a, induct b, simp)
+ − 77
1062
+ − 78
section {* Sort-Respecting Permutations *}
+ − 79
+ − 80
typedef perm =
+ − 81
"{f. bij f \<and> finite {a. f a \<noteq> a} \<and> (\<forall>a. sort_of (f a) = sort_of a)}"
+ − 82
proof
+ − 83
show "id \<in> ?perm" by simp
+ − 84
qed
+ − 85
+ − 86
lemma permI:
+ − 87
assumes "bij f" and "MOST x. f x = x" and "\<And>a. sort_of (f a) = sort_of a"
+ − 88
shows "f \<in> perm"
+ − 89
using assms unfolding perm_def MOST_iff_cofinite by simp
+ − 90
+ − 91
lemma perm_is_bij: "f \<in> perm \<Longrightarrow> bij f"
+ − 92
unfolding perm_def by simp
+ − 93
+ − 94
lemma perm_is_finite: "f \<in> perm \<Longrightarrow> finite {a. f a \<noteq> a}"
+ − 95
unfolding perm_def by simp
+ − 96
+ − 97
lemma perm_is_sort_respecting: "f \<in> perm \<Longrightarrow> sort_of (f a) = sort_of a"
+ − 98
unfolding perm_def by simp
+ − 99
+ − 100
lemma perm_MOST: "f \<in> perm \<Longrightarrow> MOST x. f x = x"
+ − 101
unfolding perm_def MOST_iff_cofinite by simp
+ − 102
+ − 103
lemma perm_id: "id \<in> perm"
+ − 104
unfolding perm_def by simp
+ − 105
+ − 106
lemma perm_comp:
+ − 107
assumes f: "f \<in> perm" and g: "g \<in> perm"
+ − 108
shows "(f \<circ> g) \<in> perm"
+ − 109
apply (rule permI)
+ − 110
apply (rule bij_comp)
+ − 111
apply (rule perm_is_bij [OF g])
+ − 112
apply (rule perm_is_bij [OF f])
+ − 113
apply (rule MOST_rev_mp [OF perm_MOST [OF g]])
+ − 114
apply (rule MOST_rev_mp [OF perm_MOST [OF f]])
+ − 115
apply (simp)
+ − 116
apply (simp add: perm_is_sort_respecting [OF f])
+ − 117
apply (simp add: perm_is_sort_respecting [OF g])
+ − 118
done
+ − 119
+ − 120
lemma perm_inv:
+ − 121
assumes f: "f \<in> perm"
+ − 122
shows "(inv f) \<in> perm"
+ − 123
apply (rule permI)
+ − 124
apply (rule bij_imp_bij_inv)
+ − 125
apply (rule perm_is_bij [OF f])
+ − 126
apply (rule MOST_mono [OF perm_MOST [OF f]])
+ − 127
apply (erule subst, rule inv_f_f)
+ − 128
apply (rule bij_is_inj [OF perm_is_bij [OF f]])
+ − 129
apply (rule perm_is_sort_respecting [OF f, THEN sym, THEN trans])
+ − 130
apply (simp add: surj_f_inv_f [OF bij_is_surj [OF perm_is_bij [OF f]]])
+ − 131
done
+ − 132
+ − 133
lemma bij_Rep_perm: "bij (Rep_perm p)"
+ − 134
using Rep_perm [of p] unfolding perm_def by simp
+ − 135
+ − 136
lemma finite_Rep_perm: "finite {a. Rep_perm p a \<noteq> a}"
+ − 137
using Rep_perm [of p] unfolding perm_def by simp
+ − 138
+ − 139
lemma sort_of_Rep_perm: "sort_of (Rep_perm p a) = sort_of a"
+ − 140
using Rep_perm [of p] unfolding perm_def by simp
+ − 141
+ − 142
lemma Rep_perm_ext:
+ − 143
"Rep_perm p1 = Rep_perm p2 \<Longrightarrow> p1 = p2"
2479
+ − 144
by (simp add: fun_eq_iff Rep_perm_inject [symmetric])
1062
+ − 145
2560
+ − 146
instance perm :: size ..
1062
+ − 147
+ − 148
subsection {* Permutations form a group *}
+ − 149
+ − 150
instantiation perm :: group_add
+ − 151
begin
+ − 152
+ − 153
definition
+ − 154
"0 = Abs_perm id"
+ − 155
+ − 156
definition
+ − 157
"- p = Abs_perm (inv (Rep_perm p))"
+ − 158
+ − 159
definition
+ − 160
"p + q = Abs_perm (Rep_perm p \<circ> Rep_perm q)"
+ − 161
+ − 162
definition
+ − 163
"(p1::perm) - p2 = p1 + - p2"
+ − 164
+ − 165
lemma Rep_perm_0: "Rep_perm 0 = id"
+ − 166
unfolding zero_perm_def
+ − 167
by (simp add: Abs_perm_inverse perm_id)
+ − 168
+ − 169
lemma Rep_perm_add:
+ − 170
"Rep_perm (p1 + p2) = Rep_perm p1 \<circ> Rep_perm p2"
+ − 171
unfolding plus_perm_def
+ − 172
by (simp add: Abs_perm_inverse perm_comp Rep_perm)
+ − 173
+ − 174
lemma Rep_perm_uminus:
+ − 175
"Rep_perm (- p) = inv (Rep_perm p)"
+ − 176
unfolding uminus_perm_def
+ − 177
by (simp add: Abs_perm_inverse perm_inv Rep_perm)
+ − 178
+ − 179
instance
+ − 180
apply default
+ − 181
unfolding Rep_perm_inject [symmetric]
+ − 182
unfolding minus_perm_def
+ − 183
unfolding Rep_perm_add
+ − 184
unfolding Rep_perm_uminus
+ − 185
unfolding Rep_perm_0
+ − 186
by (simp_all add: o_assoc inv_o_cancel [OF bij_is_inj [OF bij_Rep_perm]])
+ − 187
+ − 188
end
+ − 189
+ − 190
+ − 191
section {* Implementation of swappings *}
+ − 192
+ − 193
definition
+ − 194
swap :: "atom \<Rightarrow> atom \<Rightarrow> perm" ("'(_ \<rightleftharpoons> _')")
+ − 195
where
+ − 196
"(a \<rightleftharpoons> b) =
+ − 197
Abs_perm (if sort_of a = sort_of b
+ − 198
then (\<lambda>c. if a = c then b else if b = c then a else c)
+ − 199
else id)"
+ − 200
+ − 201
lemma Rep_perm_swap:
+ − 202
"Rep_perm (a \<rightleftharpoons> b) =
+ − 203
(if sort_of a = sort_of b
+ − 204
then (\<lambda>c. if a = c then b else if b = c then a else c)
+ − 205
else id)"
+ − 206
unfolding swap_def
+ − 207
apply (rule Abs_perm_inverse)
+ − 208
apply (rule permI)
+ − 209
apply (auto simp add: bij_def inj_on_def surj_def)[1]
+ − 210
apply (rule MOST_rev_mp [OF MOST_neq(1) [of a]])
+ − 211
apply (rule MOST_rev_mp [OF MOST_neq(1) [of b]])
+ − 212
apply (simp)
+ − 213
apply (simp)
+ − 214
done
+ − 215
+ − 216
lemmas Rep_perm_simps =
+ − 217
Rep_perm_0
+ − 218
Rep_perm_add
+ − 219
Rep_perm_uminus
+ − 220
Rep_perm_swap
+ − 221
+ − 222
lemma swap_different_sorts [simp]:
+ − 223
"sort_of a \<noteq> sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) = 0"
+ − 224
by (rule Rep_perm_ext) (simp add: Rep_perm_simps)
+ − 225
+ − 226
lemma swap_cancel:
+ − 227
"(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
1879
+ − 228
by (rule Rep_perm_ext)
2479
+ − 229
(simp add: Rep_perm_simps fun_eq_iff)
1062
+ − 230
+ − 231
lemma swap_self [simp]:
+ − 232
"(a \<rightleftharpoons> a) = 0"
2479
+ − 233
by (rule Rep_perm_ext, simp add: Rep_perm_simps fun_eq_iff)
1062
+ − 234
+ − 235
lemma minus_swap [simp]:
+ − 236
"- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
+ − 237
by (rule minus_unique [OF swap_cancel])
+ − 238
+ − 239
lemma swap_commute:
+ − 240
"(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
+ − 241
by (rule Rep_perm_ext)
2479
+ − 242
(simp add: Rep_perm_swap fun_eq_iff)
1062
+ − 243
+ − 244
lemma swap_triple:
+ − 245
assumes "a \<noteq> b" and "c \<noteq> b"
+ − 246
assumes "sort_of a = sort_of b" "sort_of b = sort_of c"
+ − 247
shows "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
+ − 248
using assms
+ − 249
by (rule_tac Rep_perm_ext)
2479
+ − 250
(auto simp add: Rep_perm_simps fun_eq_iff)
1062
+ − 251
+ − 252
+ − 253
section {* Permutation Types *}
+ − 254
+ − 255
text {*
+ − 256
Infix syntax for @{text permute} has higher precedence than
+ − 257
addition, but lower than unary minus.
+ − 258
*}
+ − 259
+ − 260
class pt =
+ − 261
fixes permute :: "perm \<Rightarrow> 'a \<Rightarrow> 'a" ("_ \<bullet> _" [76, 75] 75)
+ − 262
assumes permute_zero [simp]: "0 \<bullet> x = x"
+ − 263
assumes permute_plus [simp]: "(p + q) \<bullet> x = p \<bullet> (q \<bullet> x)"
+ − 264
begin
+ − 265
+ − 266
lemma permute_diff [simp]:
+ − 267
shows "(p - q) \<bullet> x = p \<bullet> - q \<bullet> x"
+ − 268
unfolding diff_minus by simp
+ − 269
+ − 270
lemma permute_minus_cancel [simp]:
+ − 271
shows "p \<bullet> - p \<bullet> x = x"
+ − 272
and "- p \<bullet> p \<bullet> x = x"
+ − 273
unfolding permute_plus [symmetric] by simp_all
+ − 274
+ − 275
lemma permute_swap_cancel [simp]:
+ − 276
shows "(a \<rightleftharpoons> b) \<bullet> (a \<rightleftharpoons> b) \<bullet> x = x"
+ − 277
unfolding permute_plus [symmetric]
+ − 278
by (simp add: swap_cancel)
+ − 279
+ − 280
lemma permute_swap_cancel2 [simp]:
+ − 281
shows "(a \<rightleftharpoons> b) \<bullet> (b \<rightleftharpoons> a) \<bullet> x = x"
+ − 282
unfolding permute_plus [symmetric]
+ − 283
by (simp add: swap_commute)
+ − 284
+ − 285
lemma inj_permute [simp]:
+ − 286
shows "inj (permute p)"
+ − 287
by (rule inj_on_inverseI)
+ − 288
(rule permute_minus_cancel)
+ − 289
+ − 290
lemma surj_permute [simp]:
+ − 291
shows "surj (permute p)"
+ − 292
by (rule surjI, rule permute_minus_cancel)
+ − 293
+ − 294
lemma bij_permute [simp]:
+ − 295
shows "bij (permute p)"
+ − 296
by (rule bijI [OF inj_permute surj_permute])
+ − 297
+ − 298
lemma inv_permute:
+ − 299
shows "inv (permute p) = permute (- p)"
+ − 300
by (rule inv_equality) (simp_all)
+ − 301
+ − 302
lemma permute_minus:
+ − 303
shows "permute (- p) = inv (permute p)"
+ − 304
by (simp add: inv_permute)
+ − 305
+ − 306
lemma permute_eq_iff [simp]:
+ − 307
shows "p \<bullet> x = p \<bullet> y \<longleftrightarrow> x = y"
+ − 308
by (rule inj_permute [THEN inj_eq])
+ − 309
+ − 310
end
+ − 311
+ − 312
subsection {* Permutations for atoms *}
+ − 313
+ − 314
instantiation atom :: pt
+ − 315
begin
+ − 316
+ − 317
definition
1879
+ − 318
"p \<bullet> a = (Rep_perm p) a"
1062
+ − 319
+ − 320
instance
+ − 321
apply(default)
+ − 322
apply(simp_all add: permute_atom_def Rep_perm_simps)
+ − 323
done
+ − 324
+ − 325
end
+ − 326
+ − 327
lemma sort_of_permute [simp]:
+ − 328
shows "sort_of (p \<bullet> a) = sort_of a"
+ − 329
unfolding permute_atom_def by (rule sort_of_Rep_perm)
+ − 330
+ − 331
lemma swap_atom:
+ − 332
shows "(a \<rightleftharpoons> b) \<bullet> c =
+ − 333
(if sort_of a = sort_of b
+ − 334
then (if c = a then b else if c = b then a else c) else c)"
+ − 335
unfolding permute_atom_def
+ − 336
by (simp add: Rep_perm_swap)
+ − 337
+ − 338
lemma swap_atom_simps [simp]:
+ − 339
"sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> a = b"
+ − 340
"sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> b = a"
+ − 341
"c \<noteq> a \<Longrightarrow> c \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> c = c"
+ − 342
unfolding swap_atom by simp_all
+ − 343
+ − 344
lemma expand_perm_eq:
+ − 345
fixes p q :: "perm"
+ − 346
shows "p = q \<longleftrightarrow> (\<forall>a::atom. p \<bullet> a = q \<bullet> a)"
+ − 347
unfolding permute_atom_def
+ − 348
by (metis Rep_perm_ext ext)
+ − 349
+ − 350
+ − 351
subsection {* Permutations for permutations *}
+ − 352
+ − 353
instantiation perm :: pt
+ − 354
begin
+ − 355
+ − 356
definition
+ − 357
"p \<bullet> q = p + q - p"
+ − 358
+ − 359
instance
+ − 360
apply default
+ − 361
apply (simp add: permute_perm_def)
+ − 362
apply (simp add: permute_perm_def diff_minus minus_add add_assoc)
+ − 363
done
+ − 364
+ − 365
end
+ − 366
1879
+ − 367
lemma permute_self:
+ − 368
shows "p \<bullet> p = p"
+ − 369
unfolding permute_perm_def
+ − 370
by (simp add: diff_minus add_assoc)
1062
+ − 371
+ − 372
lemma permute_eqvt:
+ − 373
shows "p \<bullet> (q \<bullet> x) = (p \<bullet> q) \<bullet> (p \<bullet> x)"
+ − 374
unfolding permute_perm_def by simp
+ − 375
+ − 376
lemma zero_perm_eqvt:
+ − 377
shows "p \<bullet> (0::perm) = 0"
+ − 378
unfolding permute_perm_def by simp
+ − 379
+ − 380
lemma add_perm_eqvt:
+ − 381
fixes p p1 p2 :: perm
+ − 382
shows "p \<bullet> (p1 + p2) = p \<bullet> p1 + p \<bullet> p2"
+ − 383
unfolding permute_perm_def
+ − 384
by (simp add: expand_perm_eq)
+ − 385
+ − 386
lemma swap_eqvt:
+ − 387
shows "p \<bullet> (a \<rightleftharpoons> b) = (p \<bullet> a \<rightleftharpoons> p \<bullet> b)"
+ − 388
unfolding permute_perm_def
+ − 389
by (auto simp add: swap_atom expand_perm_eq)
+ − 390
2310
+ − 391
lemma uminus_eqvt:
+ − 392
fixes p q::"perm"
+ − 393
shows "p \<bullet> (- q) = - (p \<bullet> q)"
+ − 394
unfolding permute_perm_def
+ − 395
by (simp add: diff_minus minus_add add_assoc)
1062
+ − 396
+ − 397
subsection {* Permutations for functions *}
+ − 398
+ − 399
instantiation "fun" :: (pt, pt) pt
+ − 400
begin
+ − 401
+ − 402
definition
+ − 403
"p \<bullet> f = (\<lambda>x. p \<bullet> (f (- p \<bullet> x)))"
+ − 404
+ − 405
instance
+ − 406
apply default
+ − 407
apply (simp add: permute_fun_def)
+ − 408
apply (simp add: permute_fun_def minus_add)
+ − 409
done
+ − 410
+ − 411
end
+ − 412
+ − 413
lemma permute_fun_app_eq:
+ − 414
shows "p \<bullet> (f x) = (p \<bullet> f) (p \<bullet> x)"
1879
+ − 415
unfolding permute_fun_def by simp
1062
+ − 416
+ − 417
subsection {* Permutations for booleans *}
+ − 418
+ − 419
instantiation bool :: pt
+ − 420
begin
+ − 421
+ − 422
definition "p \<bullet> (b::bool) = b"
+ − 423
+ − 424
instance
+ − 425
apply(default)
+ − 426
apply(simp_all add: permute_bool_def)
+ − 427
done
+ − 428
+ − 429
end
+ − 430
+ − 431
lemma Not_eqvt:
+ − 432
shows "p \<bullet> (\<not> A) = (\<not> (p \<bullet> A))"
+ − 433
by (simp add: permute_bool_def)
+ − 434
2466
+ − 435
lemma conj_eqvt:
+ − 436
shows "p \<bullet> (A \<and> B) = ((p \<bullet> A) \<and> (p \<bullet> B))"
+ − 437
by (simp add: permute_bool_def)
+ − 438
+ − 439
lemma imp_eqvt:
+ − 440
shows "p \<bullet> (A \<longrightarrow> B) = ((p \<bullet> A) \<longrightarrow> (p \<bullet> B))"
+ − 441
by (simp add: permute_bool_def)
+ − 442
+ − 443
lemma ex_eqvt:
+ − 444
shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. (p \<bullet> P) x)"
+ − 445
unfolding permute_fun_def permute_bool_def
+ − 446
by (auto, rule_tac x="p \<bullet> x" in exI, simp)
+ − 447
2470
+ − 448
lemma all_eqvt:
+ − 449
shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. (p \<bullet> P) x)"
+ − 450
unfolding permute_fun_def permute_bool_def
+ − 451
by (auto, drule_tac x="p \<bullet> x" in spec, simp)
+ − 452
1557
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 453
lemma permute_boolE:
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 454
fixes P::"bool"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 455
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
+ − 456
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
+ − 457
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 458
lemma permute_boolI:
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 459
fixes P::"bool"
fee2389789ad
moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 460
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
+ − 461
by(simp add: permute_bool_def)
1062
+ − 462
+ − 463
subsection {* Permutations for sets *}
+ − 464
+ − 465
lemma permute_set_eq:
+ − 466
fixes x::"'a::pt"
+ − 467
and p::"perm"
+ − 468
shows "(p \<bullet> X) = {p \<bullet> x | x. x \<in> X}"
1879
+ − 469
unfolding permute_fun_def
+ − 470
unfolding permute_bool_def
+ − 471
apply(auto simp add: mem_def)
1062
+ − 472
apply(rule_tac x="- p \<bullet> x" in exI)
+ − 473
apply(simp)
+ − 474
done
+ − 475
+ − 476
lemma permute_set_eq_image:
+ − 477
shows "p \<bullet> X = permute p ` X"
1879
+ − 478
unfolding permute_set_eq by auto
1062
+ − 479
+ − 480
lemma permute_set_eq_vimage:
+ − 481
shows "p \<bullet> X = permute (- p) -` X"
1879
+ − 482
unfolding permute_fun_def permute_bool_def
+ − 483
unfolding vimage_def Collect_def mem_def ..
1062
+ − 484
2588
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 485
lemma permute_finite [simp]:
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 486
shows "finite (p \<bullet> X) = finite X"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 487
apply(simp add: permute_set_eq_image)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 488
apply(rule iffI)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 489
apply(drule finite_imageD)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 490
using inj_permute[where p="p"]
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 491
apply(simp add: inj_on_def)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 492
apply(assumption)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 493
apply(rule finite_imageI)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 494
apply(assumption)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 495
done
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 496
1062
+ − 497
lemma swap_set_not_in:
+ − 498
assumes a: "a \<notin> S" "b \<notin> S"
+ − 499
shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1879
+ − 500
unfolding permute_set_eq
+ − 501
using a by (auto simp add: swap_atom)
1062
+ − 502
+ − 503
lemma swap_set_in:
+ − 504
assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
+ − 505
shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
1879
+ − 506
unfolding permute_set_eq
+ − 507
using a by (auto simp add: swap_atom)
1062
+ − 508
2470
+ − 509
lemma mem_permute_iff:
+ − 510
shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X"
+ − 511
unfolding mem_def permute_fun_def permute_bool_def
+ − 512
by simp
+ − 513
+ − 514
lemma mem_eqvt:
+ − 515
shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)"
+ − 516
unfolding mem_def
+ − 517
by (simp add: permute_fun_app_eq)
+ − 518
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 519
lemma empty_eqvt:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 520
shows "p \<bullet> {} = {}"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 521
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
+ − 522
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
+ − 523
2470
+ − 524
lemma insert_eqvt:
+ − 525
shows "p \<bullet> (insert x A) = insert (p \<bullet> x) (p \<bullet> A)"
+ − 526
unfolding permute_set_eq_image image_insert ..
+ − 527
+ − 528
1062
+ − 529
subsection {* Permutations for units *}
+ − 530
+ − 531
instantiation unit :: pt
+ − 532
begin
+ − 533
+ − 534
definition "p \<bullet> (u::unit) = u"
+ − 535
1879
+ − 536
instance
+ − 537
by (default) (simp_all add: permute_unit_def)
1062
+ − 538
+ − 539
end
+ − 540
+ − 541
+ − 542
subsection {* Permutations for products *}
+ − 543
2378
+ − 544
instantiation prod :: (pt, pt) pt
1062
+ − 545
begin
+ − 546
+ − 547
primrec
+ − 548
permute_prod
+ − 549
where
+ − 550
Pair_eqvt: "p \<bullet> (x, y) = (p \<bullet> x, p \<bullet> y)"
+ − 551
+ − 552
instance
+ − 553
by default auto
+ − 554
+ − 555
end
+ − 556
+ − 557
subsection {* Permutations for sums *}
+ − 558
2378
+ − 559
instantiation sum :: (pt, pt) pt
1062
+ − 560
begin
+ − 561
+ − 562
primrec
+ − 563
permute_sum
+ − 564
where
+ − 565
"p \<bullet> (Inl x) = Inl (p \<bullet> x)"
+ − 566
| "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
+ − 567
1879
+ − 568
instance
+ − 569
by (default) (case_tac [!] x, simp_all)
1062
+ − 570
+ − 571
end
+ − 572
+ − 573
subsection {* Permutations for lists *}
+ − 574
+ − 575
instantiation list :: (pt) pt
+ − 576
begin
+ − 577
+ − 578
primrec
+ − 579
permute_list
+ − 580
where
+ − 581
"p \<bullet> [] = []"
+ − 582
| "p \<bullet> (x # xs) = p \<bullet> x # p \<bullet> xs"
+ − 583
1879
+ − 584
instance
+ − 585
by (default) (induct_tac [!] x, simp_all)
1062
+ − 586
+ − 587
end
+ − 588
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 589
lemma set_eqvt:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 590
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
+ − 591
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
+ − 592
1062
+ − 593
subsection {* Permutations for options *}
+ − 594
+ − 595
instantiation option :: (pt) pt
+ − 596
begin
+ − 597
+ − 598
primrec
+ − 599
permute_option
+ − 600
where
+ − 601
"p \<bullet> None = None"
+ − 602
| "p \<bullet> (Some x) = Some (p \<bullet> x)"
+ − 603
1879
+ − 604
instance
+ − 605
by (default) (induct_tac [!] x, simp_all)
1062
+ − 606
+ − 607
end
+ − 608
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 609
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 610
subsection {* Permutations for fsets *}
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 611
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 612
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
+ − 613
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
+ − 614
unfolding fun_rel_def
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 615
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
+ − 616
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 617
instantiation fset :: (pt) pt
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 618
begin
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 619
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 620
quotient_definition
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 621
"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
+ − 622
is
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 623
"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
+ − 624
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 625
instance
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 626
proof
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 627
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
+ − 628
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
+ − 629
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
+ − 630
qed
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 631
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 632
end
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 633
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 634
lemma permute_fset [simp]:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 635
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
+ − 636
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
+ − 637
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
+ − 638
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
+ − 639
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 640
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 641
1062
+ − 642
subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *}
+ − 643
+ − 644
instantiation char :: pt
+ − 645
begin
+ − 646
+ − 647
definition "p \<bullet> (c::char) = c"
+ − 648
1879
+ − 649
instance
+ − 650
by (default) (simp_all add: permute_char_def)
1062
+ − 651
+ − 652
end
+ − 653
+ − 654
instantiation nat :: pt
+ − 655
begin
+ − 656
+ − 657
definition "p \<bullet> (n::nat) = n"
+ − 658
1879
+ − 659
instance
+ − 660
by (default) (simp_all add: permute_nat_def)
1062
+ − 661
+ − 662
end
+ − 663
+ − 664
instantiation int :: pt
+ − 665
begin
+ − 666
+ − 667
definition "p \<bullet> (i::int) = i"
+ − 668
1879
+ − 669
instance
+ − 670
by (default) (simp_all add: permute_int_def)
1062
+ − 671
+ − 672
end
+ − 673
+ − 674
+ − 675
section {* Pure types *}
+ − 676
+ − 677
text {* Pure types will have always empty support. *}
+ − 678
+ − 679
class pure = pt +
+ − 680
assumes permute_pure: "p \<bullet> x = x"
+ − 681
+ − 682
text {* Types @{typ unit} and @{typ bool} are pure. *}
+ − 683
+ − 684
instance unit :: pure
+ − 685
proof qed (rule permute_unit_def)
+ − 686
+ − 687
instance bool :: pure
+ − 688
proof qed (rule permute_bool_def)
+ − 689
+ − 690
text {* Other type constructors preserve purity. *}
+ − 691
+ − 692
instance "fun" :: (pure, pure) pure
+ − 693
by default (simp add: permute_fun_def permute_pure)
+ − 694
2378
+ − 695
instance prod :: (pure, pure) pure
1062
+ − 696
by default (induct_tac x, simp add: permute_pure)
+ − 697
2378
+ − 698
instance sum :: (pure, pure) pure
1062
+ − 699
by default (induct_tac x, simp_all add: permute_pure)
+ − 700
+ − 701
instance list :: (pure) pure
+ − 702
by default (induct_tac x, simp_all add: permute_pure)
+ − 703
+ − 704
instance option :: (pure) pure
+ − 705
by default (induct_tac x, simp_all add: permute_pure)
+ − 706
+ − 707
+ − 708
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
+ − 709
+ − 710
instance char :: pure
+ − 711
proof qed (rule permute_char_def)
+ − 712
+ − 713
instance nat :: pure
+ − 714
proof qed (rule permute_nat_def)
+ − 715
+ − 716
instance int :: pure
+ − 717
proof qed (rule permute_int_def)
+ − 718
+ − 719
+ − 720
subsection {* Supp, Freshness and Supports *}
+ − 721
+ − 722
context pt
+ − 723
begin
+ − 724
+ − 725
definition
+ − 726
supp :: "'a \<Rightarrow> atom set"
+ − 727
where
+ − 728
"supp x = {a. infinite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}}"
+ − 729
+ − 730
end
+ − 731
+ − 732
definition
+ − 733
fresh :: "atom \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp> _" [55, 55] 55)
+ − 734
where
+ − 735
"a \<sharp> x \<equiv> a \<notin> supp x"
+ − 736
+ − 737
lemma supp_conv_fresh:
+ − 738
shows "supp x = {a. \<not> a \<sharp> x}"
+ − 739
unfolding fresh_def by simp
+ − 740
+ − 741
lemma swap_rel_trans:
+ − 742
assumes "sort_of a = sort_of b"
+ − 743
assumes "sort_of b = sort_of c"
+ − 744
assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
+ − 745
assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
+ − 746
shows "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 747
proof (cases)
+ − 748
assume "a = b \<or> c = b"
+ − 749
with assms show "(a \<rightleftharpoons> b) \<bullet> x = x" by auto
+ − 750
next
+ − 751
assume *: "\<not> (a = b \<or> c = b)"
+ − 752
have "((a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c)) \<bullet> x = x"
+ − 753
using assms by simp
+ − 754
also have "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
+ − 755
using assms * by (simp add: swap_triple)
+ − 756
finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
+ − 757
qed
+ − 758
+ − 759
lemma swap_fresh_fresh:
+ − 760
assumes a: "a \<sharp> x"
+ − 761
and b: "b \<sharp> x"
+ − 762
shows "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 763
proof (cases)
+ − 764
assume asm: "sort_of a = sort_of b"
+ − 765
have "finite {c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x}" "finite {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x}"
+ − 766
using a b unfolding fresh_def supp_def by simp_all
+ − 767
then have "finite ({c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x} \<union> {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x})" by simp
+ − 768
then obtain c
+ − 769
where "(a \<rightleftharpoons> c) \<bullet> x = x" "(b \<rightleftharpoons> c) \<bullet> x = x" "sort_of c = sort_of b"
+ − 770
by (rule obtain_atom) (auto)
+ − 771
then show "(a \<rightleftharpoons> b) \<bullet> x = x" using asm by (rule_tac swap_rel_trans) (simp_all)
+ − 772
next
+ − 773
assume "sort_of a \<noteq> sort_of b"
+ − 774
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by simp
+ − 775
qed
+ − 776
+ − 777
+ − 778
subsection {* supp and fresh are equivariant *}
+ − 779
+ − 780
lemma finite_Collect_bij:
+ − 781
assumes a: "bij f"
+ − 782
shows "finite {x. P (f x)} = finite {x. P x}"
+ − 783
by (metis a finite_vimage_iff vimage_Collect_eq)
+ − 784
+ − 785
lemma fresh_permute_iff:
+ − 786
shows "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x"
+ − 787
proof -
+ − 788
have "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
+ − 789
unfolding fresh_def supp_def by simp
+ − 790
also have "\<dots> \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> p \<bullet> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
1879
+ − 791
using bij_permute by (rule finite_Collect_bij[symmetric])
1062
+ − 792
also have "\<dots> \<longleftrightarrow> finite {b. p \<bullet> (a \<rightleftharpoons> b) \<bullet> x \<noteq> p \<bullet> x}"
+ − 793
by (simp only: permute_eqvt [of p] swap_eqvt)
+ − 794
also have "\<dots> \<longleftrightarrow> finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"
+ − 795
by (simp only: permute_eq_iff)
+ − 796
also have "\<dots> \<longleftrightarrow> a \<sharp> x"
+ − 797
unfolding fresh_def supp_def by simp
1879
+ − 798
finally show "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x" .
1062
+ − 799
qed
+ − 800
+ − 801
lemma fresh_eqvt:
+ − 802
shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
1879
+ − 803
unfolding permute_bool_def
+ − 804
by (simp add: fresh_permute_iff)
1062
+ − 805
+ − 806
lemma supp_eqvt:
+ − 807
fixes p :: "perm"
+ − 808
and x :: "'a::pt"
+ − 809
shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
+ − 810
unfolding supp_conv_fresh
1879
+ − 811
unfolding Collect_def
+ − 812
unfolding permute_fun_def
1062
+ − 813
by (simp add: Not_eqvt fresh_eqvt)
+ − 814
+ − 815
subsection {* supports *}
+ − 816
+ − 817
definition
+ − 818
supports :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" (infixl "supports" 80)
+ − 819
where
+ − 820
"S supports x \<equiv> \<forall>a b. (a \<notin> S \<and> b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x)"
+ − 821
+ − 822
lemma supp_is_subset:
+ − 823
fixes S :: "atom set"
+ − 824
and x :: "'a::pt"
+ − 825
assumes a1: "S supports x"
+ − 826
and a2: "finite S"
+ − 827
shows "(supp x) \<subseteq> S"
+ − 828
proof (rule ccontr)
1879
+ − 829
assume "\<not> (supp x \<subseteq> S)"
1062
+ − 830
then obtain a where b1: "a \<in> supp x" and b2: "a \<notin> S" by auto
1879
+ − 831
from a1 b2 have "\<forall>b. b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x" unfolding supports_def by auto
+ − 832
then have "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x} \<subseteq> S" by auto
1062
+ − 833
with a2 have "finite {b. (a \<rightleftharpoons> b)\<bullet>x \<noteq> x}" by (simp add: finite_subset)
+ − 834
then have "a \<notin> (supp x)" unfolding supp_def by simp
+ − 835
with b1 show False by simp
+ − 836
qed
+ − 837
+ − 838
lemma supports_finite:
+ − 839
fixes S :: "atom set"
+ − 840
and x :: "'a::pt"
+ − 841
assumes a1: "S supports x"
+ − 842
and a2: "finite S"
+ − 843
shows "finite (supp x)"
+ − 844
proof -
+ − 845
have "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
+ − 846
then show "finite (supp x)" using a2 by (simp add: finite_subset)
+ − 847
qed
+ − 848
+ − 849
lemma supp_supports:
+ − 850
fixes x :: "'a::pt"
+ − 851
shows "(supp x) supports x"
1879
+ − 852
unfolding supports_def
+ − 853
proof (intro strip)
1062
+ − 854
fix a b
+ − 855
assume "a \<notin> (supp x) \<and> b \<notin> (supp x)"
+ − 856
then have "a \<sharp> x" and "b \<sharp> x" by (simp_all add: fresh_def)
1879
+ − 857
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
1062
+ − 858
qed
+ − 859
+ − 860
lemma supp_is_least_supports:
+ − 861
fixes S :: "atom set"
+ − 862
and x :: "'a::pt"
+ − 863
assumes a1: "S supports x"
+ − 864
and a2: "finite S"
+ − 865
and a3: "\<And>S'. finite S' \<Longrightarrow> (S' supports x) \<Longrightarrow> S \<subseteq> S'"
+ − 866
shows "(supp x) = S"
+ − 867
proof (rule equalityI)
+ − 868
show "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
+ − 869
with a2 have fin: "finite (supp x)" by (rule rev_finite_subset)
+ − 870
have "(supp x) supports x" by (rule supp_supports)
+ − 871
with fin a3 show "S \<subseteq> supp x" by blast
+ − 872
qed
+ − 873
+ − 874
lemma subsetCI:
+ − 875
shows "(\<And>x. x \<in> A \<Longrightarrow> x \<notin> B \<Longrightarrow> False) \<Longrightarrow> A \<subseteq> B"
+ − 876
by auto
+ − 877
+ − 878
lemma finite_supp_unique:
+ − 879
assumes a1: "S supports x"
+ − 880
assumes a2: "finite S"
+ − 881
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"
+ − 882
shows "(supp x) = S"
+ − 883
using a1 a2
+ − 884
proof (rule supp_is_least_supports)
+ − 885
fix S'
+ − 886
assume "finite S'" and "S' supports x"
+ − 887
show "S \<subseteq> S'"
+ − 888
proof (rule subsetCI)
+ − 889
fix a
+ − 890
assume "a \<in> S" and "a \<notin> S'"
+ − 891
have "finite (S \<union> S')"
+ − 892
using `finite S` `finite S'` by simp
+ − 893
then obtain b where "b \<notin> S \<union> S'" and "sort_of b = sort_of a"
+ − 894
by (rule obtain_atom)
+ − 895
then have "b \<notin> S" and "b \<notin> S'" and "sort_of a = sort_of b"
+ − 896
by simp_all
+ − 897
then have "(a \<rightleftharpoons> b) \<bullet> x = x"
+ − 898
using `a \<notin> S'` `S' supports x` by (simp add: supports_def)
+ − 899
moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
+ − 900
using `a \<in> S` `b \<notin> S` `sort_of a = sort_of b`
+ − 901
by (rule a3)
+ − 902
ultimately show "False" by simp
+ − 903
qed
+ − 904
qed
+ − 905
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
+ − 906
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
+ − 907
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
+ − 908
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
+ − 909
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
+ − 910
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
+ − 911
*}
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
+ − 912
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
+ − 913
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
+ − 914
"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
+ − 915
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
+ − 916
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
+ − 917
1062
+ − 918
section {* Finitely-supported types *}
+ − 919
+ − 920
class fs = pt +
+ − 921
assumes finite_supp: "finite (supp x)"
+ − 922
+ − 923
lemma pure_supp:
+ − 924
shows "supp (x::'a::pure) = {}"
+ − 925
unfolding supp_def by (simp add: permute_pure)
+ − 926
+ − 927
lemma pure_fresh:
+ − 928
fixes x::"'a::pure"
+ − 929
shows "a \<sharp> x"
+ − 930
unfolding fresh_def by (simp add: pure_supp)
+ − 931
+ − 932
instance pure < fs
+ − 933
by default (simp add: pure_supp)
+ − 934
+ − 935
+ − 936
subsection {* Type @{typ atom} is finitely-supported. *}
+ − 937
+ − 938
lemma supp_atom:
+ − 939
shows "supp a = {a}"
+ − 940
apply (rule finite_supp_unique)
+ − 941
apply (clarsimp simp add: supports_def)
+ − 942
apply simp
+ − 943
apply simp
+ − 944
done
+ − 945
+ − 946
lemma fresh_atom:
+ − 947
shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
+ − 948
unfolding fresh_def supp_atom by simp
+ − 949
+ − 950
instance atom :: fs
+ − 951
by default (simp add: supp_atom)
+ − 952
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
+ − 953
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
+ − 954
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
+ − 955
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
+ − 956
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
+ − 957
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
+ − 958
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
+ − 959
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
+ − 960
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
+ − 961
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
+ − 962
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
+ − 963
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
+ − 964
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
+ − 965
1062
+ − 966
section {* Type @{typ perm} is finitely-supported. *}
+ − 967
+ − 968
lemma perm_swap_eq:
+ − 969
shows "(a \<rightleftharpoons> b) \<bullet> p = p \<longleftrightarrow> (p \<bullet> (a \<rightleftharpoons> b)) = (a \<rightleftharpoons> b)"
+ − 970
unfolding permute_perm_def
+ − 971
by (metis add_diff_cancel minus_perm_def)
+ − 972
+ − 973
lemma supports_perm:
+ − 974
shows "{a. p \<bullet> a \<noteq> a} supports p"
+ − 975
unfolding supports_def
1879
+ − 976
unfolding perm_swap_eq
+ − 977
by (simp add: swap_eqvt)
1062
+ − 978
+ − 979
lemma finite_perm_lemma:
+ − 980
shows "finite {a::atom. p \<bullet> a \<noteq> a}"
+ − 981
using finite_Rep_perm [of p]
+ − 982
unfolding permute_atom_def .
+ − 983
+ − 984
lemma supp_perm:
+ − 985
shows "supp p = {a. p \<bullet> a \<noteq> a}"
+ − 986
apply (rule finite_supp_unique)
+ − 987
apply (rule supports_perm)
+ − 988
apply (rule finite_perm_lemma)
+ − 989
apply (simp add: perm_swap_eq swap_eqvt)
+ − 990
apply (auto simp add: expand_perm_eq swap_atom)
+ − 991
done
+ − 992
+ − 993
lemma fresh_perm:
+ − 994
shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
1879
+ − 995
unfolding fresh_def
+ − 996
by (simp add: supp_perm)
1062
+ − 997
+ − 998
lemma supp_swap:
+ − 999
shows "supp (a \<rightleftharpoons> b) = (if a = b \<or> sort_of a \<noteq> sort_of b then {} else {a, b})"
+ − 1000
by (auto simp add: supp_perm swap_atom)
+ − 1001
+ − 1002
lemma fresh_zero_perm:
+ − 1003
shows "a \<sharp> (0::perm)"
+ − 1004
unfolding fresh_perm by simp
+ − 1005
+ − 1006
lemma supp_zero_perm:
+ − 1007
shows "supp (0::perm) = {}"
+ − 1008
unfolding supp_perm by simp
+ − 1009
1087
+ − 1010
lemma fresh_plus_perm:
+ − 1011
fixes p q::perm
+ − 1012
assumes "a \<sharp> p" "a \<sharp> q"
+ − 1013
shows "a \<sharp> (p + q)"
+ − 1014
using assms
+ − 1015
unfolding fresh_def
+ − 1016
by (auto simp add: supp_perm)
+ − 1017
1062
+ − 1018
lemma supp_plus_perm:
+ − 1019
fixes p q::perm
+ − 1020
shows "supp (p + q) \<subseteq> supp p \<union> supp q"
+ − 1021
by (auto simp add: supp_perm)
+ − 1022
1087
+ − 1023
lemma fresh_minus_perm:
+ − 1024
fixes p::perm
+ − 1025
shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
+ − 1026
unfolding fresh_def
1879
+ − 1027
unfolding supp_perm
+ − 1028
apply(simp)
+ − 1029
apply(metis permute_minus_cancel)
1087
+ − 1030
done
+ − 1031
1062
+ − 1032
lemma supp_minus_perm:
+ − 1033
fixes p::perm
+ − 1034
shows "supp (- p) = supp p"
1087
+ − 1035
unfolding supp_conv_fresh
+ − 1036
by (simp add: fresh_minus_perm)
1062
+ − 1037
+ − 1038
instance perm :: fs
+ − 1039
by default (simp add: supp_perm finite_perm_lemma)
+ − 1040
1305
+ − 1041
lemma plus_perm_eq:
+ − 1042
fixes p q::"perm"
1879
+ − 1043
assumes asm: "supp p \<inter> supp q = {}"
1305
+ − 1044
shows "p + q = q + p"
+ − 1045
unfolding expand_perm_eq
+ − 1046
proof
+ − 1047
fix a::"atom"
+ − 1048
show "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1049
proof -
+ − 1050
{ assume "a \<notin> supp p" "a \<notin> supp q"
+ − 1051
then have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1052
by (simp add: supp_perm)
+ − 1053
}
+ − 1054
moreover
+ − 1055
{ assume a: "a \<in> supp p" "a \<notin> supp q"
+ − 1056
then have "p \<bullet> a \<in> supp p" by (simp add: supp_perm)
+ − 1057
then have "p \<bullet> a \<notin> supp q" using asm by auto
+ − 1058
with a have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1059
by (simp add: supp_perm)
+ − 1060
}
+ − 1061
moreover
+ − 1062
{ assume a: "a \<notin> supp p" "a \<in> supp q"
+ − 1063
then have "q \<bullet> a \<in> supp q" by (simp add: supp_perm)
+ − 1064
then have "q \<bullet> a \<notin> supp p" using asm by auto
+ − 1065
with a have "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1066
by (simp add: supp_perm)
+ − 1067
}
+ − 1068
ultimately show "(p + q) \<bullet> a = (q + p) \<bullet> a"
+ − 1069
using asm by blast
+ − 1070
qed
+ − 1071
qed
1062
+ − 1072
+ − 1073
section {* Finite Support instances for other types *}
+ − 1074
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1075
1062
+ − 1076
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
+ − 1077
+ − 1078
lemma supp_Pair:
+ − 1079
shows "supp (x, y) = supp x \<union> supp y"
+ − 1080
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
+ − 1081
+ − 1082
lemma fresh_Pair:
+ − 1083
shows "a \<sharp> (x, y) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> y"
+ − 1084
by (simp add: fresh_def supp_Pair)
+ − 1085
2470
+ − 1086
lemma supp_Unit:
+ − 1087
shows "supp () = {}"
+ − 1088
by (simp add: supp_def)
+ − 1089
+ − 1090
lemma fresh_Unit:
+ − 1091
shows "a \<sharp> ()"
+ − 1092
by (simp add: fresh_def supp_Unit)
+ − 1093
2378
+ − 1094
instance prod :: (fs, fs) fs
1062
+ − 1095
apply default
+ − 1096
apply (induct_tac x)
+ − 1097
apply (simp add: supp_Pair finite_supp)
+ − 1098
done
+ − 1099
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1100
1062
+ − 1101
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
+ − 1102
+ − 1103
lemma supp_Inl:
+ − 1104
shows "supp (Inl x) = supp x"
+ − 1105
by (simp add: supp_def)
+ − 1106
+ − 1107
lemma supp_Inr:
+ − 1108
shows "supp (Inr x) = supp x"
+ − 1109
by (simp add: supp_def)
+ − 1110
+ − 1111
lemma fresh_Inl:
+ − 1112
shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
+ − 1113
by (simp add: fresh_def supp_Inl)
+ − 1114
+ − 1115
lemma fresh_Inr:
+ − 1116
shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
+ − 1117
by (simp add: fresh_def supp_Inr)
+ − 1118
2378
+ − 1119
instance sum :: (fs, fs) fs
1062
+ − 1120
apply default
+ − 1121
apply (induct_tac x)
+ − 1122
apply (simp_all add: supp_Inl supp_Inr finite_supp)
+ − 1123
done
+ − 1124
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1125
1062
+ − 1126
subsection {* Type @{typ "'a option"} is finitely supported *}
+ − 1127
+ − 1128
lemma supp_None:
+ − 1129
shows "supp None = {}"
+ − 1130
by (simp add: supp_def)
+ − 1131
+ − 1132
lemma supp_Some:
+ − 1133
shows "supp (Some x) = supp x"
+ − 1134
by (simp add: supp_def)
+ − 1135
+ − 1136
lemma fresh_None:
+ − 1137
shows "a \<sharp> None"
+ − 1138
by (simp add: fresh_def supp_None)
+ − 1139
+ − 1140
lemma fresh_Some:
+ − 1141
shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
+ − 1142
by (simp add: fresh_def supp_Some)
+ − 1143
+ − 1144
instance option :: (fs) fs
+ − 1145
apply default
+ − 1146
apply (induct_tac x)
+ − 1147
apply (simp_all add: supp_None supp_Some finite_supp)
+ − 1148
done
+ − 1149
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1150
1062
+ − 1151
subsubsection {* Type @{typ "'a list"} is finitely supported *}
+ − 1152
+ − 1153
lemma supp_Nil:
+ − 1154
shows "supp [] = {}"
+ − 1155
by (simp add: supp_def)
+ − 1156
+ − 1157
lemma supp_Cons:
+ − 1158
shows "supp (x # xs) = supp x \<union> supp xs"
+ − 1159
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
+ − 1160
2591
+ − 1161
lemma supp_append:
+ − 1162
shows "supp (xs @ ys) = supp xs \<union> supp ys"
+ − 1163
by (induct xs) (auto simp add: supp_Nil supp_Cons)
+ − 1164
1062
+ − 1165
lemma fresh_Nil:
+ − 1166
shows "a \<sharp> []"
+ − 1167
by (simp add: fresh_def supp_Nil)
+ − 1168
+ − 1169
lemma fresh_Cons:
+ − 1170
shows "a \<sharp> (x # xs) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> xs"
+ − 1171
by (simp add: fresh_def supp_Cons)
+ − 1172
2591
+ − 1173
lemma fresh_append:
+ − 1174
shows "a \<sharp> (xs @ ys) \<longleftrightarrow> a \<sharp> xs \<and> a \<sharp> ys"
+ − 1175
by (induct xs) (simp_all add: fresh_Nil fresh_Cons)
+ − 1176
+ − 1177
1062
+ − 1178
instance list :: (fs) fs
+ − 1179
apply default
+ − 1180
apply (induct_tac x)
+ − 1181
apply (simp_all add: supp_Nil supp_Cons finite_supp)
+ − 1182
done
+ − 1183
2588
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1184
lemma supp_of_atom_list:
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1185
fixes as::"atom list"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1186
shows "supp as = set as"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1187
by (induct as)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1188
(simp_all add: supp_Nil supp_Cons supp_atom)
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1189
2466
+ − 1190
2470
+ − 1191
section {* Support and Freshness for Applications *}
1062
+ − 1192
1879
+ − 1193
lemma fresh_conv_MOST:
+ − 1194
shows "a \<sharp> x \<longleftrightarrow> (MOST b. (a \<rightleftharpoons> b) \<bullet> x = x)"
+ − 1195
unfolding fresh_def supp_def
+ − 1196
unfolding MOST_iff_cofinite by simp
+ − 1197
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1198
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
+ − 1199
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
+ − 1200
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
+ − 1201
using a
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1202
unfolding fresh_def
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1203
by blast
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1204
1879
+ − 1205
lemma fresh_fun_app:
+ − 1206
assumes "a \<sharp> f" and "a \<sharp> x"
+ − 1207
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
+ − 1208
using assms
1879
+ − 1209
unfolding fresh_conv_MOST
+ − 1210
unfolding permute_fun_app_eq
+ − 1211
by (elim MOST_rev_mp, simp)
+ − 1212
1062
+ − 1213
lemma supp_fun_app:
+ − 1214
shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
1879
+ − 1215
using fresh_fun_app
+ − 1216
unfolding fresh_def
+ − 1217
by auto
+ − 1218
2470
+ − 1219
text {* Support of Equivariant Functions *}
2003
b53e98bfb298
added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1220
1941
+ − 1221
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
+ − 1222
assumes a: "\<And>p. p \<bullet> f = f"
1941
+ − 1223
shows "supp f = {}"
+ − 1224
unfolding supp_def
+ − 1225
using a by simp
+ − 1226
1062
+ − 1227
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
+ − 1228
assumes a: "\<And>p. p \<bullet> f = f"
1062
+ − 1229
shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
+ − 1230
proof -
1941
+ − 1231
from a have "supp f = {}" by (simp add: supp_fun_eqvt)
1879
+ − 1232
then show "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
1062
+ − 1233
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
+ − 1234
using supp_fun_app by auto
1062
+ − 1235
qed
+ − 1236
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
+ − 1237
2466
+ − 1238
section {* Support of Finite Sets of Finitely Supported Elements *}
+ − 1239
+ − 1240
lemma Union_fresh:
+ − 1241
shows "a \<sharp> S \<Longrightarrow> a \<sharp> (\<Union>x \<in> S. supp x)"
+ − 1242
unfolding Union_image_eq[symmetric]
+ − 1243
apply(rule_tac f="\<lambda>S. \<Union> supp ` S" in fresh_fun_eqvt_app)
+ − 1244
apply(simp add: permute_fun_def UNION_def Collect_def Bex_def ex_eqvt mem_def conj_eqvt)
+ − 1245
apply(subst permute_fun_app_eq)
+ − 1246
back
+ − 1247
apply(simp add: supp_eqvt)
+ − 1248
apply(assumption)
+ − 1249
done
+ − 1250
+ − 1251
lemma Union_supports_set:
+ − 1252
shows "(\<Union>x \<in> S. supp x) supports S"
+ − 1253
proof -
+ − 1254
{ fix a b
+ − 1255
have "\<forall>x \<in> S. (a \<rightleftharpoons> b) \<bullet> x = x \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> S = S"
+ − 1256
unfolding permute_set_eq by force
+ − 1257
}
+ − 1258
then show "(\<Union>x \<in> S. supp x) supports S"
+ − 1259
unfolding supports_def
+ − 1260
by (simp add: fresh_def[symmetric] swap_fresh_fresh)
+ − 1261
qed
+ − 1262
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1263
lemma Union_of_finite_supp_sets:
2466
+ − 1264
fixes S::"('a::fs set)"
+ − 1265
assumes fin: "finite S"
+ − 1266
shows "finite (\<Union>x\<in>S. supp x)"
+ − 1267
using fin by (induct) (auto simp add: finite_supp)
+ − 1268
+ − 1269
lemma Union_included_in_supp:
+ − 1270
fixes S::"('a::fs set)"
+ − 1271
assumes fin: "finite S"
+ − 1272
shows "(\<Union>x\<in>S. supp x) \<subseteq> supp S"
+ − 1273
proof -
+ − 1274
have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)"
+ − 1275
by (rule supp_finite_atom_set[symmetric])
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1276
(rule Union_of_finite_supp_sets[OF fin])
2466
+ − 1277
also have "\<dots> \<subseteq> supp S"
+ − 1278
by (rule supp_subset_fresh)
+ − 1279
(simp add: Union_fresh)
+ − 1280
finally show "(\<Union>x\<in>S. supp x) \<subseteq> supp S" .
+ − 1281
qed
+ − 1282
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1283
lemma supp_of_finite_sets:
2466
+ − 1284
fixes S::"('a::fs set)"
+ − 1285
assumes fin: "finite S"
+ − 1286
shows "(supp S) = (\<Union>x\<in>S. supp x)"
+ − 1287
apply(rule subset_antisym)
+ − 1288
apply(rule supp_is_subset)
+ − 1289
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
+ − 1290
apply(rule Union_of_finite_supp_sets[OF fin])
2466
+ − 1291
apply(rule Union_included_in_supp[OF fin])
+ − 1292
done
+ − 1293
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1294
lemma finite_sets_supp:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1295
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
+ − 1296
assumes "finite S"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1297
shows "finite (supp S)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1298
using assms
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1299
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
+ − 1300
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1301
lemma supp_of_finite_union:
2466
+ − 1302
fixes S T::"('a::fs) set"
+ − 1303
assumes fin1: "finite S"
+ − 1304
and fin2: "finite T"
+ − 1305
shows "supp (S \<union> T) = supp S \<union> supp T"
+ − 1306
using fin1 fin2
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1307
by (simp add: supp_of_finite_sets)
2466
+ − 1308
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1309
lemma supp_of_finite_insert:
2466
+ − 1310
fixes S::"('a::fs) set"
+ − 1311
assumes fin: "finite S"
+ − 1312
shows "supp (insert x S) = supp x \<union> supp S"
+ − 1313
using fin
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1314
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
+ − 1315
2588
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1316
lemma fresh_finite_insert:
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1317
fixes S::"('a::fs) set"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1318
assumes fin: "finite S"
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1319
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
+ − 1320
using fin unfolding fresh_def
8f5420681039
completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1321
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
+ − 1322
2591
+ − 1323
lemma supp_set_empty:
+ − 1324
shows "supp {} = {}"
+ − 1325
unfolding supp_def
+ − 1326
by (simp add: empty_eqvt)
+ − 1327
+ − 1328
lemma fresh_set_empty:
+ − 1329
shows "a \<sharp> {}"
+ − 1330
by (simp add: fresh_def supp_set_empty)
+ − 1331
+ − 1332
lemma supp_set:
+ − 1333
fixes xs :: "('a::fs) list"
+ − 1334
shows "supp (set xs) = supp xs"
+ − 1335
apply(induct xs)
+ − 1336
apply(simp add: supp_set_empty supp_Nil)
+ − 1337
apply(simp add: supp_Cons supp_of_finite_insert)
+ − 1338
done
+ − 1339
+ − 1340
lemma fresh_set:
+ − 1341
fixes xs :: "('a::fs) list"
+ − 1342
shows "a \<sharp> (set xs) \<longleftrightarrow> a \<sharp> xs"
+ − 1343
unfolding fresh_def
+ − 1344
by (simp add: supp_set)
+ − 1345
2565
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1346
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1347
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
+ − 1348
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1349
lemma fset_eqvt:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1350
shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1351
by (lifting set_eqvt)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1352
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1353
lemma supp_fset [simp]:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1354
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
+ − 1355
unfolding supp_def
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1356
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
+ − 1357
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1358
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
+ − 1359
shows "supp {||} = {}"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1360
unfolding supp_def
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1361
by simp
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1362
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1363
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
+ − 1364
fixes x::"'a::fs"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1365
and S::"'a fset"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1366
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
+ − 1367
apply(subst supp_fset[symmetric])
2587
+ − 1368
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
+ − 1369
done
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1370
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1371
lemma fset_finite_supp:
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1372
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
+ − 1373
shows "finite (supp S)"
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1374
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
+ − 1375
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1376
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1377
instance fset :: (fs) fs
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1378
apply (default)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1379
apply (rule fset_finite_supp)
6bf332360510
moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1380
done
2466
+ − 1381
+ − 1382
2470
+ − 1383
section {* Fresh-Star *}
+ − 1384
+ − 1385
+ − 1386
text {* The fresh-star generalisation of fresh is used in strong
+ − 1387
induction principles. *}
+ − 1388
+ − 1389
definition
+ − 1390
fresh_star :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp>* _" [80,80] 80)
+ − 1391
where
+ − 1392
"as \<sharp>* x \<equiv> \<forall>a \<in> as. a \<sharp> x"
+ − 1393
2507
+ − 1394
lemma fresh_star_supp_conv:
+ − 1395
shows "supp x \<sharp>* y \<Longrightarrow> supp y \<sharp>* x"
+ − 1396
by (auto simp add: fresh_star_def fresh_def)
+ − 1397
2591
+ − 1398
lemma fresh_star_Pair:
2470
+ − 1399
shows "as \<sharp>* (x, y) = (as \<sharp>* x \<and> as \<sharp>* y)"
+ − 1400
by (auto simp add: fresh_star_def fresh_Pair)
+ − 1401
2591
+ − 1402
lemma fresh_star_list:
+ − 1403
shows "as \<sharp>* (xs @ ys) \<longleftrightarrow> as \<sharp>* xs \<and> as \<sharp>* ys"
+ − 1404
and "as \<sharp>* (x # xs) \<longleftrightarrow> as \<sharp>* x \<and> as \<sharp>* xs"
+ − 1405
and "as \<sharp>* []"
+ − 1406
by (auto simp add: fresh_star_def fresh_Nil fresh_Cons fresh_append)
+ − 1407
+ − 1408
lemma fresh_star_set:
+ − 1409
fixes xs::"('a::fs) list"
+ − 1410
shows "as \<sharp>* set xs \<longleftrightarrow> as \<sharp>* xs"
+ − 1411
unfolding fresh_star_def
+ − 1412
by (simp add: fresh_set)
+ − 1413
+ − 1414
lemma fresh_star_Un:
2470
+ − 1415
shows "(as \<union> bs) \<sharp>* x = (as \<sharp>* x \<and> bs \<sharp>* x)"
+ − 1416
by (auto simp add: fresh_star_def)
+ − 1417
+ − 1418
lemma fresh_star_insert:
+ − 1419
shows "(insert a as) \<sharp>* x = (a \<sharp> x \<and> as \<sharp>* x)"
+ − 1420
by (auto simp add: fresh_star_def)
+ − 1421
+ − 1422
lemma fresh_star_Un_elim:
+ − 1423
"((as \<union> bs) \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (as \<sharp>* x \<Longrightarrow> bs \<sharp>* x \<Longrightarrow> PROP C)"
+ − 1424
unfolding fresh_star_def
+ − 1425
apply(rule)
+ − 1426
apply(erule meta_mp)
+ − 1427
apply(auto)
+ − 1428
done
+ − 1429
+ − 1430
lemma fresh_star_insert_elim:
+ − 1431
"(insert a as \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> as \<sharp>* x \<Longrightarrow> PROP C)"
+ − 1432
unfolding fresh_star_def
+ − 1433
by rule (simp_all add: fresh_star_def)
+ − 1434
+ − 1435
lemma fresh_star_empty_elim:
+ − 1436
"({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
+ − 1437
by (simp add: fresh_star_def)
+ − 1438
+ − 1439
lemma fresh_star_unit_elim:
+ − 1440
shows "(a \<sharp>* () \<Longrightarrow> PROP C) \<equiv> PROP C"
+ − 1441
by (simp add: fresh_star_def fresh_Unit)
+ − 1442
2591
+ − 1443
lemma fresh_star_Pair_elim:
2470
+ − 1444
shows "(a \<sharp>* (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp>* x \<Longrightarrow> a \<sharp>* y \<Longrightarrow> PROP C)"
2591
+ − 1445
by (rule, simp_all add: fresh_star_Pair)
2470
+ − 1446
+ − 1447
lemma fresh_star_zero:
+ − 1448
shows "as \<sharp>* (0::perm)"
+ − 1449
unfolding fresh_star_def
+ − 1450
by (simp add: fresh_zero_perm)
+ − 1451
+ − 1452
lemma fresh_star_plus:
+ − 1453
fixes p q::perm
+ − 1454
shows "\<lbrakk>a \<sharp>* p; a \<sharp>* q\<rbrakk> \<Longrightarrow> a \<sharp>* (p + q)"
+ − 1455
unfolding fresh_star_def
+ − 1456
by (simp add: fresh_plus_perm)
+ − 1457
+ − 1458
lemma fresh_star_permute_iff:
+ − 1459
shows "(p \<bullet> a) \<sharp>* (p \<bullet> x) \<longleftrightarrow> a \<sharp>* x"
+ − 1460
unfolding fresh_star_def
+ − 1461
by (metis mem_permute_iff permute_minus_cancel(1) fresh_permute_iff)
+ − 1462
+ − 1463
lemma fresh_star_eqvt:
+ − 1464
shows "(p \<bullet> (as \<sharp>* x)) = (p \<bullet> as) \<sharp>* (p \<bullet> x)"
+ − 1465
unfolding fresh_star_def
+ − 1466
unfolding Ball_def
+ − 1467
apply(simp add: all_eqvt)
+ − 1468
apply(subst permute_fun_def)
+ − 1469
apply(simp add: imp_eqvt fresh_eqvt mem_eqvt)
+ − 1470
done
+ − 1471
2591
+ − 1472
lemma at_fresh_star_inter:
+ − 1473
assumes a: "(p \<bullet> bs) \<sharp>* bs"
+ − 1474
and b: "finite bs"
+ − 1475
shows "p \<bullet> bs \<inter> bs = {}"
+ − 1476
using a b
+ − 1477
unfolding fresh_star_def
+ − 1478
unfolding fresh_def
+ − 1479
by (auto simp add: supp_finite_atom_set)
+ − 1480
2470
+ − 1481
+ − 1482
section {* Induction principle for permutations *}
+ − 1483
+ − 1484
+ − 1485
lemma perm_struct_induct[consumes 1, case_names zero swap]:
+ − 1486
assumes S: "supp p \<subseteq> S"
+ − 1487
and zero: "P 0"
+ − 1488
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)"
+ − 1489
shows "P p"
+ − 1490
proof -
+ − 1491
have "finite (supp p)" by (simp add: finite_supp)
+ − 1492
then show "P p" using S
+ − 1493
proof(induct A\<equiv>"supp p" arbitrary: p rule: finite_psubset_induct)
+ − 1494
case (psubset p)
+ − 1495
then have ih: "\<And>q. supp q \<subset> supp p \<Longrightarrow> P q" by auto
+ − 1496
have as: "supp p \<subseteq> S" by fact
+ − 1497
{ assume "supp p = {}"
+ − 1498
then have "p = 0" by (simp add: supp_perm expand_perm_eq)
+ − 1499
then have "P p" using zero by simp
+ − 1500
}
+ − 1501
moreover
+ − 1502
{ assume "supp p \<noteq> {}"
+ − 1503
then obtain a where a0: "a \<in> supp p" by blast
+ − 1504
then have a1: "p \<bullet> a \<in> S" "a \<in> S" "sort_of (p \<bullet> a) = sort_of a" "p \<bullet> a \<noteq> a"
+ − 1505
using as by (auto simp add: supp_atom supp_perm swap_atom)
+ − 1506
let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
+ − 1507
have a2: "supp ?q \<subseteq> supp p" unfolding supp_perm by (auto simp add: swap_atom)
+ − 1508
moreover
+ − 1509
have "a \<notin> supp ?q" by (simp add: supp_perm)
+ − 1510
then have "supp ?q \<noteq> supp p" using a0 by auto
+ − 1511
ultimately have "supp ?q \<subset> supp p" using a2 by auto
+ − 1512
then have "P ?q" using ih by simp
+ − 1513
moreover
+ − 1514
have "supp ?q \<subseteq> S" using as a2 by simp
+ − 1515
ultimately have "P ((p \<bullet> a \<rightleftharpoons> a) + ?q)" using as a1 swap by simp
+ − 1516
moreover
+ − 1517
have "p = (p \<bullet> a \<rightleftharpoons> a) + ?q" by (simp add: expand_perm_eq)
+ − 1518
ultimately have "P p" by simp
+ − 1519
}
+ − 1520
ultimately show "P p" by blast
+ − 1521
qed
+ − 1522
qed
+ − 1523
+ − 1524
lemma perm_simple_struct_induct[case_names zero swap]:
+ − 1525
assumes zero: "P 0"
+ − 1526
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)"
+ − 1527
shows "P p"
+ − 1528
by (rule_tac S="supp p" in perm_struct_induct)
+ − 1529
(auto intro: zero swap)
+ − 1530
+ − 1531
lemma perm_subset_induct[consumes 1, case_names zero swap plus]:
+ − 1532
assumes S: "supp p \<subseteq> S"
+ − 1533
assumes zero: "P 0"
+ − 1534
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)"
+ − 1535
assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2; supp p1 \<subseteq> S; supp p2 \<subseteq> S\<rbrakk> \<Longrightarrow> P (p1 + p2)"
+ − 1536
shows "P p"
+ − 1537
using S
+ − 1538
by (induct p rule: perm_struct_induct)
+ − 1539
(auto intro: zero plus swap simp add: supp_swap)
+ − 1540
+ − 1541
lemma supp_perm_eq:
+ − 1542
assumes "(supp x) \<sharp>* p"
+ − 1543
shows "p \<bullet> x = x"
+ − 1544
proof -
+ − 1545
from assms have "supp p \<subseteq> {a. a \<sharp> x}"
+ − 1546
unfolding supp_perm fresh_star_def fresh_def by auto
+ − 1547
then show "p \<bullet> x = x"
+ − 1548
proof (induct p rule: perm_struct_induct)
+ − 1549
case zero
+ − 1550
show "0 \<bullet> x = x" by simp
+ − 1551
next
+ − 1552
case (swap p a b)
+ − 1553
then have "a \<sharp> x" "b \<sharp> x" "p \<bullet> x = x" by simp_all
+ − 1554
then show "((a \<rightleftharpoons> b) + p) \<bullet> x = x" by (simp add: swap_fresh_fresh)
+ − 1555
qed
+ − 1556
qed
+ − 1557
+ − 1558
lemma supp_perm_eq_test:
+ − 1559
assumes "(supp x) \<sharp>* p"
+ − 1560
shows "p \<bullet> x = x"
+ − 1561
proof -
+ − 1562
from assms have "supp p \<subseteq> {a. a \<sharp> x}"
+ − 1563
unfolding supp_perm fresh_star_def fresh_def by auto
+ − 1564
then show "p \<bullet> x = x"
+ − 1565
proof (induct p rule: perm_subset_induct)
+ − 1566
case zero
+ − 1567
show "0 \<bullet> x = x" by simp
+ − 1568
next
+ − 1569
case (swap a b)
+ − 1570
then have "a \<sharp> x" "b \<sharp> x" by simp_all
+ − 1571
then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
+ − 1572
next
+ − 1573
case (plus p1 p2)
+ − 1574
have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
+ − 1575
then show "(p1 + p2) \<bullet> x = x" by simp
+ − 1576
qed
+ − 1577
qed
+ − 1578
2591
+ − 1579
lemma perm_supp_eq:
+ − 1580
assumes a: "(supp p) \<sharp>* x"
+ − 1581
shows "p \<bullet> x = x"
+ − 1582
by (rule supp_perm_eq)
+ − 1583
(simp add: fresh_star_supp_conv a)
+ − 1584
2470
+ − 1585
+ − 1586
section {* Avoiding of atom sets *}
+ − 1587
+ − 1588
text {*
+ − 1589
For every set of atoms, there is another set of atoms
+ − 1590
avoiding a finitely supported c and there is a permutation
+ − 1591
which 'translates' between both sets.
+ − 1592
*}
+ − 1593
+ − 1594
lemma at_set_avoiding_aux:
+ − 1595
fixes Xs::"atom set"
+ − 1596
and As::"atom set"
+ − 1597
assumes b: "Xs \<subseteq> As"
+ − 1598
and c: "finite As"
+ − 1599
shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
+ − 1600
proof -
+ − 1601
from b c have "finite Xs" by (rule finite_subset)
+ − 1602
then show ?thesis using b
+ − 1603
proof (induct rule: finite_subset_induct)
+ − 1604
case empty
+ − 1605
have "0 \<bullet> {} \<inter> As = {}" by simp
+ − 1606
moreover
+ − 1607
have "supp (0::perm) \<subseteq> {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
+ − 1608
ultimately show ?case by blast
+ − 1609
next
+ − 1610
case (insert x Xs)
+ − 1611
then obtain p where
+ − 1612
p1: "(p \<bullet> Xs) \<inter> As = {}" and
+ − 1613
p2: "supp p \<subseteq> (Xs \<union> (p \<bullet> Xs))" by blast
+ − 1614
from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
+ − 1615
with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
+ − 1616
hence px: "p \<bullet> x = x" unfolding supp_perm by simp
+ − 1617
have "finite (As \<union> p \<bullet> Xs)"
+ − 1618
using `finite As` `finite Xs`
+ − 1619
by (simp add: permute_set_eq_image)
+ − 1620
then obtain y where "y \<notin> (As \<union> p \<bullet> Xs)" "sort_of y = sort_of x"
+ − 1621
by (rule obtain_atom)
+ − 1622
hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "sort_of y = sort_of x"
+ − 1623
by simp_all
+ − 1624
let ?q = "(x \<rightleftharpoons> y) + p"
+ − 1625
have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
+ − 1626
unfolding insert_eqvt
+ − 1627
using `p \<bullet> x = x` `sort_of y = sort_of x`
+ − 1628
using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
+ − 1629
by (simp add: swap_atom swap_set_not_in)
+ − 1630
have "?q \<bullet> insert x Xs \<inter> As = {}"
+ − 1631
using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
+ − 1632
unfolding q by simp
+ − 1633
moreover
+ − 1634
have "supp ?q \<subseteq> insert x Xs \<union> ?q \<bullet> insert x Xs"
+ − 1635
using p2 unfolding q
+ − 1636
by (intro subset_trans [OF supp_plus_perm])
+ − 1637
(auto simp add: supp_swap)
+ − 1638
ultimately show ?case by blast
+ − 1639
qed
+ − 1640
qed
+ − 1641
+ − 1642
lemma at_set_avoiding:
+ − 1643
assumes a: "finite Xs"
+ − 1644
and b: "finite (supp c)"
+ − 1645
obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
+ − 1646
using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
+ − 1647
unfolding fresh_star_def fresh_def by blast
+ − 1648
2589
+ − 1649
lemma at_set_avoiding1:
+ − 1650
assumes "finite xs"
+ − 1651
and "finite (supp c)"
+ − 1652
shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
+ − 1653
using assms
+ − 1654
apply(erule_tac c="c" in at_set_avoiding)
+ − 1655
apply(auto)
+ − 1656
done
+ − 1657
2470
+ − 1658
lemma at_set_avoiding2:
+ − 1659
assumes "finite xs"
+ − 1660
and "finite (supp c)" "finite (supp x)"
+ − 1661
and "xs \<sharp>* x"
+ − 1662
shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p"
+ − 1663
using assms
+ − 1664
apply(erule_tac c="(c, x)" in at_set_avoiding)
+ − 1665
apply(simp add: supp_Pair)
+ − 1666
apply(rule_tac x="p" in exI)
2591
+ − 1667
apply(simp add: fresh_star_Pair)
2507
+ − 1668
apply(rule fresh_star_supp_conv)
+ − 1669
apply(auto simp add: fresh_star_def)
2470
+ − 1670
done
+ − 1671
2573
+ − 1672
lemma at_set_avoiding3:
+ − 1673
assumes "finite xs"
+ − 1674
and "finite (supp c)" "finite (supp x)"
+ − 1675
and "xs \<sharp>* x"
2586
+ − 1676
shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p \<and> supp p \<subseteq> xs \<union> (p \<bullet> xs)"
+ − 1677
using assms
+ − 1678
apply(erule_tac c="(c, x)" in at_set_avoiding)
+ − 1679
apply(simp add: supp_Pair)
+ − 1680
apply(rule_tac x="p" in exI)
2591
+ − 1681
apply(simp add: fresh_star_Pair)
2586
+ − 1682
apply(rule fresh_star_supp_conv)
+ − 1683
apply(auto simp add: fresh_star_def)
+ − 1684
done
2573
+ − 1685
+ − 1686
2470
+ − 1687
lemma at_set_avoiding2_atom:
+ − 1688
assumes "finite (supp c)" "finite (supp x)"
+ − 1689
and b: "a \<sharp> x"
+ − 1690
shows "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p"
+ − 1691
proof -
+ − 1692
have a: "{a} \<sharp>* x" unfolding fresh_star_def by (simp add: b)
+ − 1693
obtain p where p1: "(p \<bullet> {a}) \<sharp>* c" and p2: "supp x \<sharp>* p"
+ − 1694
using at_set_avoiding2[of "{a}" "c" "x"] assms a by blast
+ − 1695
have c: "(p \<bullet> a) \<sharp> c" using p1
+ − 1696
unfolding fresh_star_def Ball_def
+ − 1697
by(erule_tac x="p \<bullet> a" in allE) (simp add: permute_set_eq)
+ − 1698
hence "p \<bullet> a \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
+ − 1699
then show "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p" by blast
+ − 1700
qed
+ − 1701
+ − 1702
+ − 1703
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
+ − 1704
1972
+ − 1705
text {*
+ − 1706
Class @{text at_base} allows types containing multiple sorts of atoms.
+ − 1707
Class @{text at} only allows types with a single sort.
+ − 1708
*}
+ − 1709
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
+ − 1710
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
+ − 1711
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
+ − 1712
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
+ − 1713
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
+ − 1714
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
+ − 1715
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
+ − 1716
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
+ − 1717
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
+ − 1718
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
+ − 1719
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
+ − 1720
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
+ − 1721
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
+ − 1722
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
+ − 1723
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
+ − 1724
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
+ − 1725
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
+ − 1726
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
+ − 1727
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
+ − 1728
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
+ − 1729
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
+ − 1730
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
+ − 1731
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
+ − 1732
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
+ − 1733
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
+ − 1734
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
+ − 1735
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
+ − 1736
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
+ − 1737
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
+ − 1738
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
+ − 1739
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
+ − 1740
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
+ − 1741
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
+ − 1742
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
+ − 1743
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
+ − 1744
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
+ − 1745
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
+ − 1746
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
+ − 1747
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
+ − 1748
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
+ − 1749
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
+ − 1750
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
+ − 1751
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
+ − 1752
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
+ − 1753
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
+ − 1754
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
+ − 1755
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
+ − 1756
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
+ − 1757
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
+ − 1758
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
+ − 1759
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
+ − 1760
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
+ − 1761
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
+ − 1762
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
+ − 1763
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
+ − 1764
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
+ − 1765
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
+ − 1766
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
+ − 1767
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
+ − 1768
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
+ − 1769
1973
+ − 1770
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
+ − 1771
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
+ − 1772
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
+ − 1773
apply(simp add: supp_of_finite_sets[OF a])
2466
+ − 1774
apply(simp add: supp_at_base)
+ − 1775
apply(auto)
+ − 1776
done
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1777
2467
+ − 1778
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
+ − 1779
2467
+ − 1780
section {* A swapping operation for concrete atoms *}
+ − 1781
+ − 1782
definition
+ − 1783
flip :: "'a::at_base \<Rightarrow> 'a \<Rightarrow> perm" ("'(_ \<leftrightarrow> _')")
+ − 1784
where
+ − 1785
"(a \<leftrightarrow> b) = (atom a \<rightleftharpoons> atom b)"
+ − 1786
+ − 1787
lemma flip_self [simp]: "(a \<leftrightarrow> a) = 0"
+ − 1788
unfolding flip_def by (rule swap_self)
+ − 1789
+ − 1790
lemma flip_commute: "(a \<leftrightarrow> b) = (b \<leftrightarrow> a)"
+ − 1791
unfolding flip_def by (rule swap_commute)
+ − 1792
+ − 1793
lemma minus_flip [simp]: "- (a \<leftrightarrow> b) = (a \<leftrightarrow> b)"
+ − 1794
unfolding flip_def by (rule minus_swap)
+ − 1795
+ − 1796
lemma add_flip_cancel: "(a \<leftrightarrow> b) + (a \<leftrightarrow> b) = 0"
+ − 1797
unfolding flip_def by (rule swap_cancel)
+ − 1798
+ − 1799
lemma permute_flip_cancel [simp]: "(a \<leftrightarrow> b) \<bullet> (a \<leftrightarrow> b) \<bullet> x = x"
+ − 1800
unfolding permute_plus [symmetric] add_flip_cancel by simp
+ − 1801
+ − 1802
lemma permute_flip_cancel2 [simp]: "(a \<leftrightarrow> b) \<bullet> (b \<leftrightarrow> a) \<bullet> x = x"
+ − 1803
by (simp add: flip_commute)
+ − 1804
+ − 1805
lemma flip_eqvt:
+ − 1806
fixes a b c::"'a::at_base"
+ − 1807
shows "p \<bullet> (a \<leftrightarrow> b) = (p \<bullet> a \<leftrightarrow> p \<bullet> b)"
+ − 1808
unfolding flip_def
+ − 1809
by (simp add: swap_eqvt atom_eqvt)
+ − 1810
+ − 1811
lemma flip_at_base_simps [simp]:
+ − 1812
shows "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> a = b"
+ − 1813
and "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> b = a"
+ − 1814
and "\<lbrakk>a \<noteq> c; b \<noteq> c\<rbrakk> \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> c = c"
+ − 1815
and "sort_of (atom a) \<noteq> sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> x = x"
+ − 1816
unfolding flip_def
+ − 1817
unfolding atom_eq_iff [symmetric]
+ − 1818
unfolding atom_eqvt [symmetric]
+ − 1819
by simp_all
+ − 1820
+ − 1821
text {* the following two lemmas do not hold for at_base,
+ − 1822
only for single sort atoms from at *}
+ − 1823
+ − 1824
lemma permute_flip_at:
+ − 1825
fixes a b c::"'a::at"
+ − 1826
shows "(a \<leftrightarrow> b) \<bullet> c = (if c = a then b else if c = b then a else c)"
+ − 1827
unfolding flip_def
+ − 1828
apply (rule atom_eq_iff [THEN iffD1])
+ − 1829
apply (subst atom_eqvt [symmetric])
+ − 1830
apply (simp add: swap_atom)
+ − 1831
done
+ − 1832
+ − 1833
lemma flip_at_simps [simp]:
+ − 1834
fixes a b::"'a::at"
+ − 1835
shows "(a \<leftrightarrow> b) \<bullet> a = b"
+ − 1836
and "(a \<leftrightarrow> b) \<bullet> b = a"
+ − 1837
unfolding permute_flip_at by simp_all
+ − 1838
+ − 1839
lemma flip_fresh_fresh:
+ − 1840
fixes a b::"'a::at_base"
+ − 1841
assumes "atom a \<sharp> x" "atom b \<sharp> x"
+ − 1842
shows "(a \<leftrightarrow> b) \<bullet> x = x"
+ − 1843
using assms
+ − 1844
by (simp add: flip_def swap_fresh_fresh)
+ − 1845
+ − 1846
subsection {* Syntax for coercing at-elements to the atom-type *}
+ − 1847
+ − 1848
syntax
+ − 1849
"_atom_constrain" :: "logic \<Rightarrow> type \<Rightarrow> logic" ("_:::_" [4, 0] 3)
+ − 1850
+ − 1851
translations
+ − 1852
"_atom_constrain a t" => "CONST atom (_constrain a t)"
+ − 1853
+ − 1854
+ − 1855
subsection {* A lemma for proving instances of class @{text at}. *}
+ − 1856
+ − 1857
setup {* Sign.add_const_constraint (@{const_name "permute"}, NONE) *}
+ − 1858
setup {* Sign.add_const_constraint (@{const_name "atom"}, NONE) *}
+ − 1859
+ − 1860
text {*
+ − 1861
New atom types are defined as subtypes of @{typ atom}.
+ − 1862
*}
+ − 1863
+ − 1864
lemma exists_eq_simple_sort:
+ − 1865
shows "\<exists>a. a \<in> {a. sort_of a = s}"
+ − 1866
by (rule_tac x="Atom s 0" in exI, simp)
+ − 1867
+ − 1868
lemma exists_eq_sort:
+ − 1869
shows "\<exists>a. a \<in> {a. sort_of a \<in> range sort_fun}"
+ − 1870
by (rule_tac x="Atom (sort_fun x) y" in exI, simp)
+ − 1871
+ − 1872
lemma at_base_class:
+ − 1873
fixes sort_fun :: "'b \<Rightarrow>atom_sort"
+ − 1874
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
+ − 1875
assumes type: "type_definition Rep Abs {a. sort_of a \<in> range sort_fun}"
+ − 1876
assumes atom_def: "\<And>a. atom a = Rep a"
+ − 1877
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
+ − 1878
shows "OFCLASS('a, at_base_class)"
+ − 1879
proof
+ − 1880
interpret type_definition Rep Abs "{a. sort_of a \<in> range sort_fun}" by (rule type)
+ − 1881
have sort_of_Rep: "\<And>a. sort_of (Rep a) \<in> range sort_fun" using Rep by simp
+ − 1882
fix a b :: 'a and p p1 p2 :: perm
+ − 1883
show "0 \<bullet> a = a"
+ − 1884
unfolding permute_def by (simp add: Rep_inverse)
+ − 1885
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
+ − 1886
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
+ − 1887
show "atom a = atom b \<longleftrightarrow> a = b"
+ − 1888
unfolding atom_def by (simp add: Rep_inject)
+ − 1889
show "p \<bullet> atom a = atom (p \<bullet> a)"
+ − 1890
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
+ − 1891
qed
+ − 1892
+ − 1893
(*
+ − 1894
lemma at_class:
+ − 1895
fixes s :: atom_sort
+ − 1896
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
+ − 1897
assumes type: "type_definition Rep Abs {a. sort_of a \<in> range (\<lambda>x::unit. s)}"
+ − 1898
assumes atom_def: "\<And>a. atom a = Rep a"
+ − 1899
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
+ − 1900
shows "OFCLASS('a, at_class)"
+ − 1901
proof
+ − 1902
interpret type_definition Rep Abs "{a. sort_of a \<in> range (\<lambda>x::unit. s)}" by (rule type)
+ − 1903
have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
+ − 1904
fix a b :: 'a and p p1 p2 :: perm
+ − 1905
show "0 \<bullet> a = a"
+ − 1906
unfolding permute_def by (simp add: Rep_inverse)
+ − 1907
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
+ − 1908
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
+ − 1909
show "sort_of (atom a) = sort_of (atom b)"
+ − 1910
unfolding atom_def by (simp add: sort_of_Rep)
+ − 1911
show "atom a = atom b \<longleftrightarrow> a = b"
+ − 1912
unfolding atom_def by (simp add: Rep_inject)
+ − 1913
show "p \<bullet> atom a = atom (p \<bullet> a)"
+ − 1914
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
+ − 1915
qed
+ − 1916
*)
+ − 1917
+ − 1918
lemma at_class:
+ − 1919
fixes s :: atom_sort
+ − 1920
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
+ − 1921
assumes type: "type_definition Rep Abs {a. sort_of a = s}"
+ − 1922
assumes atom_def: "\<And>a. atom a = Rep a"
+ − 1923
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
+ − 1924
shows "OFCLASS('a, at_class)"
+ − 1925
proof
+ − 1926
interpret type_definition Rep Abs "{a. sort_of a = s}" by (rule type)
+ − 1927
have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
+ − 1928
fix a b :: 'a and p p1 p2 :: perm
+ − 1929
show "0 \<bullet> a = a"
+ − 1930
unfolding permute_def by (simp add: Rep_inverse)
+ − 1931
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
+ − 1932
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
+ − 1933
show "sort_of (atom a) = sort_of (atom b)"
+ − 1934
unfolding atom_def by (simp add: sort_of_Rep)
+ − 1935
show "atom a = atom b \<longleftrightarrow> a = b"
+ − 1936
unfolding atom_def by (simp add: Rep_inject)
+ − 1937
show "p \<bullet> atom a = atom (p \<bullet> a)"
+ − 1938
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
+ − 1939
qed
+ − 1940
+ − 1941
setup {* Sign.add_const_constraint
+ − 1942
(@{const_name "permute"}, SOME @{typ "perm \<Rightarrow> 'a::pt \<Rightarrow> 'a"}) *}
+ − 1943
setup {* Sign.add_const_constraint
+ − 1944
(@{const_name "atom"}, SOME @{typ "'a::at_base \<Rightarrow> atom"}) *}
+ − 1945
+ − 1946
2470
+ − 1947
+ − 1948
section {* The freshness lemma according to Andy Pitts *}
+ − 1949
+ − 1950
lemma freshness_lemma:
+ − 1951
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 1952
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 1953
shows "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 1954
proof -
+ − 1955
from a obtain b where a1: "atom b \<sharp> h" and a2: "atom b \<sharp> h b"
+ − 1956
by (auto simp add: fresh_Pair)
+ − 1957
show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 1958
proof (intro exI allI impI)
+ − 1959
fix a :: 'a
+ − 1960
assume a3: "atom a \<sharp> h"
+ − 1961
show "h a = h b"
+ − 1962
proof (cases "a = b")
+ − 1963
assume "a = b"
+ − 1964
thus "h a = h b" by simp
+ − 1965
next
+ − 1966
assume "a \<noteq> b"
+ − 1967
hence "atom a \<sharp> b" by (simp add: fresh_at_base)
+ − 1968
with a3 have "atom a \<sharp> h b"
+ − 1969
by (rule fresh_fun_app)
+ − 1970
with a2 have d1: "(atom b \<rightleftharpoons> atom a) \<bullet> (h b) = (h b)"
+ − 1971
by (rule swap_fresh_fresh)
+ − 1972
from a1 a3 have d2: "(atom b \<rightleftharpoons> atom a) \<bullet> h = h"
+ − 1973
by (rule swap_fresh_fresh)
+ − 1974
from d1 have "h b = (atom b \<rightleftharpoons> atom a) \<bullet> (h b)" by simp
+ − 1975
also have "\<dots> = ((atom b \<rightleftharpoons> atom a) \<bullet> h) ((atom b \<rightleftharpoons> atom a) \<bullet> b)"
+ − 1976
by (rule permute_fun_app_eq)
+ − 1977
also have "\<dots> = h a"
+ − 1978
using d2 by simp
+ − 1979
finally show "h a = h b" by simp
+ − 1980
qed
+ − 1981
qed
+ − 1982
qed
+ − 1983
+ − 1984
lemma freshness_lemma_unique:
+ − 1985
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 1986
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 1987
shows "\<exists>!x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 1988
proof (rule ex_ex1I)
+ − 1989
from a show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 1990
by (rule freshness_lemma)
+ − 1991
next
+ − 1992
fix x y
+ − 1993
assume x: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
+ − 1994
assume y: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = y"
+ − 1995
from a x y show "x = y"
+ − 1996
by (auto simp add: fresh_Pair)
+ − 1997
qed
+ − 1998
+ − 1999
text {* packaging the freshness lemma into a function *}
+ − 2000
+ − 2001
definition
+ − 2002
fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
+ − 2003
where
+ − 2004
"fresh_fun h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
+ − 2005
+ − 2006
lemma fresh_fun_apply:
+ − 2007
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2008
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2009
assumes b: "atom a \<sharp> h"
+ − 2010
shows "fresh_fun h = h a"
+ − 2011
unfolding fresh_fun_def
+ − 2012
proof (rule the_equality)
+ − 2013
show "\<forall>a'. atom a' \<sharp> h \<longrightarrow> h a' = h a"
+ − 2014
proof (intro strip)
+ − 2015
fix a':: 'a
+ − 2016
assume c: "atom a' \<sharp> h"
+ − 2017
from a have "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x" by (rule freshness_lemma)
+ − 2018
with b c show "h a' = h a" by auto
+ − 2019
qed
+ − 2020
next
+ − 2021
fix fr :: 'b
+ − 2022
assume "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = fr"
+ − 2023
with b show "fr = h a" by auto
+ − 2024
qed
+ − 2025
+ − 2026
lemma fresh_fun_apply':
+ − 2027
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2028
assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
+ − 2029
shows "fresh_fun h = h a"
+ − 2030
apply (rule fresh_fun_apply)
+ − 2031
apply (auto simp add: fresh_Pair intro: a)
+ − 2032
done
+ − 2033
+ − 2034
lemma fresh_fun_eqvt:
+ − 2035
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2036
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2037
shows "p \<bullet> (fresh_fun h) = fresh_fun (p \<bullet> h)"
+ − 2038
using a
+ − 2039
apply (clarsimp simp add: fresh_Pair)
+ − 2040
apply (subst fresh_fun_apply', assumption+)
+ − 2041
apply (drule fresh_permute_iff [where p=p, THEN iffD2])
+ − 2042
apply (drule fresh_permute_iff [where p=p, THEN iffD2])
+ − 2043
apply (simp add: atom_eqvt permute_fun_app_eq [where f=h])
+ − 2044
apply (erule (1) fresh_fun_apply' [symmetric])
+ − 2045
done
+ − 2046
+ − 2047
lemma fresh_fun_supports:
+ − 2048
fixes h :: "'a::at \<Rightarrow> 'b::pt"
+ − 2049
assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
+ − 2050
shows "(supp h) supports (fresh_fun h)"
+ − 2051
apply (simp add: supports_def fresh_def [symmetric])
+ − 2052
apply (simp add: fresh_fun_eqvt [OF a] swap_fresh_fresh)
+ − 2053
done
+ − 2054
+ − 2055
notation fresh_fun (binder "FRESH " 10)
+ − 2056
+ − 2057
lemma FRESH_f_iff:
+ − 2058
fixes P :: "'a::at \<Rightarrow> 'b::pure"
+ − 2059
fixes f :: "'b \<Rightarrow> 'c::pure"
+ − 2060
assumes P: "finite (supp P)"
+ − 2061
shows "(FRESH x. f (P x)) = f (FRESH x. P x)"
+ − 2062
proof -
+ − 2063
obtain a::'a where "atom a \<notin> supp P"
+ − 2064
using P by (rule obtain_at_base)
+ − 2065
hence "atom a \<sharp> P"
+ − 2066
by (simp add: fresh_def)
+ − 2067
show "(FRESH x. f (P x)) = f (FRESH x. P x)"
+ − 2068
apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
+ − 2069
apply (cut_tac `atom a \<sharp> P`)
+ − 2070
apply (simp add: fresh_conv_MOST)
+ − 2071
apply (elim MOST_rev_mp, rule MOST_I, clarify)
2479
+ − 2072
apply (simp add: permute_fun_def permute_pure fun_eq_iff)
2470
+ − 2073
apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
+ − 2074
apply (rule refl)
+ − 2075
done
+ − 2076
qed
+ − 2077
+ − 2078
lemma FRESH_binop_iff:
+ − 2079
fixes P :: "'a::at \<Rightarrow> 'b::pure"
+ − 2080
fixes Q :: "'a::at \<Rightarrow> 'c::pure"
+ − 2081
fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
+ − 2082
assumes P: "finite (supp P)"
+ − 2083
and Q: "finite (supp Q)"
+ − 2084
shows "(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)"
+ − 2085
proof -
+ − 2086
from assms have "finite (supp P \<union> supp Q)" by simp
+ − 2087
then obtain a::'a where "atom a \<notin> (supp P \<union> supp Q)"
+ − 2088
by (rule obtain_at_base)
+ − 2089
hence "atom a \<sharp> P" and "atom a \<sharp> Q"
+ − 2090
by (simp_all add: fresh_def)
+ − 2091
show ?thesis
+ − 2092
apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
+ − 2093
apply (cut_tac `atom a \<sharp> P` `atom a \<sharp> Q`)
+ − 2094
apply (simp add: fresh_conv_MOST)
+ − 2095
apply (elim MOST_rev_mp, rule MOST_I, clarify)
2479
+ − 2096
apply (simp add: permute_fun_def permute_pure fun_eq_iff)
2470
+ − 2097
apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
+ − 2098
apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
+ − 2099
apply (rule refl)
+ − 2100
done
+ − 2101
qed
+ − 2102
+ − 2103
lemma FRESH_conj_iff:
+ − 2104
fixes P Q :: "'a::at \<Rightarrow> bool"
+ − 2105
assumes P: "finite (supp P)" and Q: "finite (supp Q)"
+ − 2106
shows "(FRESH x. P x \<and> Q x) \<longleftrightarrow> (FRESH x. P x) \<and> (FRESH x. Q x)"
+ − 2107
using P Q by (rule FRESH_binop_iff)
+ − 2108
+ − 2109
lemma FRESH_disj_iff:
+ − 2110
fixes P Q :: "'a::at \<Rightarrow> bool"
+ − 2111
assumes P: "finite (supp P)" and Q: "finite (supp Q)"
+ − 2112
shows "(FRESH x. P x \<or> Q x) \<longleftrightarrow> (FRESH x. P x) \<or> (FRESH x. Q x)"
+ − 2113
using P Q by (rule FRESH_binop_iff)
+ − 2114
+ − 2115
2467
+ − 2116
section {* Library functions for the nominal infrastructure *}
+ − 2117
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2118
use "nominal_library.ML"
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2119
2466
+ − 2120
2467
+ − 2121
section {* Automation for creating concrete atom types *}
+ − 2122
+ − 2123
text {* at the moment only single-sort concrete atoms are supported *}
+ − 2124
+ − 2125
use "nominal_atoms.ML"
+ − 2126
+ − 2127
2466
+ − 2128
1062
+ − 2129
end