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

Theorem dfphi2 13083
Description: Alternate definition of the Euler  phi function. (Contributed by Mario Carneiro, 23-Feb-2014.) (Revised by Mario Carneiro, 2-May-2016.)
Assertion
Ref Expression
dfphi2  |-  ( N  e.  NN  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
Distinct variable group:    x, N

Proof of Theorem dfphi2
StepHypRef Expression
1 elnn1uz2 10477 . 2  |-  ( N  e.  NN  <->  ( N  =  1  \/  N  e.  ( ZZ>= `  2 )
) )
2 phi1 13082 . . . . 5  |-  ( phi `  1 )  =  1
3 0z 10218 . . . . . 6  |-  0  e.  ZZ
4 hashsng 11567 . . . . . 6  |-  ( 0  e.  ZZ  ->  ( # `
 { 0 } )  =  1 )
53, 4ax-mp 8 . . . . 5  |-  ( # `  { 0 } )  =  1
6 rabid2 2821 . . . . . . 7  |-  ( { 0 }  =  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 }  <->  A. x  e.  { 0 }  (
x  gcd  1 )  =  1 )
7 elsni 3774 . . . . . . . . 9  |-  ( x  e.  { 0 }  ->  x  =  0 )
87oveq1d 6028 . . . . . . . 8  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  ( 0  gcd  1 ) )
9 gcd1 12952 . . . . . . . . 9  |-  ( 0  e.  ZZ  ->  (
0  gcd  1 )  =  1 )
103, 9ax-mp 8 . . . . . . . 8  |-  ( 0  gcd  1 )  =  1
118, 10syl6eq 2428 . . . . . . 7  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  1 )
126, 11mprgbir 2712 . . . . . 6  |-  { 0 }  =  { x  e.  { 0 }  | 
( x  gcd  1
)  =  1 }
1312fveq2i 5664 . . . . 5  |-  ( # `  { 0 } )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
142, 5, 133eqtr2i 2406 . . . 4  |-  ( phi `  1 )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
15 fveq2 5661 . . . 4  |-  ( N  =  1  ->  ( phi `  N )  =  ( phi `  1
) )
16 oveq2 6021 . . . . . . 7  |-  ( N  =  1  ->  (
0..^ N )  =  ( 0..^ 1 ) )
17 fzo01 11103 . . . . . . 7  |-  ( 0..^ 1 )  =  {
0 }
1816, 17syl6eq 2428 . . . . . 6  |-  ( N  =  1  ->  (
0..^ N )  =  { 0 } )
19 oveq2 6021 . . . . . . 7  |-  ( N  =  1  ->  (
x  gcd  N )  =  ( x  gcd  1 ) )
2019eqeq1d 2388 . . . . . 6  |-  ( N  =  1  ->  (
( x  gcd  N
)  =  1  <->  (
x  gcd  1 )  =  1 ) )
2118, 20rabeqbidv 2887 . . . . 5  |-  ( N  =  1  ->  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  =  { x  e. 
{ 0 }  | 
( x  gcd  1
)  =  1 } )
2221fveq2d 5665 . . . 4  |-  ( N  =  1  ->  ( # `
 { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )  =  ( # `  { x  e.  {
0 }  |  ( x  gcd  1 )  =  1 } ) )
2314, 15, 223eqtr4a 2438 . . 3  |-  ( N  =  1  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
24 eluz2b3 10474 . . . . . 6  |-  ( N  e.  ( ZZ>= `  2
)  <->  ( N  e.  NN  /\  N  =/=  1 ) )
2524simplbi 447 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN )
26 phival 13076 . . . . 5  |-  ( N  e.  NN  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } ) )
2725, 26syl 16 . . . 4  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( phi `  N )  =  (
# `  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 } ) )
28 fzossfz 11080 . . . . . . . . . . 11  |-  ( 1..^ N )  C_  (
1 ... N )
2928a1i 11 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  C_  (
1 ... N ) )
30 sseqin2 3496 . . . . . . . . . 10  |-  ( ( 1..^ N )  C_  ( 1 ... N
)  <->  ( ( 1 ... N )  i^i  ( 1..^ N ) )  =  ( 1..^ N ) )
3129, 30sylib 189 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( (
1 ... N )  i^i  ( 1..^ N ) )  =  ( 1..^ N ) )
32 1nn0 10162 . . . . . . . . . . . 12  |-  1  e.  NN0
33 nn0uz 10445 . . . . . . . . . . . 12  |-  NN0  =  ( ZZ>= `  0 )
3432, 33eleqtri 2452 . . . . . . . . . . 11  |-  1  e.  ( ZZ>= `  0 )
35 fzoss1 11085 . . . . . . . . . . 11  |-  ( 1  e.  ( ZZ>= `  0
)  ->  ( 1..^ N )  C_  (
0..^ N ) )
3634, 35ax-mp 8 . . . . . . . . . 10  |-  ( 1..^ N )  C_  (
0..^ N )
37 sseqin2 3496 . . . . . . . . . 10  |-  ( ( 1..^ N )  C_  ( 0..^ N )  <->  ( (
0..^ N )  i^i  ( 1..^ N ) )  =  ( 1..^ N ) )
3836, 37mpbi 200 . . . . . . . . 9  |-  ( ( 0..^ N )  i^i  ( 1..^ N ) )  =  ( 1..^ N )
3931, 38syl6eqr 2430 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( (
1 ... N )  i^i  ( 1..^ N ) )  =  ( ( 0..^ N )  i^i  ( 1..^ N ) ) )
40 rabeq 2886 . . . . . . . 8  |-  ( ( ( 1 ... N
)  i^i  ( 1..^ N ) )  =  ( ( 0..^ N )  i^i  ( 1..^ N ) )  ->  { x  e.  (
( 1 ... N
)  i^i  ( 1..^ N ) )  |  ( x  gcd  N
)  =  1 }  =  { x  e.  ( ( 0..^ N )  i^i  ( 1..^ N ) )  |  ( x  gcd  N
)  =  1 } )
4139, 40syl 16 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( ( 1 ... N )  i^i  (
1..^ N ) )  |  ( x  gcd  N )  =  1 }  =  { x  e.  ( ( 0..^ N )  i^i  ( 1..^ N ) )  |  ( x  gcd  N
)  =  1 } )
42 inrab2 3550 . . . . . . 7  |-  ( { x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 }  i^i  ( 1..^ N ) )  =  {
x  e.  ( ( 1 ... N )  i^i  ( 1..^ N ) )  |  ( x  gcd  N )  =  1 }
43 inrab2 3550 . . . . . . 7  |-  ( { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  i^i  ( 1..^ N ) )  =  { x  e.  ( ( 0..^ N )  i^i  ( 1..^ N ) )  |  ( x  gcd  N
)  =  1 }
4441, 42, 433eqtr4g 2437 . . . . . 6  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 }  i^i  ( 1..^ N ) )  =  ( { x  e.  ( 0..^ N )  |  ( x  gcd  N
)  =  1 }  i^i  ( 1..^ N ) ) )
45 phibndlem 13079 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1 ... ( N  - 
1 ) ) )
46 eluzelz 10421 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  ZZ )
47 fzoval 11064 . . . . . . . . 9  |-  ( N  e.  ZZ  ->  (
1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4846, 47syl 16 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4945, 48sseqtr4d 3321 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1..^ N ) )
50 df-ss 3270 . . . . . . 7  |-  ( { x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } 
C_  ( 1..^ N )  <->  ( { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  i^i  (
1..^ N ) )  =  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 } )
5149, 50sylib 189 . . . . . 6  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 }  i^i  ( 1..^ N ) )  =  {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } )
52 gcd0id 12943 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ZZ  ->  (
0  gcd  N )  =  ( abs `  N
) )
5346, 52syl 16 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  ( abs `  N
) )
54 eluzelre 10422 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  RR )
5525nnnn0d 10199 . . . . . . . . . . . . . . . . 17  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN0 )
5655nn0ge0d 10202 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  0  <_  N )
5754, 56absidd 12145 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( abs `  N )  =  N )
5853, 57eqtrd 2412 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  N )
5924simprbi 451 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  =/=  1 )
6058, 59eqnetrd 2561 . . . . . . . . . . . . 13  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =/=  1 )
6160adantr 452 . . . . . . . . . . . 12  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( 0  gcd  N )  =/=  1 )
627oveq1d 6028 . . . . . . . . . . . . . 14  |-  ( x  e.  { 0 }  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6362, 17eleq2s 2472 . . . . . . . . . . . . 13  |-  ( x  e.  ( 0..^ 1 )  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6463neeq1d 2556 . . . . . . . . . . . 12  |-  ( x  e.  ( 0..^ 1 )  ->  ( (
x  gcd  N )  =/=  1  <->  ( 0  gcd 
N )  =/=  1
) )
6561, 64syl5ibrcom 214 . . . . . . . . . . 11  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( x  e.  ( 0..^ 1 )  ->  ( x  gcd  N )  =/=  1 ) )
6665necon2bd 2592 . . . . . . . . . 10  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( (
x  gcd  N )  =  1  ->  -.  x  e.  ( 0..^ 1 ) ) )
67 simpr 448 . . . . . . . . . . . 12  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  x  e.  ( 0..^ N ) )
68 1z 10236 . . . . . . . . . . . 12  |-  1  e.  ZZ
69 fzospliti 11088 . . . . . . . . . . . 12  |-  ( ( x  e.  ( 0..^ N )  /\  1  e.  ZZ )  ->  (
x  e.  ( 0..^ 1 )  \/  x  e.  ( 1..^ N ) ) )
7067, 68, 69sylancl 644 . . . . . . . . . . 11  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( x  e.  ( 0..^ 1 )  \/  x  e.  ( 1..^ N ) ) )
7170ord 367 . . . . . . . . . 10  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( -.  x  e.  ( 0..^ 1 )  ->  x  e.  ( 1..^ N ) ) )
7266, 71syld 42 . . . . . . . . 9  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( (
x  gcd  N )  =  1  ->  x  e.  ( 1..^ N ) ) )
7372ralrimiva 2725 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  A. x  e.  ( 0..^ N ) ( ( x  gcd  N )  =  1  ->  x  e.  ( 1..^ N ) ) )
74 rabss 3356 . . . . . . . 8  |-  ( { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  C_  ( 1..^ N )  <->  A. x  e.  ( 0..^ N ) ( ( x  gcd  N )  =  1  ->  x  e.  ( 1..^ N ) ) )
7573, 74sylibr 204 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } 
C_  ( 1..^ N ) )
76 df-ss 3270 . . . . . . 7  |-  ( { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  C_  ( 1..^ N )  <->  ( {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  i^i  ( 1..^ N ) )  =  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )
7775, 76sylib 189 . . . . . 6  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  i^i  ( 1..^ N ) )  =  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )
7844, 51, 773eqtr3d 2420 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  =  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )
7978fveq2d 5665 . . . 4  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( # `  {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } )  =  ( # `  { x  e.  ( 0..^ N )  |  ( x  gcd  N
)  =  1 } ) )
8027, 79eqtrd 2412 . . 3  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( phi `  N )  =  (
# `  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
8123, 80jaoi 369 . 2  |-  ( ( N  =  1  \/  N  e.  ( ZZ>= ` 
2 ) )  -> 
( phi `  N
)  =  ( # `  { x  e.  ( 0..^ N )  |  ( x  gcd  N
)  =  1 } ) )
821, 81sylbi 188 1  |-  ( N  e.  NN  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    \/ wo 358    /\ wa 359    = wceq 1649    e. wcel 1717    =/= wne 2543   A.wral 2642   {crab 2646    i^i cin 3255    C_ wss 3256   {csn 3750   ` cfv 5387  (class class class)co 6013   0cc0 8916   1c1 8917    - cmin 9216   NNcn 9925   2c2 9974   NN0cn0 10146   ZZcz 10207   ZZ>=cuz 10413   ...cfz 10968  ..^cfzo 11058   #chash 11538   abscabs 11959    gcd cgcd 12926   phicphi 13073
This theorem is referenced by:  phimullem  13088  eulerth  13092  odngen  15131  znunithash  16761  hashgcdeq  27179
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1552  ax-5 1563  ax-17 1623  ax-9 1661  ax-8 1682  ax-13 1719  ax-14 1721  ax-6 1736  ax-7 1741  ax-11 1753  ax-12 1939  ax-ext 2361  ax-sep 4264  ax-nul 4272  ax-pow 4311  ax-pr 4337  ax-un 4634  ax-cnex 8972  ax-resscn 8973  ax-1cn 8974  ax-icn 8975  ax-addcl 8976  ax-addrcl 8977  ax-mulcl 8978  ax-mulrcl 8979  ax-mulcom 8980  ax-addass 8981  ax-mulass 8982  ax-distr 8983  ax-i2m1 8984  ax-1ne0 8985  ax-1rid 8986  ax-rnegex 8987  ax-rrecex 8988  ax-cnre 8989  ax-pre-lttri 8990  ax-pre-lttrn 8991  ax-pre-ltadd 8992  ax-pre-mulgt0 8993  ax-pre-sup 8994
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3or 937  df-3an 938  df-tru 1325  df-ex 1548  df-nf 1551  df-sb 1656  df-eu 2235  df-mo 2236  df-clab 2367  df-cleq 2373  df-clel 2376  df-nfc 2505  df-ne 2545  df-nel 2546  df-ral 2647  df-rex 2648  df-reu 2649  df-rmo 2650  df-rab 2651  df-v 2894  df-sbc 3098  df-csb 3188  df-dif 3259  df-un 3261  df-in 3263  df-ss 3270  df-pss 3272  df-nul 3565  df-if 3676  df-pw 3737  df-sn 3756  df-pr 3757  df-tp 3758  df-op 3759  df-uni 3951  df-int 3986  df-iun 4030  df-br 4147  df-opab 4201  df-mpt 4202  df-tr 4237  df-eprel 4428  df-id 4432  df-po 4437  df-so 4438  df-fr 4475  df-we 4477  df-ord 4518  df-on 4519  df-lim 4520  df-suc 4521  df-om 4779  df-xp 4817  df-rel 4818  df-cnv 4819  df-co 4820  df-dm 4821  df-rn 4822  df-res 4823  df-ima 4824  df-iota 5351  df-fun 5389  df-fn 5390  df-f 5391  df-f1 5392  df-fo 5393  df-f1o 5394  df-fv 5395  df-ov 6016  df-oprab 6017  df-mpt2 6018  df-1st 6281  df-2nd 6282  df-riota 6478  df-recs 6562  df-rdg 6597  df-1o 6653  df-oadd 6657  df-er 6834  df-en 7039  df-dom 7040  df-sdom 7041  df-fin 7042  df-sup 7374  df-card 7752  df-pnf 9048  df-mnf 9049  df-xr 9050  df-ltxr 9051  df-le 9052  df-sub 9218  df-neg 9219  df-div 9603  df-nn 9926  df-2 9983  df-3 9984  df-n0 10147  df-z 10208  df-uz 10414  df-rp 10538  df-fz 10969  df-fzo 11059  df-seq 11244  df-exp 11303  df-hash 11539  df-cj 11824  df-re 11825  df-im 11826  df-sqr 11960  df-abs 11961  df-dvds 12773  df-gcd 12927  df-phi 13075
  Copyright terms: Public domain W3C validator