author | wenzelm |
Fri, 03 May 2019 19:27:41 +0200 | |
changeset 70243 | b134cf366c2c |
parent 70133 | 4f19b92ab6d7 |
child 71392 | a3f7f00b4fd8 |
permissions | -rw-r--r-- |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
1 |
(* Title: HOL/Algebra/Multiplicative_Group.thy |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
2 |
Author: Simon Wimmer |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
3 |
Author: Lars Noschinski |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
4 |
*) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
5 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
6 |
theory Multiplicative_Group |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
7 |
imports |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
8 |
Complex_Main |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
9 |
Group |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
10 |
Coset |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
11 |
UnivPoly |
68575 | 12 |
Generated_Groups |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
13 |
begin |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
14 |
|
67226 | 15 |
section \<open>Simplification Rules for Polynomials\<close> |
16 |
text_raw \<open>\label{sec:simp-rules}\<close> |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
17 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
18 |
lemma (in ring_hom_cring) hom_sub[simp]: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
19 |
assumes "x \<in> carrier R" "y \<in> carrier R" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
20 |
shows "h (x \<ominus> y) = h x \<ominus>\<^bsub>S\<^esub> h y" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
21 |
using assms by (simp add: R.minus_eq S.minus_eq) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
22 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
23 |
context UP_ring begin |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
24 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
25 |
lemma deg_nzero_nzero: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
26 |
assumes deg_p_nzero: "deg R p \<noteq> 0" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
27 |
shows "p \<noteq> \<zero>\<^bsub>P\<^esub>" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
28 |
using deg_zero deg_p_nzero by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
29 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
30 |
lemma deg_add_eq: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
31 |
assumes c: "p \<in> carrier P" "q \<in> carrier P" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
32 |
assumes "deg R q \<noteq> deg R p" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
33 |
shows "deg R (p \<oplus>\<^bsub>P\<^esub> q) = max (deg R p) (deg R q)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
34 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
35 |
let ?m = "max (deg R p) (deg R q)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
36 |
from assms have "coeff P p ?m = \<zero> \<longleftrightarrow> coeff P q ?m \<noteq> \<zero>" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
37 |
by (metis deg_belowI lcoeff_nonzero[OF deg_nzero_nzero] linear max.absorb_iff2 max.absorb1) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
38 |
then have "coeff P (p \<oplus>\<^bsub>P\<^esub> q) ?m \<noteq> \<zero>" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
39 |
using assms by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
40 |
then have "deg R (p \<oplus>\<^bsub>P\<^esub> q) \<ge> ?m" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
41 |
using assms by (blast intro: deg_belowI) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
42 |
with deg_add[OF c] show ?thesis by arith |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
43 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
44 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
45 |
lemma deg_minus_eq: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
46 |
assumes "p \<in> carrier P" "q \<in> carrier P" "deg R q \<noteq> deg R p" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
47 |
shows "deg R (p \<ominus>\<^bsub>P\<^esub> q) = max (deg R p) (deg R q)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
48 |
using assms by (simp add: deg_add_eq a_minus_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
49 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
50 |
end |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
51 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
52 |
context UP_cring begin |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
53 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
54 |
lemma evalRR_add: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
55 |
assumes "p \<in> carrier P" "q \<in> carrier P" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
56 |
assumes x: "x \<in> carrier R" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
57 |
shows "eval R R id x (p \<oplus>\<^bsub>P\<^esub> q) = eval R R id x p \<oplus> eval R R id x q" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
58 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
59 |
interpret UP_pre_univ_prop R R id by unfold_locales simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
60 |
interpret ring_hom_cring P R "eval R R id x" by unfold_locales (rule eval_ring_hom[OF x]) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
61 |
show ?thesis using assms by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
62 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
63 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
64 |
lemma evalRR_sub: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
65 |
assumes "p \<in> carrier P" "q \<in> carrier P" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
66 |
assumes x: "x \<in> carrier R" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
67 |
shows "eval R R id x (p \<ominus>\<^bsub>P\<^esub> q) = eval R R id x p \<ominus> eval R R id x q" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
68 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
69 |
interpret UP_pre_univ_prop R R id by unfold_locales simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
70 |
interpret ring_hom_cring P R "eval R R id x" by unfold_locales (rule eval_ring_hom[OF x]) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
71 |
show ?thesis using assms by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
72 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
73 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
74 |
lemma evalRR_mult: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
75 |
assumes "p \<in> carrier P" "q \<in> carrier P" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
76 |
assumes x: "x \<in> carrier R" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
77 |
shows "eval R R id x (p \<otimes>\<^bsub>P\<^esub> q) = eval R R id x p \<otimes> eval R R id x q" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
78 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
79 |
interpret UP_pre_univ_prop R R id by unfold_locales simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
80 |
interpret ring_hom_cring P R "eval R R id x" by unfold_locales (rule eval_ring_hom[OF x]) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
81 |
show ?thesis using assms by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
82 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
83 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
84 |
lemma evalRR_monom: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
85 |
assumes a: "a \<in> carrier R" and x: "x \<in> carrier R" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
86 |
shows "eval R R id x (monom P a d) = a \<otimes> x [^] d" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
87 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
88 |
interpret UP_pre_univ_prop R R id by unfold_locales simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
89 |
show ?thesis using assms by (simp add: eval_monom) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
90 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
91 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
92 |
lemma evalRR_one: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
93 |
assumes x: "x \<in> carrier R" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
94 |
shows "eval R R id x \<one>\<^bsub>P\<^esub> = \<one>" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
95 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
96 |
interpret UP_pre_univ_prop R R id by unfold_locales simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
97 |
interpret ring_hom_cring P R "eval R R id x" by unfold_locales (rule eval_ring_hom[OF x]) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
98 |
show ?thesis using assms by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
99 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
100 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
101 |
lemma carrier_evalRR: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
102 |
assumes x: "x \<in> carrier R" and "p \<in> carrier P" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
103 |
shows "eval R R id x p \<in> carrier R" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
104 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
105 |
interpret UP_pre_univ_prop R R id by unfold_locales simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
106 |
interpret ring_hom_cring P R "eval R R id x" by unfold_locales (rule eval_ring_hom[OF x]) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
107 |
show ?thesis using assms by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
108 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
109 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
110 |
lemmas evalRR_simps = evalRR_add evalRR_sub evalRR_mult evalRR_monom evalRR_one carrier_evalRR |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
111 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
112 |
end |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
113 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
114 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
115 |
|
67226 | 116 |
section \<open>Properties of the Euler \<open>\<phi>\<close>-function\<close> |
117 |
text_raw \<open>\label{sec:euler-phi}\<close> |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
118 |
|
67226 | 119 |
text\<open> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
120 |
In this section we prove that for every positive natural number the equation |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
121 |
$\sum_{d | n}^n \varphi(d) = n$ holds. |
67226 | 122 |
\<close> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
123 |
|
68575 | 124 |
lemma dvd_div_ge_1: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
125 |
fixes a b :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
126 |
assumes "a \<ge> 1" "b dvd a" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
127 |
shows "a div b \<ge> 1" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
128 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
129 |
from \<open>b dvd a\<close> obtain c where "a = b * c" .. |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
130 |
with \<open>a \<ge> 1\<close> show ?thesis by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
131 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
132 |
|
68575 | 133 |
lemma dvd_nat_bounds: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
134 |
fixes n p :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
135 |
assumes "p > 0" "n dvd p" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
136 |
shows "n > 0 \<and> n \<le> p" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
137 |
using assms by (simp add: dvd_pos_nat dvd_imp_le) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
138 |
|
69785
9e326f6f8a24
More material for HOL-Number_Theory: ord, Carmichael's function, primitive roots
Manuel Eberl <eberlm@in.tum.de>
parents:
69749
diff
changeset
|
139 |
(* TODO FIXME: This is the "totient" function from HOL-Number_Theory, but since part of |
9e326f6f8a24
More material for HOL-Number_Theory: ord, Carmichael's function, primitive roots
Manuel Eberl <eberlm@in.tum.de>
parents:
69749
diff
changeset
|
140 |
HOL-Number_Theory depends on HOL-Algebra.Multiplicative_Group, there would be a cyclic |
9e326f6f8a24
More material for HOL-Number_Theory: ord, Carmichael's function, primitive roots
Manuel Eberl <eberlm@in.tum.de>
parents:
69749
diff
changeset
|
141 |
dependency. *) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
142 |
definition phi' :: "nat => nat" |
67051 | 143 |
where "phi' m = card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
144 |
|
66500 | 145 |
notation (latex output) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
146 |
phi' ("\<phi> _") |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
147 |
|
68575 | 148 |
lemma phi'_nonzero: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
149 |
assumes "m > 0" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
150 |
shows "phi' m > 0" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
151 |
proof - |
67051 | 152 |
have "1 \<in> {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}" using assms by simp |
153 |
hence "card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m} > 0" by (auto simp: card_gt_0_iff) |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
154 |
thus ?thesis unfolding phi'_def by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
155 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
156 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
157 |
lemma dvd_div_eq_1: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
158 |
fixes a b c :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
159 |
assumes "c dvd a" "c dvd b" "a div c = b div c" |
67226 | 160 |
shows "a = b" using assms dvd_mult_div_cancel[OF \<open>c dvd a\<close>] dvd_mult_div_cancel[OF \<open>c dvd b\<close>] |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
161 |
by presburger |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
162 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
163 |
lemma dvd_div_eq_2: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
164 |
fixes a b c :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
165 |
assumes "c>0" "a dvd c" "b dvd c" "c div a = c div b" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
166 |
shows "a = b" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
167 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
168 |
have "a > 0" "a \<le> c" using dvd_nat_bounds[OF assms(1-2)] by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
169 |
have "a*(c div a) = c" using assms dvd_mult_div_cancel by fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
170 |
also have "\<dots> = b*(c div a)" using assms dvd_mult_div_cancel by fastforce |
67226 | 171 |
finally show "a = b" using \<open>c>0\<close> dvd_div_ge_1[OF _ \<open>a dvd c\<close>] by fastforce |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
172 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
173 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
174 |
lemma div_mult_mono: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
175 |
fixes a b c :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
176 |
assumes "a > 0" "a\<le>d" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
177 |
shows "a * b div d \<le> b" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
178 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
179 |
have "a*b div d \<le> b*a div a" using assms div_le_mono2 mult.commute[of a b] by presburger |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
180 |
thus ?thesis using assms by force |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
181 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
182 |
|
67226 | 183 |
text\<open> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
184 |
We arrive at the main result of this section: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
185 |
For every positive natural number the equation $\sum_{d | n}^n \varphi(d) = n$ holds. |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
186 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
187 |
The outline of the proof for this lemma is as follows: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
188 |
We count the $n$ fractions $1/n$, $\ldots$, $(n-1)/n$, $n/n$. |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
189 |
We analyze the reduced form $a/d = m/n$ for any of those fractions. |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
190 |
We want to know how many fractions $m/n$ have the reduced form denominator $d$. |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
191 |
The condition $1 \leq m \leq n$ is equivalent to the condition $1 \leq a \leq d$. |
69597 | 192 |
Therefore we want to know how many $a$ with $1 \leq a \leq d$ exist, s.t. \<^term>\<open>gcd a d = 1\<close>. |
193 |
This number is exactly \<^term>\<open>phi' d\<close>. |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
194 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
195 |
Finally, by counting the fractions $m/n$ according to their reduced form denominator, |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
196 |
we get: @{term [display] "(\<Sum>d | d dvd n . phi' d) = n"}. |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
197 |
To formalize this proof in Isabelle, we analyze for an arbitrary divisor $d$ of $n$ |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
198 |
\begin{itemize} |
69597 | 199 |
\item the set of reduced form numerators \<^term>\<open>{a. (1::nat) \<le> a \<and> a \<le> d \<and> coprime a d}\<close> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
200 |
\item the set of numerators $m$, for which $m/n$ has the reduced form denominator $d$, |
69597 | 201 |
i.e. the set \<^term>\<open>{m \<in> {1::nat .. n}. n div gcd m n = d}\<close> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
202 |
\end{itemize} |
69597 | 203 |
We show that \<^term>\<open>\<lambda>a. a*n div d\<close> with the inverse \<^term>\<open>\<lambda>a. a div gcd a n\<close> is |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
204 |
a bijection between theses sets, thus yielding the equality |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
205 |
@{term [display] "phi' d = card {m \<in> {1 .. n}. n div gcd m n = d}"} |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
206 |
This gives us |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
207 |
@{term [display] "(\<Sum>d | d dvd n . phi' d) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
208 |
= card (\<Union>d \<in> {d. d dvd n}. {m \<in> {1 .. n}. n div gcd m n = d})"} |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
209 |
and by showing |
69597 | 210 |
\<^term>\<open>(\<Union>d \<in> {d. d dvd n}. {m \<in> {1::nat .. n}. n div gcd m n = d}) \<supseteq> {1 .. n}\<close> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
211 |
(this is our counting argument) the thesis follows. |
67226 | 212 |
\<close> |
68575 | 213 |
lemma sum_phi'_factors: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
214 |
fixes n :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
215 |
assumes "n > 0" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
216 |
shows "(\<Sum>d | d dvd n. phi' d) = n" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
217 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
218 |
{ fix d assume "d dvd n" then obtain q where q: "n = d * q" .. |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
219 |
have "card {a. 1 \<le> a \<and> a \<le> d \<and> coprime a d} = card {m \<in> {1 .. n}. n div gcd m n = d}" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
220 |
(is "card ?RF = card ?F") |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
221 |
proof (rule card_bij_eq) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
222 |
{ fix a b assume "a * n div d = b * n div d" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
223 |
hence "a * (n div d) = b * (n div d)" |
67226 | 224 |
using dvd_div_mult[OF \<open>d dvd n\<close>] by (fastforce simp add: mult.commute) |
225 |
hence "a = b" using dvd_div_ge_1[OF _ \<open>d dvd n\<close>] \<open>n>0\<close> |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
226 |
by (simp add: mult.commute nat_mult_eq_cancel1) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
227 |
} thus "inj_on (\<lambda>a. a*n div d) ?RF" unfolding inj_on_def by blast |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
228 |
{ fix a assume a: "a\<in>?RF" |
67226 | 229 |
hence "a * (n div d) \<ge> 1" using \<open>n>0\<close> dvd_div_ge_1[OF _ \<open>d dvd n\<close>] by simp |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
230 |
hence ge_1: "a * n div d \<ge> 1" by (simp add: \<open>d dvd n\<close> div_mult_swap) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
231 |
have le_n: "a * n div d \<le> n" using div_mult_mono a by simp |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
232 |
have "gcd (a * n div d) n = n div d * gcd a d" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
233 |
by (simp add: gcd_mult_distrib_nat q ac_simps) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
234 |
hence "n div gcd (a * n div d) n = d*n div (d*(n div d))" using a by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
235 |
hence "a * n div d \<in> ?F" |
67226 | 236 |
using ge_1 le_n by (fastforce simp add: \<open>d dvd n\<close>) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
237 |
} thus "(\<lambda>a. a*n div d) ` ?RF \<subseteq> ?F" by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
238 |
{ fix m l assume A: "m \<in> ?F" "l \<in> ?F" "m div gcd m n = l div gcd l n" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
239 |
hence "gcd m n = gcd l n" using dvd_div_eq_2[OF assms] by fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
240 |
hence "m = l" using dvd_div_eq_1[of "gcd m n" m l] A(3) by fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
241 |
} thus "inj_on (\<lambda>a. a div gcd a n) ?F" unfolding inj_on_def by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
242 |
{ fix m assume "m \<in> ?F" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
243 |
hence "m div gcd m n \<in> ?RF" using dvd_div_ge_1 |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
244 |
by (fastforce simp add: div_le_mono div_gcd_coprime) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
245 |
} thus "(\<lambda>a. a div gcd a n) ` ?F \<subseteq> ?RF" by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
246 |
qed force+ |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
247 |
} hence phi'_eq: "\<And>d. d dvd n \<Longrightarrow> phi' d = card {m \<in> {1 .. n}. n div gcd m n = d}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
248 |
unfolding phi'_def by presburger |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
249 |
have fin: "finite {d. d dvd n}" using dvd_nat_bounds[OF \<open>n>0\<close>] by force |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
250 |
have "(\<Sum>d | d dvd n. phi' d) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
251 |
= card (\<Union>d \<in> {d. d dvd n}. {m \<in> {1 .. n}. n div gcd m n = d})" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
252 |
using card_UN_disjoint[OF fin, of "(\<lambda>d. {m \<in> {1 .. n}. n div gcd m n = d})"] phi'_eq |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
253 |
by fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
254 |
also have "(\<Union>d \<in> {d. d dvd n}. {m \<in> {1 .. n}. n div gcd m n = d}) = {1 .. n}" (is "?L = ?R") |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
255 |
proof |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
256 |
show "?L \<supseteq> ?R" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
257 |
proof |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
258 |
fix m assume m: "m \<in> ?R" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
259 |
thus "m \<in> ?L" using dvd_triv_right[of "n div gcd m n" "gcd m n"] |
67051 | 260 |
by simp |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
261 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
262 |
qed fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
263 |
finally show ?thesis by force |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
264 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
265 |
|
67226 | 266 |
section \<open>Order of an Element of a Group\<close> |
267 |
text_raw \<open>\label{sec:order-elem}\<close> |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
268 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
269 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
270 |
context group begin |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
271 |
|
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
272 |
definition (in group) ord :: "'a \<Rightarrow> nat" where |
70131 | 273 |
"ord x \<equiv> (@d. \<forall>n::nat. x [^] n = \<one> \<longleftrightarrow> d dvd n)" |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
274 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
275 |
lemma (in group) pow_eq_id: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
276 |
assumes "x \<in> carrier G" |
70131 | 277 |
shows "x [^] n = \<one> \<longleftrightarrow> (ord x) dvd n" |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
278 |
proof (cases "\<forall>n::nat. pow G x n = one G \<longrightarrow> n = 0") |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
279 |
case True |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
280 |
show ?thesis |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
281 |
unfolding ord_def |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
282 |
by (rule someI2 [where a=0]) (auto simp: True) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
283 |
next |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
284 |
case False |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
285 |
define N where "N \<equiv> LEAST n::nat. x [^] n = \<one> \<and> n > 0" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
286 |
have N: "x [^] N = \<one> \<and> N > 0" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
287 |
using False |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
288 |
apply (simp add: N_def) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
289 |
by (metis (mono_tags, lifting) LeastI) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
290 |
have eq0: "n = 0" if "x [^] n = \<one>" "n < N" for n |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
291 |
using N_def not_less_Least that by fastforce |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
292 |
show ?thesis |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
293 |
unfolding ord_def |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
294 |
proof (rule someI2 [where a = N], rule allI) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
295 |
fix n :: "nat" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
296 |
show "(x [^] n = \<one>) \<longleftrightarrow> (N dvd n)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
297 |
proof (cases "n = 0") |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
298 |
case False |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
299 |
show ?thesis |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
300 |
unfolding dvd_def |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
301 |
proof safe |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
302 |
assume 1: "x [^] n = \<one>" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
303 |
have "x [^] n = x [^] (n mod N + N * (n div N))" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
304 |
by simp |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
305 |
also have "\<dots> = x [^] (n mod N) \<otimes> x [^] (N * (n div N))" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
306 |
by (simp add: assms nat_pow_mult) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
307 |
also have "\<dots> = x [^] (n mod N)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
308 |
by (metis N assms l_cancel_one nat_pow_closed nat_pow_one nat_pow_pow) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
309 |
finally have "x [^] (n mod N) = \<one>" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
310 |
by (simp add: "1") |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
311 |
then have "n mod N = 0" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
312 |
using N eq0 mod_less_divisor by blast |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
313 |
then show "\<exists>k. n = N * k" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
314 |
by blast |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
315 |
next |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
316 |
fix k :: "nat" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
317 |
assume "n = N * k" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
318 |
with N show "x [^] (N * k) = \<one>" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
319 |
by (metis assms nat_pow_one nat_pow_pow) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
320 |
qed |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
321 |
qed simp |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
322 |
qed blast |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
323 |
qed |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
324 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
325 |
lemma (in group) pow_ord_eq_1 [simp]: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
326 |
"x \<in> carrier G \<Longrightarrow> x [^] ord x = \<one>" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
327 |
by (simp add: pow_eq_id) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
328 |
|
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
329 |
lemma (in group) int_pow_eq_id: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
330 |
assumes "x \<in> carrier G" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
331 |
shows "(pow G x i = one G \<longleftrightarrow> int (ord x) dvd i)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
332 |
proof (cases i rule: int_cases2) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
333 |
case (nonneg n) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
334 |
then show ?thesis |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
335 |
by (simp add: int_pow_int pow_eq_id assms) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
336 |
next |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
337 |
case (nonpos n) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
338 |
then have "x [^] i = inv (x [^] n)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
339 |
by (simp add: assms int_pow_int int_pow_neg) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
340 |
then show ?thesis |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
341 |
by (simp add: assms pow_eq_id nonpos) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
342 |
qed |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
343 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
344 |
lemma (in group) int_pow_eq: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
345 |
"x \<in> carrier G \<Longrightarrow> (x [^] m = x [^] n) \<longleftrightarrow> int (ord x) dvd (n - m)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
346 |
apply (simp flip: int_pow_eq_id) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
347 |
by (metis int_pow_closed int_pow_diff inv_closed r_inv right_cancel) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
348 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
349 |
lemma (in group) ord_eq_0: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
350 |
"x \<in> carrier G \<Longrightarrow> (ord x = 0 \<longleftrightarrow> (\<forall>n::nat. n \<noteq> 0 \<longrightarrow> x [^] n \<noteq> \<one>))" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
351 |
by (auto simp: pow_eq_id) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
352 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
353 |
lemma (in group) ord_unique: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
354 |
"x \<in> carrier G \<Longrightarrow> ord x = d \<longleftrightarrow> (\<forall>n. pow G x n = one G \<longleftrightarrow> d dvd n)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
355 |
by (meson dvd_antisym dvd_refl pow_eq_id) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
356 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
357 |
lemma (in group) ord_eq_1: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
358 |
"x \<in> carrier G \<Longrightarrow> (ord x = 1 \<longleftrightarrow> x = \<one>)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
359 |
by (metis pow_eq_id nat_dvd_1_iff_1 nat_pow_eone) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
360 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
361 |
lemma (in group) ord_id [simp]: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
362 |
"ord (one G) = 1" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
363 |
using ord_eq_1 by blast |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
364 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
365 |
lemma (in group) ord_inv [simp]: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
366 |
"x \<in> carrier G |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
367 |
\<Longrightarrow> ord (m_inv G x) = ord x" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
368 |
by (simp add: ord_unique pow_eq_id nat_pow_inv) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
369 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
370 |
lemma (in group) ord_pow: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
371 |
assumes "x \<in> carrier G" "k dvd ord x" "k \<noteq> 0" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
372 |
shows "ord (pow G x k) = ord x div k" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
373 |
proof - |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
374 |
have "(x [^] k) [^] (ord x div k) = \<one>" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
375 |
using assms by (simp add: nat_pow_pow) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
376 |
moreover have "ord x dvd k * ord (x [^] k)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
377 |
by (metis assms(1) pow_ord_eq_1 pow_eq_id nat_pow_closed nat_pow_pow) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
378 |
ultimately show ?thesis |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
379 |
by (metis assms div_dvd_div dvd_antisym dvd_triv_left pow_eq_id nat_pow_closed nonzero_mult_div_cancel_left) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
380 |
qed |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
381 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
382 |
lemma (in group) ord_mul_divides: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
383 |
assumes eq: "x \<otimes> y = y \<otimes> x" and xy: "x \<in> carrier G" "y \<in> carrier G" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
384 |
shows "ord (x \<otimes> y) dvd (ord x * ord y)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
385 |
apply (simp add: xy flip: pow_eq_id eq) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
386 |
by (metis dvd_triv_left dvd_triv_right eq pow_eq_id one_closed pow_mult_distrib r_one xy) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
387 |
|
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
388 |
lemma (in comm_group) abelian_ord_mul_divides: |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
389 |
"\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
390 |
\<Longrightarrow> ord (x \<otimes> y) dvd (ord x * ord y)" |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
391 |
by (simp add: ord_mul_divides m_comm) |
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
392 |
|
68575 | 393 |
lemma ord_inj: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
394 |
assumes a: "a \<in> carrier G" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
395 |
shows "inj_on (\<lambda> x . a [^] x) {0 .. ord a - 1}" |
70131 | 396 |
proof - |
397 |
let ?M = "Max (ord ` carrier G)" |
|
398 |
have "finite {d \<in> {..?M}. a [^] d = \<one>}" by auto |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
399 |
|
70131 | 400 |
have *: False if A: "x < y" "x \<in> {0 .. ord a - 1}" "y \<in> {0 .. ord a - 1}" |
401 |
"a [^] x = a [^] y" for x y |
|
402 |
proof - |
|
403 |
have "y - x < ord a" using that by auto |
|
404 |
moreover have "a [^] (y-x) = \<one>" using a A by (simp add: pow_eq_div2) |
|
405 |
ultimately have "min (y - x) (ord a) = ord a" |
|
406 |
using A(1) a pow_eq_id by auto |
|
407 |
with \<open>y - x < ord a\<close> show False by linarith |
|
408 |
qed |
|
409 |
show ?thesis |
|
410 |
unfolding inj_on_def by (metis nat_neq_iff *) |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
411 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
412 |
|
68575 | 413 |
lemma ord_inj': |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
414 |
assumes a: "a \<in> carrier G" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
415 |
shows "inj_on (\<lambda> x . a [^] x) {1 .. ord a}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
416 |
proof (rule inj_onI, rule ccontr) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
417 |
fix x y :: nat |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
418 |
assume A: "x \<in> {1 .. ord a}" "y \<in> {1 .. ord a}" "a [^] x = a [^] y" "x\<noteq>y" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
419 |
{ assume "x < ord a" "y < ord a" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
420 |
hence False using ord_inj[OF assms] A unfolding inj_on_def by fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
421 |
} |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
422 |
moreover |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
423 |
{ assume "x = ord a" "y < ord a" |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
424 |
hence "a [^] y = a [^] (0::nat)" using pow_ord_eq_1 A by (simp add: a) |
67226 | 425 |
hence "y=0" using ord_inj[OF assms] \<open>y < ord a\<close> unfolding inj_on_def by force |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
426 |
hence False using A by fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
427 |
} |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
428 |
moreover |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
429 |
{ assume "y = ord a" "x < ord a" |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
430 |
hence "a [^] x = a [^] (0::nat)" using pow_ord_eq_1 A by (simp add: a) |
67226 | 431 |
hence "x=0" using ord_inj[OF assms] \<open>x < ord a\<close> unfolding inj_on_def by force |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
432 |
hence False using A by fastforce |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
433 |
} |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
434 |
ultimately show False using A by force |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
435 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
436 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
437 |
lemma (in group) ord_ge_1: |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
438 |
assumes finite: "finite (carrier G)" and a: "a \<in> carrier G" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
439 |
shows "ord a \<ge> 1" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
440 |
proof - |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
441 |
have "((\<lambda>n::nat. a [^] n) ` {0<..}) \<subseteq> carrier G" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
442 |
using a by blast |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
443 |
then have "finite ((\<lambda>n::nat. a [^] n) ` {0<..})" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
444 |
using finite_subset finite by auto |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
445 |
then have "\<not> inj_on (\<lambda>n::nat. a [^] n) {0<..}" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
446 |
using finite_imageD infinite_Ioi by blast |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
447 |
then obtain i j::nat where "i \<noteq> j" "a [^] i = a [^] j" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
448 |
by (auto simp: inj_on_def) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
449 |
then have "\<exists>n::nat. n>0 \<and> a [^] n = \<one>" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
450 |
by (metis a diffs0_imp_equal pow_eq_div2 neq0_conv) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
451 |
then have "ord a \<noteq> 0" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
452 |
by (simp add: ord_eq_0 [OF a]) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
453 |
then show ?thesis |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
454 |
by simp |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
455 |
qed |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
456 |
|
68575 | 457 |
lemma ord_elems: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
458 |
assumes "finite (carrier G)" "a \<in> carrier G" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
459 |
shows "{a[^]x | x. x \<in> (UNIV :: nat set)} = {a[^]x | x. x \<in> {0 .. ord a - 1}}" (is "?L = ?R") |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
460 |
proof |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
461 |
show "?R \<subseteq> ?L" by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
462 |
{ fix y assume "y \<in> ?L" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
463 |
then obtain x::nat where x: "y = a[^]x" by auto |
68157 | 464 |
define r q where "r = x mod ord a" and "q = x div ord a" |
465 |
then have "x = q * ord a + r" |
|
466 |
by (simp add: div_mult_mod_eq) |
|
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
467 |
hence "y = (a[^]ord a)[^]q \<otimes> a[^]r" |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
468 |
using x assms by (metis mult.commute nat_pow_mult nat_pow_pow) |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
469 |
hence "y = a[^]r" using assms by (simp add: pow_ord_eq_1) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
470 |
have "r < ord a" using ord_ge_1[OF assms] by (simp add: r_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
471 |
hence "r \<in> {0 .. ord a - 1}" by (force simp: r_def) |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
472 |
hence "y \<in> {a[^]x | x. x \<in> {0 .. ord a - 1}}" using \<open>y=a[^]r\<close> by blast |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
473 |
} |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
474 |
thus "?L \<subseteq> ?R" by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
475 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
476 |
|
69895
6b03a8cf092d
more formal contributors (with the help of the history);
wenzelm
parents:
69785
diff
changeset
|
477 |
lemma generate_pow_on_finite_carrier: \<^marker>\<open>contributor \<open>Paulo EmÃlio de Vilhena\<close>\<close> |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
478 |
assumes "finite (carrier G)" and a: "a \<in> carrier G" |
68575 | 479 |
shows "generate G { a } = { a [^] k | k. k \<in> (UNIV :: nat set) }" |
480 |
proof |
|
481 |
show "{ a [^] k | k. k \<in> (UNIV :: nat set) } \<subseteq> generate G { a }" |
|
482 |
proof |
|
483 |
fix b assume "b \<in> { a [^] k | k. k \<in> (UNIV :: nat set) }" |
|
484 |
then obtain k :: nat where "b = a [^] k" by blast |
|
485 |
hence "b = a [^] (int k)" |
|
69749
10e48c47a549
some new results in group theory
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
486 |
by (simp add: int_pow_int) |
68575 | 487 |
thus "b \<in> generate G { a }" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
488 |
unfolding generate_pow[OF a] by blast |
68575 | 489 |
qed |
490 |
next |
|
491 |
show "generate G { a } \<subseteq> { a [^] k | k. k \<in> (UNIV :: nat set) }" |
|
492 |
proof |
|
493 |
fix b assume "b \<in> generate G { a }" |
|
494 |
then obtain k :: int where k: "b = a [^] k" |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
495 |
unfolding generate_pow[OF a] by blast |
68575 | 496 |
show "b \<in> { a [^] k | k. k \<in> (UNIV :: nat set) }" |
497 |
proof (cases "k < 0") |
|
498 |
assume "\<not> k < 0" |
|
499 |
hence "b = a [^] (nat k)" |
|
70027
94494b92d8d0
some new group theory results: integer group, trivial group, etc.
paulson <lp15@cam.ac.uk>
parents:
69895
diff
changeset
|
500 |
by (simp add: k) |
68575 | 501 |
thus ?thesis by blast |
502 |
next |
|
503 |
assume "k < 0" |
|
504 |
hence b: "b = inv (a [^] (nat (- k)))" |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
505 |
using k a by (auto simp: int_pow_neg) |
68575 | 506 |
obtain m where m: "ord a * m \<ge> nat (- k)" |
507 |
by (metis assms mult.left_neutral mult_le_mono1 ord_ge_1) |
|
508 |
hence "a [^] (ord a * m) = \<one>" |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
509 |
by (metis a nat_pow_one nat_pow_pow pow_ord_eq_1) |
68575 | 510 |
then obtain k' :: nat where "(a [^] (nat (- k))) \<otimes> (a [^] k') = \<one>" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
511 |
using m a nat_le_iff_add nat_pow_mult by auto |
68575 | 512 |
hence "b = a [^] k'" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
513 |
using b a by (metis inv_unique' nat_pow_closed nat_pow_comm) |
68575 | 514 |
thus "b \<in> { a [^] k | k. k \<in> (UNIV :: nat set) }" by blast |
515 |
qed |
|
516 |
qed |
|
517 |
qed |
|
518 |
||
69895
6b03a8cf092d
more formal contributors (with the help of the history);
wenzelm
parents:
69785
diff
changeset
|
519 |
lemma generate_pow_card: \<^marker>\<open>contributor \<open>Paulo EmÃlio de Vilhena\<close>\<close> |
70131 | 520 |
assumes "finite (carrier G)" and a: "a \<in> carrier G" |
68575 | 521 |
shows "ord a = card (generate G { a })" |
522 |
proof - |
|
523 |
have "generate G { a } = (([^]) a) ` {0..ord a - 1}" |
|
524 |
using generate_pow_on_finite_carrier[OF assms] unfolding ord_elems[OF assms] by auto |
|
525 |
thus ?thesis |
|
70131 | 526 |
using ord_inj[OF a] ord_ge_1[OF assms] by (simp add: card_image) |
68575 | 527 |
qed |
528 |
||
70131 | 529 |
lemma ord_dvd_group_order: |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
530 |
assumes "a \<in> carrier G" |
70131 | 531 |
shows "(ord a) dvd (order G)" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
532 |
proof (cases "finite (carrier G)") |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
533 |
case True |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
534 |
then show ?thesis |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
535 |
using lagrange[OF generate_is_subgroup[of "{a}"]] assms |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
536 |
unfolding generate_pow_card[OF True assms] |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
537 |
by (metis dvd_triv_right empty_subsetI insert_subset) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
538 |
next |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
539 |
case False |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
540 |
then show ?thesis |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
541 |
using order_gt_0_iff_finite by auto |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
542 |
qed |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
543 |
|
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
544 |
lemma (in group) pow_order_eq_1: |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
545 |
assumes "a \<in> carrier G" shows "a [^] order G = \<one>" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
546 |
using assms by (metis nat_pow_pow ord_dvd_group_order pow_ord_eq_1 dvdE nat_pow_one) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
547 |
|
70131 | 548 |
lemma dvd_gcd: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
549 |
fixes a b :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
550 |
obtains q where "a * (b div gcd a b) = b*q" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
551 |
proof |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
552 |
have "a * (b div gcd a b) = (a div gcd a b) * b" by (simp add: div_mult_swap dvd_div_mult) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
553 |
also have "\<dots> = b * (a div gcd a b)" by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
554 |
finally show "a * (b div gcd a b) = b * (a div gcd a b) " . |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
555 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
556 |
|
70131 | 557 |
lemma (in group) ord_le_group_order: |
558 |
assumes finite: "finite (carrier G)" and a: "a \<in> carrier G" |
|
559 |
shows "ord a \<le> order G" |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
560 |
by (simp add: a dvd_imp_le local.finite ord_dvd_group_order order_gt_0_iff_finite) |
70131 | 561 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
562 |
lemma (in group) ord_pow_gen: |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
563 |
assumes "x \<in> carrier G" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
564 |
shows "ord (pow G x k) = (if k = 0 then 1 else ord x div gcd (ord x) k)" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
565 |
proof - |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
566 |
have "ord (x [^] k) = ord x div gcd (ord x) k" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
567 |
if "0 < k" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
568 |
proof - |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
569 |
have "(d dvd k * n) = (d div gcd (d) k dvd n)" for d n |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
570 |
using that by (simp add: div_dvd_iff_mult gcd_mult_distrib_nat mult.commute) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
571 |
then show ?thesis |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
572 |
using that by (auto simp add: assms ord_unique nat_pow_pow pow_eq_id) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
573 |
qed |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
574 |
then show ?thesis by auto |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
575 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
576 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
577 |
lemma (in group) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
578 |
assumes finite': "finite (carrier G)" "a \<in> carrier G" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
579 |
shows pow_ord_eq_ord_iff: "group.ord G (a [^] k) = ord a \<longleftrightarrow> coprime k (ord a)" (is "?L \<longleftrightarrow> ?R") |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
580 |
using assms ord_ge_1 [OF assms] |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
581 |
by (auto simp: div_eq_dividend_iff ord_pow_gen coprime_iff_gcd_eq_1 gcd.commute split: if_split_asm) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
582 |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
583 |
lemma element_generates_subgroup: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
584 |
assumes finite[simp]: "finite (carrier G)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
585 |
assumes a[simp]: "a \<in> carrier G" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
586 |
shows "subgroup {a [^] i | i. i \<in> {0 .. ord a - 1}} G" |
68575 | 587 |
using generate_is_subgroup[of "{ a }"] assms(2) |
588 |
generate_pow_on_finite_carrier[OF assms] |
|
589 |
unfolding ord_elems[OF assms] by auto |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
590 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
591 |
end |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
592 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
593 |
|
67226 | 594 |
section \<open>Number of Roots of a Polynomial\<close> |
595 |
text_raw \<open>\label{sec:number-roots}\<close> |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
596 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
597 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
598 |
definition mult_of :: "('a, 'b) ring_scheme \<Rightarrow> 'a monoid" where |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
599 |
"mult_of R \<equiv> \<lparr> carrier = carrier R - {\<zero>\<^bsub>R\<^esub>}, mult = mult R, one = \<one>\<^bsub>R\<^esub>\<rparr>" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
600 |
|
68583 | 601 |
lemma carrier_mult_of [simp]: "carrier (mult_of R) = carrier R - {\<zero>\<^bsub>R\<^esub>}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
602 |
by (simp add: mult_of_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
603 |
|
68583 | 604 |
lemma mult_mult_of [simp]: "mult (mult_of R) = mult R" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
605 |
by (simp add: mult_of_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
606 |
|
67399 | 607 |
lemma nat_pow_mult_of: "([^]\<^bsub>mult_of R\<^esub>) = (([^]\<^bsub>R\<^esub>) :: _ \<Rightarrow> nat \<Rightarrow> _)" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
608 |
by (simp add: mult_of_def fun_eq_iff nat_pow_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
609 |
|
68583 | 610 |
lemma one_mult_of [simp]: "\<one>\<^bsub>mult_of R\<^esub> = \<one>\<^bsub>R\<^esub>" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
611 |
by (simp add: mult_of_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
612 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
613 |
lemmas mult_of_simps = carrier_mult_of mult_mult_of nat_pow_mult_of one_mult_of |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
614 |
|
68575 | 615 |
context field |
68551
b680e74eb6f2
More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents:
68445
diff
changeset
|
616 |
begin |
b680e74eb6f2
More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents:
68445
diff
changeset
|
617 |
|
68575 | 618 |
lemma mult_of_is_Units: "mult_of R = units_of R" |
68551
b680e74eb6f2
More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents:
68445
diff
changeset
|
619 |
unfolding mult_of_def units_of_def using field_Units by auto |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
620 |
|
70131 | 621 |
lemma m_inv_mult_of: |
68561 | 622 |
"\<And>x. x \<in> carrier (mult_of R) \<Longrightarrow> m_inv (mult_of R) x = m_inv R x" |
623 |
using mult_of_is_Units units_of_inv unfolding units_of_def |
|
68575 | 624 |
by simp |
68561 | 625 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
626 |
lemma (in field) field_mult_group: "group (mult_of R)" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
627 |
proof (rule groupI) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
628 |
show "\<exists>y\<in>carrier (mult_of R). y \<otimes>\<^bsub>mult_of R\<^esub> x = \<one>\<^bsub>mult_of R\<^esub>" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
629 |
if "x \<in> carrier (mult_of R)" for x |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
630 |
using group.l_inv_ex mult_of_is_Units that units_group by fastforce |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
631 |
qed (auto simp: m_assoc dest: integral) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
632 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
633 |
lemma finite_mult_of: "finite (carrier R) \<Longrightarrow> finite (carrier (mult_of R))" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
634 |
by simp |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
635 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
636 |
lemma order_mult_of: "finite (carrier R) \<Longrightarrow> order (mult_of R) = order R - 1" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
637 |
unfolding order_def carrier_mult_of by (simp add: card.remove) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
638 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
639 |
end |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
640 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
641 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
642 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
643 |
lemma (in monoid) Units_pow_closed : |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
644 |
fixes d :: nat |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
645 |
assumes "x \<in> Units G" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
646 |
shows "x [^] d \<in> Units G" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
647 |
by (metis assms group.is_monoid monoid.nat_pow_closed units_group units_of_carrier units_of_pow) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
648 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
649 |
lemma (in comm_monoid) is_monoid: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
650 |
shows "monoid G" by unfold_locales |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
651 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
652 |
declare comm_monoid.is_monoid[intro?] |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
653 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
654 |
lemma (in ring) r_right_minus_eq[simp]: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
655 |
assumes "a \<in> carrier R" "b \<in> carrier R" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
656 |
shows "a \<ominus> b = \<zero> \<longleftrightarrow> a = b" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
657 |
using assms by (metis a_minus_def add.inv_closed minus_equality r_neg) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
658 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
659 |
context UP_cring begin |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
660 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
661 |
lemma is_UP_cring: "UP_cring R" by (unfold_locales) |
70131 | 662 |
lemma is_UP_ring: |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
663 |
shows "UP_ring R" by (unfold_locales) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
664 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
665 |
end |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
666 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
667 |
context UP_domain begin |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
668 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
669 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
670 |
lemma roots_bound: |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
671 |
assumes f [simp]: "f \<in> carrier P" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
672 |
assumes f_not_zero: "f \<noteq> \<zero>\<^bsub>P\<^esub>" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
673 |
assumes finite: "finite (carrier R)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
674 |
shows "finite {a \<in> carrier R . eval R R id a f = \<zero>} \<and> |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
675 |
card {a \<in> carrier R . eval R R id a f = \<zero>} \<le> deg R f" using f f_not_zero |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
676 |
proof (induction "deg R f" arbitrary: f) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
677 |
case 0 |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
678 |
have "\<And>x. eval R R id x f \<noteq> \<zero>" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
679 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
680 |
fix x |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
681 |
have "(\<Oplus>i\<in>{..deg R f}. id (coeff P f i) \<otimes> x [^] i) \<noteq> \<zero>" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
682 |
using 0 lcoeff_nonzero_nonzero[where p = f] by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
683 |
thus "eval R R id x f \<noteq> \<zero>" using 0 unfolding eval_def P_def by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
684 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
685 |
then have *: "{a \<in> carrier R. eval R R (\<lambda>a. a) a f = \<zero>} = {}" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
686 |
by (auto simp: id_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
687 |
show ?case by (simp add: *) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
688 |
next |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
689 |
case (Suc x) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
690 |
show ?case |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
691 |
proof (cases "\<exists> a \<in> carrier R . eval R R id a f = \<zero>") |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
692 |
case True |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
693 |
then obtain a where a_carrier[simp]: "a \<in> carrier R" and a_root: "eval R R id a f = \<zero>" by blast |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
694 |
have R_not_triv: "carrier R \<noteq> {\<zero>}" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
695 |
by (metis R.one_zeroI R.zero_not_one) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
696 |
obtain q where q: "(q \<in> carrier P)" and |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
697 |
f: "f = (monom P \<one>\<^bsub>R\<^esub> 1 \<ominus>\<^bsub> P\<^esub> monom P a 0) \<otimes>\<^bsub>P\<^esub> q \<oplus>\<^bsub>P\<^esub> monom P (eval R R id a f) 0" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
698 |
using remainder_theorem[OF Suc.prems(1) a_carrier R_not_triv] by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
699 |
hence lin_fac: "f = (monom P \<one>\<^bsub>R\<^esub> 1 \<ominus>\<^bsub> P\<^esub> monom P a 0) \<otimes>\<^bsub>P\<^esub> q" using q by (simp add: a_root) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
700 |
have deg: "deg R (monom P \<one>\<^bsub>R\<^esub> 1 \<ominus>\<^bsub> P\<^esub> monom P a 0) = 1" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
701 |
using a_carrier by (simp add: deg_minus_eq) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
702 |
hence mon_not_zero: "(monom P \<one>\<^bsub>R\<^esub> 1 \<ominus>\<^bsub> P\<^esub> monom P a 0) \<noteq> \<zero>\<^bsub>P\<^esub>" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
703 |
by (fastforce simp del: r_right_minus_eq) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
704 |
have q_not_zero: "q \<noteq> \<zero>\<^bsub>P\<^esub>" using Suc by (auto simp add : lin_fac) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
705 |
hence "deg R q = x" using Suc deg deg_mult[OF mon_not_zero q_not_zero _ q] |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
706 |
by (simp add : lin_fac) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
707 |
hence q_IH: "finite {a \<in> carrier R . eval R R id a q = \<zero>} |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
708 |
\<and> card {a \<in> carrier R . eval R R id a q = \<zero>} \<le> x" using Suc q q_not_zero by blast |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
709 |
have subs: "{a \<in> carrier R . eval R R id a f = \<zero>} |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
710 |
\<subseteq> {a \<in> carrier R . eval R R id a q = \<zero>} \<union> {a}" (is "?L \<subseteq> ?R \<union> {a}") |
67226 | 711 |
using a_carrier \<open>q \<in> _\<close> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
712 |
by (auto simp: evalRR_simps lin_fac R.integral_iff) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
713 |
have "{a \<in> carrier R . eval R R id a f = \<zero>} \<subseteq> insert a {a \<in> carrier R . eval R R id a q = \<zero>}" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
714 |
using subs by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
715 |
hence "card {a \<in> carrier R . eval R R id a f = \<zero>} \<le> |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
716 |
card (insert a {a \<in> carrier R . eval R R id a q = \<zero>})" using q_IH by (blast intro: card_mono) |
67226 | 717 |
also have "\<dots> \<le> deg R f" using q_IH \<open>Suc x = _\<close> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
718 |
by (simp add: card_insert_if) |
67226 | 719 |
finally show ?thesis using q_IH \<open>Suc x = _\<close> using finite by force |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
720 |
next |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
721 |
case False |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
722 |
hence "card {a \<in> carrier R. eval R R id a f = \<zero>} = 0" using finite by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
723 |
also have "\<dots> \<le> deg R f" by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
724 |
finally show ?thesis using finite by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
725 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
726 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
727 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
728 |
end |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
729 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
730 |
lemma (in domain) num_roots_le_deg : |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
731 |
fixes p d :: nat |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
732 |
assumes finite: "finite (carrier R)" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
733 |
assumes d_neq_zero: "d \<noteq> 0" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
734 |
shows "card {x \<in> carrier R. x [^] d = \<one>} \<le> d" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
735 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
736 |
let ?f = "monom (UP R) \<one>\<^bsub>R\<^esub> d \<ominus>\<^bsub> (UP R)\<^esub> monom (UP R) \<one>\<^bsub>R\<^esub> 0" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
737 |
have one_in_carrier: "\<one> \<in> carrier R" by simp |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
738 |
interpret R: UP_domain R "UP R" by (unfold_locales) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
739 |
have "deg R ?f = d" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
740 |
using d_neq_zero by (simp add: R.deg_minus_eq) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
741 |
hence f_not_zero: "?f \<noteq> \<zero>\<^bsub>UP R\<^esub>" using d_neq_zero by (auto simp add : R.deg_nzero_nzero) |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
742 |
have roots_bound: "finite {a \<in> carrier R . eval R R id a ?f = \<zero>} \<and> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
743 |
card {a \<in> carrier R . eval R R id a ?f = \<zero>} \<le> deg R ?f" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
744 |
using finite by (intro R.roots_bound[OF _ f_not_zero]) simp |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
745 |
have subs: "{x \<in> carrier R. x [^] d = \<one>} \<subseteq> {a \<in> carrier R . eval R R id a ?f = \<zero>}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
746 |
by (auto simp: R.evalRR_simps) |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
747 |
then have "card {x \<in> carrier R. x [^] d = \<one>} \<le> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
748 |
card {a \<in> carrier R. eval R R id a ?f = \<zero>}" using finite by (simp add : card_mono) |
67226 | 749 |
thus ?thesis using \<open>deg R ?f = d\<close> roots_bound by linarith |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
750 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
751 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
752 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
753 |
|
67226 | 754 |
section \<open>The Multiplicative Group of a Field\<close> |
755 |
text_raw \<open>\label{sec:mult-group}\<close> |
|
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
756 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
757 |
|
67226 | 758 |
text \<open> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
759 |
In this section we show that the multiplicative group of a finite field |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
760 |
is generated by a single element, i.e. it is cyclic. The proof is inspired |
67299 | 761 |
by the first proof given in the survey~@{cite "conrad-cyclicity"}. |
67226 | 762 |
\<close> |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
763 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
764 |
context field begin |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
765 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
766 |
lemma num_elems_of_ord_eq_phi': |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
767 |
assumes finite: "finite (carrier R)" and dvd: "d dvd order (mult_of R)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
768 |
and exists: "\<exists>a\<in>carrier (mult_of R). group.ord (mult_of R) a = d" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
769 |
shows "card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d} = phi' d" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
770 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
771 |
note mult_of_simps[simp] |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
772 |
have finite': "finite (carrier (mult_of R))" using finite by (rule finite_mult_of) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
773 |
|
67399 | 774 |
interpret G:group "mult_of R" rewrites "([^]\<^bsub>mult_of R\<^esub>) = (([^]) :: _ \<Rightarrow> nat \<Rightarrow> _)" and "\<one>\<^bsub>mult_of R\<^esub> = \<one>" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
775 |
by (rule field_mult_group) simp_all |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
776 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
777 |
from exists |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
778 |
obtain a where a: "a \<in> carrier (mult_of R)" and ord_a: "group.ord (mult_of R) a = d" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
779 |
by (auto simp add: card_gt_0_iff) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
780 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
781 |
have set_eq1: "{a[^]n| n. n \<in> {1 .. d}} = {x \<in> carrier (mult_of R). x [^] d = \<one>}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
782 |
proof (rule card_seteq) |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
783 |
show "finite {x \<in> carrier (mult_of R). x [^] d = \<one>}" using finite by auto |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
784 |
|
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
785 |
show "{a[^]n| n. n \<in> {1 ..d}} \<subseteq> {x \<in> carrier (mult_of R). x[^]d = \<one>}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
786 |
proof |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
787 |
fix x assume "x \<in> {a[^]n | n. n \<in> {1 .. d}}" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
788 |
then obtain n where n: "x = a[^]n \<and> n \<in> {1 .. d}" by auto |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
789 |
have "x[^]d =(a[^]d)[^]n" using n a ord_a by (simp add:nat_pow_pow mult.commute) |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
790 |
hence "x[^]d = \<one>" using ord_a G.pow_ord_eq_1[OF a] by fastforce |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
791 |
thus "x \<in> {x \<in> carrier (mult_of R). x[^]d = \<one>}" using G.nat_pow_closed[OF a] n by blast |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
792 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
793 |
|
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
794 |
show "card {x \<in> carrier (mult_of R). x [^] d = \<one>} \<le> card {a[^]n | n. n \<in> {1 .. d}}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
795 |
proof - |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
796 |
have *: "{a[^]n | n. n \<in> {1 .. d }} = ((\<lambda> n. a[^]n) ` {1 .. d})" by auto |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
797 |
have "0 < order (mult_of R)" unfolding order_mult_of[OF finite] |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
798 |
using card_mono[OF finite, of "{\<zero>, \<one>}"] by (simp add: order_def) |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
799 |
have "card {x \<in> carrier (mult_of R). x [^] d = \<one>} \<le> card {x \<in> carrier R. x [^] d = \<one>}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
800 |
using finite by (auto intro: card_mono) |
67226 | 801 |
also have "\<dots> \<le> d" using \<open>0 < order (mult_of R)\<close> num_roots_le_deg[OF finite, of d] |
802 |
by (simp add : dvd_pos_nat[OF _ \<open>d dvd order (mult_of R)\<close>]) |
|
70131 | 803 |
finally show ?thesis using G.ord_inj'[OF a] ord_a * by (simp add: card_image) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
804 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
805 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
806 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
807 |
have set_eq2: "{x \<in> carrier (mult_of R) . group.ord (mult_of R) x = d} |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
808 |
= (\<lambda> n . a[^]n) ` {n \<in> {1 .. d}. group.ord (mult_of R) (a[^]n) = d}" (is "?L = ?R") |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
809 |
proof |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
810 |
{ fix x assume x: "x \<in> (carrier (mult_of R)) \<and> group.ord (mult_of R) x = d" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
811 |
hence "x \<in> {x \<in> carrier (mult_of R). x [^] d = \<one>}" |
70030
042ae6ca2c40
The order of a group now follows the HOL Light definition, which is more general
paulson <lp15@cam.ac.uk>
parents:
70027
diff
changeset
|
812 |
by (simp add: G.pow_ord_eq_1[of x, symmetric]) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
813 |
then obtain n where n: "x = a[^]n \<and> n \<in> {1 .. d}" using set_eq1 by blast |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
814 |
hence "x \<in> ?R" using x by fast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
815 |
} thus "?L \<subseteq> ?R" by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
816 |
show "?R \<subseteq> ?L" using a by (auto simp add: carrier_mult_of[symmetric] simp del: carrier_mult_of) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
817 |
qed |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
818 |
have "inj_on (\<lambda> n . a[^]n) {n \<in> {1 .. d}. group.ord (mult_of R) (a[^]n) = d}" |
70131 | 819 |
using G.ord_inj'[OF a, unfolded ord_a] unfolding inj_on_def by fast |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
820 |
hence "card ((\<lambda>n. a[^]n) ` {n \<in> {1 .. d}. group.ord (mult_of R) (a[^]n) = d}) |
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
821 |
= card {k \<in> {1 .. d}. group.ord (mult_of R) (a[^]k) = d}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
822 |
using card_image by blast |
67226 | 823 |
thus ?thesis using set_eq2 G.pow_ord_eq_ord_iff[OF finite' \<open>a \<in> _\<close>, unfolded ord_a] |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
824 |
by (simp add: phi'_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
825 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
826 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
827 |
end |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
828 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
829 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
830 |
theorem (in field) finite_field_mult_group_has_gen : |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
831 |
assumes finite: "finite (carrier R)" |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
832 |
shows "\<exists> a \<in> carrier (mult_of R) . carrier (mult_of R) = {a[^]i | i::nat . i \<in> UNIV}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
833 |
proof - |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
834 |
note mult_of_simps[simp] |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
835 |
have finite': "finite (carrier (mult_of R))" using finite by (rule finite_mult_of) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
836 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
837 |
interpret G: group "mult_of R" rewrites |
67399 | 838 |
"([^]\<^bsub>mult_of R\<^esub>) = (([^]) :: _ \<Rightarrow> nat \<Rightarrow> _)" and "\<one>\<^bsub>mult_of R\<^esub> = \<one>" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
839 |
by (rule field_mult_group) (simp_all add: fun_eq_iff nat_pow_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
840 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
841 |
let ?N = "\<lambda> x . card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = x}" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
842 |
have "0 < order R - 1" unfolding order_def using card_mono[OF finite, of "{\<zero>, \<one>}"] by simp |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
843 |
then have *: "0 < order (mult_of R)" using assms by (simp add: order_mult_of) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
844 |
have fin: "finite {d. d dvd order (mult_of R) }" using dvd_nat_bounds[OF *] by force |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
845 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
846 |
have "(\<Sum>d | d dvd order (mult_of R). ?N d) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
847 |
= card (UN d:{d . d dvd order (mult_of R) }. {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d})" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
848 |
(is "_ = card ?U") |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
849 |
using fin finite by (subst card_UN_disjoint) auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
850 |
also have "?U = carrier (mult_of R)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
851 |
proof |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
852 |
{ fix x assume x: "x \<in> carrier (mult_of R)" |
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
853 |
hence x': "x\<in>carrier (mult_of R)" by simp |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
854 |
then have "group.ord (mult_of R) x dvd order (mult_of R)" |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
855 |
using G.ord_dvd_group_order by blast |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
856 |
hence "x \<in> ?U" using dvd_nat_bounds[of "order (mult_of R)" "group.ord (mult_of R) x"] x by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
857 |
} thus "carrier (mult_of R) \<subseteq> ?U" by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
858 |
qed auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
859 |
also have "card ... = order (mult_of R)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
860 |
using order_mult_of finite' by (simp add: order_def) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
861 |
finally have sum_Ns_eq: "(\<Sum>d | d dvd order (mult_of R). ?N d) = order (mult_of R)" . |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
862 |
|
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
863 |
{ fix d assume d: "d dvd order (mult_of R)" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
864 |
have "card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d} \<le> phi' d" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
865 |
proof cases |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
866 |
assume "card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d} = 0" thus ?thesis by presburger |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
867 |
next |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
868 |
assume "card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d} \<noteq> 0" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
869 |
hence "\<exists>a \<in> carrier (mult_of R). group.ord (mult_of R) a = d" by (auto simp: card_eq_0_iff) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
870 |
thus ?thesis using num_elems_of_ord_eq_phi'[OF finite d] by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
871 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
872 |
} |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
873 |
hence all_le: "\<And>i. i \<in> {d. d dvd order (mult_of R) } |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
874 |
\<Longrightarrow> (\<lambda>i. card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = i}) i \<le> (\<lambda>i. phi' i) i" by fast |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
875 |
hence le: "(\<Sum>i | i dvd order (mult_of R). ?N i) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
876 |
\<le> (\<Sum>i | i dvd order (mult_of R). phi' i)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
877 |
using sum_mono[of "{d . d dvd order (mult_of R)}" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
878 |
"\<lambda>i. card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = i}"] by presburger |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
879 |
have "order (mult_of R) = (\<Sum>d | d dvd order (mult_of R). phi' d)" using * |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
880 |
by (simp add: sum_phi'_factors) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
881 |
hence eq: "(\<Sum>i | i dvd order (mult_of R). ?N i) |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
882 |
= (\<Sum>i | i dvd order (mult_of R). phi' i)" using le sum_Ns_eq by presburger |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
883 |
have "\<And>i. i \<in> {d. d dvd order (mult_of R) } \<Longrightarrow> ?N i = (\<lambda>i. phi' i) i" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
884 |
proof (rule ccontr) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
885 |
fix i |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
886 |
assume i1: "i \<in> {d. d dvd order (mult_of R)}" and "?N i \<noteq> phi' i" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
887 |
hence "?N i = 0" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
888 |
using num_elems_of_ord_eq_phi'[OF finite, of i] by (auto simp: card_eq_0_iff) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
889 |
moreover have "0 < i" using * i1 by (simp add: dvd_nat_bounds[of "order (mult_of R)" i]) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
890 |
ultimately have "?N i < phi' i" using phi'_nonzero by presburger |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
891 |
hence "(\<Sum>i | i dvd order (mult_of R). ?N i) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
892 |
< (\<Sum>i | i dvd order (mult_of R). phi' i)" |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
893 |
using sum_strict_mono_ex1[OF fin, of "?N" "\<lambda> i . phi' i"] |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
894 |
i1 all_le by auto |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
895 |
thus False using eq by force |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
896 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
897 |
hence "?N (order (mult_of R)) > 0" using * by (simp add: phi'_nonzero) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
898 |
then obtain a where a: "a \<in> carrier (mult_of R)" and a_ord: "group.ord (mult_of R) a = order (mult_of R)" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
899 |
by (auto simp add: card_gt_0_iff) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
900 |
hence set_eq: "{a[^]i | i::nat. i \<in> UNIV} = (\<lambda>x. a[^]x) ` {0 .. group.ord (mult_of R) a - 1}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
901 |
using G.ord_elems[OF finite'] by auto |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
902 |
have card_eq: "card ((\<lambda>x. a[^]x) ` {0 .. group.ord (mult_of R) a - 1}) = card {0 .. group.ord (mult_of R) a - 1}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
903 |
by (intro card_image G.ord_inj finite' a) |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
904 |
hence "card ((\<lambda> x . a[^]x) ` {0 .. group.ord (mult_of R) a - 1}) = card {0 ..order (mult_of R) - 1}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
905 |
using assms by (simp add: card_eq a_ord) |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
906 |
hence card_R_minus_1: "card {a[^]i | i::nat. i \<in> UNIV} = order (mult_of R)" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
907 |
using * by (subst set_eq) auto |
70133
4f19b92ab6d7
tidying up messy proofs about group element order
paulson <lp15@cam.ac.uk>
parents:
70131
diff
changeset
|
908 |
have **: "{a[^]i | i::nat. i \<in> UNIV} \<subseteq> carrier (mult_of R)" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
909 |
using G.nat_pow_closed[OF a] by auto |
67341
df79ef3b3a41
Renamed (^) to [^] in preparation of the move from "op X" to (X)
nipkow
parents:
67299
diff
changeset
|
910 |
with _ have "carrier (mult_of R) = {a[^]i|i::nat. i \<in> UNIV}" |
65416
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
911 |
by (rule card_seteq[symmetric]) (simp_all add: card_R_minus_1 finite order_def del: UNIV_I) |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
912 |
thus ?thesis using a by blast |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
913 |
qed |
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
914 |
|
f707dbcf11e3
more approproiate placement of theories MiscAlgebra and Multiplicate_Group
haftmann
parents:
diff
changeset
|
915 |
end |