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