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

Theorem dfphi2 12858
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 10310 . 2  |-  ( N  e.  NN  <->  ( N  =  1  \/  N  e.  ( ZZ>= `  2 )
) )
2 phi1 12857 . . . . 5  |-  ( phi `  1 )  =  1
3 0z 10051 . . . . . 6  |-  0  e.  ZZ
4 hashsng 11372 . . . . . 6  |-  ( 0  e.  ZZ  ->  ( # `
 { 0 } )  =  1 )
53, 4ax-mp 8 . . . . 5  |-  ( # `  { 0 } )  =  1
6 rabid2 2730 . . . . . . 7  |-  ( { 0 }  =  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 }  <->  A. x  e.  { 0 }  (
x  gcd  1 )  =  1 )
7 elsni 3677 . . . . . . . . 9  |-  ( x  e.  { 0 }  ->  x  =  0 )
87oveq1d 5889 . . . . . . . 8  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  ( 0  gcd  1 ) )
9 gcd1 12727 . . . . . . . . 9  |-  ( 0  e.  ZZ  ->  (
0  gcd  1 )  =  1 )
103, 9ax-mp 8 . . . . . . . 8  |-  ( 0  gcd  1 )  =  1
118, 10syl6eq 2344 . . . . . . 7  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  1 )
126, 11mprgbir 2626 . . . . . 6  |-  { 0 }  =  { x  e.  { 0 }  | 
( x  gcd  1
)  =  1 }
1312fveq2i 5544 . . . . 5  |-  ( # `  { 0 } )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
142, 5, 133eqtr2i 2322 . . . 4  |-  ( phi `  1 )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
15 fveq2 5541 . . . 4  |-  ( N  =  1  ->  ( phi `  N )  =  ( phi `  1
) )
16 oveq2 5882 . . . . . . 7  |-  ( N  =  1  ->  (
0..^ N )  =  ( 0..^ 1 ) )
17 fzo01 10929 . . . . . . 7  |-  ( 0..^ 1 )  =  {
0 }
1816, 17syl6eq 2344 . . . . . 6  |-  ( N  =  1  ->  (
0..^ N )  =  { 0 } )
19 oveq2 5882 . . . . . . 7  |-  ( N  =  1  ->  (
x  gcd  N )  =  ( x  gcd  1 ) )
2019eqeq1d 2304 . . . . . 6  |-  ( N  =  1  ->  (
( x  gcd  N
)  =  1  <->  (
x  gcd  1 )  =  1 ) )
2118, 20rabeqbidv 2796 . . . . 5  |-  ( N  =  1  ->  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  =  { x  e. 
{ 0 }  | 
( x  gcd  1
)  =  1 } )
2221fveq2d 5545 . . . 4  |-  ( N  =  1  ->  ( # `
 { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )  =  ( # `  { x  e.  {
0 }  |  ( x  gcd  1 )  =  1 } ) )
2314, 15, 223eqtr4a 2354 . . 3  |-  ( N  =  1  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
24 eluz2b3 10307 . . . . . 6  |-  ( N  e.  ( ZZ>= `  2
)  <->  ( N  e.  NN  /\  N  =/=  1 ) )
2524simplbi 446 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN )
26 phival 12851 . . . . 5  |-  ( N  e.  NN  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } ) )
2725, 26syl 15 . . . 4  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( phi `  N )  =  (
# `  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 } ) )
28 fzossfz 10908 . . . . . . . . . . 11  |-  ( 1..^ N )  C_  (
1 ... N )
2928a1i 10 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  C_  (
1 ... N ) )
30 sseqin2 3401 . . . . . . . . . 10  |-  ( ( 1..^ N )  C_  ( 1 ... N
)  <->  ( ( 1 ... N )  i^i  ( 1..^ N ) )  =  ( 1..^ N ) )
3129, 30sylib 188 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( (
1 ... N )  i^i  ( 1..^ N ) )  =  ( 1..^ N ) )
32 1nn0 9997 . . . . . . . . . . . 12  |-  1  e.  NN0
33 nn0uz 10278 . . . . . . . . . . . 12  |-  NN0  =  ( ZZ>= `  0 )
3432, 33eleqtri 2368 . . . . . . . . . . 11  |-  1  e.  ( ZZ>= `  0 )
35 fzoss1 10912 . . . . . . . . . . 11  |-  ( 1  e.  ( ZZ>= `  0
)  ->  ( 1..^ N )  C_  (
0..^ N ) )
3634, 35ax-mp 8 . . . . . . . . . 10  |-  ( 1..^ N )  C_  (
0..^ N )
37 sseqin2 3401 . . . . . . . . . 10  |-  ( ( 1..^ N )  C_  ( 0..^ N )  <->  ( (
0..^ N )  i^i  ( 1..^ N ) )  =  ( 1..^ N ) )
3836, 37mpbi 199 . . . . . . . . 9  |-  ( ( 0..^ N )  i^i  ( 1..^ N ) )  =  ( 1..^ N )
3931, 38syl6eqr 2346 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( (
1 ... N )  i^i  ( 1..^ N ) )  =  ( ( 0..^ N )  i^i  ( 1..^ N ) ) )
40 rabeq 2795 . . . . . . . 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 15 . . . . . . 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 3454 . . . . . . 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 3454 . . . . . . 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 2353 . . . . . 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 12854 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1 ... ( N  - 
1 ) ) )
46 eluzelz 10254 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  ZZ )
47 fzoval 10892 . . . . . . . . 9  |-  ( N  e.  ZZ  ->  (
1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4846, 47syl 15 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4945, 48sseqtr4d 3228 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1..^ N ) )
50 df-ss 3179 . . . . . . 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 188 . . . . . 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 12718 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ZZ  ->  (
0  gcd  N )  =  ( abs `  N
) )
5346, 52syl 15 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  ( abs `  N
) )
54 eluzelre 10255 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  RR )
5525nnnn0d 10034 . . . . . . . . . . . . . . . . 17  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN0 )
5655nn0ge0d 10037 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  0  <_  N )
5754, 56absidd 11921 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( abs `  N )  =  N )
5853, 57eqtrd 2328 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  N )
5924simprbi 450 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  =/=  1 )
6058, 59eqnetrd 2477 . . . . . . . . . . . . 13  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =/=  1 )
6160adantr 451 . . . . . . . . . . . 12  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( 0  gcd  N )  =/=  1 )
627oveq1d 5889 . . . . . . . . . . . . . 14  |-  ( x  e.  { 0 }  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6362, 17eleq2s 2388 . . . . . . . . . . . . 13  |-  ( x  e.  ( 0..^ 1 )  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6463neeq1d 2472 . . . . . . . . . . . 12  |-  ( x  e.  ( 0..^ 1 )  ->  ( (
x  gcd  N )  =/=  1  <->  ( 0  gcd 
N )  =/=  1
) )
6561, 64syl5ibrcom 213 . . . . . . . . . . 11  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( x  e.  ( 0..^ 1 )  ->  ( x  gcd  N )  =/=  1 ) )
6665necon2bd 2508 . . . . . . . . . 10  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( (
x  gcd  N )  =  1  ->  -.  x  e.  ( 0..^ 1 ) ) )
67 simpr 447 . . . . . . . . . . . 12  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  x  e.  ( 0..^ N ) )
68 1z 10069 . . . . . . . . . . . 12  |-  1  e.  ZZ
69 fzospliti 10914 . . . . . . . . . . . 12  |-  ( ( x  e.  ( 0..^ N )  /\  1  e.  ZZ )  ->  (
x  e.  ( 0..^ 1 )  \/  x  e.  ( 1..^ N ) ) )
7067, 68, 69sylancl 643 . . . . . . . . . . 11  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( x  e.  ( 0..^ 1 )  \/  x  e.  ( 1..^ N ) ) )
7170ord 366 . . . . . . . . . 10  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( -.  x  e.  ( 0..^ 1 )  ->  x  e.  ( 1..^ N ) ) )
7266, 71syld 40 . . . . . . . . 9  |-  ( ( N  e.  ( ZZ>= ` 
2 )  /\  x  e.  ( 0..^ N ) )  ->  ( (
x  gcd  N )  =  1  ->  x  e.  ( 1..^ N ) ) )
7372ralrimiva 2639 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  A. x  e.  ( 0..^ N ) ( ( x  gcd  N )  =  1  ->  x  e.  ( 1..^ N ) ) )
74 rabss 3263 . . . . . . . 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 203 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } 
C_  ( 1..^ N ) )
76 df-ss 3179 . . . . . . 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 188 . . . . . 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 2336 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  =  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )
7978fveq2d 5545 . . . 4  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( # `  {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } )  =  ( # `  { x  e.  ( 0..^ N )  |  ( x  gcd  N
)  =  1 } ) )
8027, 79eqtrd 2328 . . 3  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( phi `  N )  =  (
# `  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
8123, 80jaoi 368 . 2  |-  ( ( N  =  1  \/  N  e.  ( ZZ>= ` 
2 ) )  -> 
( phi `  N
)  =  ( # `  { x  e.  ( 0..^ N )  |  ( x  gcd  N
)  =  1 } ) )
821, 81sylbi 187 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 357    /\ wa 358    = wceq 1632    e. wcel 1696    =/= wne 2459   A.wral 2556   {crab 2560    i^i cin 3164    C_ wss 3165   {csn 3653   ` cfv 5271  (class class class)co 5874   0cc0 8753   1c1 8754    - cmin 9053   NNcn 9762   2c2 9811   NN0cn0 9981   ZZcz 10040   ZZ>=cuz 10246   ...cfz 10798  ..^cfzo 10886   #chash 11353   abscabs 11735    gcd cgcd 12701   phicphi 12848
This theorem is referenced by:  phimullem  12863  eulerth  12867  odngen  14904  znunithash  16534  hashgcdeq  27620
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1536  ax-5 1547  ax-17 1606  ax-9 1644  ax-8 1661  ax-13 1698  ax-14 1700  ax-6 1715  ax-7 1720  ax-11 1727  ax-12 1878  ax-ext 2277  ax-sep 4157  ax-nul 4165  ax-pow 4204  ax-pr 4230  ax-un 4528  ax-cnex 8809  ax-resscn 8810  ax-1cn 8811  ax-icn 8812  ax-addcl 8813  ax-addrcl 8814  ax-mulcl 8815  ax-mulrcl 8816  ax-mulcom 8817  ax-addass 8818  ax-mulass 8819  ax-distr 8820  ax-i2m1 8821  ax-1ne0 8822  ax-1rid 8823  ax-rnegex 8824  ax-rrecex 8825  ax-cnre 8826  ax-pre-lttri 8827  ax-pre-lttrn 8828  ax-pre-ltadd 8829  ax-pre-mulgt0 8830  ax-pre-sup 8831
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3or 935  df-3an 936  df-tru 1310  df-ex 1532  df-nf 1535  df-sb 1639  df-eu 2160  df-mo 2161  df-clab 2283  df-cleq 2289  df-clel 2292  df-nfc 2421  df-ne 2461  df-nel 2462  df-ral 2561  df-rex 2562  df-reu 2563  df-rmo 2564  df-rab 2565  df-v 2803  df-sbc 3005  df-csb 3095  df-dif 3168  df-un 3170  df-in 3172  df-ss 3179  df-pss 3181  df-nul 3469  df-if 3579  df-pw 3640  df-sn 3659  df-pr 3660  df-tp 3661  df-op 3662  df-uni 3844  df-int 3879  df-iun 3923  df-br 4040  df-opab 4094  df-mpt 4095  df-tr 4130  df-eprel 4321  df-id 4325  df-po 4330  df-so 4331  df-fr 4368  df-we 4370  df-ord 4411  df-on 4412  df-lim 4413  df-suc 4414  df-om 4673  df-xp 4711  df-rel 4712  df-cnv 4713  df-co 4714  df-dm 4715  df-rn 4716  df-res 4717  df-ima 4718  df-iota 5235  df-fun 5273  df-fn 5274  df-f 5275  df-f1 5276  df-fo 5277  df-f1o 5278  df-fv 5279  df-ov 5877  df-oprab 5878  df-mpt2 5879  df-1st 6138  df-2nd 6139  df-riota 6320  df-recs 6404  df-rdg 6439  df-1o 6495  df-oadd 6499  df-er 6676  df-en 6880  df-dom 6881  df-sdom 6882  df-fin 6883  df-sup 7210  df-card 7588  df-pnf 8885  df-mnf 8886  df-xr 8887  df-ltxr 8888  df-le 8889  df-sub 9055  df-neg 9056  df-div 9440  df-nn 9763  df-2 9820  df-3 9821  df-n0 9982  df-z 10041  df-uz 10247  df-rp 10371  df-fz 10799  df-fzo 10887  df-seq 11063  df-exp 11121  df-hash 11354  df-cj 11600  df-re 11601  df-im 11602  df-sqr 11736  df-abs 11737  df-dvds 12548  df-gcd 12702  df-phi 12850
  Copyright terms: Public domain W3C validator