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

Theorem ppidif 20507
Description: The difference of the prime pi 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 10327 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ZZ )
2 eluzel2 10324 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ZZ )
3 2z 10143 . . . . . . 7  |-  2  e.  ZZ
4 ifcl 3677 . . . . . . 7  |-  ( ( M  e.  ZZ  /\  2  e.  ZZ )  ->  if ( M  <_ 
2 ,  M , 
2 )  e.  ZZ )
52, 3, 4sylancl 643 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  e.  ZZ )
63a1i 10 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ZZ )
72zred 10206 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  RR )
8 2re 9902 . . . . . . 7  |-  2  e.  RR
9 min2 10607 . . . . . . 7  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  2
)
107, 8, 9sylancl 643 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_ 
2 )
11 eluz2 10325 . . . . . 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 1136 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
13 ppival2g 20473 . . . . 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 642 . . . 4  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i 
Prime ) ) )
15 min1 10606 . . . . . . . . . . 11  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  M
)
167, 8, 15sylancl 643 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_  M )
17 eluz2 10325 . . . . . . . . . 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 1136 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
19 id 19 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ( ZZ>= `  M )
)
20 elfzuzb 10881 . . . . . . . . 9  |-  ( M  e.  ( if ( M  <_  2 ,  M ,  2 ) ... N )  <->  ( M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) )  /\  N  e.  (
ZZ>= `  M ) ) )
2118, 19, 20sylanbrc 645 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ( if ( M  <_ 
2 ,  M , 
2 ) ... N
) )
22 fzsplit 10905 . . . . . . . 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 15 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( if ( M  <_  2 ,  M ,  2 ) ... N )  =  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  u.  ( ( M  + 
1 ) ... N
) ) )
2423ineq1d 3445 . . . . . 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 3493 . . . . . 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 2406 . . . . 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 5609 . . . 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 9774 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  <  ( M  +  1 ) )
29 fzdisj 10906 . . . . . . . 8  |-  ( M  <  ( M  + 
1 )  ->  (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  =  (/) )
3028, 29syl 15 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  ( ( M  + 
1 ) ... N
) )  =  (/) )
3130ineq1d 3445 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  i^i  Prime )  =  ( (/)  i^i  Prime ) )
32 inindir 3463 . . . . . 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 3437 . . . . . . 7  |-  ( (/)  i^i 
Prime )  =  ( Prime  i^i  (/) )
34 in0 3556 . . . . . . 7  |-  ( Prime  i^i  (/) )  =  (/)
3533, 34eqtri 2378 . . . . . 6  |-  ( (/)  i^i 
Prime )  =  (/)
3631, 32, 353eqtr3g 2413 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime )  i^i  ( ( ( M  +  1 ) ... N )  i^i 
Prime ) )  =  (/) )
37 fzfi 11123 . . . . . . 7  |-  ( if ( M  <_  2 ,  M ,  2 ) ... M )  e. 
Fin
38 inss1 3465 . . . . . . 7  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  C_  ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)
39 ssfi 7168 . . . . . . 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 653 . . . . . 6  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  e. 
Fin
41 fzfi 11123 . . . . . . 7  |-  ( ( M  +  1 ) ... N )  e. 
Fin
42 inss1 3465 . . . . . . 7  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  C_  (
( M  +  1 ) ... N )
43 ssfi 7168 . . . . . . 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 653 . . . . . 6  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  e.  Fin
45 hashun 11454 . . . . . 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 1267 . . . . 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 15 . . . 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 2394 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) ) )
49 ppival2g 20473 . . . 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 642 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  M
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) ) )
5148, 50oveq12d 5960 . 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 11440 . . . . 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 8 . . . 4  |-  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  NN0
5453nn0cni 10066 . . 3  |-  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  CC
55 hashcl 11440 . . . . 5  |-  ( ( ( ( M  + 
1 ) ... N
)  i^i  Prime )  e. 
Fin  ->  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) )  e.  NN0 )
5644, 55ax-mp 8 . . . 4  |-  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  NN0
5756nn0cni 10066 . . 3  |-  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  CC
58 pncan2 9145 . . 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 653 . 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 2406 1  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (π `  N )  -  (π `  M ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )
Colors of variables: wff set class
Syntax hints:    -> wi 4    = wceq 1642    e. wcel 1710    u. cun 3226    i^i cin 3227    C_ wss 3228   (/)c0 3531   ifcif 3641   class class class wbr 4102   ` cfv 5334  (class class class)co 5942   Fincfn 6948   CCcc 8822   RRcr 8823   1c1 8825    + caddc 8827    < clt 8954    <_ cle 8955    - cmin 9124   2c2 9882   NN0cn0 10054   ZZcz 10113   ZZ>=cuz 10319   ...cfz 10871   #chash 11427   Primecprime 12849  πcppi 20437
This theorem is referenced by:  ppiub  20549  chtppilimlem1  20728
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1546  ax-5 1557  ax-17 1616  ax-9 1654  ax-8 1675  ax-13 1712  ax-14 1714  ax-6 1729  ax-7 1734  ax-11 1746  ax-12 1930  ax-ext 2339  ax-rep 4210  ax-sep 4220  ax-nul 4228  ax-pow 4267  ax-pr 4293  ax-un 4591  ax-cnex 8880  ax-resscn 8881  ax-1cn 8882  ax-icn 8883  ax-addcl 8884  ax-addrcl 8885  ax-mulcl 8886  ax-mulrcl 8887  ax-mulcom 8888  ax-addass 8889  ax-mulass 8890  ax-distr 8891  ax-i2m1 8892  ax-1ne0 8893  ax-1rid 8894  ax-rnegex 8895  ax-rrecex 8896  ax-cnre 8897  ax-pre-lttri 8898  ax-pre-lttrn 8899  ax-pre-ltadd 8900  ax-pre-mulgt0 8901  ax-pre-sup 8902
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3or 935  df-3an 936  df-tru 1319  df-ex 1542  df-nf 1545  df-sb 1649  df-eu 2213  df-mo 2214  df-clab 2345  df-cleq 2351  df-clel 2354  df-nfc 2483  df-ne 2523  df-nel 2524  df-ral 2624  df-rex 2625  df-reu 2626  df-rmo 2627  df-rab 2628  df-v 2866  df-sbc 3068  df-csb 3158  df-dif 3231  df-un 3233  df-in 3235  df-ss 3242  df-pss 3244  df-nul 3532  df-if 3642  df-pw 3703  df-sn 3722  df-pr 3723  df-tp 3724  df-op 3725  df-uni 3907  df-int 3942  df-iun 3986  df-br 4103  df-opab 4157  df-mpt 4158  df-tr 4193  df-eprel 4384  df-id 4388  df-po 4393  df-so 4394  df-fr 4431  df-we 4433  df-ord 4474  df-on 4475  df-lim 4476  df-suc 4477  df-om 4736  df-xp 4774  df-rel 4775  df-cnv 4776  df-co 4777  df-dm 4778  df-rn 4779  df-res 4780  df-ima 4781  df-iota 5298  df-fun 5336  df-fn 5337  df-f 5338  df-f1 5339  df-fo 5340  df-f1o 5341  df-fv 5342  df-ov 5945  df-oprab 5946  df-mpt2 5947  df-1st 6206  df-2nd 6207  df-riota 6388  df-recs 6472  df-rdg 6507  df-1o 6563  df-2o 6564  df-oadd 6567  df-er 6744  df-en 6949  df-dom 6950  df-sdom 6951  df-fin 6952  df-sup 7281  df-card 7659  df-cda 7881  df-pnf 8956  df-mnf 8957  df-xr 8958  df-ltxr 8959  df-le 8960  df-sub 9126  df-neg 9127  df-nn 9834  df-2 9891  df-n0 10055  df-z 10114  df-uz 10320  df-icc 10752  df-fz 10872  df-fl 11014  df-hash 11428  df-dvds 12623  df-prm 12850  df-ppi 20443
  Copyright terms: Public domain W3C validator