3 *) |
3 *) |
4 |
4 |
5 section \<open>More on groups\<close> |
5 section \<open>More on groups\<close> |
6 |
6 |
7 theory More_Group |
7 theory More_Group |
8 imports |
8 imports Ring |
9 Ring |
|
10 begin |
9 begin |
11 |
10 |
12 text \<open> |
11 text \<open> |
13 Show that the units in any monoid give rise to a group. |
12 Show that the units in any monoid give rise to a group. |
14 |
13 |
15 The file Residues.thy provides some infrastructure to use |
14 The file Residues.thy provides some infrastructure to use |
16 facts about the unit group within the ring locale. |
15 facts about the unit group within the ring locale. |
17 \<close> |
16 \<close> |
18 |
17 |
19 definition units_of :: "('a, 'b) monoid_scheme => 'a monoid" where |
18 definition units_of :: "('a, 'b) monoid_scheme \<Rightarrow> 'a monoid" |
20 "units_of G == (| carrier = Units G, |
19 where "units_of G = |
21 Group.monoid.mult = Group.monoid.mult G, |
20 \<lparr>carrier = Units G, Group.monoid.mult = Group.monoid.mult G, one = one G\<rparr>" |
22 one = one G |)" |
|
23 |
21 |
24 lemma (in monoid) units_group: "group(units_of G)" |
22 lemma (in monoid) units_group: "group (units_of G)" |
25 apply (unfold units_of_def) |
23 apply (unfold units_of_def) |
26 apply (rule groupI) |
24 apply (rule groupI) |
27 apply auto |
25 apply auto |
28 apply (subst m_assoc) |
26 apply (subst m_assoc) |
29 apply auto |
27 apply auto |
30 apply (rule_tac x = "inv x" in bexI) |
28 apply (rule_tac x = "inv x" in bexI) |
31 apply auto |
29 apply auto |
32 done |
30 done |
33 |
31 |
34 lemma (in comm_monoid) units_comm_group: "comm_group(units_of G)" |
32 lemma (in comm_monoid) units_comm_group: "comm_group (units_of G)" |
35 apply (rule group.group_comm_groupI) |
33 apply (rule group.group_comm_groupI) |
36 apply (rule units_group) |
34 apply (rule units_group) |
37 apply (insert comm_monoid_axioms) |
35 apply (insert comm_monoid_axioms) |
38 apply (unfold units_of_def Units_def comm_monoid_def comm_monoid_axioms_def) |
36 apply (unfold units_of_def Units_def comm_monoid_def comm_monoid_axioms_def) |
39 apply auto |
37 apply auto |
40 done |
38 done |
41 |
39 |
42 lemma units_of_carrier: "carrier (units_of G) = Units G" |
40 lemma units_of_carrier: "carrier (units_of G) = Units G" |
43 unfolding units_of_def by auto |
41 by (auto simp: units_of_def) |
44 |
42 |
45 lemma units_of_mult: "mult(units_of G) = mult G" |
43 lemma units_of_mult: "mult (units_of G) = mult G" |
46 unfolding units_of_def by auto |
44 by (auto simp: units_of_def) |
47 |
45 |
48 lemma units_of_one: "one(units_of G) = one G" |
46 lemma units_of_one: "one (units_of G) = one G" |
49 unfolding units_of_def by auto |
47 by (auto simp: units_of_def) |
50 |
48 |
51 lemma (in monoid) units_of_inv: "x : Units G ==> m_inv (units_of G) x = m_inv G x" |
49 lemma (in monoid) units_of_inv: "x \<in> Units G \<Longrightarrow> m_inv (units_of G) x = m_inv G x" |
52 apply (rule sym) |
50 apply (rule sym) |
53 apply (subst m_inv_def) |
51 apply (subst m_inv_def) |
54 apply (rule the1_equality) |
52 apply (rule the1_equality) |
55 apply (rule ex_ex1I) |
53 apply (rule ex_ex1I) |
56 apply (subst (asm) Units_def) |
54 apply (subst (asm) Units_def) |
57 apply auto |
55 apply auto |
58 apply (erule inv_unique) |
56 apply (erule inv_unique) |
59 apply auto |
57 apply auto |
60 apply (rule Units_closed) |
58 apply (rule Units_closed) |
61 apply (simp_all only: units_of_carrier [symmetric]) |
59 apply (simp_all only: units_of_carrier [symmetric]) |
62 apply (insert units_group) |
60 apply (insert units_group) |
63 apply auto |
61 apply auto |
64 apply (subst units_of_mult [symmetric]) |
62 apply (subst units_of_mult [symmetric]) |
65 apply (subst units_of_one [symmetric]) |
63 apply (subst units_of_one [symmetric]) |
66 apply (erule group.r_inv, assumption) |
64 apply (erule group.r_inv, assumption) |
67 apply (subst units_of_mult [symmetric]) |
65 apply (subst units_of_mult [symmetric]) |
68 apply (subst units_of_one [symmetric]) |
66 apply (subst units_of_one [symmetric]) |
69 apply (erule group.l_inv, assumption) |
67 apply (erule group.l_inv, assumption) |
70 done |
68 done |
71 |
69 |
72 lemma (in group) inj_on_const_mult: "a: (carrier G) ==> inj_on (%x. a \<otimes> x) (carrier G)" |
70 lemma (in group) inj_on_const_mult: "a \<in> carrier G \<Longrightarrow> inj_on (\<lambda>x. a \<otimes> x) (carrier G)" |
73 unfolding inj_on_def by auto |
71 unfolding inj_on_def by auto |
74 |
72 |
75 lemma (in group) surj_const_mult: "a : (carrier G) ==> (%x. a \<otimes> x) ` (carrier G) = (carrier G)" |
73 lemma (in group) surj_const_mult: "a \<in> carrier G \<Longrightarrow> (\<lambda>x. a \<otimes> x) ` carrier G = carrier G" |
76 apply (auto simp add: image_def) |
74 apply (auto simp add: image_def) |
77 apply (rule_tac x = "(m_inv G a) \<otimes> x" in bexI) |
75 apply (rule_tac x = "(m_inv G a) \<otimes> x" in bexI) |
78 apply auto |
76 apply auto |
79 (* auto should get this. I suppose we need "comm_monoid_simprules" |
77 (* auto should get this. I suppose we need "comm_monoid_simprules" |
80 for ac_simps rewriting. *) |
78 for ac_simps rewriting. *) |
81 apply (subst m_assoc [symmetric]) |
79 apply (subst m_assoc [symmetric]) |
82 apply auto |
80 apply auto |
83 done |
81 done |
84 |
82 |
85 lemma (in group) l_cancel_one [simp]: |
83 lemma (in group) l_cancel_one [simp]: "x \<in> carrier G \<Longrightarrow> a \<in> carrier G \<Longrightarrow> x \<otimes> a = x \<longleftrightarrow> a = one G" |
86 "x : carrier G \<Longrightarrow> a : carrier G \<Longrightarrow> (x \<otimes> a = x) = (a = one G)" |
|
87 apply auto |
84 apply auto |
88 apply (subst l_cancel [symmetric]) |
85 apply (subst l_cancel [symmetric]) |
89 prefer 4 |
86 prefer 4 |
90 apply (erule ssubst) |
87 apply (erule ssubst) |
91 apply auto |
88 apply auto |
92 done |
89 done |
93 |
90 |
94 lemma (in group) r_cancel_one [simp]: "x : carrier G \<Longrightarrow> a : carrier G \<Longrightarrow> |
91 lemma (in group) r_cancel_one [simp]: "x \<in> carrier G \<Longrightarrow> a \<in> carrier G \<Longrightarrow> a \<otimes> x = x \<longleftrightarrow> a = one G" |
95 (a \<otimes> x = x) = (a = one G)" |
|
96 apply auto |
92 apply auto |
97 apply (subst r_cancel [symmetric]) |
93 apply (subst r_cancel [symmetric]) |
98 prefer 4 |
94 prefer 4 |
99 apply (erule ssubst) |
95 apply (erule ssubst) |
100 apply auto |
96 apply auto |
101 done |
97 done |
102 |
98 |
103 (* Is there a better way to do this? *) |
99 (* Is there a better way to do this? *) |
104 lemma (in group) l_cancel_one' [simp]: "x : carrier G \<Longrightarrow> a : carrier G \<Longrightarrow> |
100 lemma (in group) l_cancel_one' [simp]: "x \<in> carrier G \<Longrightarrow> a \<in> carrier G \<Longrightarrow> x = x \<otimes> a \<longleftrightarrow> a = one G" |
105 (x = x \<otimes> a) = (a = one G)" |
|
106 apply (subst eq_commute) |
101 apply (subst eq_commute) |
107 apply simp |
102 apply simp |
108 done |
103 done |
109 |
104 |
110 lemma (in group) r_cancel_one' [simp]: "x : carrier G \<Longrightarrow> a : carrier G \<Longrightarrow> |
105 lemma (in group) r_cancel_one' [simp]: "x \<in> carrier G \<Longrightarrow> a \<in> carrier G \<Longrightarrow> x = a \<otimes> x \<longleftrightarrow> a = one G" |
111 (x = a \<otimes> x) = (a = one G)" |
|
112 apply (subst eq_commute) |
106 apply (subst eq_commute) |
113 apply simp |
107 apply simp |
114 done |
108 done |
115 |
109 |
116 (* This should be generalized to arbitrary groups, not just commutative |
110 (* This should be generalized to arbitrary groups, not just commutative |
117 ones, using Lagrange's theorem. *) |
111 ones, using Lagrange's theorem. *) |
118 |
112 |
119 lemma (in comm_group) power_order_eq_one: |
113 lemma (in comm_group) power_order_eq_one: |
120 assumes fin [simp]: "finite (carrier G)" |
114 assumes fin [simp]: "finite (carrier G)" |
121 and a [simp]: "a : carrier G" |
115 and a [simp]: "a \<in> carrier G" |
122 shows "a (^) card(carrier G) = one G" |
116 shows "a (^) card(carrier G) = one G" |
123 proof - |
117 proof - |
124 have "(\<Otimes>x\<in>carrier G. x) = (\<Otimes>x\<in>carrier G. a \<otimes> x)" |
118 have "(\<Otimes>x\<in>carrier G. x) = (\<Otimes>x\<in>carrier G. a \<otimes> x)" |
125 by (subst (2) finprod_reindex [symmetric], |
119 by (subst (2) finprod_reindex [symmetric], |
126 auto simp add: Pi_def inj_on_const_mult surj_const_mult) |
120 auto simp add: Pi_def inj_on_const_mult surj_const_mult) |