| author | huffman | 
| Fri, 22 May 2009 13:18:59 -0700 | |
| changeset 31232 | 689aa7da48cc | 
| parent 30729 | 461ee3e49ad3 | 
| child 31727 | 2621a957d417 | 
| permissions | -rw-r--r-- | 
| 13813 | 1 | (* | 
| 2 | Title: HOL/Algebra/Group.thy | |
| 3 | Author: Clemens Ballarin, started 4 February 2003 | |
| 4 | ||
| 5 | Based on work by Florian Kammueller, L C Paulson and Markus Wenzel. | |
| 6 | *) | |
| 7 | ||
| 28823 | 8 | theory Group | 
| 9 | imports Lattice FuncSet | |
| 10 | begin | |
| 13813 | 11 | |
| 14761 | 12 | |
| 14963 | 13 | section {* Monoids and Groups *}
 | 
| 13936 | 14 | |
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 15 | subsection {* Definitions *}
 | 
| 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 16 | |
| 13813 | 17 | text {*
 | 
| 14963 | 18 |   Definitions follow \cite{Jacobson:1985}.
 | 
| 13813 | 19 | *} | 
| 20 | ||
| 14963 | 21 | record 'a monoid = "'a partial_object" + | 
| 22 | mult :: "['a, 'a] \<Rightarrow> 'a" (infixl "\<otimes>\<index>" 70) | |
| 23 |   one     :: 'a ("\<one>\<index>")
 | |
| 13817 | 24 | |
| 14651 | 25 | constdefs (structure G) | 
| 14852 | 26 |   m_inv :: "('a, 'b) monoid_scheme => 'a => 'a" ("inv\<index> _" [81] 80)
 | 
| 14651 | 27 | "inv x == (THE y. y \<in> carrier G & x \<otimes> y = \<one> & y \<otimes> x = \<one>)" | 
| 13936 | 28 | |
| 14651 | 29 | Units :: "_ => 'a set" | 
| 14852 | 30 |   --{*The set of invertible elements*}
 | 
| 14963 | 31 |   "Units G == {y. y \<in> carrier G & (\<exists>x \<in> carrier G. x \<otimes> y = \<one> & y \<otimes> x = \<one>)}"
 | 
| 13936 | 32 | |
| 33 | consts | |
| 34 |   pow :: "[('a, 'm) monoid_scheme, 'a, 'b::number] => 'a" (infixr "'(^')\<index>" 75)
 | |
| 35 | ||
| 19699 | 36 | defs (overloaded) | 
| 14693 | 37 | nat_pow_def: "pow G a n == nat_rec \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a) n" | 
| 13936 | 38 | int_pow_def: "pow G a z == | 
| 14693 | 39 | let p = nat_rec \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a) | 
| 40 | in if neg z then inv\<^bsub>G\<^esub> (p (nat (-z))) else p (nat z)" | |
| 13813 | 41 | |
| 19783 | 42 | locale monoid = | 
| 43 | fixes G (structure) | |
| 13813 | 44 | assumes m_closed [intro, simp]: | 
| 14963 | 45 | "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<otimes> y \<in> carrier G" | 
| 46 | and m_assoc: | |
| 47 | "\<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> | |
| 48 | \<Longrightarrow> (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)" | |
| 49 | and one_closed [intro, simp]: "\<one> \<in> carrier G" | |
| 50 | and l_one [simp]: "x \<in> carrier G \<Longrightarrow> \<one> \<otimes> x = x" | |
| 51 | and r_one [simp]: "x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x" | |
| 13817 | 52 | |
| 13936 | 53 | lemma monoidI: | 
| 19783 | 54 | fixes G (structure) | 
| 13936 | 55 | assumes m_closed: | 
| 14693 | 56 | "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G" | 
| 57 | and one_closed: "\<one> \<in> carrier G" | |
| 13936 | 58 | and m_assoc: | 
| 59 | "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 14693 | 60 | (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)" | 
| 61 | and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x" | |
| 62 | and r_one: "!!x. x \<in> carrier G ==> x \<otimes> \<one> = x" | |
| 13936 | 63 | shows "monoid G" | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 64 | by (fast intro!: monoid.intro intro: assms) | 
| 13936 | 65 | |
| 66 | lemma (in monoid) Units_closed [dest]: | |
| 67 | "x \<in> Units G ==> x \<in> carrier G" | |
| 68 | by (unfold Units_def) fast | |
| 69 | ||
| 70 | lemma (in monoid) inv_unique: | |
| 14693 | 71 | assumes eq: "y \<otimes> x = \<one>" "x \<otimes> y' = \<one>" | 
| 72 | and G: "x \<in> carrier G" "y \<in> carrier G" "y' \<in> carrier G" | |
| 13936 | 73 | shows "y = y'" | 
| 74 | proof - | |
| 75 | from G eq have "y = y \<otimes> (x \<otimes> y')" by simp | |
| 76 | also from G have "... = (y \<otimes> x) \<otimes> y'" by (simp add: m_assoc) | |
| 77 | also from G eq have "... = y'" by simp | |
| 78 | finally show ?thesis . | |
| 79 | qed | |
| 80 | ||
| 27698 | 81 | lemma (in monoid) Units_m_closed [intro, simp]: | 
| 82 | assumes x: "x \<in> Units G" and y: "y \<in> Units G" | |
| 83 | shows "x \<otimes> y \<in> Units G" | |
| 84 | proof - | |
| 85 | from x obtain x' where x: "x \<in> carrier G" "x' \<in> carrier G" and xinv: "x \<otimes> x' = \<one>" "x' \<otimes> x = \<one>" | |
| 86 | unfolding Units_def by fast | |
| 87 | from y obtain y' where y: "y \<in> carrier G" "y' \<in> carrier G" and yinv: "y \<otimes> y' = \<one>" "y' \<otimes> y = \<one>" | |
| 88 | unfolding Units_def by fast | |
| 89 | from x y xinv yinv have "y' \<otimes> (x' \<otimes> x) \<otimes> y = \<one>" by simp | |
| 90 | moreover from x y xinv yinv have "x \<otimes> (y \<otimes> y') \<otimes> x' = \<one>" by simp | |
| 91 | moreover note x y | |
| 92 | ultimately show ?thesis unfolding Units_def | |
| 93 |     -- "Must avoid premature use of @{text hyp_subst_tac}."
 | |
