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

Theorem prmgaplem5 16887
Description: Lemma for prmgap 16891: 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 3637 . . . 4 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑟 ∈ ℙ)
21ad2antlr 725 . . 3 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → 𝑟 ∈ ℙ)
3 breq1 5106 . . . . 5 (𝑝 = 𝑟 → (𝑝 < 𝑁𝑟 < 𝑁))
4 oveq1 7358 . . . . . . 7 (𝑝 = 𝑟 → (𝑝 + 1) = (𝑟 + 1))
54oveq1d 7366 . . . . . 6 (𝑝 = 𝑟 → ((𝑝 + 1)..^𝑁) = ((𝑟 + 1)..^𝑁))
65raleqdv 3311 . . . . 5 (𝑝 = 𝑟 → (∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ ↔ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
73, 6anbi12d 631 . . . 4 (𝑝 = 𝑟 → ((𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ) ↔ (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)))
87adantl 482 . . 3 ((((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) ∧ 𝑝 = 𝑟) → ((𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ) ↔ (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)))
9 breq1 5106 . . . . . . 7 (𝑞 = 𝑟 → (𝑞 < 𝑁𝑟 < 𝑁))
109elrab 3643 . . . . . 6 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} ↔ (𝑟 ∈ ℙ ∧ 𝑟 < 𝑁))
1110simprbi 497 . . . . 5 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑟 < 𝑁)
1211ad2antlr 725 . . . 4 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → 𝑟 < 𝑁)
13 elfzo2 13529 . . . . . . . 8 (𝑧 ∈ ((𝑟 + 1)..^𝑁) ↔ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))
14 breq1 5106 . . . . . . . . . . . . . 14 (𝑞 = 𝑧 → (𝑞 < 𝑁𝑧 < 𝑁))
15 simpl 483 . . . . . . . . . . . . . 14 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 ∈ ℙ)
16 simpr3 1196 . . . . . . . . . . . . . 14 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 < 𝑁)
1714, 15, 16elrabd 3645 . . . . . . . . . . . . 13 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁})
1817adantrl 714 . . . . . . . . . . . 12 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → 𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁})
19 eluz2 12727 . . . . . . . . . . . . . . . . . 18 (𝑧 ∈ (ℤ‘(𝑟 + 1)) ↔ ((𝑟 + 1) ∈ ℤ ∧ 𝑧 ∈ ℤ ∧ (𝑟 + 1) ≤ 𝑧))
20 prmz 16511 . . . . . . . . . . . . . . . . . . . . . . . 24 (𝑟 ∈ ℙ → 𝑟 ∈ ℤ)
21 zltp1le 12511 . . . . . . . . . . . . . . . . . . . . . . . 24 ((𝑟 ∈ ℤ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 ↔ (𝑟 + 1) ≤ 𝑧))
2220, 21sylan 580 . . . . . . . . . . . . . . . . . . . . . . 23 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 ↔ (𝑟 + 1) ≤ 𝑧))
23 prmnn 16510 . . . . . . . . . . . . . . . . . . . . . . . . . 26 (𝑟 ∈ ℙ → 𝑟 ∈ ℕ)
2423nnred 12126 . . . . . . . . . . . . . . . . . . . . . . . . 25 (𝑟 ∈ ℙ → 𝑟 ∈ ℝ)
25 zre 12461 . . . . . . . . . . . . . . . . . . . . . . . . 25 (𝑧 ∈ ℤ → 𝑧 ∈ ℝ)
26 ltnle 11192 . . . . . . . . . . . . . . . . . . . . . . . . . 26 ((𝑟 ∈ ℝ ∧ 𝑧 ∈ ℝ) → (𝑟 < 𝑧 ↔ ¬ 𝑧𝑟))
2726biimpd 228 . . . . . . . . . . . . . . . . . . . . . . . . 25 ((𝑟 ∈ ℝ ∧ 𝑧 ∈ ℝ) → (𝑟 < 𝑧 → ¬ 𝑧𝑟))
2824, 25, 27syl2an 596 . . . . . . . . . . . . . . . . . . . . . . . 24 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 → ¬ 𝑧𝑟))
29 pm2.21 123 . . . . . . . . . . . . . . . . . . . . . . . 24 𝑧𝑟 → (𝑧𝑟𝑧 ∉ ℙ))
3028, 29syl6 35 . . . . . . . . . . . . . . . . . . . . . . 23 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 → (𝑧𝑟𝑧 ∉ ℙ)))
3122, 30sylbird 259 . . . . . . . . . . . . . . . . . . . . . 22 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → ((𝑟 + 1) ≤ 𝑧 → (𝑧𝑟𝑧 ∉ ℙ)))
3231expcom 414 . . . . . . . . . . . . . . . . . . . . 21 (𝑧 ∈ ℤ → (𝑟 ∈ ℙ → ((𝑟 + 1) ≤ 𝑧 → (𝑧𝑟𝑧 ∉ ℙ))))
3332com23 86 . . . . . . . . . . . . . . . . . . . 20 (𝑧 ∈ ℤ → ((𝑟 + 1) ≤ 𝑧 → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ))))
3433a1i 11 . . . . . . . . . . . . . . . . . . 19 ((𝑟 + 1) ∈ ℤ → (𝑧 ∈ ℤ → ((𝑟 + 1) ≤ 𝑧 → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))))
35343imp 1111 . . . . . . . . . . . . . . . . . 18 (((𝑟 + 1) ∈ ℤ ∧ 𝑧 ∈ ℤ ∧ (𝑟 + 1) ≤ 𝑧) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
3619, 35sylbi 216 . . . . . . . . . . . . . . . . 17 (𝑧 ∈ (ℤ‘(𝑟 + 1)) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
37363ad2ant1 1133 . . . . . . . . . . . . . . . 16 ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
381, 37syl5com 31 . . . . . . . . . . . . . . 15 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑧𝑟𝑧 ∉ ℙ)))
3938adantl 482 . . . . . . . . . . . . . 14 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑧𝑟𝑧 ∉ ℙ)))
4039imp 407 . . . . . . . . . . . . 13 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → (𝑧𝑟𝑧 ∉ ℙ))
4140adantl 482 . . . . . . . . . . . 12 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → (𝑧𝑟𝑧 ∉ ℙ))
4218, 41embantd 59 . . . . . . . . . . 11 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ))
4342ex 413 . . . . . . . . . 10 (𝑧 ∈ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
44 df-nel 3048 . . . . . . . . . . 11 (𝑧 ∉ ℙ ↔ ¬ 𝑧 ∈ ℙ)
45 2a1 28 . . . . . . . . . . 11 (𝑧 ∉ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
4644, 45sylbir 234 . . . . . . . . . 10 𝑧 ∈ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
4743, 46pm2.61i 182 . . . . . . . . 9 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ))
4847impancom 452 . . . . . . . 8 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟)) → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → 𝑧 ∉ ℙ))
4913, 48biimtrid 241 . . . . . . 7 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟)) → (𝑧 ∈ ((𝑟 + 1)..^𝑁) → 𝑧 ∉ ℙ))
5049ex 413 . . . . . 6 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → (𝑧 ∈ ((𝑟 + 1)..^𝑁) → 𝑧 ∉ ℙ)))
5150ralimdv2 3158 . . . . 5 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → (∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟 → ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
5251imp 407 . . . 4 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)
5312, 52jca 512 . . 3 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
542, 8, 53rspcedvd 3581 . 2 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → ∃𝑝 ∈ ℙ (𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ))
55 eqid 2737 . . 3 {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} = {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}
5655prmgaplem3 16885 . 2 (𝑁 ∈ (ℤ‘3) → ∃𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟)
5754, 56r19.29a 3157 1 (𝑁 ∈ (ℤ‘3) → ∃𝑝 ∈ ℙ (𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ))
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 205  wa 396  w3a 1087  wcel 2106  wnel 3047  wral 3062  wrex 3071  {crab 3405   class class class wbr 5103  cfv 6493  (class class class)co 7351  cr 11008  1c1 11010   + caddc 11012   < clt 11147  cle 11148  3c3 12167  cz 12457  cuz 12721  ..^cfzo 13521  cprime 16507
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1797  ax-4 1811  ax-5 1913  ax-6 1971  ax-7 2011  ax-8 2108  ax-9 2116  ax-10 2137  ax-11 2154  ax-12 2171  ax-ext 2708  ax-sep 5254  ax-nul 5261  ax-pow 5318  ax-pr 5382  ax-un 7664  ax-cnex 11065  ax-resscn 11066  ax-1cn 11067  ax-icn 11068  ax-addcl 11069  ax-addrcl 11070  ax-mulcl 11071  ax-mulrcl 11072  ax-mulcom 11073  ax-addass 11074  ax-mulass 11075  ax-distr 11076  ax-i2m1 11077  ax-1ne0 11078  ax-1rid 11079  ax-rnegex 11080  ax-rrecex 11081  ax-cnre 11082  ax-pre-lttri 11083  ax-pre-lttrn 11084  ax-pre-ltadd 11085  ax-pre-mulgt0 11086  ax-pre-sup 11087
This theorem depends on definitions:  df-bi 206  df-an 397  df-or 846  df-3or 1088  df-3an 1089  df-tru 1544  df-fal 1554  df-ex 1782  df-nf 1786  df-sb 2068  df-mo 2539  df-eu 2568  df-clab 2715  df-cleq 2729  df-clel 2815  df-nfc 2887  df-ne 2942  df-nel 3048  df-ral 3063  df-rex 3072  df-rmo 3351  df-reu 3352  df-rab 3406  df-v 3445  df-sbc 3738  df-csb 3854  df-dif 3911  df-un 3913  df-in 3915  df-ss 3925  df-pss 3927  df-nul 4281  df-if 4485  df-pw 4560  df-sn 4585  df-pr 4587  df-op 4591  df-uni 4864  df-iun 4954  df-br 5104  df-opab 5166  df-mpt 5187  df-tr 5221  df-id 5529  df-eprel 5535  df-po 5543  df-so 5544  df-fr 5586  df-we 5588  df-xp 5637  df-rel 5638  df-cnv 5639  df-co 5640  df-dm 5641  df-rn 5642  df-res 5643  df-ima 5644  df-pred 6251  df-ord 6318  df-on 6319  df-lim 6320  df-suc 6321  df-iota 6445  df-fun 6495  df-fn 6496  df-f 6497  df-f1 6498  df-fo 6499  df-f1o 6500  df-fv 6501  df-riota 7307  df-ov 7354  df-oprab 7355  df-mpo 7356  df-om 7795  df-1st 7913  df-2nd 7914  df-frecs 8204  df-wrecs 8235  df-recs 8309  df-rdg 8348  df-1o 8404  df-2o 8405  df-er 8606  df-en 8842  df-dom 8843  df-sdom 8844  df-fin 8845  df-sup 9336  df-pnf 11149  df-mnf 11150  df-xr 11151  df-ltxr 11152  df-le 11153  df-sub 11345  df-neg 11346  df-div 11771  df-nn 12112  df-2 12174  df-3 12175  df-n0 12372  df-z 12458  df-uz 12722  df-rp 12870  df-fz 13379  df-fzo 13522  df-seq 13861  df-exp 13922  df-cj 14944  df-re 14945  df-im 14946  df-sqrt 15080  df-abs 15081  df-dvds 16097  df-prm 16508
This theorem is referenced by:  prmgaplem7  16889
  Copyright terms: Public domain W3C validator