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

Theorem ppidif 23554
Description: The difference of the prime-counting function π at two points counts the number of primes in an interval. (Contributed by Mario Carneiro, 21-Sep-2014.)
Assertion
Ref Expression
ppidif  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (π `  N )  -  (π `  M ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )

Proof of Theorem ppidif
StepHypRef Expression
1 eluzelz 11010 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ZZ )
2 eluzel2 11006 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ZZ )
3 2z 10813 . . . . . . 7  |-  2  e.  ZZ
4 ifcl 3899 . . . . . . 7  |-  ( ( M  e.  ZZ  /\  2  e.  ZZ )  ->  if ( M  <_ 
2 ,  M , 
2 )  e.  ZZ )
52, 3, 4sylancl 660 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  e.  ZZ )
63a1i 11 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ZZ )
72zred 10884 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  RR )
8 2re 10522 . . . . . . 7  |-  2  e.  RR
9 min2 11311 . . . . . . 7  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  2
)
107, 8, 9sylancl 660 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_ 
2 )
11 eluz2 11007 . . . . . 6  |-  ( 2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) )  <->  ( if ( M  <_  2 ,  M ,  2 )  e.  ZZ  /\  2  e.  ZZ  /\  if ( M  <_  2 ,  M ,  2 )  <_  2 ) )
125, 6, 10, 11syl3anbrc 1178 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
13 ppival2g 23520 . . . . 5  |-  ( ( N  e.  ZZ  /\  2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )  ->  (π `  N )  =  (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i 
Prime ) ) )
141, 12, 13syl2anc 659 . . . 4  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i 
Prime ) ) )
15 min1 11310 . . . . . . . . . . 11  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  M
)
167, 8, 15sylancl 660 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_  M )
17 eluz2 11007 . . . . . . . . . 10  |-  ( M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) )  <->  ( if ( M  <_  2 ,  M ,  2 )  e.  ZZ  /\  M  e.  ZZ  /\  if ( M  <_  2 ,  M ,  2 )  <_  M ) )
185, 2, 16, 17syl3anbrc 1178 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
19 id 22 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ( ZZ>= `  M )
)
20 elfzuzb 11603 . . . . . . . . 9  |-  ( M  e.  ( if ( M  <_  2 ,  M ,  2 ) ... N )  <->  ( M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) )  /\  N  e.  (
ZZ>= `  M ) ) )
2118, 19, 20sylanbrc 662 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ( if ( M  <_ 
2 ,  M , 
2 ) ... N
) )
22 fzsplit 11632 . . . . . . . 8  |-  ( M  e.  ( if ( M  <_  2 ,  M ,  2 ) ... N )  -> 
( if ( M  <_  2 ,  M ,  2 ) ... N )  =  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  u.  (
( M  +  1 ) ... N ) ) )
2321, 22syl 16 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( if ( M  <_  2 ,  M ,  2 ) ... N )  =  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  u.  ( ( M  + 
1 ) ... N
) ) )
2423ineq1d 3613 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( ( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i 
Prime )  =  (
( ( if ( M  <_  2 ,  M ,  2 ) ... M )  u.  ( ( M  + 
1 ) ... N
) )  i^i  Prime ) )
25 indir 3671 . . . . . 6  |-  ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  u.  (
( M  +  1 ) ... N ) )  i^i  Prime )  =  ( ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  u.  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )
2624, 25syl6eq 2439 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( ( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i 
Prime )  =  (
( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  u.  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )
2726fveq2d 5778 . . . 4  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( # `  (
( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i  Prime ) )  =  ( # `  ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  u.  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) ) )
287ltp1d 10392 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  <  ( M  +  1 ) )
29 fzdisj 11633 . . . . . . . 8  |-  ( M  <  ( M  + 
1 )  ->  (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  =  (/) )
3028, 29syl 16 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  ( ( M  + 
1 ) ... N
) )  =  (/) )
3130ineq1d 3613 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  i^i  Prime )  =  ( (/)  i^i  Prime ) )
32 inindir 3630 . . . . . 6  |-  ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  i^i  Prime )  =  ( ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  i^i  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )
33 incom 3605 . . . . . . 7  |-  ( (/)  i^i 
Prime )  =  ( Prime  i^i  (/) )
34 in0 3738 . . . . . . 7  |-  ( Prime  i^i  (/) )  =  (/)
3533, 34eqtri 2411 . . . . . 6  |-  ( (/)  i^i 
Prime )  =  (/)
3631, 32, 353eqtr3g 2446 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime )  i^i  ( ( ( M  +  1 ) ... N )  i^i 
Prime ) )  =  (/) )
37 fzfi 11985 . . . . . . 7  |-  ( if ( M  <_  2 ,  M ,  2 ) ... M )  e. 
Fin
38 inss1 3632 . . . . . . 7  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  C_  ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)
39 ssfi 7656 . . . . . . 7  |-  ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  e.  Fin  /\  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  C_  ( if ( M  <_  2 ,  M ,  2 ) ... M ) )  ->  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  e.  Fin )
4037, 38, 39mp2an 670 . . . . . 6  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  e. 
Fin
41 fzfi 11985 . . . . . . 7  |-  ( ( M  +  1 ) ... N )  e. 
Fin
42 inss1 3632 . . . . . . 7  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  C_  (
( M  +  1 ) ... N )
43 ssfi 7656 . . . . . . 7  |-  ( ( ( ( M  + 
1 ) ... N
)  e.  Fin  /\  ( ( ( M  +  1 ) ... N )  i^i  Prime ) 
C_  ( ( M  +  1 ) ... N ) )  -> 
( ( ( M  +  1 ) ... N )  i^i  Prime )  e.  Fin )
4441, 42, 43mp2an 670 . . . . . 6  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  e.  Fin
45 hashun 12353 . . . . . 6  |-  ( ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  e.  Fin  /\  ( ( ( M  +  1 ) ... N )  i^i  Prime )  e.  Fin  /\  (
( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  i^i  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) )  =  (/) )  ->  ( # `
 ( ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  u.  ( ( ( M  +  1 ) ... N )  i^i  Prime ) ) )  =  ( ( # `  (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime ) )  +  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) ) ) )
4640, 44, 45mp3an12 1312 . . . . 5  |-  ( ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  i^i  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) )  =  (/)  ->  ( # `  ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  u.  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )  =  ( (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) ) )
4736, 46syl 16 . . . 4  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( # `  (
( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime )  u.  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )  =  ( (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) ) )
4814, 27, 473eqtrd 2427 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) ) )
49 ppival2g 23520 . . . 4  |-  ( ( M  e.  ZZ  /\  2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )  ->  (π `  M )  =  (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) ) )
502, 12, 49syl2anc 659 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  M
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) ) )
5148, 50oveq12d 6214 . 2  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (π `  N )  -  (π `  M ) )  =  ( ( ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) )  -  ( # `  (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime ) ) ) )
52 hashcl 12330 . . . . 5  |-  ( ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime )  e.  Fin  ->  ( # `
 ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  NN0 )