| 94 | apply (rule_tac CollectI) | |
| 95 | apply (rule) | |
| 96 | apply (fast) | |
| 97 | apply (rule bexI [where x = "y' \<otimes> x'"]) | |
| 98 | apply (auto simp: m_assoc) | |
| 99 | done | |
| 100 | qed | |
| 101 | ||
| 13940 | 102 | lemma (in monoid) Units_one_closed [intro, simp]: | 
| 103 | "\<one> \<in> Units G" | |
| 104 | by (unfold Units_def) auto | |
| 105 | ||
| 13936 | 106 | lemma (in monoid) Units_inv_closed [intro, simp]: | 
| 107 | "x \<in> Units G ==> inv x \<in> carrier G" | |
| 13943 | 108 | apply (unfold Units_def m_inv_def, auto) | 
| 13936 | 109 | apply (rule theI2, fast) | 
| 13943 | 110 | apply (fast intro: inv_unique, fast) | 
| 13936 | 111 | done | 
| 112 | ||
| 19981 | 113 | lemma (in monoid) Units_l_inv_ex: | 
| 114 | "x \<in> Units G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>" | |
| 115 | by (unfold Units_def) auto | |
| 116 | ||
| 117 | lemma (in monoid) Units_r_inv_ex: | |
| 118 | "x \<in> Units G ==> \<exists>y \<in> carrier G. x \<otimes> y = \<one>" | |
| 119 | by (unfold Units_def) auto | |
| 120 | ||
| 27698 | 121 | lemma (in monoid) Units_l_inv [simp]: | 
| 13936 | 122 | "x \<in> Units G ==> inv x \<otimes> x = \<one>" | 
| 13943 | 123 | apply (unfold Units_def m_inv_def, auto) | 
| 13936 | 124 | apply (rule theI2, fast) | 
| 13943 | 125 | apply (fast intro: inv_unique, fast) | 
| 13936 | 126 | done | 
| 127 | ||
| 27698 | 128 | lemma (in monoid) Units_r_inv [simp]: | 
| 13936 | 129 | "x \<in> Units G ==> x \<otimes> inv x = \<one>" | 
| 13943 | 130 | apply (unfold Units_def m_inv_def, auto) | 
| 13936 | 131 | apply (rule theI2, fast) | 
| 13943 | 132 | apply (fast intro: inv_unique, fast) | 
| 13936 | 133 | done | 
| 134 | ||
| 135 | lemma (in monoid) Units_inv_Units [intro, simp]: | |
| 136 | "x \<in> Units G ==> inv x \<in> Units G" | |
| 137 | proof - | |
| 138 | assume x: "x \<in> Units G" | |
| 139 | show "inv x \<in> Units G" | |
| 140 | by (auto simp add: Units_def | |
| 141 | intro: Units_l_inv Units_r_inv x Units_closed [OF x]) | |
| 142 | qed | |
| 143 | ||
| 144 | lemma (in monoid) Units_l_cancel [simp]: | |
| 145 | "[| x \<in> Units G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 146 | (x \<otimes> y = x \<otimes> z) = (y = z)" | |
| 147 | proof | |
| 148 | assume eq: "x \<otimes> y = x \<otimes> z" | |
| 14693 | 149 | and G: "x \<in> Units G" "y \<in> carrier G" "z \<in> carrier G" | 
| 13936 | 150 | then have "(inv x \<otimes> x) \<otimes> y = (inv x \<otimes> x) \<otimes> z" | 
| 27698 | 151 | by (simp add: m_assoc Units_closed del: Units_l_inv) | 
| 13936 | 152 | with G show "y = z" by (simp add: Units_l_inv) | 
| 153 | next | |
| 154 | assume eq: "y = z" | |
| 14693 | 155 | and G: "x \<in> Units G" "y \<in> carrier G" "z \<in> carrier G" | 
| 13936 | 156 | then show "x \<otimes> y = x \<otimes> z" by simp | 
| 157 | qed | |
| 158 | ||
| 159 | lemma (in monoid) Units_inv_inv [simp]: | |
| 160 | "x \<in> Units G ==> inv (inv x) = x" | |
| 161 | proof - | |
| 162 | assume x: "x \<in> Units G" | |
| 27698 | 163 | then have "inv x \<otimes> inv (inv x) = inv x \<otimes> x" by simp | 
| 164 | with x show ?thesis by (simp add: Units_closed del: Units_l_inv Units_r_inv) | |
| 13936 | 165 | qed | 
| 166 | ||
| 167 | lemma (in monoid) inv_inj_on_Units: | |
| 168 | "inj_on (m_inv G) (Units G)" | |
| 169 | proof (rule inj_onI) | |
| 170 | fix x y | |
| 14693 | 171 | assume G: "x \<in> Units G" "y \<in> Units G" and eq: "inv x = inv y" | 
| 13936 | 172 | then have "inv (inv x) = inv (inv y)" by simp | 
| 173 | with G show "x = y" by simp | |
| 174 | qed | |
| 175 | ||
| 13940 | 176 | lemma (in monoid) Units_inv_comm: | 
| 177 | assumes inv: "x \<otimes> y = \<one>" | |
| 14693 | 178 | and G: "x \<in> Units G" "y \<in> Units G" | 
| 13940 | 179 | shows "y \<otimes> x = \<one>" | 
| 180 | proof - | |
| 181 | from G have "x \<otimes> y \<otimes> x = x \<otimes> \<one>" by (auto simp add: inv Units_closed) | |
| 182 | with G show ?thesis by (simp del: r_one add: m_assoc Units_closed) | |
| 183 | qed | |
| 184 | ||
| 13936 | 185 | text {* Power *}
 | 
