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

Theorem dfphi2 12842
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 10294 . 2  |-  ( N  e.  NN  <->  ( N  =  1  \/  N  e.  ( ZZ>= `  2 )
) )
2 phi1 12841 . . . . 5  |-  ( phi `  1 )  =  1
3 0z 10035 . . . . . 6  |-  0  e.  ZZ
4 hashsng 11356 . . . . . 6  |-  ( 0  e.  ZZ  ->  ( # `
 { 0 } )  =  1 )
53, 4ax-mp 8 . . . . 5  |-  ( # `  { 0 } )  =  1
6 rabid2 2717 . . . . . . 7  |-  ( { 0 }  =  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 }  <->  A. x  e.  { 0 }  (
x  gcd  1 )  =  1 )
7 elsni 3664 . . . . . . . . 9  |-  ( x  e.  { 0 }  ->  x  =  0 )
87oveq1d 5873 . . . . . . . 8  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  ( 0  gcd  1 ) )
9 gcd1 12711 . . . . . . . . 9  |-  ( 0  e.  ZZ  ->  (
0  gcd  1 )  =  1 )
103, 9ax-mp 8 . . . . . . . 8  |-  ( 0  gcd  1 )  =  1
118, 10syl6eq 2331 . . . . . . 7  |-  ( x  e.  { 0 }  ->  ( x  gcd  1 )  =  1 )
126, 11mprgbir 2613 . . . . . 6  |-  { 0 }  =  { x  e.  { 0 }  | 
( x  gcd  1
)  =  1 }
1312fveq2i 5528 . . . . 5  |-  ( # `  { 0 } )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
142, 5, 133eqtr2i 2309 . . . 4  |-  ( phi `  1 )  =  ( # `  {
x  e.  { 0 }  |  ( x  gcd  1 )  =  1 } )
15 fveq2 5525 . . . 4  |-  ( N  =  1  ->  ( phi `  N )  =  ( phi `  1
) )
16 oveq2 5866 . . . . . . 7  |-  ( N  =  1  ->  (
0..^ N )  =  ( 0..^ 1 ) )
17 fzo01 10913 . . . . . . 7  |-  ( 0..^ 1 )  =  {
0 }
1816, 17syl6eq 2331 . . . . . 6  |-  ( N  =  1  ->  (
0..^ N )  =  { 0 } )
19 oveq2 5866 . . . . . . 7  |-  ( N  =  1  ->  (
x  gcd  N )  =  ( x  gcd  1 ) )
2019eqeq1d 2291 . . . . . 6  |-  ( N  =  1  ->  (
( x  gcd  N
)  =  1  <->  (
x  gcd  1 )  =  1 ) )
2118, 20rabeqbidv 2783 . . . . 5  |-  ( N  =  1  ->  { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 }  =  { x  e. 
{ 0 }  | 
( x  gcd  1
)  =  1 } )
2221fveq2d 5529 . . . 4  |-  ( N  =  1  ->  ( # `
 { x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )  =  ( # `  { x  e.  {
0 }  |  ( x  gcd  1 )  =  1 } ) )
2314, 15, 223eqtr4a 2341 . . 3  |-  ( N  =  1  ->  ( phi `  N )  =  ( # `  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } ) )
24 eluz2b3 10291 . . . . . 6  |-  ( N  e.  ( ZZ>= `  2
)  <->  ( N  e.  NN  /\  N  =/=  1 ) )
2524simplbi 446 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN )
26 phival 12835 . . . . 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 10892 . . . . . . . . . . 11  |-  ( 1..^ N )  C_  (
1 ... N )
2928a1i 10 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  C_  (
1 ... N ) )
30 sseqin2 3388 . . . . . . . . . 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 9981 . . . . . . . . . . . 12  |-  1  e.  NN0
33 nn0uz 10262 . . . . . . . . . . . 12  |-  NN0  =  ( ZZ>= `  0 )
3432, 33eleqtri 2355 . . . . . . . . . . 11  |-  1  e.  ( ZZ>= `  0 )
35 fzoss1 10896 . . . . . . . . . . 11  |-  ( 1  e.  ( ZZ>= `  0
)  ->  ( 1..^ N )  C_  (
0..^ N ) )
3634, 35ax-mp 8 . . . . . . . . . 10  |-  ( 1..^ N )  C_  (
0..^ N )
37 sseqin2 3388 . . . . . . . . . 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 2333 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( (
1 ... N )  i^i  ( 1..^ N ) )  =  ( ( 0..^ N )  i^i  ( 1..^ N ) ) )
40 rabeq 2782 . . . . . . . 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 3441 . . . . . . 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 3441 . . . . . . 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 2340 . . . . . 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 12838 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1 ... ( N  - 
1 ) ) )
46 eluzelz 10238 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  ZZ )
47 fzoval 10876 . . . . . . . . 9  |-  ( N  e.  ZZ  ->  (
1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4846, 47syl 15 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 1..^ N )  =  ( 1 ... ( N  -  1 ) ) )
4945, 48sseqtr4d 3215 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  C_  (
1..^ N ) )
50 df-ss 3166 . . . . . . 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 12702 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ZZ  ->  (
0  gcd  N )  =  ( abs `  N
) )
5346, 52syl 15 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  ( abs `  N
) )
54 eluzelre 10239 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  RR )
5525nnnn0d 10018 . . . . . . . . . . . . . . . . 17  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  e.  NN0 )
5655nn0ge0d 10021 . . . . . . . . . . . . . . . 16  |-  ( N  e.  ( ZZ>= `  2
)  ->  0  <_  N )
5754, 56absidd 11905 . . . . . . . . . . . . . . 15  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( abs `  N )  =  N )
5853, 57eqtrd 2315 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( 0  gcd  N )  =  N )
5924simprbi 450 . . . . . . . . . . . . . 14  |-  ( N  e.  ( ZZ>= `  2
)  ->  N  =/=  1 )
6058, 59eqnetrd 2464 . . . . . . . . . . . . 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 5873 . . . . . . . . . . . . . 14  |-  ( x  e.  { 0 }  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6362, 17eleq2s 2375 . . . . . . . . . . . . 13  |-  ( x  e.  ( 0..^ 1 )  ->  ( x  gcd  N )  =  ( 0  gcd  N ) )
6463neeq1d 2459 . . . . . . . . . . . 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 2495 . . . . . . . . . 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 10053 . . . . . . . . . . . 12  |-  1  e.  ZZ
69 fzospliti 10898 . . . . . . . . . . . 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 2626 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  2
)  ->  A. x  e.  ( 0..^ N ) ( ( x  gcd  N )  =  1  ->  x  e.  ( 1..^ N ) ) )
74 rabss 3250 . . . . . . . 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 3166 . . . . . . 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 2323 . . . . 5  |-  ( N  e.  ( ZZ>= `  2
)  ->  { x  e.  ( 1 ... N
)  |  ( x  gcd  N )  =  1 }  =  {
x  e.  ( 0..^ N )  |  ( x  gcd  N )  =  1 } )
7978fveq2d 5529 . . . 4  |-  ( N  e.  ( ZZ>= `  2
)  ->  ( # `  {
x  e.  ( 1 ... N )  |  ( x  gcd  N
)  =  1 } )  =  ( # `  { x  e.  ( 0..^ N )  |  ( x  gcd  N
)  =  1 } ) )
8027, 79eqtrd 2315 . . 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 1623    e. wcel 1684    =/= wne 2446   A.wral 2543   {crab 2547    i^i cin 3151    C_ wss 3152   {csn 3640   ` cfv 5255  (class class class)co 5858   0cc0 8737   1c1 8738    - cmin 9037   NNcn 9746   2c2 9795   NN0cn0 9965   ZZcz 10024   ZZ>=cuz 10230   ...cfz 10782  ..^cfzo 10870   #chash 11337   abscabs 11719    gcd cgcd 12685   phicphi 12832
This theorem is referenced by:  phimullem  12847  eulerth  12851  odngen  14888  znunithash  16518  hashgcdeq  26929
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1533  ax-5 1544  ax-17 1603  ax-9 1635  ax-8 1643  ax-13 1686  ax-14 1688  ax-6 1703  ax-7 1708  ax-11 1715  ax-12 1866  ax-ext 2264  ax-sep 4141  ax-nul 4149  ax-pow 4188  ax-pr 4214  ax-un 4512  ax-cnex 8793  ax-resscn 8794  ax-1cn 8795  ax-icn 8796  ax-addcl 8797  ax-addrcl 8798  ax-mulcl 8799  ax-mulrcl 8800  ax-mulcom 8801  ax-addass 8802  ax-mulass 8803  ax-distr 8804  ax-i2m1 8805  ax-1ne0 8806  ax-1rid 8807  ax-rnegex 8808  ax-rrecex 8809  ax-cnre 8810  ax-pre-lttri 8811  ax-pre-lttrn 8812  ax-pre-ltadd 8813  ax-pre-mulgt0 8814  ax-pre-sup 8815
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 1529  df-nf 1532  df-sb 1630  df-eu 2147  df-mo 2148  df-clab 2270  df-cleq 2276  df-clel 2279  df-nfc 2408  df-ne 2448  df-nel 2449  df-ral 2548  df-rex 2549  df-reu 2550  df-rmo 2551  df-rab 2552  df-v 2790  df-sbc 2992  df-csb 3082  df-dif 3155  df-un 3157  df-in 3159  df-ss 3166  df-pss 3168  df-nul 3456  df-if 3566  df-pw 3627  df-sn 3646  df-pr 3647  df-tp 3648  df-op 3649  df-uni 3828  df-int 3863  df-iun 3907  df-br 4024  df-opab 4078  df-mpt 4079  df-tr 4114  df-eprel 4305  df-id 4309  df-po 4314  df-so 4315  df-fr 4352  df-we 4354  df-ord 4395  df-on 4396  df-lim 4397  df-suc 4398  df-om 4657  df-xp 4695  df-rel 4696  df-cnv 4697  df-co 4698  df-dm 4699  df-rn 4700  df-res 4701  df-ima 4702  df-iota 5219  df-fun 5257  df-fn 5258  df-f 5259  df-f1 5260  df-fo 5261  df-f1o 5262  df-fv 5263  df-ov 5861  df-oprab 5862  df-mpt2 5863  df-1st 6122  df-2nd 6123  df-riota 6304  df-recs 6388  df-rdg 6423  df-1o 6479  df-oadd 6483  df-er 6660  df-en 6864  df-dom 6865  df-sdom 6866  df-fin 6867  df-sup 7194  df-card 7572  df-pnf 8869  df-mnf 8870  df-xr 8871  df-ltxr 8872  df-le 8873  df-sub 9039  df-neg 9040  df-div 9424  df-nn 9747  df-2 9804  df-3 9805  df-n0 9966  df-z 10025  df-uz 10231  df-rp 10355  df-fz 10783  df-fzo 10871  df-seq 11047  df-exp 11105  df-hash 11338  df-cj 11584  df-re 11585  df-im 11586  df-sqr 11720  df-abs 11721  df-dvds 12532  df-gcd 12686  df-phi 12834
  Copyright terms: Public domain W3C validator