428 shows "P \<Longrightarrow> p \<bullet> P" |
428 shows "P \<Longrightarrow> p \<bullet> P" |
429 by(simp add: permute_bool_def) |
429 by(simp add: permute_bool_def) |
430 |
430 |
431 subsection {* Permutations for sets *} |
431 subsection {* Permutations for sets *} |
432 |
432 |
|
433 instantiation "set" :: (pt) pt |
|
434 begin |
|
435 |
|
436 definition |
|
437 "p \<bullet> X = {p \<bullet> x | x. x \<in> X}" |
|
438 |
|
439 instance |
|
440 apply default |
|
441 apply (auto simp add: permute_set_def) |
|
442 done |
|
443 |
|
444 end |
|
445 |
433 lemma permute_set_eq: |
446 lemma permute_set_eq: |
434 fixes x::"'a::pt" |
447 shows "p \<bullet> X = {x. - p \<bullet> x \<in> X}" |
435 shows "(p \<bullet> X) = {p \<bullet> x | x. x \<in> X}" |
448 unfolding permute_set_def |
436 unfolding permute_fun_def |
449 by (auto) (metis permute_minus_cancel(1)) |
437 unfolding permute_bool_def |
|
438 apply(auto simp add: mem_def) |
|
439 apply(rule_tac x="- p \<bullet> x" in exI) |
|
440 apply(simp) |
|
441 done |
|
442 |
450 |
443 lemma permute_set_eq_image: |
451 lemma permute_set_eq_image: |
444 shows "p \<bullet> X = permute p ` X" |
452 shows "p \<bullet> X = permute p ` X" |
445 unfolding permute_set_eq by auto |
453 unfolding permute_set_def by auto |
446 |
454 |
447 lemma permute_set_eq_vimage: |
455 lemma permute_set_eq_vimage: |
448 shows "p \<bullet> X = permute (- p) -` X" |
456 shows "p \<bullet> X = permute (- p) -` X" |
449 unfolding permute_fun_def permute_bool_def |
457 unfolding permute_set_eq vimage_def |
450 unfolding vimage_def Collect_def mem_def .. |
458 by simp |
451 |
459 |
452 lemma permute_finite [simp]: |
460 lemma permute_finite [simp]: |
453 shows "finite (p \<bullet> X) = finite X" |
461 shows "finite (p \<bullet> X) = finite X" |
454 unfolding permute_set_eq_vimage |
462 unfolding permute_set_eq_vimage |
455 using bij_permute by (rule finite_vimage_iff) |
463 using bij_permute by (rule finite_vimage_iff) |
456 |
464 |
457 lemma swap_set_not_in: |
465 lemma swap_set_not_in: |
458 assumes a: "a \<notin> S" "b \<notin> S" |
466 assumes a: "a \<notin> S" "b \<notin> S" |
459 shows "(a \<rightleftharpoons> b) \<bullet> S = S" |
467 shows "(a \<rightleftharpoons> b) \<bullet> S = S" |
460 unfolding permute_set_eq |
468 unfolding permute_set_def |
461 using a by (auto simp add: swap_atom) |
469 using a by (auto simp add: swap_atom) |
462 |
470 |
463 lemma swap_set_in: |
471 lemma swap_set_in: |
464 assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b" |
472 assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b" |
465 shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S" |
473 shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S" |
466 unfolding permute_set_eq |
474 unfolding permute_set_def |
467 using a by (auto simp add: swap_atom) |
475 using a by (auto simp add: swap_atom) |
468 |
476 |
469 lemma swap_set_in_eq: |
477 lemma swap_set_in_eq: |
470 assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b" |
478 assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b" |
471 shows "(a \<rightleftharpoons> b) \<bullet> S = (S - {a}) \<union> {b}" |
479 shows "(a \<rightleftharpoons> b) \<bullet> S = (S - {a}) \<union> {b}" |
472 unfolding permute_set_eq |
480 unfolding permute_set_def |
473 using a by (auto simp add: swap_atom) |
481 using a by (auto simp add: swap_atom) |
474 |
482 |
475 lemma swap_set_both_in: |
483 lemma swap_set_both_in: |
476 assumes a: "a \<in> S" "b \<in> S" |
484 assumes a: "a \<in> S" "b \<in> S" |
477 shows "(a \<rightleftharpoons> b) \<bullet> S = S" |
485 shows "(a \<rightleftharpoons> b) \<bullet> S = S" |
478 unfolding permute_set_eq |
486 unfolding permute_set_def |
479 using a by (auto simp add: swap_atom) |
487 using a by (auto simp add: swap_atom) |
480 |
488 |
481 lemma mem_permute_iff: |
489 lemma mem_permute_iff: |
482 shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X" |
490 shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X" |
483 unfolding mem_def permute_fun_def permute_bool_def |
491 unfolding permute_set_def |
484 by simp |
492 by auto |
485 |
493 |
486 lemma empty_eqvt: |
494 lemma empty_eqvt: |
487 shows "p \<bullet> {} = {}" |
495 shows "p \<bullet> {} = {}" |
488 unfolding empty_def Collect_def |
496 unfolding permute_set_def |
489 by (simp add: permute_fun_def permute_bool_def) |
497 by (simp) |
490 |
498 |
491 lemma insert_eqvt: |
499 lemma insert_eqvt: |
492 shows "p \<bullet> (insert x A) = insert (p \<bullet> x) (p \<bullet> A)" |
500 shows "p \<bullet> (insert x A) = insert (p \<bullet> x) (p \<bullet> A)" |
493 unfolding permute_set_eq_image image_insert .. |
501 unfolding permute_set_eq_image image_insert .. |
494 |
502 |
877 |
888 |
878 subsubsection {* Equivariance of Set operators *} |
889 subsubsection {* Equivariance of Set operators *} |
879 |
890 |
880 lemma mem_eqvt [eqvt]: |
891 lemma mem_eqvt [eqvt]: |
881 shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)" |
892 shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)" |
882 unfolding mem_def |
893 unfolding permute_bool_def permute_set_def |
883 by (rule permute_fun_app_eq) |
894 by (auto) |
884 |
895 |
885 lemma Collect_eqvt [eqvt]: |
896 lemma Collect_eqvt [eqvt]: |
886 shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}" |
897 shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}" |
887 unfolding Collect_def permute_fun_def .. |
898 unfolding permute_set_eq permute_fun_def |
|
899 by (auto simp add: permute_bool_def) |
888 |
900 |
889 lemma inter_eqvt [eqvt]: |
901 lemma inter_eqvt [eqvt]: |
890 shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)" |
902 shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)" |
891 unfolding Int_def |
903 unfolding Int_def |
892 by (perm_simp) (rule refl) |
904 by (perm_simp) (rule refl) |