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

Theorem ppidif 23158
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 11080 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ZZ )
2 eluzel2 11076 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ZZ )
3 2z 10885 . . . . . . 7  |-  2  e.  ZZ
4 ifcl 3974 . . . . . . 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 10955 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  RR )
8 2re 10594 . . . . . . 7  |-  2  e.  RR
9 min2 11379 . . . . . . 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 11077 . . . . . 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 1175 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
13 ppival2g 23124 . . . . 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 11378 . . . . . . . . . . 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 11077 . . . . . . . . . 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 1175 . . . . . . . . 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 11671 . . . . . . . . 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 11700 . . . . . . . 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 3692 . . . . . 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 3739 . . . . . 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 2517 . . . . 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 5861 . . . 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 10465 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  <  ( M  +  1 ) )
29 fzdisj 11701 . . . . . . . 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 3692 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  i^i  Prime )  =  ( (/)  i^i  Prime ) )
32 inindir 3709 . . . . . 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 3684 . . . . . . 7  |-  ( (/)  i^i 
Prime )  =  ( Prime  i^i  (/) )
34 in0 3804 . . . . . . 7  |-  ( Prime  i^i  (/) )  =  (/)
3533, 34eqtri 2489 . . . . . 6  |-  ( (/)  i^i 
Prime )  =  (/)
3631, 32, 353eqtr3g 2524 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime )  i^i  ( ( ( M  +  1 ) ... N )  i^i 
Prime ) )  =  (/) )
37 fzfi 12038 . . . . . . 7  |-  ( if ( M  <_  2 ,  M ,  2 ) ... M )  e. 
Fin
38 inss1 3711 . . . . . . 7  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  C_  ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)
39 ssfi 7730 . . . . . . 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 12038 . . . . . . 7  |-  ( ( M  +  1 ) ... N )  e. 
Fin
42 inss1 3711 . . . . . . 7  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  C_  (
( M  +  1 ) ... N )
43 ssfi 7730 . . . . . . 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 12405 . . . . . 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 1309 . . . . 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 2505 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) ) )
49 ppival2g 23124 . . . 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 6293 . 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 12383 . . . . 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 10796 . . 3  |-  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  CC
55 hashcl 12383 . . . . 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 10796 . . 3  |-  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  CC
58 pncan2 9816 . . 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 2517 1  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (π `  N )  -  (π `  M ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    = wceq 1374    e. wcel 1762    u. cun 3467    i^i cin 3468    C_ wss 3469   (/)c0 3778   ifcif 3932   class class class wbr 4440   ` cfv 5579  (class class class)co 6275   Fincfn 7506   CCcc 9479   RRcr 9480   1c1 9482    + caddc 9484    < clt 9617    <_ cle 9618    - cmin 9794   2c2 10574   NN0cn0 10784   ZZcz 10853   ZZ>=cuz 11071   ...cfz 11661   #chash 12360   Primecprime 14065  πcppi 23088
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1596  ax-4 1607  ax-5 1675  ax-6 1714  ax-7 1734  ax-8 1764  ax-9 1766  ax-10 1781  ax-11 1786  ax-12 1798  ax-13 1961  ax-ext 2438  ax-rep 4551  ax-sep 4561  ax-nul 4569  ax-pow 4618  ax-pr 4679  ax-un 6567  ax-cnex 9537  ax-resscn 9538  ax-1cn 9539  ax-icn 9540  ax-addcl 9541  ax-addrcl 9542  ax-mulcl 9543  ax-mulrcl 9544  ax-mulcom 9545  ax-addass 9546  ax-mulass 9547  ax-distr 9548  ax-i2m1 9549  ax-1ne0 9550  ax-1rid 9551  ax-rnegex 9552  ax-rrecex 9553  ax-cnre 9554  ax-pre-lttri 9555  ax-pre-lttrn 9556  ax-pre-ltadd 9557  ax-pre-mulgt0 9558  ax-pre-sup 9559
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 969  df-3an 970  df-tru 1377  df-ex 1592  df-nf 1595  df-sb 1707  df-eu 2272  df-mo 2273  df-clab 2446  df-cleq 2452  df-clel 2455  df-nfc 2610  df-ne 2657  df-nel 2658  df-ral 2812  df-rex 2813  df-reu 2814  df-rmo 2815  df-rab 2816  df-v 3108  df-sbc 3325  df-csb 3429  df-dif 3472  df-un 3474  df-in 3476  df-ss 3483  df-pss 3485  df-nul 3779  df-if 3933  df-pw 4005  df-sn 4021  df-pr 4023  df-tp 4025  df-op 4027  df-uni 4239  df-int 4276  df-iun 4320  df-br 4441  df-opab 4499  df-mpt 4500  df-tr 4534  df-eprel 4784  df-id 4788  df-po 4793  df-so 4794  df-fr 4831  df-we 4833  df-ord 4874  df-on 4875  df-lim 4876  df-suc 4877  df-xp 4998  df-rel 4999  df-cnv 5000  df-co 5001  df-dm 5002  df-rn 5003  df-res 5004  df-ima 5005  df-iota 5542  df-fun 5581  df-fn 5582  df-f 5583  df-f1 5584  df-fo 5585  df-f1o 5586  df-fv 5587  df-riota 6236  df-ov 6278  df-oprab 6279  df-mpt2 6280  df-om 6672  df-1st 6774  df-2nd 6775  df-recs 7032  df-rdg 7066  df-1o 7120  df-2o 7121  df-oadd 7124  df-er 7301  df-en 7507  df-dom 7508  df-sdom 7509  df-fin 7510  df-sup 7890  df-card 8309  df-cda 8537  df-pnf 9619  df-mnf 9620  df-xr 9621  df-ltxr 9622  df-le 9623  df-sub 9796  df-neg 9797  df-nn 10526  df-2 10583  df-n0 10785  df-z 10854  df-uz 11072  df-icc 11525  df-fz 11662  df-fl 11886  df-hash 12361  df-dvds 13837  df-prm 14066  df-ppi 23094
This theorem is referenced by:  ppiub  23200  chtppilimlem1  23379
  Copyright terms: Public domain W3C validator