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

Theorem dfphi2 13155
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 10544 . 2  |-  ( N  e.  NN  <->  ( N  =  1  \/  N  e.  ( ZZ>= `  2 )
) )
2 phi1 13154 . . . . 5  |-  ( phi `  1 )  =  1
3 0z 10285 . . . . . 6  |-  0  e.  ZZ
4 hashsng 11639 . . . . . 6  |-  ( 0  e.  ZZ  ->  ( # `
 { 0 } )  =  1 )
53, 4ax-mp 8 . . . . 5  |-  ( # `  { 0 } )  =  1
6 rabid2 2877 . . . . . . 7  |-  ( { 0 }  =  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 }  <->  A. x  e.  { 0 }  (
x  gcd  1 )  =  1 )
7 elsni 3830 . . . . . . . . 9  |-  ( x  e.  { 0 }  ->  x  =  0 )
87oveq1d 6088 . . . . . . . 8  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  ( 0  gcd  1 ) )
9 gcd1 13024 . . . . . . . . 9  |-  ( 0  e.  ZZ  ->  (
0  gcd  1 )  =  1 )
103, 9ax-mp 8 . . . . . . . 8  |-  ( 0  gcd  1 )  =  1
118, 10syl6eq 2483 . . . . . . 7  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  1 )
126, 11mprgbir 2768 . . . . . 6  |-  { 0 }  =  { x  e.  { 0 }  | 
( x  gcd  1
)  =  1 }
1312fveq2i 5723 . . . . 5  |-  ( # `  { 0 } )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
142, 5, 133eqtr2i 2461 . . . 4  |-  ( phi `  1 )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
15 fveq2 5720 . . . 4  |-  ( N  =  1  ->  ( phi `  N )  =  ( phi `  1
) )
16 oveq2 6081 . . . . . . 7  |-  ( N  =  1  ->  (
0..^ N )  =  ( 0..^ 1 ) )
17 fzo01 11174 . . . . . . 7  |-  ( 0..^ 1 )  =  {
0 }
1816, 17syl6eq 2483 . . . . . 6  |-  ( N  =  1  ->  (
0..^ N )  =  { 0 } )
19 oveq2 6081 . . . . . . 7  |-  ( N  =  1  ->  (
x  gcd  N )  =  ( x  gcd  1 ) )
2019eqeq1d 2443 . . . . . 6  |-  ( N  =  1  ->  (
( x  gcd  N
)  =  1  <->  (
x  gcd  1 )  =  1 ) )
2118, 20rabeqbidv 2943 . . . . 5  |-  ( N  =  1  ->  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  =  { x  e. 
{ 0 }  | 
( x  gcd  1
)  =  1 } )
2221fveq2d 5724 . . . 4  |-  ( N  =  1  ->  ( # `
 { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )  =  ( # `  { x  e.  {
0 }  |  ( x  gcd  1 )  =  1 } ) )
2314, 15, 223eqtr4a 2493 . . 3  |-  ( N  =  1  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
24 eluz2b3 10541 . . . . . 6  |-  ( N  e.  ( ZZ>= `  2
)  <->  ( N  e.  NN  /\  N  =/=  1 ) )
2524simplbi 447 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN )
26 phival 13148 . . . . 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 11149 . . . . . . . . . . 11  |-  ( 1..^ N )  C_  (
1 ... N )
2928a1i 11 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  C_  (
1 ... N ) )
30 sseqin2 3552 . . . . . . . . . 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 10229 . . . . . . . . . . . 12  |-  1  e.  NN0
33 nn0uz 10512 . . . . . . . . . . . 12  |-  NN0  =  ( ZZ>= `  0 )
3432, 33eleqtri 2507 . . . . . . . . . . 11  |-  1  e.  ( ZZ>= `  0 )
35 fzoss1 11154 . . . . . . . . . . 11  |-  ( 1  e.  ( ZZ>= `  0
)  ->  ( 1..^ N )  C_  (
0..^ N ) )
3634, 35ax-mp 8 . . . . . . . . . 10  |-  ( 1..^ N )  C_  (
0..^ N )
37 sseqin2 3552 . . . . . . . . . 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 2485 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( (
1 ... N )  i^i  ( 1..^ N ) )  =  ( ( 0..^ N )  i^i  ( 1..^ N ) ) )
40 rabeq 2942 . . . . . . . 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 3606 . . . . . . 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 3606 . . . . . . 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 2492 . . . . . 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 13151 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1 ... ( N  - 
1 ) ) )
46 eluzelz 10488 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  ZZ )
47 fzoval 11133 . . . . . . . . 9  |-  ( N  e.  ZZ  ->  (
1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4846, 47syl 16 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4945, 48sseqtr4d 3377 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1..^ N ) )
50 df-ss 3326 . . . . . . 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 13015 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ZZ  ->  (
0  gcd  N )  =  ( abs `  N
) )
5346, 52syl 16 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  ( abs `  N
) )
54 eluzelre 10489 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  RR )
5525nnnn0d 10266 . . . . . . . . . . . . . . . . 17  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN0 )
5655nn0ge0d 10269 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  0  <_  N )
5754, 56absidd 12217 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( abs `  N )  =  N )
5853, 57eqtrd 2467 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  N )
5924simprbi 451 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  =/=  1 )
6058, 59eqnetrd 2616 . . . . . . . . . . . . 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 6088 . . . . . . . . . . . . . 14  |-  ( x  e.  { 0 }  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6362, 17eleq2s 2527 . . . . . . . . . . . . 13  |-  ( x  e.  ( 0..^ 1 )  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6463neeq1d 2611 . . . . . . . . . . . 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 2647 . . . . . . . . . 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 10303 . . . . . . . . . . . 12  |-  1  e.  ZZ
69 fzospliti 11157 . . . . . . . . . . . 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 2781 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  A. x  e.  ( 0..^ N ) ( ( x  gcd  N )  =  1  ->  x  e.  ( 1..^ N ) ) )
74 rabss 3412 . . . . . . . 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 3326 . . . . . . 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 2475 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  =  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )
7978fveq2d 5724 . . . 4  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( # `  {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } )  =  ( # `  { x  e.  ( 0..^ N )  |  ( x  gcd  N
)  =  1 } ) )
8027, 79eqtrd 2467 . . 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 1652    e. wcel 1725    =/= wne 2598   A.wral 2697   {crab 2701    i^i cin 3311    C_ wss 3312   {csn 3806   ` cfv 5446  (class class class)co 6073   0cc0 8982   1c1 8983    - cmin 9283   NNcn 9992   2c2 10041   NN0cn0 10213   ZZcz 10274   ZZ>=cuz 10480   ...cfz 11035  ..^cfzo 11127   #chash 11610   abscabs 12031    gcd cgcd 12998   phicphi 13145
This theorem is referenced by:  phimullem  13160  eulerth  13164  odngen  15203  znunithash  16837  hashgcdeq  27485
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1555  ax-5 1566  ax-17 1626  ax-9 1666  ax-8 1687  ax-13 1727  ax-14 1729  ax-6 1744  ax-7 1749  ax-11 1761  ax-12 1950  ax-ext 2416  ax-sep 4322  ax-nul 4330  ax-pow 4369  ax-pr 4395  ax-un 4693  ax-cnex 9038  ax-resscn 9039  ax-1cn 9040  ax-icn 9041  ax-addcl 9042  ax-addrcl 9043  ax-mulcl 9044  ax-mulrcl 9045  ax-mulcom 9046  ax-addass 9047  ax-mulass 9048  ax-distr 9049  ax-i2m1 9050  ax-1ne0 9051  ax-1rid 9052  ax-rnegex 9053  ax-rrecex 9054  ax-cnre 9055  ax-pre-lttri 9056  ax-pre-lttrn 9057  ax-pre-ltadd 9058  ax-pre-mulgt0 9059  ax-pre-sup 9060
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3or 937  df-3an 938  df-tru 1328  df-ex 1551  df-nf 1554  df-sb 1659  df-eu 2284  df-mo 2285  df-clab 2422  df-cleq 2428  df-clel 2431  df-nfc 2560  df-ne 2600  df-nel 2601  df-ral 2702  df-rex 2703  df-reu 2704  df-rmo 2705  df-rab 2706  df-v 2950  df-sbc 3154  df-csb 3244  df-dif 3315  df-un 3317  df-in 3319  df-ss 3326  df-pss 3328  df-nul 3621  df-if 3732  df-pw 3793  df-sn 3812  df-pr 3813  df-tp 3814  df-op 3815  df-uni 4008  df-int 4043  df-iun 4087  df-br 4205  df-opab 4259  df-mpt 4260  df-tr 4295  df-eprel 4486  df-id 4490  df-po 4495  df-so 4496  df-fr 4533  df-we 4535  df-ord 4576  df-on 4577  df-lim 4578  df-suc 4579  df-om 4838  df-xp 4876  df-rel 4877  df-cnv 4878  df-co 4879  df-dm 4880  df-rn 4881  df-res 4882  df-ima 4883  df-iota 5410  df-fun 5448  df-fn 5449  df-f 5450  df-f1 5451  df-fo 5452  df-f1o 5453  df-fv 5454  df-ov 6076  df-oprab 6077  df-mpt2 6078  df-1st 6341  df-2nd 6342  df-riota 6541  df-recs 6625  df-rdg 6660  df-1o 6716  df-oadd 6720  df-er 6897  df-en 7102  df-dom 7103  df-sdom 7104  df-fin 7105  df-sup 7438  df-card 7818  df-pnf 9114  df-mnf 9115  df-xr 9116  df-ltxr 9117  df-le 9118  df-sub 9285  df-neg 9286  df-div 9670  df-nn 9993  df-2 10050  df-3 10051  df-n0 10214  df-z 10275  df-uz 10481  df-rp 10605  df-fz 11036  df-fzo 11128  df-seq 11316  df-exp 11375  df-hash 11611  df-cj 11896  df-re 11897  df-im 11898  df-sqr 12032  df-abs 12033  df-dvds 12845  df-gcd 12999  df-phi 13147
  Copyright terms: Public domain W3C validator