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

Theorem eulerth 12799
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
) )

Proof of Theorem eulerth
StepHypRef Expression
1 phicl 12785 . . . . . . . 8  |-  ( N  e.  NN  ->  ( phi `  N )  e.  NN )
21nnnn0d 9971 . . . . . . 7  |-  ( N  e.  NN  ->  ( phi `  N )  e. 
NN0 )
3 hashfz1 11297 . . . . . . 7  |-  ( ( phi `  N )  e.  NN0  ->  ( # `  ( 1 ... ( phi `  N ) ) )  =  ( phi `  N ) )
42, 3syl 17 . . . . . 6  |-  ( N  e.  NN  ->  ( # `
 ( 1 ... ( phi `  N
) ) )  =  ( phi `  N
) )
5 dfphi2 12790 . . . . . 6  |-  ( N  e.  NN  ->  ( phi `  N )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } ) )
64, 5eqtrd 2288 . . . . 5  |-  ( N  e.  NN  ->  ( # `
 ( 1 ... ( phi `  N
) ) )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } ) )
763ad2ant1 981 . . . 4  |-  ( ( N  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  N )  =  1 )  ->  ( # `
 ( 1 ... ( phi `  N
) ) )  =  ( # `  {
k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 } ) )
8 fzfi 10986 . . . . 5  |-  ( 1 ... ( phi `  N ) )  e. 
Fin
9 fzofi 10988 . . . . . 6  |-  ( 0..^ N )  e.  Fin
10 ssrab2 3219 . . . . . 6  |-  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  C_  (
0..^ N )
11 ssfi 7037 . . . . . 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 656 . . . . 5  |-  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  e.  Fin
13 hashen 11298 . . . . 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 656 . . . 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 6825 . . 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 5785 . . . . . . 7  |-  ( k  =  y  ->  (
k  gcd  N )  =  ( y  gcd 
N ) )
2019eqeq1d 2264 . . . . . 6  |-  ( k  =  y  ->  (
( k  gcd  N
)  =  1  <->  (
y  gcd  N )  =  1 ) )
2120cbvrabv 2756 . . . . 5  |-  { k  e.  ( 0..^ N )  |  ( k  gcd  N )  =  1 }  =  {
y  e.  ( 0..^ N )  |  ( y  gcd  N )  =  1 }
22 eqid 2256 . . . . 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 5444 . . . . . . . 8  |-  ( k  =  x  ->  (
f `  k )  =  ( f `  x ) )
2524oveq2d 5794 . . . . . . 7  |-  ( k  =  x  ->  ( A  x.  ( f `  k ) )  =  ( A  x.  (
f `  x )
) )
2625oveq1d 5793 . . . . . 6  |-  ( k  =  x  ->  (
( A  x.  (
f `  k )
)  mod  N )  =  ( ( A  x.  ( f `  x ) )  mod 
N ) )
2726cbvmptv 4071 . . . . 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 12798 . . . 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 1933 . 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 939   E.wex 1537    = wceq 1619    e. wcel 1621   {crab 2520    C_ wss 3113   class class class wbr 3983    e. cmpt 4037   -1-1-onto->wf1o 4658   ` cfv 4659  (class class class)co 5778    ~~ cen 6814   Fincfn 6817   0cc0 8691   1c1 8692    x. cmul 8696   NNcn 9700   NN0cn0 9918   ZZcz 9977   ...cfz 10734  ..^cfzo 10822    mod cmo 10925   ^cexp 11056   #chash 11289    gcd cgcd 12633   phicphi 12780
This theorem is referenced by:  fermltl  12800  prmdiv  12801  odzcllem  12805  odzphi  12809  lgslem1  20483  lgsqrlem2  20529
This theorem was proved from axioms:  ax-1 7  ax-2 8  ax-3 9  ax-mp 10  ax-5 1533  ax-6 1534  ax-7 1535  ax-gen 1536  ax-8 1623  ax-11 1624  ax-13 1625  ax-14 1626  ax-17 1628  ax-12o 1664  ax-10 1678  ax-9 1684  ax-4 1692  ax-16 1927  ax-ext 2237  ax-rep 4091  ax-sep 4101  ax-nul 4109  ax-pow 4146  ax-pr 4172  ax-un 4470  ax-cnex 8747  ax-resscn 8748  ax-1cn 8749  ax-icn 8750  ax-addcl 8751  ax-addrcl 8752  ax-mulcl 8753  ax-mulrcl 8754  ax-mulcom 8755  ax-addass 8756  ax-mulass 8757  ax-distr 8758  ax-i2m1 8759  ax-1ne0 8760  ax-1rid 8761  ax-rnegex 8762  ax-rrecex 8763  ax-cnre 8764  ax-pre-lttri 8765  ax-pre-lttrn 8766  ax-pre-ltadd 8767  ax-pre-mulgt0 8768  ax-pre-sup 8769
This theorem depends on definitions:  df-bi 179  df-or 361  df-an 362  df-3or 940  df-3an 941  df-tru 1315  df-ex 1538  df-nf 1540  df-sb 1884  df-eu 2121  df-mo 2122  df-clab 2243  df-cleq 2249  df-clel 2252  df-nfc 2381  df-ne 2421  df-nel 2422  df-ral 2521  df-rex 2522  df-reu 2523  df-rmo 2524  df-rab 2525  df-v 2759  df-sbc 2953  df-csb 3043  df-dif 3116  df-un 3118  df-in 3120  df-ss 3127  df-pss 3129  df-nul 3417  df-if 3526  df-pw 3587  df-sn 3606  df-pr 3607  df-tp 3608  df-op 3609  df-uni 3788  df-int 3823  df-iun 3867  df-br 3984  df-opab 4038  df-mpt 4039  df-tr 4074  df-eprel 4263  df-id 4267  df-po 4272  df-so 4273  df-fr 4310  df-we 4312  df-ord 4353  df-on 4354  df-lim 4355  df-suc 4356  df-om 4615  df-xp 4661  df-rel 4662  df-cnv 4663  df-co 4664  df-dm 4665  df-rn 4666  df-res 4667  df-ima 4668  df-fun 4669  df-fn 4670  df-f 4671  df-f1 4672  df-fo 4673  df-f1o 4674  df-fv 4675  df-ov 5781  df-oprab 5782  df-mpt2 5783  df-1st 6042  df-2nd 6043  df-iota 6211  df-riota 6258  df-recs 6342  df-rdg 6377  df-1o 6433  df-oadd 6437  df-er 6614  df-map 6728  df-en 6818  df-dom 6819  df-sdom 6820  df-fin 6821  df-sup 7148  df-card 7526  df-pnf 8823  df-mnf 8824  df-xr 8825  df-ltxr 8826  df-le 8827  df-sub 8993  df-neg 8994  df-div 9378  df-n 9701  df-2 9758  df-3 9759  df-n0 9919  df-z 9978  df-uz 10184  df-rp 10308  df-fz 10735  df-fzo 10823  df-fl 10877  df-mod 10926  df-seq 10999  df-exp 11057  df-hash 11290  df-cj 11535  df-re 11536  df-im 11537  df-sqr 11671  df-abs 11672  df-divides 12480  df-gcd 12634  df-phi 12782
  Copyright terms: Public domain W3C validator