equal
deleted
inserted
replaced
58 apply (simp add: image_iff) |
58 apply (simp add: image_iff) |
59 apply metis |
59 apply metis |
60 done |
60 done |
61 |
61 |
62 lemma permutes_inj: "p permutes S \<Longrightarrow> inj p" |
62 lemma permutes_inj: "p permutes S \<Longrightarrow> inj p" |
63 unfolding permutes_def inj_on_def by blast |
63 unfolding permutes_def inj_def by blast |
64 |
64 |
65 lemma permutes_inj_on: "f permutes S \<Longrightarrow> inj_on f A" |
65 lemma permutes_inj_on: "f permutes S \<Longrightarrow> inj_on f A" |
66 unfolding permutes_def inj_on_def by auto |
66 unfolding permutes_def inj_on_def by auto |
67 |
67 |
68 lemma permutes_surj: "p permutes s \<Longrightarrow> surj p" |
68 lemma permutes_surj: "p permutes s \<Longrightarrow> surj p" |
697 |
697 |
698 |
698 |
699 subsection \<open>A more abstract characterization of permutations\<close> |
699 subsection \<open>A more abstract characterization of permutations\<close> |
700 |
700 |
701 lemma bij_iff: "bij f \<longleftrightarrow> (\<forall>x. \<exists>!y. f y = x)" |
701 lemma bij_iff: "bij f \<longleftrightarrow> (\<forall>x. \<exists>!y. f y = x)" |
702 unfolding bij_def inj_on_def surj_def |
702 unfolding bij_def inj_def surj_def |
703 apply auto |
703 apply auto |
704 apply metis |
704 apply metis |
705 apply metis |
705 apply metis |
706 done |
706 done |
707 |
707 |
756 let ?q = "Fun.swap a (p a) id \<circ> ?r" |
756 let ?q = "Fun.swap a (p a) id \<circ> ?r" |
757 have raa: "?r a = a" |
757 have raa: "?r a = a" |
758 by (simp add: Fun.swap_def) |
758 by (simp add: Fun.swap_def) |
759 from bij_swap_compose_bij[OF insert(4)] have br: "bij ?r" . |
759 from bij_swap_compose_bij[OF insert(4)] have br: "bij ?r" . |
760 from insert raa have th: "\<forall>x. x \<notin> F \<longrightarrow> ?r x = x" |
760 from insert raa have th: "\<forall>x. x \<notin> F \<longrightarrow> ?r x = x" |
761 by (metis bij_pointE comp_apply id_apply insert_iff swap_apply(3)) |
761 by (metis bij_pointE comp_apply id_apply insert_iff swap_apply(3)) |
762 from insert(3)[OF br th] have rp: "permutation ?r" . |
762 from insert(3)[OF br th] have rp: "permutation ?r" . |
763 have "permutation ?q" |
763 have "permutation ?q" |
764 by (simp add: permutation_compose permutation_swap_id rp) |
764 by (simp add: permutation_compose permutation_swap_id rp) |
765 then show ?case |
765 then show ?case |
766 by (simp add: o_assoc) |
766 by (simp add: o_assoc) |
1102 moreover { |
1102 moreover { |
1103 assume h: "p n < n" |
1103 assume h: "p n < n" |
1104 from H h have "p (p n) = p n" |
1104 from H h have "p (p n) = p n" |
1105 by metis |
1105 by metis |
1106 with permutes_inj[OF H(2)] have "p n = n" |
1106 with permutes_inj[OF H(2)] have "p n = n" |
1107 unfolding inj_on_def by blast |
1107 unfolding inj_def by blast |
1108 with h have False |
1108 with h have False |
1109 by simp |
1109 by simp |
1110 } |
1110 } |
1111 ultimately have "p n = n" |
1111 ultimately have "p n = n" |
1112 by blast |
1112 by blast |