Metamath Proof Explorer


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=BaseZ
znfermltl.p ×˙=mulGrpZ
Assertion znfermltl PABP×˙A=A

Proof

Step Hyp Ref Expression
1 znfermltl.z Z=/P
2 znfermltl.b B=BaseZ
3 znfermltl.p ×˙=mulGrpZ
4 prmnn PP
5 4 nnnn0d PP0
6 5 ad3antrrr PABaA=ℤRHomZaP0
7 simplr PABaA=ℤRHomZaa
8 eqid mulGrpfld𝑠=mulGrpfld𝑠
9 zsscn
10 eqid mulGrpfld=mulGrpfld
11 cnfldbas =Basefld
12 10 11 mgpbas =BasemulGrpfld
13 9 12 sseqtri BasemulGrpfld
14 eqid mulGrpfld=mulGrpfld
15 eqid invgmulGrpfld=invgmulGrpfld
16 cnring fldRing
17 10 ringmgp fldRingmulGrpfldMnd
18 16 17 ax-mp mulGrpfldMnd
19 cnfld1 1=1fld
20 10 19 ringidval 1=0mulGrpfld
21 1z 1
22 20 21 eqeltrri 0mulGrpfld
23 eqid 0mulGrpfld=0mulGrpfld
24 8 12 23 ress0g mulGrpfldMnd0mulGrpfld0mulGrpfld=0mulGrpfld𝑠
25 18 22 9 24 mp3an 0mulGrpfld=0mulGrpfld𝑠
26 8 13 14 15 25 ressmulgnn0 P0aPmulGrpfld𝑠a=PmulGrpflda
27 6 7 26 syl2anc PABaA=ℤRHomZaPmulGrpfld𝑠a=PmulGrpflda
28 7 zcnd PABaA=ℤRHomZaa
29 cnfldexp aP0PmulGrpflda=aP
30 28 6 29 syl2anc PABaA=ℤRHomZaPmulGrpflda=aP
31 27 30 eqtrd PABaA=ℤRHomZaPmulGrpfld𝑠a=aP
32 31 fveq2d PABaA=ℤRHomZaℤRHomZPmulGrpfld𝑠a=ℤRHomZaP
33 nnnn0 PP0
34 1 zncrng P0ZCRing
35 34 crngringd P0ZRing
36 eqid ℤRHomZ=ℤRHomZ
37 36 zrhrhm ZRingℤRHomZringRingHomZ
38 35 37 syl P0ℤRHomZringRingHomZ
39 zringmpg mulGrpfld𝑠=mulGrpring
40 eqid mulGrpZ=mulGrpZ
41 39 40 rhmmhm ℤRHomZringRingHomZℤRHomZmulGrpfld𝑠MndHommulGrpZ
42 4 33 38 41 4syl PℤRHomZmulGrpfld𝑠MndHommulGrpZ
43 42 ad3antrrr PABaA=ℤRHomZaℤRHomZmulGrpfld𝑠MndHommulGrpZ
44 8 12 ressbas2 =BasemulGrpfld𝑠
45 9 44 ax-mp =BasemulGrpfld𝑠
46 eqid mulGrpfld𝑠=mulGrpfld𝑠
47 45 46 3 mhmmulg ℤRHomZmulGrpfld𝑠MndHommulGrpZP0aℤRHomZPmulGrpfld𝑠a=P×˙ℤRHomZa
48 43 6 7 47 syl3anc PABaA=ℤRHomZaℤRHomZPmulGrpfld𝑠a=P×˙ℤRHomZa
49 simpr Paa
50 4 adantr PaP
51 50 nnnn0d PaP0
52 zexpcl aP0aP
53 49 51 52 syl2anc PaaP
54 eqid -ring=-ring
55 54 zringsubgval aPaaPa=aP-ringa
56 53 49 55 syl2anc PaaPa=aP-ringa
57 56 fveq2d PaℤRHomZaPa=ℤRHomZaP-ringa
58 53 zred PaaP
59 zre aa
60 59 adantl Paa
61 50 nnrpd PaP+
62 fermltl PaaPmodP=amodP
63 eqidd PaamodP=amodP
64 58 60 60 60 61 62 63 modsub12d PaaPamodP=aamodP
65 zcn aa
66 65 subidd aaa=0
67 66 adantl Paaa=0
68 67 oveq1d PaaamodP=0modP
69 0mod P+0modP=0
70 61 69 syl Pa0modP=0
71 64 68 70 3eqtrd PaaPamodP=0
72 53 49 zsubcld PaaPa
73 dvdsval3 PaPaPaPaaPamodP=0
74 50 72 73 syl2anc PaPaPaaPamodP=0
75 71 74 mpbird PaPaPa
76 eqid 0Z=0Z
77 1 36 76 zndvds0 P0aPaℤRHomZaPa=0ZPaPa
78 51 72 77 syl2anc PaℤRHomZaPa=0ZPaPa
79 75 78 mpbird PaℤRHomZaPa=0Z
80 rhmghm ℤRHomZringRingHomZℤRHomZringGrpHomZ
81 51 38 80 3syl PaℤRHomZringGrpHomZ
82 zringbas =Basering
83 eqid -Z=-Z
84 82 54 83 ghmsub ℤRHomZringGrpHomZaPaℤRHomZaP-ringa=ℤRHomZaP-ZℤRHomZa
85 81 53 49 84 syl3anc PaℤRHomZaP-ringa=ℤRHomZaP-ZℤRHomZa
86 57 79 85 3eqtr3rd PaℤRHomZaP-ZℤRHomZa=0Z
87 4 33 35 3syl PZRing
88 87 ringgrpd PZGrp
89 88 adantr PaZGrp
90 eqid BaseZ=BaseZ
91 82 90 rhmf ℤRHomZringRingHomZℤRHomZ:BaseZ
92 51 38 91 3syl PaℤRHomZ:BaseZ
93 92 53 ffvelcdmd PaℤRHomZaPBaseZ
94 92 49 ffvelcdmd PaℤRHomZaBaseZ
95 90 76 83 grpsubeq0 ZGrpℤRHomZaPBaseZℤRHomZaBaseZℤRHomZaP-ZℤRHomZa=0ZℤRHomZaP=ℤRHomZa
96 89 93 94 95 syl3anc PaℤRHomZaP-ZℤRHomZa=0ZℤRHomZaP=ℤRHomZa
97 86 96 mpbid PaℤRHomZaP=ℤRHomZa
98 97 ad4ant13 PABaA=ℤRHomZaℤRHomZaP=ℤRHomZa
99 32 48 98 3eqtr3d PABaA=ℤRHomZaP×˙ℤRHomZa=ℤRHomZa
100 oveq2 A=ℤRHomZaP×˙A=P×˙ℤRHomZa
101 100 adantl PABaA=ℤRHomZaP×˙A=P×˙ℤRHomZa
102 simpr PABaA=ℤRHomZaA=ℤRHomZa
103 99 101 102 3eqtr4d PABaA=ℤRHomZaP×˙A=A
104 1 2 36 znzrhfo P0ℤRHomZ:ontoB
105 4 33 104 3syl PℤRHomZ:ontoB
106 foelrn ℤRHomZ:ontoBABaA=ℤRHomZa
107 105 106 sylan PABaA=ℤRHomZa
108 103 107 r19.29a PABP×˙A=A