| 186 | ||
| 187 | lemma (in monoid) nat_pow_closed [intro, simp]: | |
| 188 | "x \<in> carrier G ==> x (^) (n::nat) \<in> carrier G" | |
| 189 | by (induct n) (simp_all add: nat_pow_def) | |
| 190 | ||
| 191 | lemma (in monoid) nat_pow_0 [simp]: | |
| 192 | "x (^) (0::nat) = \<one>" | |
| 193 | by (simp add: nat_pow_def) | |
| 194 | ||
| 195 | lemma (in monoid) nat_pow_Suc [simp]: | |
| 196 | "x (^) (Suc n) = x (^) n \<otimes> x" | |
| 197 | by (simp add: nat_pow_def) | |
| 198 | ||
| 199 | lemma (in monoid) nat_pow_one [simp]: | |
| 200 | "\<one> (^) (n::nat) = \<one>" | |
| 201 | by (induct n) simp_all | |
| 202 | ||
| 203 | lemma (in monoid) nat_pow_mult: | |
| 204 | "x \<in> carrier G ==> x (^) (n::nat) \<otimes> x (^) m = x (^) (n + m)" | |
| 205 | by (induct m) (simp_all add: m_assoc [THEN sym]) | |
| 206 | ||
| 207 | lemma (in monoid) nat_pow_pow: | |
| 208 | "x \<in> carrier G ==> (x (^) n) (^) m = x (^) (n * m::nat)" | |
| 209 | by (induct m) (simp, simp add: nat_pow_mult add_commute) | |
| 210 | ||
| 27698 | 211 | |
| 212 | (* Jacobson defines submonoid here. *) | |
| 213 | (* Jacobson defines the order of a monoid here. *) | |
| 214 | ||
| 215 | ||
| 216 | subsection {* Groups *}
 | |
| 217 | ||
| 13936 | 218 | text {*
 | 
| 219 | A group is a monoid all of whose elements are invertible. | |
| 220 | *} | |
| 221 | ||
| 222 | locale group = monoid + | |
| 223 | assumes Units: "carrier G <= Units G" | |
| 224 | ||
| 26199 | 225 | lemma (in group) is_group: "group G" by (rule group_axioms) | 
| 14761 | 226 | |
| 13936 | 227 | theorem groupI: | 
| 19783 | 228 | fixes G (structure) | 
| 13936 | 229 | assumes m_closed [simp]: | 
| 14693 | 230 | "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G" | 
| 231 | and one_closed [simp]: "\<one> \<in> carrier G" | |
| 13936 | 232 | and m_assoc: | 
| 233 | "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 14693 | 234 | (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)" | 
| 235 | and l_one [simp]: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x" | |
| 14963 | 236 | and l_inv_ex: "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>" | 
| 13936 | 237 | shows "group G" | 
| 238 | proof - | |
| 239 | have l_cancel [simp]: | |
| 240 | "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 14693 | 241 | (x \<otimes> y = x \<otimes> z) = (y = z)" | 
| 13936 | 242 | proof | 
| 243 | fix x y z | |
| 14693 | 244 | assume eq: "x \<otimes> y = x \<otimes> z" | 
| 245 | and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G" | |
| 13936 | 246 | with l_inv_ex obtain x_inv where xG: "x_inv \<in> carrier G" | 
| 14693 | 247 | and l_inv: "x_inv \<otimes> x = \<one>" by fast | 
| 248 | from G eq xG have "(x_inv \<otimes> x) \<otimes> y = (x_inv \<otimes> x) \<otimes> z" | |
| 13936 | 249 | by (simp add: m_assoc) | 
| 250 | with G show "y = z" by (simp add: l_inv) | |
| 251 | next | |
| 252 | fix x y z | |
| 253 | assume eq: "y = z" | |
| 14693 | 254 | and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G" | 
| 255 | then show "x \<otimes> y = x \<otimes> z" by simp | |
| 13936 | 256 | qed | 
| 257 | have r_one: | |
| 14693 | 258 | "!!x. x \<in> carrier G ==> x \<otimes> \<one> = x" | 
| 13936 | 259 | proof - | 
| 260 | fix x | |
| 261 | assume x: "x \<in> carrier G" | |
| 262 | with l_inv_ex obtain x_inv where xG: "x_inv \<in> carrier G" | |
| 14693 | 263 | and l_inv: "x_inv \<otimes> x = \<one>" by fast | 
| 264 | from x xG have "x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x" | |
| 13936 | 265 | by (simp add: m_assoc [symmetric] l_inv) | 
| 14693 | 266 | with x xG show "x \<otimes> \<one> = x" by simp | 
| 13936 | 267 | qed | 
| 268 | have inv_ex: | |
| 14963 | 269 | "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one> & x \<otimes> y = \<one>" | 
| 13936 | 270 | proof - | 
| 271 | fix x | |
| 272 | assume x: "x \<in> carrier G" | |
| 273 | with l_inv_ex obtain y where y: "y \<in> carrier G" | |
| 14693 | 274 | and l_inv: "y \<otimes> x = \<one>" by fast | 
| 275 | from x y have "y \<otimes> (x \<otimes> y) = y \<otimes> \<one>" | |
| 13936 | 276 | by (simp add: m_assoc [symmetric] l_inv r_one) | 
| 14693 | 277 | with x y have r_inv: "x \<otimes> y = \<one>" | 
| 13936 | 278 | by simp | 
| 14963 | 279 | from x y show "\<exists>y \<in> carrier G. y \<otimes> x = \<one> & x \<otimes> y = \<one>" | 
| 13936 | 280 | by (fast intro: l_inv r_inv) | 
| 281 | qed | |
| 282 | then have carrier_subset_Units: "carrier G <= Units G" | |
| 283 | by (unfold Units_def) fast | |
| 28823 | 284 | show ?thesis proof qed (auto simp: r_one m_assoc carrier_subset_Units) | 
| 13936 | 285 | qed | 
| 286 | ||
| 27698 | 287 | lemma (in monoid) group_l_invI: | 
| 13936 | 288 | assumes l_inv_ex: | 
| 14963 | 289 | "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>" | 
| 13936 | 290 | shows "group G" | 
| 291 | by (rule groupI) (auto intro: m_assoc l_inv_ex) | |
| 292 | ||
| 293 | lemma (in group) Units_eq [simp]: | |
| 294 | "Units G = carrier G" | |
| 295 | proof | |
| 296 | show "Units G <= carrier G" by fast | |
| 297 | next | |
| 298 | show "carrier G <= Units G" by (rule Units) | |
| 299 | qed | |
| 300 | ||
| 301 | lemma (in group) inv_closed [intro, simp]: | |
| 302 | "x \<in> carrier G ==> inv x \<in> carrier G" | |
| 303 | using Units_inv_closed by simp | |
| 304 | ||
| 19981 | 305 | lemma (in group) l_inv_ex [simp]: | 
| 306 | "x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>" | |
| 307 | using Units_l_inv_ex by simp | |
| 308 | ||
| 309 | lemma (in group) r_inv_ex [simp]: | |
| 310 | "x \<in> carrier G ==> \<exists>y \<in> carrier G. x \<otimes> y = \<one>" | |
| 311 | using Units_r_inv_ex by simp | |
| 312 | ||
| 14963 | 313 | lemma (in group) l_inv [simp]: | 
| 13936 | 314 | "x \<in> carrier G ==> inv x \<otimes> x = \<one>" | 
| 315 | using Units_l_inv by simp | |
| 13813 | 316 | |
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 317 | |
| 13813 | 318 | subsection {* Cancellation Laws and Basic Properties *}
 | 
