MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  prmgaplem5 Structured version   Visualization version   GIF version

Theorem prmgaplem5 16385
Description: Lemma for prmgap 16389: for each integer greater than 2 there is a smaller prime closest to this integer, i.e. there is a smaller prime and no other prime is between this prime and the integer. (Contributed by AV, 9-Aug-2020.)
Assertion
Ref Expression
prmgaplem5 (𝑁 ∈ (ℤ‘3) → ∃𝑝 ∈ ℙ (𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ))
Distinct variable group:   𝑁,𝑝,𝑧

Proof of Theorem prmgaplem5
Dummy variables 𝑞 𝑟 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 elrabi 3674 . . . 4 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑟 ∈ ℙ)
21ad2antlr 725 . . 3 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → 𝑟 ∈ ℙ)
3 breq1 5061 . . . . 5 (𝑝 = 𝑟 → (𝑝 < 𝑁𝑟 < 𝑁))
4 oveq1 7157 . . . . . . 7 (𝑝 = 𝑟 → (𝑝 + 1) = (𝑟 + 1))
54oveq1d 7165 . . . . . 6 (𝑝 = 𝑟 → ((𝑝 + 1)..^𝑁) = ((𝑟 + 1)..^𝑁))
65raleqdv 3415 . . . . 5 (𝑝 = 𝑟 → (∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ ↔ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
73, 6anbi12d 632 . . . 4 (𝑝 = 𝑟 → ((𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ) ↔ (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)))
87adantl 484 . . 3 ((((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) ∧ 𝑝 = 𝑟) → ((𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ) ↔ (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)))
9 breq1 5061 . . . . . . 7 (𝑞 = 𝑟 → (𝑞 < 𝑁𝑟 < 𝑁))
109elrab 3679 . . . . . 6 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} ↔ (𝑟 ∈ ℙ ∧ 𝑟 < 𝑁))
1110simprbi 499 . . . . 5 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑟 < 𝑁)
1211ad2antlr 725 . . . 4 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → 𝑟 < 𝑁)
13 elfzo2 13035 . . . . . . . 8 (𝑧 ∈ ((𝑟 + 1)..^𝑁) ↔ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))
14 breq1 5061 . . . . . . . . . . . . . 14 (𝑞 = 𝑧 → (𝑞 < 𝑁𝑧 < 𝑁))
15 simpl 485 . . . . . . . . . . . . . 14 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 ∈ ℙ)
16 simpr3 1192 . . . . . . . . . . . . . 14 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 < 𝑁)
1714, 15, 16elrabd 3681 . . . . . . . . . . . . 13 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁})
1817adantrl 714 . . . . . . . . . . . 12 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → 𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁})
19 eluz2 12243 . . . . . . . . . . . . . . . . . 18 (𝑧 ∈ (ℤ‘(𝑟 + 1)) ↔ ((𝑟 + 1) ∈ ℤ ∧ 𝑧 ∈ ℤ ∧ (𝑟 + 1) ≤ 𝑧))
20 prmz 16013 . . . . . . . . . . . . . . . . . . . . . . . 24 (𝑟 ∈ ℙ → 𝑟 ∈ ℤ)
21 zltp1le 12026 . . . . . . . . . . . . . . . . . . . . . . . 24 ((𝑟 ∈ ℤ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 ↔ (𝑟 + 1) ≤ 𝑧))
2220, 21sylan 582 . . . . . . . . . . . . . . . . . . . . . . 23 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 ↔ (𝑟 + 1) ≤ 𝑧))
23 prmnn 16012 . . . . . . . . . . . . . . . . . . . . . . . . . 26 (𝑟 ∈ ℙ → 𝑟 ∈ ℕ)
2423nnred 11647 . . . . . . . . . . . . . . . . . . . . . . . . 25 (𝑟 ∈ ℙ → 𝑟 ∈ ℝ)
25 zre 11979 . . . . . . . . . . . . . . . . . . . . . . . . 25 (𝑧 ∈ ℤ → 𝑧 ∈ ℝ)
26 ltnle 10714 . . . . . . . . . . . . . . . . . . . . . . . . . 26 ((𝑟 ∈ ℝ ∧ 𝑧 ∈ ℝ) → (𝑟 < 𝑧 ↔ ¬ 𝑧𝑟))
2726biimpd 231 . . . . . . . . . . . . . . . . . . . . . . . . 25 ((𝑟 ∈ ℝ ∧ 𝑧 ∈ ℝ) → (𝑟 < 𝑧 → ¬ 𝑧𝑟))
2824, 25, 27syl2an 597 . . . . . . . . . . . . . . . . . . . . . . . 24 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 → ¬ 𝑧𝑟))
29 pm2.21 123 . . . . . . . . . . . . . . . . . . . . . . . 24 𝑧𝑟 → (𝑧𝑟𝑧 ∉ ℙ))
3028, 29syl6 35 . . . . . . . . . . . . . . . . . . . . . . 23 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 → (𝑧𝑟𝑧 ∉ ℙ)))
3122, 30sylbird 262 . . . . . . . . . . . . . . . . . . . . . 22 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → ((𝑟 + 1) ≤ 𝑧 → (𝑧𝑟𝑧 ∉ ℙ)))
3231expcom 416 . . . . . . . . . . . . . . . . . . . . 21 (𝑧 ∈ ℤ → (𝑟 ∈ ℙ → ((𝑟 + 1) ≤ 𝑧 → (𝑧𝑟𝑧 ∉ ℙ))))
3332com23 86 . . . . . . . . . . . . . . . . . . . 20 (𝑧 ∈ ℤ → ((𝑟 + 1) ≤ 𝑧 → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ))))
3433a1i 11 . . . . . . . . . . . . . . . . . . 19 ((𝑟 + 1) ∈ ℤ → (𝑧 ∈ ℤ → ((𝑟 + 1) ≤ 𝑧 → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))))
35343imp 1107 . . . . . . . . . . . . . . . . . 18 (((𝑟 + 1) ∈ ℤ ∧ 𝑧 ∈ ℤ ∧ (𝑟 + 1) ≤ 𝑧) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
3619, 35sylbi 219 . . . . . . . . . . . . . . . . 17 (𝑧 ∈ (ℤ‘(𝑟 + 1)) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
37363ad2ant1 1129 . . . . . . . . . . . . . . . 16 ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
381, 37syl5com 31 . . . . . . . . . . . . . . 15 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑧𝑟𝑧 ∉ ℙ)))
3938adantl 484 . . . . . . . . . . . . . 14 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑧𝑟𝑧 ∉ ℙ)))
4039imp 409 . . . . . . . . . . . . 13 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → (𝑧𝑟𝑧 ∉ ℙ))
4140adantl 484 . . . . . . . . . . . 12 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → (𝑧𝑟𝑧 ∉ ℙ))
4218, 41embantd 59 . . . . . . . . . . 11 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ))
4342ex 415 . . . . . . . . . 10 (𝑧 ∈ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
44 df-nel 3124 . . . . . . . . . . 11 (𝑧 ∉ ℙ ↔ ¬ 𝑧 ∈ ℙ)
45 2a1 28 . . . . . . . . . . 11 (𝑧 ∉ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
4644, 45sylbir 237 . . . . . . . . . 10 𝑧 ∈ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
4743, 46pm2.61i 184 . . . . . . . . 9 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ))
4847impancom 454 . . . . . . . 8 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟)) → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → 𝑧 ∉ ℙ))
4913, 48syl5bi 244 . . . . . . 7 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟)) → (𝑧 ∈ ((𝑟 + 1)..^𝑁) → 𝑧 ∉ ℙ))
5049ex 415 . . . . . 6 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → (𝑧 ∈ ((𝑟 + 1)..^𝑁) → 𝑧 ∉ ℙ)))
5150ralimdv2 3176 . . . . 5 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → (∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟 → ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
5251imp 409 . . . 4 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)
5312, 52jca 514 . . 3 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
542, 8, 53rspcedvd 3625 . 2 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → ∃𝑝 ∈ ℙ (𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ))
55 eqid 2821 . . 3 {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} = {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}
5655prmgaplem3 16383 . 2 (𝑁 ∈ (ℤ‘3) → ∃𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟)
5754, 56r19.29a 3289 1 (𝑁 ∈ (ℤ‘3) → ∃𝑝 ∈ ℙ (𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ))
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 208  wa 398  w3a 1083  wcel 2110  wnel 3123  wral 3138  wrex 3139  {crab 3142   class class class wbr 5058  cfv 6349  (class class class)co 7150  cr 10530  1c1 10532   + caddc 10534   < clt 10669  cle 10670  3c3 11687  cz 11975  cuz 12237  ..^cfzo 13027  cprime 16009
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1792  ax-4 1806  ax-5 1907  ax-6 1966  ax-7 2011  ax-8 2112  ax-9 2120  ax-10 2141  ax-11 2157  ax-12 2173  ax-ext 2793  ax-sep 5195  ax-nul 5202  ax-pow 5258  ax-pr 5321  ax-un 7455  ax-cnex 10587  ax-resscn 10588  ax-1cn 10589  ax-icn 10590  ax-addcl 10591  ax-addrcl 10592  ax-mulcl 10593  ax-mulrcl 10594  ax-mulcom 10595  ax-addass 10596  ax-mulass 10597  ax-distr 10598  ax-i2m1 10599  ax-1ne0 10600  ax-1rid 10601  ax-rnegex 10602  ax-rrecex 10603  ax-cnre 10604  ax-pre-lttri 10605  ax-pre-lttrn 10606  ax-pre-ltadd 10607  ax-pre-mulgt0 10608  ax-pre-sup 10609
This theorem depends on definitions:  df-bi 209  df-an 399  df-or 844  df-3or 1084  df-3an 1085  df-tru 1536  df-ex 1777  df-nf 1781  df-sb 2066  df-mo 2618  df-eu 2650  df-clab 2800  df-cleq 2814  df-clel 2893  df-nfc 2963  df-ne 3017  df-nel 3124  df-ral 3143  df-rex 3144  df-reu 3145  df-rmo 3146  df-rab 3147  df-v 3496  df-sbc 3772  df-csb 3883  df-dif 3938  df-un 3940  df-in 3942  df-ss 3951  df-pss 3953  df-nul 4291  df-if 4467  df-pw 4540  df-sn 4561  df-pr 4563  df-tp 4565  df-op 4567  df-uni 4832  df-iun 4913  df-br 5059  df-opab 5121  df-mpt 5139  df-tr 5165  df-id 5454  df-eprel 5459  df-po 5468  df-so 5469  df-fr 5508  df-we 5510  df-xp 5555  df-rel 5556  df-cnv 5557  df-co 5558  df-dm 5559  df-rn 5560  df-res 5561  df-ima 5562  df-pred 6142  df-ord 6188  df-on 6189  df-lim 6190  df-suc 6191  df-iota 6308  df-fun 6351  df-fn 6352  df-f 6353  df-f1 6354  df-fo 6355  df-f1o 6356  df-fv 6357  df-riota 7108  df-ov 7153  df-oprab 7154  df-mpo 7155  df-om 7575  df-1st 7683  df-2nd 7684  df-wrecs 7941  df-recs 8002  df-rdg 8040  df-1o 8096  df-2o 8097  df-er 8283  df-en 8504  df-dom 8505  df-sdom 8506  df-fin 8507  df-sup 8900  df-pnf 10671  df-mnf 10672  df-xr 10673  df-ltxr 10674  df-le 10675  df-sub 10866  df-neg 10867  df-div 11292  df-nn 11633  df-2 11694  df-3 11695  df-n0 11892  df-z 11976  df-uz 12238  df-rp 12384  df-fz 12887  df-fzo 13028  df-seq 13364  df-exp 13424  df-cj 14452  df-re 14453  df-im 14454  df-sqrt 14588  df-abs 14589  df-dvds 15602  df-prm 16010
This theorem is referenced by:  prmgaplem7  16387
  Copyright terms: Public domain W3C validator