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