| 319 | ||
| 320 | lemma (in group) l_cancel [simp]: | |
| 321 | "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 322 | (x \<otimes> y = x \<otimes> z) = (y = z)" | |
| 13936 | 323 | using Units_l_inv by simp | 
| 13940 | 324 | |
| 14963 | 325 | lemma (in group) r_inv [simp]: | 
| 13813 | 326 | "x \<in> carrier G ==> x \<otimes> inv x = \<one>" | 
| 327 | proof - | |
| 328 | assume x: "x \<in> carrier G" | |
| 329 | then have "inv x \<otimes> (x \<otimes> inv x) = inv x \<otimes> \<one>" | |
| 330 | by (simp add: m_assoc [symmetric] l_inv) | |
| 331 | with x show ?thesis by (simp del: r_one) | |
| 332 | qed | |
| 333 | ||
| 334 | lemma (in group) r_cancel [simp]: | |
| 335 | "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 336 | (y \<otimes> x = z \<otimes> x) = (y = z)" | |
| 337 | proof | |
| 338 | assume eq: "y \<otimes> x = z \<otimes> x" | |
| 14693 | 339 | and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G" | 
| 13813 | 340 | then have "y \<otimes> (x \<otimes> inv x) = z \<otimes> (x \<otimes> inv x)" | 
| 27698 | 341 | by (simp add: m_assoc [symmetric] del: r_inv Units_r_inv) | 
| 14963 | 342 | with G show "y = z" by simp | 
| 13813 | 343 | next | 
| 344 | assume eq: "y = z" | |
| 14693 | 345 | and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G" | 
| 13813 | 346 | then show "y \<otimes> x = z \<otimes> x" by simp | 
| 347 | qed | |
| 348 | ||
| 13854 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 349 | lemma (in group) inv_one [simp]: | 
| 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 350 | "inv \<one> = \<one>" | 
| 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 351 | proof - | 
| 27698 | 352 | have "inv \<one> = \<one> \<otimes> (inv \<one>)" by (simp del: r_inv Units_r_inv) | 
| 14963 | 353 | moreover have "... = \<one>" by simp | 
| 13854 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 354 | finally show ?thesis . | 
| 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 355 | qed | 
| 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 356 | |
| 13813 | 357 | lemma (in group) inv_inv [simp]: | 
| 358 | "x \<in> carrier G ==> inv (inv x) = x" | |
| 13936 | 359 | using Units_inv_inv by simp | 
| 360 | ||
| 361 | lemma (in group) inv_inj: | |
| 362 | "inj_on (m_inv G) (carrier G)" | |
| 363 | using inv_inj_on_Units by simp | |
| 13813 | 364 | |
| 13854 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 365 | lemma (in group) inv_mult_group: | 
| 13813 | 366 | "[| x \<in> carrier G; y \<in> carrier G |] ==> inv (x \<otimes> y) = inv y \<otimes> inv x" | 
| 367 | proof - | |
| 14693 | 368 | assume G: "x \<in> carrier G" "y \<in> carrier G" | 
| 13813 | 369 | then have "inv (x \<otimes> y) \<otimes> (x \<otimes> y) = (inv y \<otimes> inv x) \<otimes> (x \<otimes> y)" | 
| 14963 | 370 | by (simp add: m_assoc l_inv) (simp add: m_assoc [symmetric]) | 
| 27698 | 371 | with G show ?thesis by (simp del: l_inv Units_l_inv) | 
| 13813 | 372 | qed | 
| 373 | ||
| 13940 | 374 | lemma (in group) inv_comm: | 
| 375 | "[| x \<otimes> y = \<one>; x \<in> carrier G; y \<in> carrier G |] ==> y \<otimes> x = \<one>" | |
| 14693 | 376 | by (rule Units_inv_comm) auto | 
| 13940 | 377 | |
| 13944 | 378 | lemma (in group) inv_equality: | 
| 13943 | 379 | "[|y \<otimes> x = \<one>; x \<in> carrier G; y \<in> carrier G|] ==> inv x = y" | 
| 380 | apply (simp add: m_inv_def) | |
| 381 | apply (rule the_equality) | |
| 14693 | 382 | apply (simp add: inv_comm [of y x]) | 
| 383 | apply (rule r_cancel [THEN iffD1], auto) | |
| 13943 | 384 | done | 
| 385 | ||
| 13936 | 386 | text {* Power *}
 | 
| 387 | ||
| 388 | lemma (in group) int_pow_def2: | |
| 389 | "a (^) (z::int) = (if neg z then inv (a (^) (nat (-z))) else a (^) (nat z))" | |
| 390 | by (simp add: int_pow_def nat_pow_def Let_def) | |
| 391 | ||
| 392 | lemma (in group) int_pow_0 [simp]: | |
| 393 | "x (^) (0::int) = \<one>" | |
| 394 | by (simp add: int_pow_def2) | |
| 395 | ||
| 396 | lemma (in group) int_pow_one [simp]: | |
| 397 | "\<one> (^) (z::int) = \<one>" | |
| 398 | by (simp add: int_pow_def2) | |
| 399 | ||
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 400 | |
| 14963 | 401 | subsection {* Subgroups *}
 | 
| 13813 | 402 | |
| 19783 | 403 | locale subgroup = | 
| 404 | fixes H and G (structure) | |
| 14963 | 405 | assumes subset: "H \<subseteq> carrier G" | 
| 406 | and m_closed [intro, simp]: "\<lbrakk>x \<in> H; y \<in> H\<rbrakk> \<Longrightarrow> x \<otimes> y \<in> H" | |
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 407 | and one_closed [simp]: "\<one> \<in> H" | 
| 14963 | 408 | and m_inv_closed [intro,simp]: "x \<in> H \<Longrightarrow> inv x \<in> H" | 
| 13813 | 409 | |
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 410 | lemma (in subgroup) is_subgroup: | 
| 26199 | 411 | "subgroup H G" by (rule subgroup_axioms) | 
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 412 | |
| 13813 | 413 | declare (in subgroup) group.intro [intro] | 
| 13949 
0ce528cd6f19
HOL-Algebra complete for release Isabelle2003 (modulo section headers).
 ballarin parents: 
