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

Theorem ppidif 22481
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 10862 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ZZ )
2 eluzel2 10858 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ZZ )
3 2z 10670 . . . . . . 7  |-  2  e.  ZZ
4 ifcl 3826 . . . . . . 7  |-  ( ( M  e.  ZZ  /\  2  e.  ZZ )  ->  if ( M  <_ 
2 ,  M , 
2 )  e.  ZZ )
52, 3, 4sylancl 662 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  e.  ZZ )
63a1i 11 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ZZ )
72zred 10739 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  RR )
8 2re 10383 . . . . . . 7  |-  2  e.  RR
9 min2 11153 . . . . . . 7  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  2
)
107, 8, 9sylancl 662 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_ 
2 )
11 eluz2 10859 . . . . . 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 1172 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
13 ppival2g 22447 . . . . 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 661 . . . 4  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i 
Prime ) ) )
15 min1 11152 . . . . . . . . . . 11  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  M
)
167, 8, 15sylancl 662 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_  M )
17 eluz2 10859 . . . . . . . . . 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 1172 . . . . . . . . 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 11439 . . . . . . . . 9  |-  ( M  e.  ( if ( M  <_  2 ,  M ,  2 ) ... N )  <->  ( M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) )  /\  N  e.  (
ZZ>= `  M ) ) )
2118, 19, 20sylanbrc 664 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ( if ( M  <_ 
2 ,  M , 
2 ) ... N
) )
22 fzsplit 11467 . . . . . . . 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 3546 . . . . . 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 3593 . . . . . 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 2486 . . . . 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 5690 . . . 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 10255 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  <  ( M  +  1 ) )
29 fzdisj 11468 . . . . . . . 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 3546 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  i^i  Prime )  =  ( (/)  i^i  Prime ) )
32 inindir 3563 . . . . . 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 3538 . . . . . . 7  |-  ( (/)  i^i 
Prime )  =  ( Prime  i^i  (/) )
34 in0 3658 . . . . . . 7  |-  ( Prime  i^i  (/) )  =  (/)
3533, 34eqtri 2458 . . . . . 6  |-  ( (/)  i^i 
Prime )  =  (/)
3631, 32, 353eqtr3g 2493 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime )  i^i  ( ( ( M  +  1 ) ... N )  i^i 
Prime ) )  =  (/) )
37 fzfi 11786 . . . . . . 7  |-  ( if ( M  <_  2 ,  M ,  2 ) ... M )  e. 
Fin
38 inss1 3565 . . . . . . 7  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  C_  ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)
39 ssfi 7525 . . . . . . 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 672 . . . . . 6  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  e. 
Fin
41 fzfi 11786 . . . . . . 7  |-  ( ( M  +  1 ) ... N )  e. 
Fin
42 inss1 3565 . . . . . . 7  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  C_  (
( M  +  1 ) ... N )
43 ssfi 7525 . . . . . . 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 672 . . . . . 6  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  e.  Fin
45 hashun 12137 . . . . . 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 1304 . . . . 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 2474 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) ) )
49 ppival2g 22447 . . . 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 661 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  M
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) ) )
5148, 50oveq12d 6104 . 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 12118 . . . . 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 10583 . . 3  |-  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  CC
55 hashcl 12118 . . . . 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 10583 . . 3  |-  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  CC
58 pncan2 9609 . . 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 672 . 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 2486 1  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (π `  N )  -  (π `  M ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    = wceq 1369    e. wcel 1756    u. cun 3321    i^i cin 3322    C_ wss 3323   (/)c0 3632   ifcif 3786   class class class wbr 4287   ` cfv 5413  (class class class)co 6086   Fincfn 7302   CCcc 9272   RRcr 9273   1c1 9275    + caddc 9277    < clt 9410    <_ cle 9411    - cmin 9587   2c2 10363   NN0cn0 10571   ZZcz 10638   ZZ>=cuz 10853   ...cfz 11429   #chash 12095   Primecprime 13755  πcppi 22411
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1591  ax-4 1602  ax-5 1670  ax-6 1708  ax-7 1728  ax-8 1758  ax-9 1760  ax-10 1775  ax-11 1780  ax-12 1792  ax-13 1943  ax-ext 2419  ax-rep 4398  ax-sep 4408  ax-nul 4416  ax-pow 4465  ax-pr 4526  ax-un 6367  ax-cnex 9330  ax-resscn 9331  ax-1cn 9332  ax-icn 9333  ax-addcl 9334  ax-addrcl 9335  ax-mulcl 9336  ax-mulrcl 9337  ax-mulcom 9338  ax-addass 9339  ax-mulass 9340  ax-distr 9341  ax-i2m1 9342  ax-1ne0 9343  ax-1rid 9344  ax-rnegex 9345  ax-rrecex 9346  ax-cnre 9347  ax-pre-lttri 9348  ax-pre-lttrn 9349  ax-pre-ltadd 9350  ax-pre-mulgt0 9351  ax-pre-sup 9352
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 966  df-3an 967  df-tru 1372  df-ex 1587  df-nf 1590  df-sb 1701  df-eu 2256  df-mo 2257  df-clab 2425  df-cleq 2431  df-clel 2434  df-nfc 2563  df-ne 2603  df-nel 2604  df-ral 2715  df-rex 2716  df-reu 2717  df-rmo 2718  df-rab 2719  df-v 2969  df-sbc 3182  df-csb 3284  df-dif 3326  df-un 3328  df-in 3330  df-ss 3337  df-pss 3339  df-nul 3633  df-if 3787  df-pw 3857  df-sn 3873  df-pr 3875  df-tp 3877  df-op 3879  df-uni 4087  df-int 4124  df-iun 4168  df-br 4288  df-opab 4346  df-mpt 4347  df-tr 4381  df-eprel 4627  df-id 4631  df-po 4636  df-so 4637  df-fr 4674  df-we 4676  df-ord 4717  df-on 4718  df-lim 4719  df-suc 4720  df-xp 4841  df-rel 4842  df-cnv 4843  df-co 4844  df-dm 4845  df-rn 4846  df-res 4847  df-ima 4848  df-iota 5376  df-fun 5415  df-fn 5416  df-f 5417  df-f1 5418  df-fo 5419  df-f1o 5420  df-fv 5421  df-riota 6047  df-ov 6089  df-oprab 6090  df-mpt2 6091  df-om 6472  df-1st 6572  df-2nd 6573  df-recs 6824  df-rdg 6858  df-1o 6912  df-2o 6913  df-oadd 6916  df-er 7093  df-en 7303  df-dom 7304  df-sdom 7305  df-fin 7306  df-sup 7683  df-card 8101  df-cda 8329  df-pnf 9412  df-mnf 9413  df-xr 9414  df-ltxr 9415  df-le 9416  df-sub 9589  df-neg 9590  df-nn 10315  df-2 10372  df-n0 10572  df-z 10639  df-uz 10854  df-icc 11299  df-fz 11430  df-fl 11634  df-hash 12096  df-dvds 13528  df-prm 13756  df-ppi 22417
This theorem is referenced by:  ppiub  22523  chtppilimlem1  22702
  Copyright terms: Public domain W3C validator