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