13944diff
changeset | 414 | |
| 14963 | 415 | lemma (in subgroup) mem_carrier [simp]: | 
| 416 | "x \<in> H \<Longrightarrow> x \<in> carrier G" | |
| 417 | using subset by blast | |
| 13813 | 418 | |
| 14963 | 419 | lemma subgroup_imp_subset: | 
| 420 | "subgroup H G \<Longrightarrow> H \<subseteq> carrier G" | |
| 421 | by (rule subgroup.subset) | |
| 422 | ||
| 423 | lemma (in subgroup) subgroup_is_group [intro]: | |
| 27611 | 424 | assumes "group G" | 
| 425 | shows "group (G\<lparr>carrier := H\<rparr>)" | |
| 426 | proof - | |
| 29237 | 427 | interpret group G by fact | 
| 27611 | 428 | show ?thesis | 
| 27698 | 429 | apply (rule monoid.group_l_invI) | 
| 430 | apply (unfold_locales) [1] | |
| 431 | apply (auto intro: m_assoc l_inv mem_carrier) | |
| 432 | done | |
| 27611 | 433 | qed | 
| 13813 | 434 | |
| 435 | text {*
 | |
| 436 |   Since @{term H} is nonempty, it contains some element @{term x}.  Since
 | |
| 437 |   it is closed under inverse, it contains @{text "inv x"}.  Since
 | |
| 438 |   it is closed under product, it contains @{text "x \<otimes> inv x = \<one>"}.
 | |
| 439 | *} | |
| 440 | ||
| 441 | lemma (in group) one_in_subset: | |
| 442 |   "[| H \<subseteq> carrier G; H \<noteq> {}; \<forall>a \<in> H. inv a \<in> H; \<forall>a\<in>H. \<forall>b\<in>H. a \<otimes> b \<in> H |]
 | |
| 443 | ==> \<one> \<in> H" | |
| 444 | by (force simp add: l_inv) | |
| 445 | ||
| 446 | text {* A characterization of subgroups: closed, non-empty subset. *}
 | |
| 447 | ||
| 448 | lemma (in group) subgroupI: | |
| 449 |   assumes subset: "H \<subseteq> carrier G" and non_empty: "H \<noteq> {}"
 | |
| 14963 | 450 | and inv: "!!a. a \<in> H \<Longrightarrow> inv a \<in> H" | 
| 451 | and mult: "!!a b. \<lbrakk>a \<in> H; b \<in> H\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> H" | |
| 13813 | 452 | shows "subgroup H G" | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 453 | proof (simp add: subgroup_def assms) | 
| 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 454 | show "\<one> \<in> H" by (rule one_in_subset) (auto simp only: assms) | 
| 13813 | 455 | qed | 
| 456 | ||
| 13936 | 457 | declare monoid.one_closed [iff] group.inv_closed [simp] | 
| 458 | monoid.l_one [simp] monoid.r_one [simp] group.inv_inv [simp] | |
| 13813 | 459 | |
| 460 | lemma subgroup_nonempty: | |
| 461 |   "~ subgroup {} G"
 | |
| 462 | by (blast dest: subgroup.one_closed) | |
| 463 | ||
| 464 | lemma (in subgroup) finite_imp_card_positive: | |
| 465 | "finite (carrier G) ==> 0 < card H" | |
| 466 | proof (rule classical) | |
| 14963 | 467 | assume "finite (carrier G)" "~ 0 < card H" | 
| 468 | then have "finite H" by (blast intro: finite_subset [OF subset]) | |
| 469 |   with prems have "subgroup {} G" by simp
 | |
| 13813 | 470 | with subgroup_nonempty show ?thesis by contradiction | 
| 471 | qed | |
| 472 | ||
| 13936 | 473 | (* | 
| 474 | lemma (in monoid) Units_subgroup: | |
| 475 | "subgroup (Units G) G" | |
| 476 | *) | |
| 477 | ||
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 478 | |
| 13813 | 479 | subsection {* Direct Products *}
 | 
| 480 | ||
| 14963 | 481 | constdefs | 
| 482 |   DirProd :: "_ \<Rightarrow> _ \<Rightarrow> ('a \<times> 'b) monoid"  (infixr "\<times>\<times>" 80)
 | |
