MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  fermltl Structured version   Unicode version

Theorem fermltl 13864
Description: Fermat's little theorem. When  P is prime,  A ^ P  ==  A, mod  P for any  A. (Contributed by Mario Carneiro, 28-Feb-2014.)
Assertion
Ref Expression
fermltl  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A ^ P
)  mod  P )  =  ( A  mod  P ) )

Proof of Theorem fermltl
StepHypRef Expression
1 prmnn 13771 . . . 4  |-  ( P  e.  Prime  ->  P  e.  NN )
2 dvdsval3 13544 . . . 4  |-  ( ( P  e.  NN  /\  A  e.  ZZ )  ->  ( P  ||  A  <->  ( A  mod  P )  =  0 ) )
31, 2sylan 471 . . 3  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  ||  A  <->  ( A  mod  P )  =  0 ) )
4 simp2 989 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  A  e.  ZZ )
5 0zd 10663 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  0  e.  ZZ )
613ad2ant1 1009 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  P  e.  NN )
76nnnn0d 10641 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  P  e.  NN0 )
86nnrpd 11031 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  P  e.  RR+ )
9 simp3 990 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  ( A  mod  P )  =  0 )
10 0mod 11744 . . . . . . . 8  |-  ( P  e.  RR+  ->  ( 0  mod  P )  =  0 )
118, 10syl 16 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  (
0  mod  P )  =  0 )
129, 11eqtr4d 2478 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  ( A  mod  P )  =  ( 0  mod  P
) )
13 modexp 12004 . . . . . 6  |-  ( ( ( A  e.  ZZ  /\  0  e.  ZZ )  /\  ( P  e. 
NN0  /\  P  e.  RR+ )  /\  ( A  mod  P )  =  ( 0  mod  P
) )  ->  (
( A ^ P
)  mod  P )  =  ( ( 0 ^ P )  mod 
P ) )
144, 5, 7, 8, 12, 13syl221anc 1229 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  (
( A ^ P
)  mod  P )  =  ( ( 0 ^ P )  mod 
P ) )
1560expd 12029 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  (
0 ^ P )  =  0 )
1615oveq1d 6111 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  (
( 0 ^ P
)  mod  P )  =  ( 0  mod 
P ) )
1712, 16eqtr4d 2478 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  ( A  mod  P )  =  ( ( 0 ^ P )  mod  P
) )
1814, 17eqtr4d 2478 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  mod  P )  =  0 )  ->  (
( A ^ P
)  mod  P )  =  ( A  mod  P ) )
19183expia 1189 . . 3  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A  mod  P
)  =  0  -> 
( ( A ^ P )  mod  P
)  =  ( A  mod  P ) ) )
203, 19sylbid 215 . 2  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  ||  A  ->  (
( A ^ P
)  mod  P )  =  ( A  mod  P ) ) )
21 coprm 13791 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( -.  P  ||  A  <->  ( P  gcd  A )  =  1 ) )
22 prmz 13772 . . . . . 6  |-  ( P  e.  Prime  ->  P  e.  ZZ )
23 gcdcom 13709 . . . . . 6  |-  ( ( P  e.  ZZ  /\  A  e.  ZZ )  ->  ( P  gcd  A
)  =  ( A  gcd  P ) )
2422, 23sylan 471 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  gcd  A )  =  ( A  gcd  P
) )
2524eqeq1d 2451 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( P  gcd  A
)  =  1  <->  ( A  gcd  P )  =  1 ) )
2621, 25bitrd 253 . . 3  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( -.  P  ||  A  <->  ( A  gcd  P )  =  1 ) )
27 simp2 989 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  A  e.  ZZ )
2813ad2ant1 1009 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  P  e.  NN )
2928phicld 13852 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  ( phi `  P )  e.  NN )
3029nnnn0d 10641 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  ( phi `  P )  e. 
NN0 )
31 zexpcl 11885 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  ( phi `  P )  e.  NN0 )  -> 
( A ^ ( phi `  P ) )  e.  ZZ )
3227, 30, 31syl2anc 661 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  ( A ^ ( phi `  P ) )  e.  ZZ )
3332zred 10752 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  ( A ^ ( phi `  P ) )  e.  RR )
34 1red 9406 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  1  e.  RR )
3528nnrpd 11031 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  P  e.  RR+ )
36 eulerth 13863 . . . . . . 7  |-  ( ( P  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
371, 36syl3an1 1251 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
38 modmul1 11757 . . . . . 6  |-  ( ( ( ( A ^
( phi `  P
) )  e.  RR  /\  1  e.  RR )  /\  ( A  e.  ZZ  /\  P  e.  RR+ )  /\  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )  ->  (
( ( A ^
( phi `  P
) )  x.  A
)  mod  P )  =  ( ( 1  x.  A )  mod 
P ) )
3933, 34, 27, 35, 37, 38syl221anc 1229 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( ( A ^
( phi `  P
) )  x.  A
)  mod  P )  =  ( ( 1  x.  A )  mod 
P ) )
40 phiprm 13857 . . . . . . . . . 10  |-  ( P  e.  Prime  ->  ( phi `  P )  =  ( P  -  1 ) )
41403ad2ant1 1009 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  ( phi `  P )  =  ( P  -  1 ) )
4241oveq2d 6112 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  ( A ^ ( phi `  P ) )  =  ( A ^ ( P  -  1 ) ) )
4342oveq1d 6111 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  x.  A )  =  ( ( A ^
( P  -  1 ) )  x.  A
) )
4427zcnd 10753 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  A  e.  CC )
45 expm1t 11897 . . . . . . . 8  |-  ( ( A  e.  CC  /\  P  e.  NN )  ->  ( A ^ P
)  =  ( ( A ^ ( P  -  1 ) )  x.  A ) )
4644, 28, 45syl2anc 661 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  ( A ^ P )  =  ( ( A ^
( P  -  1 ) )  x.  A
) )
4743, 46eqtr4d 2478 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  x.  A )  =  ( A ^ P
) )
4847oveq1d 6111 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( ( A ^
( phi `  P
) )  x.  A
)  mod  P )  =  ( ( A ^ P )  mod 
P ) )
4944mulid2d 9409 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
1  x.  A )  =  A )
5049oveq1d 6111 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( 1  x.  A
)  mod  P )  =  ( A  mod  P ) )
5139, 48, 503eqtr3d 2483 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ P
)  mod  P )  =  ( A  mod  P ) )
52513expia 1189 . . 3  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A  gcd  P
)  =  1  -> 
( ( A ^ P )  mod  P
)  =  ( A  mod  P ) ) )
5326, 52sylbid 215 . 2  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( -.  P  ||  A  -> 
( ( A ^ P )  mod  P
)  =  ( A  mod  P ) ) )
5420, 53pm2.61d 158 1  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A ^ P
)  mod  P )  =  ( A  mod  P ) )
Colors of variables: wff setvar class
Syntax hints:   -. wn 3    -> wi 4    <-> wb 184    /\ wa 369    /\ w3a 965    = wceq 1369    e. wcel 1756   class class class wbr 4297   ` cfv 5423  (class class class)co 6096   CCcc 9285   RRcr 9286   0cc0 9287   1c1 9288    x. cmul 9292    - cmin 9600   NNcn 10327   NN0cn0 10584   ZZcz 10651   RR+crp 10996    mod cmo 11713   ^cexp 11870    || cdivides 13540    gcd cgcd 13695   Primecprime 13768   phicphi 13844
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1591  ax-4 1602  ax-5 1670  ax-6 1708  ax-7 1728  ax-8 1758  ax-9 1760  ax-10 1775  ax-11 1780  ax-12 1792  ax-13 1943  ax-ext 2423  ax-rep 4408  ax-sep 4418  ax-nul 4426  ax-pow 4475  ax-pr 4536  ax-un 6377  ax-cnex 9343  ax-resscn 9344  ax-1cn 9345  ax-icn 9346  ax-addcl 9347  ax-addrcl 9348  ax-mulcl 9349  ax-mulrcl 9350  ax-mulcom 9351  ax-addass 9352  ax-mulass 9353  ax-distr 9354  ax-i2m1 9355  ax-1ne0 9356  ax-1rid 9357  ax-rnegex 9358  ax-rrecex 9359  ax-cnre 9360  ax-pre-lttri 9361  ax-pre-lttrn 9362  ax-pre-ltadd 9363  ax-pre-mulgt0 9364  ax-pre-sup 9365
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 966  df-3an 967  df-tru 1372  df-ex 1587  df-nf 1590  df-sb 1701  df-eu 2257  df-mo 2258  df-clab 2430  df-cleq 2436  df-clel 2439  df-nfc 2573  df-ne 2613  df-nel 2614  df-ral 2725  df-rex 2726  df-reu 2727  df-rmo 2728  df-rab 2729  df-v 2979  df-sbc 3192  df-csb 3294  df-dif 3336  df-un 3338  df-in 3340  df-ss 3347  df-pss 3349  df-nul 3643  df-if 3797  df-pw 3867  df-sn 3883  df-pr 3885  df-tp 3887  df-op 3889  df-uni 4097  df-int 4134  df-iun 4178  df-br 4298  df-opab 4356  df-mpt 4357  df-tr 4391  df-eprel 4637  df-id 4641  df-po 4646  df-so 4647  df-fr 4684  df-we 4686  df-ord 4727  df-on 4728  df-lim 4729  df-suc 4730  df-xp 4851  df-rel 4852  df-cnv 4853  df-co 4854  df-dm 4855  df-rn 4856  df-res 4857  df-ima 4858  df-iota 5386  df-fun 5425  df-fn 5426  df-f 5427  df-f1 5428  df-fo 5429  df-f1o 5430  df-fv 5431  df-riota 6057  df-ov 6099  df-oprab 6100  df-mpt2 6101  df-om 6482  df-1st 6582  df-2nd 6583  df-recs 6837  df-rdg 6871  df-1o 6925  df-2o 6926  df-oadd 6929  df-er 7106  df-map 7221  df-en 7316  df-dom 7317  df-sdom 7318  df-fin 7319  df-sup 7696  df-card 8114  df-cda 8342  df-pnf 9425  df-mnf 9426  df-xr 9427  df-ltxr 9428  df-le 9429  df-sub 9602  df-neg 9603  df-div 9999  df-nn 10328  df-2 10385  df-3 10386  df-n0 10585  df-z 10652  df-uz 10867  df-rp 10997  df-fz 11443  df-fzo 11554  df-fl 11647  df-mod 11714  df-seq 11812  df-exp 11871  df-hash 12109  df-cj 12593  df-re 12594  df-im 12595  df-sqr 12729  df-abs 12730  df-dvds 13541  df-gcd 13696  df-prm 13769  df-phi 13846
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator