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

Theorem eulerth 12845
Description: Euler's theorem, a generalization of Fermat's little theorem. If  A and  N are coprime, then  A ^ phi ( N )  ==  1, mod  N. (Contributed by Mario Carneiro, 28-Feb-2014.)
Assertion
Ref Expression
eulerth  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  (
( A ^ ( phi `  N ) )  mod  N )  =  ( 1  mod  N
) )
Dummy variables  f 
k  x  y are mutually distinct and distinct from all other variables.

Proof of Theorem eulerth
StepHypRef Expression
1 phicl 12831 . . . . . . . 8  |-  ( N  e.  NN  ->  ( phi `  N )  e.  NN )
21nnnn0d 10013 . . . . . . 7  |-  ( N  e.  NN  ->  ( phi `  N )  e. 
NN0 )
3 hashfz1 11339 . . . . . . 7  |-  ( ( phi `  N )  e.  NN0  ->  ( # `  ( 1 ... ( phi `  N ) ) )  =  ( phi `  N ) )
42, 3syl 17 . . . . . 6  |-  ( N  e.  NN  ->  ( # `
 ( 1 ... ( phi `  N
) ) )  =  ( phi `  N
) )
5 dfphi2 12836 . . . . . 6  |-  ( N  e.  NN  ->  ( phi `  N )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } ) )
64, 5eqtrd 2316 . . . . 5  |-  ( N  e.  NN  ->  ( # `
 ( 1 ... ( phi `  N
) ) )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } ) )
763ad2ant1 978 . . . 4  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  ( # `
 ( 1 ... ( phi `  N
) ) )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } ) )
8 fzfi 11028 . . . . 5  |-  ( 1 ... ( phi `  N ) )  e. 
Fin
9 fzofi 11030 . . . . . 6  |-  ( 0..^ N )  e.  Fin
10 ssrab2 3259 . . . . . 6  |-  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  C_  (
0..^ N )
11 ssfi 7078 . . . . . 6  |-  ( ( ( 0..^ N )  e.  Fin  /\  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  C_  ( 0..^ N ) )  ->  { k  e.  ( 0..^ N )  |  ( k  gcd 
N )  =  1 }  e.  Fin )
129, 10, 11mp2an 655 . . . . 5  |-  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  e.  Fin
13 hashen 11340 . . . . 5  |-  ( ( ( 1 ... ( phi `  N ) )  e.  Fin  /\  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  e.  Fin )  ->  ( (
# `  ( 1 ... ( phi `  N
) ) )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } )  <-> 
( 1 ... ( phi `  N ) ) 
~~  { k  e.  ( 0..^ N )  |  ( k  gcd 
N )  =  1 } ) )
148, 12, 13mp2an 655 . . . 4  |-  ( (
# `  ( 1 ... ( phi `  N
) ) )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } )  <-> 
( 1 ... ( phi `  N ) ) 
~~  { k  e.  ( 0..^ N )  |  ( k  gcd 
N )  =  1 } )
157, 14sylib 190 . . 3  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  (
1 ... ( phi `  N ) )  ~~  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } )
16 bren 6866 . . 3  |-  ( ( 1 ... ( phi `  N ) )  ~~  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  <->  E. f 
f : ( 1 ... ( phi `  N ) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } )
1715, 16sylib 190 . 2  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  E. f 
f : ( 1 ... ( phi `  N ) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } )
18 simpl 445 . . . . 5  |-  ( ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  /\  f : ( 1 ... ( phi `  N
) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N
)  =  1 } )  ->  ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 ) )
19 oveq1 5826 . . . . . . 7  |-  ( k  =  y  ->  (
k  gcd  N )  =  ( y  gcd 
N ) )
2019eqeq1d 2292 . . . . . 6  |-  ( k  =  y  ->  (
( k  gcd  N
)  =  1  <->  (
y  gcd  N )  =  1 ) )
2120cbvrabv 2788 . . . . 5  |-  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  =  {
y  e.  ( 0..^ N )  |  ( y  gcd  N )  =  1 }
22 eqid 2284 . . . . 5  |-  ( 1 ... ( phi `  N ) )  =  ( 1 ... ( phi `  N ) )
23 simpr 449 . . . . 5  |-  ( ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  /\  f : ( 1 ... ( phi `  N
) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N
)  =  1 } )  ->  f :
( 1 ... ( phi `  N ) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } )
24 fveq2 5485 . . . . . . . 8  |-  ( k  =  x  ->  (
f `  k )  =  ( f `  x ) )
2524oveq2d 5835 . . . . . . 7  |-  ( k  =  x  ->  ( A  x.  ( f `  k ) )  =  ( A  x.  (
f `  x )
) )
2625oveq1d 5834 . . . . . 6  |-  ( k  =  x  ->  (
( A  x.  (
f `  k )
)  mod  N )  =  ( ( A  x.  ( f `  x ) )  mod 
N ) )
2726cbvmptv 4112 . . . . 5  |-  ( k  e.  ( 1 ... ( phi `  N
) )  |->  ( ( A  x.  ( f `
 k ) )  mod  N ) )  =  ( x  e.  ( 1 ... ( phi `  N ) ) 
|->  ( ( A  x.  ( f `  x
) )  mod  N
) )
2818, 21, 22, 23, 27eulerthlem2 12844 . . . 4  |-  ( ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  /\  f : ( 1 ... ( phi `  N
) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N
)  =  1 } )  ->  ( ( A ^ ( phi `  N ) )  mod 
N )  =  ( 1  mod  N ) )
2928ex 425 . . 3  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  (
f : ( 1 ... ( phi `  N ) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  ->  (
( A ^ ( phi `  N ) )  mod  N )  =  ( 1  mod  N
) ) )
3029exlimdv 1665 . 2  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  ( E. f  f :
( 1 ... ( phi `  N ) ) -1-1-onto-> { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  ->  ( ( A ^ ( phi `  N ) )  mod  N )  =  ( 1  mod  N
) ) )
3117, 30mpd 16 1  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  (
( A ^ ( phi `  N ) )  mod  N )  =  ( 1  mod  N
) )
Colors of variables: wff set class
Syntax hints:    -> wi 6    <-> wb 178    /\ wa 360    /\ w3a 936   E.wex 1529    = wceq 1624    e. wcel 1685   {crab 2548    C_ wss 3153   class class class wbr 4024    e. cmpt 4078   -1-1-onto->wf1o 5220   ` cfv 5221  (class class class)co 5819    ~~ cen 6855   Fincfn 6858   0cc0 8732   1c1 8733    x. cmul 8737   NNcn 9741   NN0cn0 9960   ZZcz 10019   ...cfz 10776  ..^cfzo 10864    mod cmo 10967   ^cexp 11098   #chash 11331    gcd cgcd 12679   phicphi 12826
This theorem is referenced by:  fermltl  12846  prmdiv  12847  odzcllem  12851  odzphi  12855  lgslem1  20529  lgsqrlem2  20575
This theorem was proved from axioms:  ax-1 7  ax-2 8  ax-3 9  ax-mp 10  ax-gen 1534  ax-5 1545  ax-17 1604  ax-9 1637  ax-8 1645  ax-13 1687  ax-14 1689  ax-6 1704  ax-7 1709  ax-11 1716  ax-12 1867  ax-ext 2265  ax-rep 4132  ax-sep 4142  ax-nul 4150  ax-pow 4187  ax-pr 4213  ax-un 4511  ax-cnex 8788  ax-resscn 8789  ax-1cn 8790  ax-icn 8791  ax-addcl 8792  ax-addrcl 8793  ax-mulcl 8794  ax-mulrcl 8795  ax-mulcom 8796  ax-addass 8797  ax-mulass 8798  ax-distr 8799  ax-i2m1 8800  ax-1ne0 8801  ax-1rid 8802  ax-rnegex 8803  ax-rrecex 8804  ax-cnre 8805  ax-pre-lttri 8806  ax-pre-lttrn 8807  ax-pre-ltadd 8808  ax-pre-mulgt0 8809  ax-pre-sup 8810
This theorem depends on definitions:  df-bi 179  df-or 361  df-an 362  df-3or 937  df-3an 938  df-tru 1312  df-ex 1530  df-nf 1533  df-sb 1632  df-eu 2148  df-mo 2149  df-clab 2271  df-cleq 2277  df-clel 2280  df-nfc 2409  df-ne 2449  df-nel 2450  df-ral 2549  df-rex 2550  df-reu 2551  df-rmo 2552  df-rab 2553  df-v 2791  df-sbc 2993  df-csb 3083  df-dif 3156  df-un 3158  df-in 3160  df-ss 3167  df-pss 3169  df-nul 3457  df-if 3567  df-pw 3628  df-sn 3647  df-pr 3648  df-tp 3649  df-op 3650  df-uni 3829  df-int 3864  df-iun 3908  df-br 4025  df-opab 4079  df-mpt 4080  df-tr 4115  df-eprel 4304  df-id 4308  df-po 4313  df-so 4314  df-fr 4351  df-we 4353  df-ord 4394  df-on 4395  df-lim 4396  df-suc 4397  df-om 4656  df-xp 4694  df-rel 4695  df-cnv 4696  df-co 4697  df-dm 4698  df-rn 4699  df-res 4700  df-ima 4701  df-fun 5223  df-fn 5224  df-f 5225  df-f1 5226  df-fo 5227  df-f1o 5228  df-fv 5229  df-ov 5822  df-oprab 5823  df-mpt2 5824  df-1st 6083  df-2nd 6084  df-iota 6252  df-riota 6299  df-recs 6383  df-rdg 6418  df-1o 6474  df-oadd 6478  df-er 6655  df-map 6769  df-en 6859  df-dom 6860  df-sdom 6861  df-fin 6862  df-sup 7189  df-card 7567  df-pnf 8864  df-mnf 8865  df-xr 8866  df-ltxr 8867  df-le 8868  df-sub 9034  df-neg 9035  df-div 9419  df-nn 9742  df-2 9799  df-3 9800  df-n0 9961  df-z 10020  df-uz 10226  df-rp 10350  df-fz 10777  df-fzo 10865  df-fl 10919  df-mod 10968  df-seq 11041  df-exp 11099  df-hash 11332  df-cj 11578  df-re 11579  df-im 11580  df-sqr 11714  df-abs 11715  df-dvds 12526  df-gcd 12680  df-phi 12828
  Copyright terms: Public domain W3C validator