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

Theorem prmgaplem5 16381
Description: Lemma for prmgap 16385: 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 3623 . . . 4 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑟 ∈ ℙ)
21ad2antlr 726 . . 3 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → 𝑟 ∈ ℙ)
3 breq1 5033 . . . . 5 (𝑝 = 𝑟 → (𝑝 < 𝑁𝑟 < 𝑁))
4 oveq1 7142 . . . . . . 7 (𝑝 = 𝑟 → (𝑝 + 1) = (𝑟 + 1))
54oveq1d 7150 . . . . . 6 (𝑝 = 𝑟 → ((𝑝 + 1)..^𝑁) = ((𝑟 + 1)..^𝑁))
65raleqdv 3364 . . . . 5 (𝑝 = 𝑟 → (∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ ↔ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
73, 6anbi12d 633 . . . 4 (𝑝 = 𝑟 → ((𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ) ↔ (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)))
87adantl 485 . . 3 ((((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) ∧ 𝑝 = 𝑟) → ((𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ) ↔ (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)))
9 breq1 5033 . . . . . . 7 (𝑞 = 𝑟 → (𝑞 < 𝑁𝑟 < 𝑁))
109elrab 3628 . . . . . 6 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} ↔ (𝑟 ∈ ℙ ∧ 𝑟 < 𝑁))
1110simprbi 500 . . . . 5 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑟 < 𝑁)
1211ad2antlr 726 . . . 4 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → 𝑟 < 𝑁)
13 elfzo2 13036 . . . . . . . 8 (𝑧 ∈ ((𝑟 + 1)..^𝑁) ↔ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))
14 breq1 5033 . . . . . . . . . . . . . 14 (𝑞 = 𝑧 → (𝑞 < 𝑁𝑧 < 𝑁))
15 simpl 486 . . . . . . . . . . . . . 14 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 ∈ ℙ)
16 simpr3 1193 . . . . . . . . . . . . . 14 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 < 𝑁)
1714, 15, 16elrabd 3630 . . . . . . . . . . . . 13 ((𝑧 ∈ ℙ ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → 𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁})
1817adantrl 715 . . . . . . . . . . . 12 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → 𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁})
19 eluz2 12237 . . . . . . . . . . . . . . . . . 18 (𝑧 ∈ (ℤ‘(𝑟 + 1)) ↔ ((𝑟 + 1) ∈ ℤ ∧ 𝑧 ∈ ℤ ∧ (𝑟 + 1) ≤ 𝑧))
20 prmz 16009 . . . . . . . . . . . . . . . . . . . . . . . 24 (𝑟 ∈ ℙ → 𝑟 ∈ ℤ)
21 zltp1le 12020 . . . . . . . . . . . . . . . . . . . . . . . 24 ((𝑟 ∈ ℤ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 ↔ (𝑟 + 1) ≤ 𝑧))
2220, 21sylan 583 . . . . . . . . . . . . . . . . . . . . . . 23 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 ↔ (𝑟 + 1) ≤ 𝑧))
23 prmnn 16008 . . . . . . . . . . . . . . . . . . . . . . . . . 26 (𝑟 ∈ ℙ → 𝑟 ∈ ℕ)
2423nnred 11640 . . . . . . . . . . . . . . . . . . . . . . . . 25 (𝑟 ∈ ℙ → 𝑟 ∈ ℝ)
25 zre 11973 . . . . . . . . . . . . . . . . . . . . . . . . 25 (𝑧 ∈ ℤ → 𝑧 ∈ ℝ)
26 ltnle 10709 . . . . . . . . . . . . . . . . . . . . . . . . . 26 ((𝑟 ∈ ℝ ∧ 𝑧 ∈ ℝ) → (𝑟 < 𝑧 ↔ ¬ 𝑧𝑟))
2726biimpd 232 . . . . . . . . . . . . . . . . . . . . . . . . 25 ((𝑟 ∈ ℝ ∧ 𝑧 ∈ ℝ) → (𝑟 < 𝑧 → ¬ 𝑧𝑟))
2824, 25, 27syl2an 598 . . . . . . . . . . . . . . . . . . . . . . . 24 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 → ¬ 𝑧𝑟))
29 pm2.21 123 . . . . . . . . . . . . . . . . . . . . . . . 24 𝑧𝑟 → (𝑧𝑟𝑧 ∉ ℙ))
3028, 29syl6 35 . . . . . . . . . . . . . . . . . . . . . . 23 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → (𝑟 < 𝑧 → (𝑧𝑟𝑧 ∉ ℙ)))
3122, 30sylbird 263 . . . . . . . . . . . . . . . . . . . . . 22 ((𝑟 ∈ ℙ ∧ 𝑧 ∈ ℤ) → ((𝑟 + 1) ≤ 𝑧 → (𝑧𝑟𝑧 ∉ ℙ)))
3231expcom 417 . . . . . . . . . . . . . . . . . . . . 21 (𝑧 ∈ ℤ → (𝑟 ∈ ℙ → ((𝑟 + 1) ≤ 𝑧 → (𝑧𝑟𝑧 ∉ ℙ))))
3332com23 86 . . . . . . . . . . . . . . . . . . . 20 (𝑧 ∈ ℤ → ((𝑟 + 1) ≤ 𝑧 → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ))))
3433a1i 11 . . . . . . . . . . . . . . . . . . 19 ((𝑟 + 1) ∈ ℤ → (𝑧 ∈ ℤ → ((𝑟 + 1) ≤ 𝑧 → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))))
35343imp 1108 . . . . . . . . . . . . . . . . . 18 (((𝑟 + 1) ∈ ℤ ∧ 𝑧 ∈ ℤ ∧ (𝑟 + 1) ≤ 𝑧) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
3619, 35sylbi 220 . . . . . . . . . . . . . . . . 17 (𝑧 ∈ (ℤ‘(𝑟 + 1)) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
37363ad2ant1 1130 . . . . . . . . . . . . . . . 16 ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑟 ∈ ℙ → (𝑧𝑟𝑧 ∉ ℙ)))
381, 37syl5com 31 . . . . . . . . . . . . . . 15 (𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑧𝑟𝑧 ∉ ℙ)))
3938adantl 485 . . . . . . . . . . . . . 14 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → (𝑧𝑟𝑧 ∉ ℙ)))
4039imp 410 . . . . . . . . . . . . 13 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → (𝑧𝑟𝑧 ∉ ℙ))
4140adantl 485 . . . . . . . . . . . 12 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → (𝑧𝑟𝑧 ∉ ℙ))
4218, 41embantd 59 . . . . . . . . . . 11 ((𝑧 ∈ ℙ ∧ ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁))) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ))
4342ex 416 . . . . . . . . . 10 (𝑧 ∈ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
44 df-nel 3092 . . . . . . . . . . 11 (𝑧 ∉ ℙ ↔ ¬ 𝑧 ∈ ℙ)
45 2a1 28 . . . . . . . . . . 11 (𝑧 ∉ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
4644, 45sylbir 238 . . . . . . . . . 10 𝑧 ∈ ℙ → (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ)))
4743, 46pm2.61i 185 . . . . . . . . 9 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁)) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → 𝑧 ∉ ℙ))
4847impancom 455 . . . . . . . 8 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟)) → ((𝑧 ∈ (ℤ‘(𝑟 + 1)) ∧ 𝑁 ∈ ℤ ∧ 𝑧 < 𝑁) → 𝑧 ∉ ℙ))
4913, 48syl5bi 245 . . . . . . 7 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ (𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟)) → (𝑧 ∈ ((𝑟 + 1)..^𝑁) → 𝑧 ∉ ℙ))
5049ex 416 . . . . . 6 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → ((𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} → 𝑧𝑟) → (𝑧 ∈ ((𝑟 + 1)..^𝑁) → 𝑧 ∉ ℙ)))
5150ralimdv2 3143 . . . . 5 ((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) → (∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟 → ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
5251imp 410 . . . 4 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ)
5312, 52jca 515 . . 3 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → (𝑟 < 𝑁 ∧ ∀𝑧 ∈ ((𝑟 + 1)..^𝑁)𝑧 ∉ ℙ))
542, 8, 53rspcedvd 3574 . 2 (((𝑁 ∈ (ℤ‘3) ∧ 𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}) ∧ ∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟) → ∃𝑝 ∈ ℙ (𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ))
55 eqid 2798 . . 3 {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁} = {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}
5655prmgaplem3 16379 . 2 (𝑁 ∈ (ℤ‘3) → ∃𝑟 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}∀𝑧 ∈ {𝑞 ∈ ℙ ∣ 𝑞 < 𝑁}𝑧𝑟)
5754, 56r19.29a 3248 1 (𝑁 ∈ (ℤ‘3) → ∃𝑝 ∈ ℙ (𝑝 < 𝑁 ∧ ∀𝑧 ∈ ((𝑝 + 1)..^𝑁)𝑧 ∉ ℙ))
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 209  wa 399  w3a 1084  wcel 2111  wnel 3091  wral 3106  wrex 3107  {crab 3110   class class class wbr 5030  cfv 6324  (class class class)co 7135  cr 10525  1c1 10527   + caddc 10529   < clt 10664  cle 10665  3c3 11681  cz 11969  cuz 12231  ..^cfzo 13028  cprime 16005
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 1911  ax-6 1970  ax-7 2015  ax-8 2113  ax-9 2121  ax-10 2142  ax-11 2158  ax-12 2175  ax-ext 2770  ax-sep 5167  ax-nul 5174  ax-pow 5231  ax-pr 5295  ax-un 7441  ax-cnex 10582  ax-resscn 10583  ax-1cn 10584  ax-icn 10585  ax-addcl 10586  ax-addrcl 10587  ax-mulcl 10588  ax-mulrcl 10589  ax-mulcom 10590  ax-addass 10591  ax-mulass 10592  ax-distr 10593  ax-i2m1 10594  ax-1ne0 10595  ax-1rid 10596  ax-rnegex 10597  ax-rrecex 10598  ax-cnre 10599  ax-pre-lttri 10600  ax-pre-lttrn 10601  ax-pre-ltadd 10602  ax-pre-mulgt0 10603  ax-pre-sup 10604
This theorem depends on definitions:  df-bi 210  df-an 400  df-or 845  df-3or 1085  df-3an 1086  df-tru 1541  df-ex 1782  df-nf 1786  df-sb 2070  df-mo 2598  df-eu 2629  df-clab 2777  df-cleq 2791  df-clel 2870  df-nfc 2938  df-ne 2988  df-nel 3092  df-ral 3111  df-rex 3112  df-reu 3113  df-rmo 3114  df-rab 3115  df-v 3443  df-sbc 3721  df-csb 3829  df-dif 3884  df-un 3886  df-in 3888  df-ss 3898  df-pss 3900  df-nul 4244  df-if 4426  df-pw 4499  df-sn 4526  df-pr 4528  df-tp 4530  df-op 4532  df-uni 4801  df-iun 4883  df-br 5031  df-opab 5093  df-mpt 5111  df-tr 5137  df-id 5425  df-eprel 5430  df-po 5438  df-so 5439  df-fr 5478  df-we 5480  df-xp 5525  df-rel 5526  df-cnv 5527  df-co 5528  df-dm 5529  df-rn 5530  df-res 5531  df-ima 5532  df-pred 6116  df-ord 6162  df-on 6163  df-lim 6164  df-suc 6165  df-iota 6283  df-fun 6326  df-fn 6327  df-f 6328  df-f1 6329  df-fo 6330  df-f1o 6331  df-fv 6332  df-riota 7093  df-ov 7138  df-oprab 7139  df-mpo 7140  df-om 7561  df-1st 7671  df-2nd 7672  df-wrecs 7930  df-recs 7991  df-rdg 8029  df-1o 8085  df-2o 8086  df-er 8272  df-en 8493  df-dom 8494  df-sdom 8495  df-fin 8496  df-sup 8890  df-pnf 10666  df-mnf 10667  df-xr 10668  df-ltxr 10669  df-le 10670  df-sub 10861  df-neg 10862  df-div 11287  df-nn 11626  df-2 11688  df-3 11689  df-n0 11886  df-z 11970  df-uz 12232  df-rp 12378  df-fz 12886  df-fzo 13029  df-seq 13365  df-exp 13426  df-cj 14450  df-re 14451  df-im 14452  df-sqrt 14586  df-abs 14587  df-dvds 15600  df-prm 16006
This theorem is referenced by:  prmgaplem7  16383
  Copyright terms: Public domain W3C validator