| 483 | "G \<times>\<times> H \<equiv> \<lparr>carrier = carrier G \<times> carrier H, | |
| 484 | mult = (\<lambda>(g, h) (g', h'). (g \<otimes>\<^bsub>G\<^esub> g', h \<otimes>\<^bsub>H\<^esub> h')), | |
| 485 | one = (\<one>\<^bsub>G\<^esub>, \<one>\<^bsub>H\<^esub>)\<rparr>" | |
| 13813 | 486 | |
| 14963 | 487 | lemma DirProd_monoid: | 
| 27611 | 488 | assumes "monoid G" and "monoid H" | 
| 14963 | 489 | shows "monoid (G \<times>\<times> H)" | 
| 490 | proof - | |
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29240diff
changeset | 491 | interpret G: monoid G by fact | 
| 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29240diff
changeset | 492 | interpret H: monoid H by fact | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 493 | from assms | 
| 14963 | 494 | show ?thesis by (unfold monoid_def DirProd_def, auto) | 
| 495 | qed | |
| 13813 | 496 | |
| 497 | ||
| 14963 | 498 | text{*Does not use the previous result because it's easier just to use auto.*}
 | 
| 499 | lemma DirProd_group: | |
| 27611 | 500 | assumes "group G" and "group H" | 
| 14963 | 501 | shows "group (G \<times>\<times> H)" | 
| 27611 | 502 | proof - | 
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29240diff
changeset | 503 | interpret G: group G by fact | 
| 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29240diff
changeset | 504 | interpret H: group H by fact | 
| 27611 | 505 | show ?thesis by (rule groupI) | 
| 14963 | 506 | (auto intro: G.m_assoc H.m_assoc G.l_inv H.l_inv | 
| 507 | simp add: DirProd_def) | |
| 27611 | 508 | qed | 
| 13813 | 509 | |
| 14963 | 510 | lemma carrier_DirProd [simp]: | 
| 511 | "carrier (G \<times>\<times> H) = carrier G \<times> carrier H" | |
| 512 | by (simp add: DirProd_def) | |
| 13944 | 513 | |
| 14963 | 514 | lemma one_DirProd [simp]: | 
| 515 | "\<one>\<^bsub>G \<times>\<times> H\<^esub> = (\<one>\<^bsub>G\<^esub>, \<one>\<^bsub>H\<^esub>)" | |
| 516 | by (simp add: DirProd_def) | |
| 13944 | 517 | |
| 14963 | 518 | lemma mult_DirProd [simp]: | 
| 519 | "(g, h) \<otimes>\<^bsub>(G \<times>\<times> H)\<^esub> (g', h') = (g \<otimes>\<^bsub>G\<^esub> g', h \<otimes>\<^bsub>H\<^esub> h')" | |
| 520 | by (simp add: DirProd_def) | |
| 13944 | 521 | |
| 14963 | 522 | lemma inv_DirProd [simp]: | 
| 27611 | 523 | assumes "group G" and "group H" | 
| 13944 | 524 | assumes g: "g \<in> carrier G" | 
| 525 | and h: "h \<in> carrier H" | |
| 14963 | 526 | shows "m_inv (G \<times>\<times> H) (g, h) = (inv\<^bsub>G\<^esub> g, inv\<^bsub>H\<^esub> h)" | 
| 27611 | 527 | proof - | 
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29240diff
changeset | 528 | interpret G: group G by fact | 
| 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29240diff
changeset | 529 | interpret H: group H by fact | 
| 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29240diff
changeset | 530 | interpret Prod: group "G \<times>\<times> H" | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 531 | by (auto intro: DirProd_group group.intro group.axioms assms) | 
| 14963 | 532 | show ?thesis by (simp add: Prod.inv_equality g h) | 
| 533 | qed | |
| 27698 | 534 | |
| 14963 | 535 | |
| 536 | subsection {* Homomorphisms and Isomorphisms *}
 | |
| 13813 | 537 | |
| 14651 | 538 | constdefs (structure G and H) | 
| 539 |   hom :: "_ => _ => ('a => 'b) set"
 | |
| 13813 | 540 | "hom G H == | 
| 541 |     {h. h \<in> carrier G -> carrier H &
 | |
| 14693 | 542 | (\<forall>x \<in> carrier G. \<forall>y \<in> carrier G. h (x \<otimes>\<^bsub>G\<^esub> y) = h x \<otimes>\<^bsub>H\<^esub> h y)}" | 
| 13813 | 543 | |
| 14761 | 544 | lemma (in group) hom_compose: | 
| 545 | "[|h \<in> hom G H; i \<in> hom H I|] ==> compose (carrier G) i h \<in> hom G I" | |
| 546 | apply (auto simp add: hom_def funcset_compose) | |
| 547 | apply (simp add: compose_def funcset_mem) | |
| 13943 | 548 | done | 
| 549 | ||
| 14803 | 550 | constdefs | 
| 551 |   iso :: "_ => _ => ('a => 'b) set"  (infixr "\<cong>" 60)
 | |
| 552 |   "G \<cong> H == {h. h \<in> hom G H & bij_betw h (carrier G) (carrier H)}"
 | |
| 14761 | 553 | |
| 14803 | 554 | lemma iso_refl: "(%x. x) \<in> G \<cong> G" | 
| 14761 | 555 | by (simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def) | 
| 556 | ||
| 557 | lemma (in group) iso_sym: | |
| 14803 | 558 | "h \<in> G \<cong> H \<Longrightarrow> Inv (carrier G) h \<in> H \<cong> G" | 
| 14761 | 559 | apply (simp add: iso_def bij_betw_Inv) | 
| 560 | apply (subgoal_tac "Inv (carrier G) h \<in> carrier H \<rightarrow> carrier G") | |
| 561 | prefer 2 apply (simp add: bij_betw_imp_funcset [OF bij_betw_Inv]) | |
| 562 | apply (simp add: hom_def bij_betw_def Inv_f_eq funcset_mem f_Inv_f) | |
| 563 | done | |
| 564 | ||
| 565 | lemma (in group) iso_trans: | |
| 14803 | 566 | "[|h \<in> G \<cong> H; i \<in> H \<cong> I|] ==> (compose (carrier G) i h) \<in> G \<cong> I" | 
| 14761 | 567 | by (auto simp add: iso_def hom_compose bij_betw_compose) | 
| 568 | ||
| 14963 | 569 | lemma DirProd_commute_iso: | 
| 570 | shows "(\<lambda>(x,y). (y,x)) \<in> (G \<times>\<times> H) \<cong> (H \<times>\<times> G)" | |
| 14761 | 571 | by (auto simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def) | 
| 572 | ||
| 14963 | 573 | lemma DirProd_assoc_iso: | 
| 574 | shows "(\<lambda>(x,y,z). (x,(y,z))) \<in> (G \<times>\<times> H \<times>\<times> I) \<cong> (G \<times>\<times> (H \<times>\<times> I))" | |
| 14761 | 575 | by (auto simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def) | 
| 576 | ||
| 577 | ||
| 14963 | 578 | text{*Basis for homomorphism proofs: we assume two groups @{term G} and
 | 
| 15076 
4b3d280ef06a
New prover for transitive and reflexive-transitive closure of relations.
 ballarin parents: 
14963diff
changeset | 579 |   @{term H}, with a homomorphism @{term h} between them*}
 | 
| 29237 | 580 | locale group_hom = G: group G + H: group H for G (structure) and H (structure) + | 
| 581 | fixes h | |
| 13813 | 582 | assumes homh: "h \<in> hom G H" | 
| 29240 | 583 | |
| 584 | lemma (in group_hom) hom_mult [simp]: | |
| 585 | "[| x \<in> carrier G; y \<in> carrier G |] ==> h (x \<otimes>\<^bsub>G\<^esub> y) = h x \<otimes>\<^bsub>H\<^esub> h y" | |
| 586 | proof - | |
| 587 | assume "x \<in> carrier G" "y \<in> carrier G" | |
| 588 | with homh [unfolded hom_def] show ?thesis by simp | |
| 589 | qed | |
| 590 | ||
| 591 | lemma (in group_hom) hom_closed [simp]: | |
| 592 | "x \<in> carrier G ==> h x \<in> carrier H" | |
| 593 | proof - | |
| 594 | assume "x \<in> carrier G" | |
| 595 | with homh [unfolded hom_def] show ?thesis by (auto simp add: funcset_mem) | |
| 596 | qed | |
| 13813 | 597 | |
| 598 | lemma (in group_hom) one_closed [simp]: | |
| 599 | "h \<one> \<in> carrier H" | |
| 600 | by simp | |
| 601 | ||
| 602 | lemma (in group_hom) hom_one [simp]: | |
| 14693 | 603 | "h \<one> = \<one>\<^bsub>H\<^esub>" | 
| 13813 | 604 | proof - | 
| 15076 
4b3d280ef06a
New prover for transitive and reflexive-transitive closure of relations.
 ballarin parents: 
14963diff
changeset | 605 | have "h \<one> \<otimes>\<^bsub>H\<^esub> \<one>\<^bsub>H\<^esub> = h \<one> \<otimes>\<^bsub>H\<^esub> h \<one>" | 
| 13813 | 606 | by (simp add: hom_mult [symmetric] del: hom_mult) | 
| 607 | then show ?thesis by (simp del: r_one) | |
| 608 | qed | |
| 609 | ||
| 610 | lemma (in group_hom) inv_closed [simp]: | |
| 611 | "x \<in> carrier G ==> h (inv x) \<in> carrier H" | |
| 612 | by simp | |
| 613 | ||
| 614 | lemma (in group_hom) hom_inv [simp]: | |
| 14693 | 615 | "x \<in> carrier G ==> h (inv x) = inv\<^bsub>H\<^esub> (h x)" | 
| 13813 | 616 | proof - | 
| 617 | assume x: "x \<in> carrier G" | |
| 14693 | 618 | then have "h x \<otimes>\<^bsub>H\<^esub> h (inv x) = \<one>\<^bsub>H\<^esub>" | 
| 14963 | 619 | by (simp add: hom_mult [symmetric] del: hom_mult) | 
| 14693 | 620 | also from x have "... = h x \<otimes>\<^bsub>H\<^esub> inv\<^bsub>H\<^esub> (h x)" | 
| 14963 | 621 | by (simp add: hom_mult [symmetric] del: hom_mult) | 
| 14693 | 622 | finally have "h x \<otimes>\<^bsub>H\<^esub> h (inv x) = h x \<otimes>\<^bsub>H\<^esub> inv\<^bsub>H\<^esub> (h x)" . | 
| 27698 | 623 | with x show ?thesis by (simp del: H.r_inv H.Units_r_inv) | 
| 13813 | 624 | qed | 
| 625 | ||
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 626 | |
| 13949 
0ce528cd6f19
HOL-Algebra complete for release Isabelle2003 (modulo section headers).
 ballarin parents: 
13944diff
changeset | 627 | subsection {* Commutative Structures *}
 | 
| 13936 | 628 | |
| 629 | text {*
 | |
| 630 | Naming convention: multiplicative structures that are commutative | |
| 631 |   are called \emph{commutative}, additive structures are called
 | |
| 632 |   \emph{Abelian}.
 | |
| 633 | *} | |
| 13813 | 634 | |
| 14963 | 635 | locale comm_monoid = monoid + | 
| 636 | assumes m_comm: "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<otimes> y = y \<otimes> x" | |
| 13813 | 637 | |
| 14963 | 638 | lemma (in comm_monoid) m_lcomm: | 
| 639 | "\<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> \<Longrightarrow> | |
| 13813 | 640 | x \<otimes> (y \<otimes> z) = y \<otimes> (x \<otimes> z)" | 
| 641 | proof - | |
| 14693 | 642 | assume xyz: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G" | 
| 13813 | 643 | from xyz have "x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z" by (simp add: m_assoc) | 
| 644 | also from xyz have "... = (y \<otimes> x) \<otimes> z" by (simp add: m_comm) | |
| 645 | also from xyz have "... = y \<otimes> (x \<otimes> z)" by (simp add: m_assoc) | |
| 646 | finally show ?thesis . | |
| 647 | qed | |
| 648 | ||
| 14963 | 649 | lemmas (in comm_monoid) m_ac = m_assoc m_comm m_lcomm | 
| 13813 | 650 | |
| 13936 | 651 | lemma comm_monoidI: | 
| 19783 | 652 | fixes G (structure) | 
| 13936 | 653 | assumes m_closed: | 
| 14693 | 654 | "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G" | 
| 655 | and one_closed: "\<one> \<in> carrier G" | |
| 13936 | 656 | and m_assoc: | 
| 657 | "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 14693 | 658 | (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)" | 
| 659 | and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x" | |
| 13936 | 660 | and m_comm: | 
| 14693 | 661 | "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x" | 
| 13936 | 662 | shows "comm_monoid G" | 
| 663 | using l_one | |
| 14963 | 664 | by (auto intro!: comm_monoid.intro comm_monoid_axioms.intro monoid.intro | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 665 | intro: assms simp: m_closed one_closed m_comm) | 
| 13817 | 666 | |
| 13936 | 667 | lemma (in monoid) monoid_comm_monoidI: | 
| 668 | assumes m_comm: | |
| 14693 | 669 | "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x" | 
| 13936 | 670 | shows "comm_monoid G" | 
| 671 | by (rule comm_monoidI) (auto intro: m_assoc m_comm) | |
| 14963 | 672 | |
| 14693 | 673 | (*lemma (in comm_monoid) r_one [simp]: | 
| 13817 | 674 | "x \<in> carrier G ==> x \<otimes> \<one> = x" | 
| 675 | proof - | |
| 676 | assume G: "x \<in> carrier G" | |
| 677 | then have "x \<otimes> \<one> = \<one> \<otimes> x" by (simp add: m_comm) | |
| 678 | also from G have "... = x" by simp | |
| 679 | finally show ?thesis . | |
| 14693 | 680 | qed*) | 
| 14963 | 681 | |
| 13936 | 682 | lemma (in comm_monoid) nat_pow_distr: | 
| 683 | "[| x \<in> carrier G; y \<in> carrier G |] ==> | |
| 684 | (x \<otimes> y) (^) (n::nat) = x (^) n \<otimes> y (^) n" | |
| 685 | by (induct n) (simp, simp add: m_ac) | |
| 686 | ||
| 687 | locale comm_group = comm_monoid + group | |
| 688 | ||
| 689 | lemma (in group) group_comm_groupI: | |
| 690 | assumes m_comm: "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> | |
| 14693 | 691 | x \<otimes> y = y \<otimes> x" | 
| 13936 | 692 | shows "comm_group G" | 
| 28823 | 693 | proof qed (simp_all add: m_comm) | 
| 13817 | 694 | |
| 13936 | 695 | lemma comm_groupI: | 
| 19783 | 696 | fixes G (structure) | 
| 13936 | 697 | assumes m_closed: | 
| 14693 | 698 | "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G" | 
| 699 | and one_closed: "\<one> \<in> carrier G" | |
| 13936 | 700 | and m_assoc: | 
| 701 | "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> | |
| 14693 | 702 | (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)" | 
| 13936 | 703 | and m_comm: | 
| 14693 | 704 | "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x" | 
| 705 | and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x" | |
| 14963 | 706 | and l_inv_ex: "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>" | 
| 13936 | 707 | shows "comm_group G" | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 708 | by (fast intro: group.group_comm_groupI groupI assms) | 
| 13936 | 709 | |
| 710 | lemma (in comm_group) inv_mult: | |
| 13854 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 711 | "[| x \<in> carrier G; y \<in> carrier G |] ==> inv (x \<otimes> y) = inv x \<otimes> inv y" | 
| 13936 | 712 | by (simp add: m_ac inv_mult_group) | 
| 13854 
91c9ab25fece
First distributed version of Group and Ring theory.
 ballarin parents: 
13835diff
changeset | 713 | |
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 714 | |
| 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 715 | subsection {* The Lattice of Subgroups of a Group *}
 | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 716 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 717 | text_raw {* \label{sec:subgroup-lattice} *}
 | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 718 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 719 | theorem (in group) subgroups_partial_order: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27698diff
changeset | 720 |   "partial_order (| carrier = {H. subgroup H G}, eq = op =, le = op \<subseteq> |)"
 | 
| 28823 | 721 | proof qed simp_all | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 722 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 723 | lemma (in group) subgroup_self: | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 724 | "subgroup (carrier G) G" | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 725 | by (rule subgroupI) auto | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 726 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 727 | lemma (in group) subgroup_imp_group: | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 728 | "subgroup H G ==> group (G(| carrier := H |))" | 
| 26199 | 729 | by (erule subgroup.subgroup_is_group) (rule group_axioms) | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 730 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 731 | lemma (in group) is_monoid [intro, simp]: | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 732 | "monoid G" | 
| 14963 | 733 | by (auto intro: monoid.intro m_assoc) | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 734 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 735 | lemma (in group) subgroup_inv_equality: | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 736 | "[| subgroup H G; x \<in> H |] ==> m_inv (G (| carrier := H |)) x = inv x" | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 737 | apply (rule_tac inv_equality [THEN sym]) | 
| 14761 | 738 | apply (rule group.l_inv [OF subgroup_imp_group, simplified], assumption+) | 
| 739 | apply (rule subsetD [OF subgroup.subset], assumption+) | |
| 740 | apply (rule subsetD [OF subgroup.subset], assumption) | |
| 741 | apply (rule_tac group.inv_closed [OF subgroup_imp_group, simplified], assumption+) | |
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 742 | done | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 743 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 744 | theorem (in group) subgroups_Inter: | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 745 | assumes subgr: "(!!H. H \<in> A ==> subgroup H G)" | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 746 |     and not_empty: "A ~= {}"
 | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 747 | shows "subgroup (\<Inter>A) G" | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 748 | proof (rule subgroupI) | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 749 | from subgr [THEN subgroup.subset] and not_empty | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 750 | show "\<Inter>A \<subseteq> carrier G" by blast | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 751 | next | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 752 | from subgr [THEN subgroup.one_closed] | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 753 |   show "\<Inter>A ~= {}" by blast
 | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 754 | next | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 755 | fix x assume "x \<in> \<Inter>A" | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 756 | with subgr [THEN subgroup.m_inv_closed] | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 757 | show "inv x \<in> \<Inter>A" by blast | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 758 | next | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 759 | fix x y assume "x \<in> \<Inter>A" "y \<in> \<Inter>A" | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 760 | with subgr [THEN subgroup.m_closed] | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 761 | show "x \<otimes> y \<in> \<Inter>A" by blast | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 762 | qed | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 763 | |
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 764 | theorem (in group) subgroups_complete_lattice: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27698diff
changeset | 765 |   "complete_lattice (| carrier = {H. subgroup H G}, eq = op =, le = op \<subseteq> |)"
 | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21041diff
changeset | 766 | (is "complete_lattice ?L") | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 767 | proof (rule partial_order.complete_lattice_criterion1) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21041diff
changeset | 768 | show "partial_order ?L" by (rule subgroups_partial_order) | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 769 | next | 
| 26805 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 770 | show "\<exists>G. greatest ?L G (carrier ?L)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 771 | proof | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 772 | show "greatest ?L (carrier G) (carrier ?L)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 773 | by (unfold greatest_def) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 774 | (simp add: subgroup.subset subgroup_self) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 775 | qed | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 776 | next | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 777 | fix A | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21041diff
changeset | 778 |   assume L: "A \<subseteq> carrier ?L" and non_empty: "A ~= {}"
 | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 779 | then have Int_subgroup: "subgroup (\<Inter>A) G" | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 780 | by (fastsimp intro: subgroups_Inter) | 
| 26805 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 781 | show "\<exists>I. greatest ?L I (Lower ?L A)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 782 | proof | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 783 | show "greatest ?L (\<Inter>A) (Lower ?L A)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 784 | (is "greatest _ ?Int _") | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 785 | proof (rule greatest_LowerI) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 786 | fix H | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 787 | assume H: "H \<in> A" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 788 | with L have subgroupH: "subgroup H G" by auto | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 789 | from subgroupH have groupH: "group (G (| carrier := H |))" (is "group ?H") | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 790 | by (rule subgroup_imp_group) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 791 | from groupH have monoidH: "monoid ?H" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 792 | by (rule group.is_monoid) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 793 | from H have Int_subset: "?Int \<subseteq> H" by fastsimp | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 794 | then show "le ?L ?Int H" by simp | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 795 | next | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 796 | fix H | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 797 | assume H: "H \<in> Lower ?L A" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 798 | with L Int_subgroup show "le ?L H ?Int" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 799 | by (fastsimp simp: Lower_def intro: Inter_greatest) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 800 | next | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 801 | show "A \<subseteq> carrier ?L" by (rule L) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 802 | next | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 803 | show "?Int \<in> carrier ?L" by simp (rule Int_subgroup) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
26199diff
changeset | 804 | qed | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 805 | qed | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 806 | qed | 
| 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 807 | |
| 13813 | 808 | end |