Database
SUPPLEMENTARY MATERIAL (USERS' MATHBOXES)
Mathbox for Thierry Arnoux
Algebra
The ring of integers modulo ` N `
znfermltl
Next ⟩
Independent sets and families
Metamath Proof Explorer
Ascii
Unicode
Theorem
znfermltl
Description:
Fermat's little theorem in
Z/nZ
.
(Contributed by
Thierry Arnoux
, 24-Jul-2024)
Ref
Expression
Hypotheses
znfermltl.z
⊢
Z
=
ℤ
/
P
ℤ
znfermltl.b
⊢
B
=
Base
Z
znfermltl.p
⊢
×
˙
=
⋅
mulGrp
Z
Assertion
znfermltl
⊢
P
∈
ℙ
∧
A
∈
B
→
P
×
˙
A
=
A
Proof
Step
Hyp
Ref
Expression
1
znfermltl.z
⊢
Z
=
ℤ
/
P
ℤ
2
znfermltl.b
⊢
B
=
Base
Z
3
znfermltl.p
⊢
×
˙
=
⋅
mulGrp
Z
4
prmnn
⊢
P
∈
ℙ
→
P
∈
ℕ
5
4
nnnn0d
⊢
P
∈
ℙ
→
P
∈
ℕ
0
6
5
ad3antrrr
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
P
∈
ℕ
0
7
simplr
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
a
∈
ℤ
8
eqid
⊢
mulGrp
ℂ
fld
↾
𝑠
ℤ
=
mulGrp
ℂ
fld
↾
𝑠
ℤ
9
zsscn
⊢
ℤ
⊆
ℂ
10
eqid
⊢
mulGrp
ℂ
fld
=
mulGrp
ℂ
fld
11
cnfldbas
⊢
ℂ
=
Base
ℂ
fld
12
10
11
mgpbas
⊢
ℂ
=
Base
mulGrp
ℂ
fld
13
9
12
sseqtri
⊢
ℤ
⊆
Base
mulGrp
ℂ
fld
14
eqid
⊢
⋅
mulGrp
ℂ
fld
=
⋅
mulGrp
ℂ
fld
15
eqid
⊢
inv
g
mulGrp
ℂ
fld
=
inv
g
mulGrp
ℂ
fld
16
cnring
⊢
ℂ
fld
∈
Ring
17
10
ringmgp
⊢
ℂ
fld
∈
Ring
→
mulGrp
ℂ
fld
∈
Mnd
18
16
17
ax-mp
⊢
mulGrp
ℂ
fld
∈
Mnd
19
cnfld1
⊢
1
=
1
ℂ
fld
20
10
19
ringidval
⊢
1
=
0
mulGrp
ℂ
fld
21
1z
⊢
1
∈
ℤ
22
20
21
eqeltrri
⊢
0
mulGrp
ℂ
fld
∈
ℤ
23
eqid
⊢
0
mulGrp
ℂ
fld
=
0
mulGrp
ℂ
fld
24
8
12
23
ress0g
⊢
mulGrp
ℂ
fld
∈
Mnd
∧
0
mulGrp
ℂ
fld
∈
ℤ
∧
ℤ
⊆
ℂ
→
0
mulGrp
ℂ
fld
=
0
mulGrp
ℂ
fld
↾
𝑠
ℤ
25
18
22
9
24
mp3an
⊢
0
mulGrp
ℂ
fld
=
0
mulGrp
ℂ
fld
↾
𝑠
ℤ
26
8
13
14
15
25
ressmulgnn0
⊢
P
∈
ℕ
0
∧
a
∈
ℤ
→
P
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
a
=
P
⋅
mulGrp
ℂ
fld
a
27
6
7
26
syl2anc
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
P
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
a
=
P
⋅
mulGrp
ℂ
fld
a
28
7
zcnd
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
a
∈
ℂ
29
cnfldexp
⊢
a
∈
ℂ
∧
P
∈
ℕ
0
→
P
⋅
mulGrp
ℂ
fld
a
=
a
P
30
28
6
29
syl2anc
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
P
⋅
mulGrp
ℂ
fld
a
=
a
P
31
27
30
eqtrd
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
P
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
a
=
a
P
32
31
fveq2d
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
ℤRHom
Z
P
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
a
=
ℤRHom
Z
a
P
33
nnnn0
⊢
P
∈
ℕ
→
P
∈
ℕ
0
34
1
zncrng
⊢
P
∈
ℕ
0
→
Z
∈
CRing
35
34
crngringd
⊢
P
∈
ℕ
0
→
Z
∈
Ring
36
eqid
⊢
ℤRHom
Z
=
ℤRHom
Z
37
36
zrhrhm
⊢
Z
∈
Ring
→
ℤRHom
Z
∈
ℤ
ring
RingHom
Z
38
35
37
syl
⊢
P
∈
ℕ
0
→
ℤRHom
Z
∈
ℤ
ring
RingHom
Z
39
zringmpg
⊢
mulGrp
ℂ
fld
↾
𝑠
ℤ
=
mulGrp
ℤ
ring
40
eqid
⊢
mulGrp
Z
=
mulGrp
Z
41
39
40
rhmmhm
⊢
ℤRHom
Z
∈
ℤ
ring
RingHom
Z
→
ℤRHom
Z
∈
mulGrp
ℂ
fld
↾
𝑠
ℤ
MndHom
mulGrp
Z
42
4
33
38
41
4syl
⊢
P
∈
ℙ
→
ℤRHom
Z
∈
mulGrp
ℂ
fld
↾
𝑠
ℤ
MndHom
mulGrp
Z
43
42
ad3antrrr
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
ℤRHom
Z
∈
mulGrp
ℂ
fld
↾
𝑠
ℤ
MndHom
mulGrp
Z
44
8
12
ressbas2
⊢
ℤ
⊆
ℂ
→
ℤ
=
Base
mulGrp
ℂ
fld
↾
𝑠
ℤ
45
9
44
ax-mp
⊢
ℤ
=
Base
mulGrp
ℂ
fld
↾
𝑠
ℤ
46
eqid
⊢
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
=
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
47
45
46
3
mhmmulg
⊢
ℤRHom
Z
∈
mulGrp
ℂ
fld
↾
𝑠
ℤ
MndHom
mulGrp
Z
∧
P
∈
ℕ
0
∧
a
∈
ℤ
→
ℤRHom
Z
P
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
a
=
P
×
˙
ℤRHom
Z
a
48
43
6
7
47
syl3anc
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
ℤRHom
Z
P
⋅
mulGrp
ℂ
fld
↾
𝑠
ℤ
a
=
P
×
˙
ℤRHom
Z
a
49
simpr
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
∈
ℤ
50
4
adantr
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
P
∈
ℕ
51
50
nnnn0d
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
P
∈
ℕ
0
52
zexpcl
⊢
a
∈
ℤ
∧
P
∈
ℕ
0
→
a
P
∈
ℤ
53
49
51
52
syl2anc
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
P
∈
ℤ
54
eqid
⊢
-
ℤ
ring
=
-
ℤ
ring
55
54
zringsubgval
⊢
a
P
∈
ℤ
∧
a
∈
ℤ
→
a
P
−
a
=
a
P
-
ℤ
ring
a
56
53
49
55
syl2anc
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
P
−
a
=
a
P
-
ℤ
ring
a
57
56
fveq2d
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
−
a
=
ℤRHom
Z
a
P
-
ℤ
ring
a
58
53
zred
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
P
∈
ℝ
59
zre
⊢
a
∈
ℤ
→
a
∈
ℝ
60
59
adantl
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
∈
ℝ
61
50
nnrpd
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
P
∈
ℝ
+
62
fermltl
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
P
mod
P
=
a
mod
P
63
eqidd
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
mod
P
=
a
mod
P
64
58
60
60
60
61
62
63
modsub12d
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
P
−
a
mod
P
=
a
−
a
mod
P
65
zcn
⊢
a
∈
ℤ
→
a
∈
ℂ
66
65
subidd
⊢
a
∈
ℤ
→
a
−
a
=
0
67
66
adantl
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
−
a
=
0
68
67
oveq1d
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
−
a
mod
P
=
0
mod
P
69
0mod
⊢
P
∈
ℝ
+
→
0
mod
P
=
0
70
61
69
syl
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
0
mod
P
=
0
71
64
68
70
3eqtrd
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
P
−
a
mod
P
=
0
72
53
49
zsubcld
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
a
P
−
a
∈
ℤ
73
dvdsval3
⊢
P
∈
ℕ
∧
a
P
−
a
∈
ℤ
→
P
∥
a
P
−
a
↔
a
P
−
a
mod
P
=
0
74
50
72
73
syl2anc
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
P
∥
a
P
−
a
↔
a
P
−
a
mod
P
=
0
75
71
74
mpbird
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
P
∥
a
P
−
a
76
eqid
⊢
0
Z
=
0
Z
77
1
36
76
zndvds0
⊢
P
∈
ℕ
0
∧
a
P
−
a
∈
ℤ
→
ℤRHom
Z
a
P
−
a
=
0
Z
↔
P
∥
a
P
−
a
78
51
72
77
syl2anc
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
−
a
=
0
Z
↔
P
∥
a
P
−
a
79
75
78
mpbird
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
−
a
=
0
Z
80
rhmghm
⊢
ℤRHom
Z
∈
ℤ
ring
RingHom
Z
→
ℤRHom
Z
∈
ℤ
ring
GrpHom
Z
81
51
38
80
3syl
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
∈
ℤ
ring
GrpHom
Z
82
zringbas
⊢
ℤ
=
Base
ℤ
ring
83
eqid
⊢
-
Z
=
-
Z
84
82
54
83
ghmsub
⊢
ℤRHom
Z
∈
ℤ
ring
GrpHom
Z
∧
a
P
∈
ℤ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
-
ℤ
ring
a
=
ℤRHom
Z
a
P
-
Z
ℤRHom
Z
a
85
81
53
49
84
syl3anc
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
-
ℤ
ring
a
=
ℤRHom
Z
a
P
-
Z
ℤRHom
Z
a
86
57
79
85
3eqtr3rd
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
-
Z
ℤRHom
Z
a
=
0
Z
87
4
33
35
3syl
⊢
P
∈
ℙ
→
Z
∈
Ring
88
87
ringgrpd
⊢
P
∈
ℙ
→
Z
∈
Grp
89
88
adantr
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
Z
∈
Grp
90
eqid
⊢
Base
Z
=
Base
Z
91
82
90
rhmf
⊢
ℤRHom
Z
∈
ℤ
ring
RingHom
Z
→
ℤRHom
Z
:
ℤ
⟶
Base
Z
92
51
38
91
3syl
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
:
ℤ
⟶
Base
Z
93
92
53
ffvelcdmd
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
∈
Base
Z
94
92
49
ffvelcdmd
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
∈
Base
Z
95
90
76
83
grpsubeq0
⊢
Z
∈
Grp
∧
ℤRHom
Z
a
P
∈
Base
Z
∧
ℤRHom
Z
a
∈
Base
Z
→
ℤRHom
Z
a
P
-
Z
ℤRHom
Z
a
=
0
Z
↔
ℤRHom
Z
a
P
=
ℤRHom
Z
a
96
89
93
94
95
syl3anc
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
-
Z
ℤRHom
Z
a
=
0
Z
↔
ℤRHom
Z
a
P
=
ℤRHom
Z
a
97
86
96
mpbid
⊢
P
∈
ℙ
∧
a
∈
ℤ
→
ℤRHom
Z
a
P
=
ℤRHom
Z
a
98
97
ad4ant13
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
ℤRHom
Z
a
P
=
ℤRHom
Z
a
99
32
48
98
3eqtr3d
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
P
×
˙
ℤRHom
Z
a
=
ℤRHom
Z
a
100
oveq2
⊢
A
=
ℤRHom
Z
a
→
P
×
˙
A
=
P
×
˙
ℤRHom
Z
a
101
100
adantl
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
P
×
˙
A
=
P
×
˙
ℤRHom
Z
a
102
simpr
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
A
=
ℤRHom
Z
a
103
99
101
102
3eqtr4d
⊢
P
∈
ℙ
∧
A
∈
B
∧
a
∈
ℤ
∧
A
=
ℤRHom
Z
a
→
P
×
˙
A
=
A
104
1
2
36
znzrhfo
⊢
P
∈
ℕ
0
→
ℤRHom
Z
:
ℤ
⟶
onto
B
105
4
33
104
3syl
⊢
P
∈
ℙ
→
ℤRHom
Z
:
ℤ
⟶
onto
B
106
foelrn
⊢
ℤRHom
Z
:
ℤ
⟶
onto
B
∧
A
∈
B
→
∃
a
∈
ℤ
A
=
ℤRHom
Z
a
107
105
106
sylan
⊢
P
∈
ℙ
∧
A
∈
B
→
∃
a
∈
ℤ
A
=
ℤRHom
Z
a
108
103
107
r19.29a
⊢
P
∈
ℙ
∧
A
∈
B
→
P
×
˙
A
=
A