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