5340, 52ax-mp 5 . . . 4  |-  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  NN0
5453nn0cni 10724 . . 3  |-  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  CC
55 hashcl 12330 . . . . 5  |-  ( ( ( ( M  + 
1 ) ... N
)  i^i  Prime )  e. 
Fin  ->  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) )  e.  NN0 )
5644, 55ax-mp 5 . . . 4  |-  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  NN0
5756nn0cni 10724 . . 3  |-  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  CC
58 pncan2 9740 . . 3  |-  ( ( ( # `  (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime ) )  e.  CC  /\  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  CC )  ->  (
( ( # `  (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime ) )  +  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) ) )  -  ( # `
 ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )
5954, 57, 58mp2an 670 . 2  |-  ( ( ( # `  (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime ) )  +  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) ) )  -  ( # `
 ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) )
6051, 59syl6eq 2439 1  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (π `  N )  -  (π `  M ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    = wceq 1399    e. wcel 1826    u. cun 3387    i^i cin 3388    C_ wss 3389   (/)c0 3711   ifcif 3857   class class class wbr 4367   ` cfv 5496  (class class class)co 6196   Fincfn 7435   CCcc 9401   RRcr 9402   1c1 9404    + caddc 9406    < clt 9539    <_ cle 9540    - cmin 9718   2c2 10502   NN0cn0 10712   ZZcz 10781   ZZ>=cuz 11001   ...cfz 11593   #chash 12307   Primecprime 14219  πcppi 23484
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1626  ax-4 1639  ax-5 1712  ax-6 1755  ax-7 1798  ax-8 1828  ax-9 1830  ax-10 1845  ax-11 1850  ax-12 1862  ax-13 2006  ax-ext 2360  ax-rep 4478  ax-sep 4488  ax-nul 4496  ax-pow 4543  ax-pr 4601  ax-un 6491  ax-cnex 9459  ax-resscn 9460  ax-1cn 9461  ax-icn 9462  ax-addcl 9463  ax-addrcl 9464  ax-mulcl 9465  ax-mulrcl 9466  ax-mulcom 9467  ax-addass 9468  ax-mulass 9469  ax-distr 9470  ax-i2m1 9471  ax-1ne0 9472  ax-1rid 9473  ax-rnegex 9474  ax-rrecex 9475  ax-cnre 9476  ax-pre-lttri 9477  ax-pre-lttrn 9478  ax-pre-ltadd 9479  ax-pre-mulgt0 9480  ax-pre-sup 9481
This theorem depends on definitions:  df-bi 185  df-or 368  df-an 369  df-3or 972  df-3an 973  df-tru 1402  df-ex 1621  df-nf 1625  df-sb 1748  df-eu 2222  df-mo 2223  df-clab 2368  df-cleq 2374  df-clel 2377  df-nfc 2532  df-ne 2579  df-nel 2580  df-ral 2737  df-rex 2738  df-reu 2739  df-rmo 2740  df-rab 2741  df-v 3036  df-sbc 3253  df-csb 3349  df-dif 3392  df-un 3394  df-in 3396  df-ss 3403  df-pss 3405  df-nul 3712  df-if 3858  df-pw 3929  df-sn 3945  df-pr 3947  df-tp 3949  df-op 3951  df-uni 4164  df-int 4200  df-iun 4245  df-br 4368  df-opab 4426  df-mpt 4427  df-tr 4461  df-eprel 4705  df-id 4709  df-po 4714  df-so 4715  df-fr 4752  df-we 4754  df-ord 4795  df-on 4796  df-lim 4797  df-suc 4798  df-xp 4919  df-rel 4920  df-cnv 4921  df-co 4922  df-dm 4923  df-rn 4924  df-res 4925  df-ima 4926  df-iota 5460  df-fun 5498  df-fn 5499  df-f 5500  df-f1 5501  df-fo 5502  df-f1o 5503  df-fv 5504  df-riota 6158  df-ov 6199  df-oprab 6200  df-mpt2 6201  df-om 6600  df-1st 6699  df-2nd 6700  df-recs 6960  df-rdg 6994  df-1o 7048  df-2o 7049  df-oadd 7052  df-er 7229  df-en 7436  df-dom 7437  df-sdom 7438  df-fin 7439  df-sup 7816  df-card 8233  df-cda 8461  df-pnf 9541  df-mnf 9542  df-xr 9543  df-ltxr 9544  df-le 9545  df-sub 9720  df-neg 9721  df-nn 10453  df-2 10511  df-n0 10713  df-z 10782  df-uz 11002  df-icc 11457  df-fz 11594  df-fl 11828  df-hash 12308  df-dvds 13989  df-prm 14220  df-ppi 23490
This theorem is referenced by:  ppiub  23596  chtppilimlem1  23775
  Copyright terms: Public domain W3C validator