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

Theorem ppidif 20899
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 10452 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ZZ )
2 eluzel2 10449 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ZZ )
3 2z 10268 . . . . . . 7  |-  2  e.  ZZ
4 ifcl 3735 . . . . . . 7  |-  ( ( M  e.  ZZ  /\  2  e.  ZZ )  ->  if ( M  <_ 
2 ,  M , 
2 )  e.  ZZ )
52, 3, 4sylancl 644 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  e.  ZZ )
63a1i 11 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ZZ )
72zred 10331 . . . . . . 7  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  RR )
8 2re 10025 . . . . . . 7  |-  2  e.  RR
9 min2 10733 . . . . . . 7  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  2
)
107, 8, 9sylancl 644 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_ 
2 )
11 eluz2 10450 . . . . . 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 1138 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  2  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
13 ppival2g 20865 . . . . 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 643 . . . 4  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... N )  i^i 
Prime ) ) )
15 min1 10732 . . . . . . . . . . 11  |-  ( ( M  e.  RR  /\  2  e.  RR )  ->  if ( M  <_ 
2 ,  M , 
2 )  <_  M
)
167, 8, 15sylancl 644 . . . . . . . . . 10  |-  ( N  e.  ( ZZ>= `  M
)  ->  if ( M  <_  2 ,  M ,  2 )  <_  M )
17 eluz2 10450 . . . . . . . . . 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 1138 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) ) )
19 id 20 . . . . . . . . 9  |-  ( N  e.  ( ZZ>= `  M
)  ->  N  e.  ( ZZ>= `  M )
)
20 elfzuzb 11009 . . . . . . . . 9  |-  ( M  e.  ( if ( M  <_  2 ,  M ,  2 ) ... N )  <->  ( M  e.  ( ZZ>= `  if ( M  <_  2 ,  M ,  2 ) )  /\  N  e.  (
ZZ>= `  M ) ) )
2118, 19, 20sylanbrc 646 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  e.  ( if ( M  <_ 
2 ,  M , 
2 ) ... N
) )
22 fzsplit 11033 . . . . . . . 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 3501 . . . . . 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 3549 . . . . . 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 2452 . . . . 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 5691 . . . 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 9897 . . . . . . . 8  |-  ( N  e.  ( ZZ>= `  M
)  ->  M  <  ( M  +  1 ) )
29 fzdisj 11034 . . . . . . . 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 3501 . . . . . 6  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  (
( M  +  1 ) ... N ) )  i^i  Prime )  =  ( (/)  i^i  Prime ) )
32 inindir 3519 . . . . . 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 3493 . . . . . . 7  |-  ( (/)  i^i 
Prime )  =  ( Prime  i^i  (/) )
34 in0 3613 . . . . . . 7  |-  ( Prime  i^i  (/) )  =  (/)
3533, 34eqtri 2424 . . . . . 6  |-  ( (/)  i^i 
Prime )  =  (/)
3631, 32, 353eqtr3g 2459 . . . . 5  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (
( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i  Prime )  i^i  ( ( ( M  +  1 ) ... N )  i^i 
Prime ) )  =  (/) )
37 fzfi 11266 . . . . . . 7  |-  ( if ( M  <_  2 ,  M ,  2 ) ... M )  e. 
Fin
38 inss1 3521 . . . . . . 7  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  C_  ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)
39 ssfi 7288 . . . . . . 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 654 . . . . . 6  |-  ( ( if ( M  <_ 
2 ,  M , 
2 ) ... M
)  i^i  Prime )  e. 
Fin
41 fzfi 11266 . . . . . . 7  |-  ( ( M  +  1 ) ... N )  e. 
Fin
42 inss1 3521 . . . . . . 7  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  C_  (
( M  +  1 ) ... N )
43 ssfi 7288 . . . . . . 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 654 . . . . . 6  |-  ( ( ( M  +  1 ) ... N )  i^i  Prime )  e.  Fin
45 hashun 11611 . . . . . 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 1269 . . . . 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 2440 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  N
)  =  ( (
# `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  +  (
# `  ( (
( M  +  1 ) ... N )  i^i  Prime ) ) ) )
49 ppival2g 20865 . . . 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 643 . . 3  |-  ( N  e.  ( ZZ>= `  M
)  ->  (π `  M
)  =  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) ) )
5148, 50oveq12d 6058 . 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 11594 . . . . 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 10189 . . 3  |-  ( # `  ( ( if ( M  <_  2 ,  M ,  2 ) ... M )  i^i 
Prime ) )  e.  CC
55 hashcl 11594 . . . . 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 10189 . . 3  |-  ( # `  ( ( ( M  +  1 ) ... N )  i^i  Prime ) )  e.  CC
58 pncan2 9268 . . 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 654 . 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 2452 1  |-  ( N  e.  ( ZZ>= `  M
)  ->  ( (π `  N )  -  (π `  M ) )  =  ( # `  (
( ( M  + 
1 ) ... N
)  i^i  Prime ) ) )
Colors of variables: wff set class
Syntax hints:    -> wi 4    = wceq 1649    e. wcel 1721    u. cun 3278    i^i cin 3279    C_ wss 3280   (/)c0 3588   ifcif 3699   class class class wbr 4172   ` cfv 5413  (class class class)co 6040   Fincfn 7068   CCcc 8944   RRcr 8945   1c1 8947    + caddc 8949    < clt 9076    <_ cle 9077    - cmin 9247   2c2 10005   NN0cn0 10177   ZZcz 10238   ZZ>=cuz 10444   ...cfz 10999   #chash 11573   Primecprime 13034  πcppi 20829
This theorem is referenced by:  ppiub  20941  chtppilimlem1  21120
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1552  ax-5 1563  ax-17 1623  ax-9 1662  ax-8 1683  ax-13 1723  ax-14 1725  ax-6 1740  ax-7 1745  ax-11 1757  ax-12 1946  ax-ext 2385  ax-rep 4280  ax-sep 4290  ax-nul 4298  ax-pow 4337  ax-pr 4363  ax-un 4660  ax-cnex 9002  ax-resscn 9003  ax-1cn 9004  ax-icn 9005  ax-addcl 9006  ax-addrcl 9007  ax-mulcl 9008  ax-mulrcl 9009  ax-mulcom 9010  ax-addass 9011  ax-mulass 9012  ax-distr 9013  ax-i2m1 9014  ax-1ne0 9015  ax-1rid 9016  ax-rnegex 9017  ax-rrecex 9018  ax-cnre 9019  ax-pre-lttri 9020  ax-pre-lttrn 9021  ax-pre-ltadd 9022  ax-pre-mulgt0 9023  ax-pre-sup 9024
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3or 937  df-3an 938  df-tru 1325  df-ex 1548  df-nf 1551  df-sb 1656  df-eu 2258  df-mo 2259  df-clab 2391  df-cleq 2397  df-clel 2400  df-nfc 2529  df-ne 2569  df-nel 2570  df-ral 2671  df-rex 2672  df-reu 2673  df-rmo 2674  df-rab 2675  df-v 2918  df-sbc 3122  df-csb 3212  df-dif 3283  df-un 3285  df-in 3287  df-ss 3294  df-pss 3296  df-nul 3589  df-if 3700  df-pw 3761  df-sn 3780  df-pr 3781  df-tp 3782  df-op 3783  df-uni 3976  df-int 4011  df-iun 4055  df-br 4173  df-opab 4227  df-mpt 4228  df-tr 4263  df-eprel 4454  df-id 4458  df-po 4463  df-so 4464  df-fr 4501  df-we 4503  df-ord 4544  df-on 4545  df-lim 4546  df-suc 4547  df-om 4805  df-xp 4843  df-rel 4844  df-cnv 4845  df-co 4846  df-dm 4847  df-rn 4848  df-res 4849  df-ima 4850  df-iota 5377  df-fun 5415  df-fn 5416  df-f 5417  df-f1 5418  df-fo 5419  df-f1o 5420  df-fv 5421  df-ov 6043  df-oprab 6044  df-mpt2 6045  df-1st 6308  df-2nd 6309  df-riota 6508  df-recs 6592  df-rdg 6627  df-1o 6683  df-2o 6684  df-oadd 6687  df-er 6864  df-en 7069  df-dom 7070  df-sdom 7071  df-fin 7072  df-sup 7404  df-card 7782  df-cda 8004  df-pnf 9078  df-mnf 9079  df-xr 9080  df-ltxr 9081  df-le 9082  df-sub 9249  df-neg 9250  df-nn 9957  df-2 10014  df-n0 10178  df-z 10239  df-uz 10445  df-icc 10879  df-fz 11000  df-fl 11157  df-hash 11574  df-dvds 12808  df-prm 13035  df-ppi 20835
  Copyright terms: Public domain W3C validator