Skip to content

Commit d981732

Browse files
committed
Ch. 1: prove monotone_primeCountingReal
1 parent c8b681a commit d981732

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

FormalBook/Ch01_Six_proofs_of_the_infinity_of_primes.lean

+12-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ using elementary calculus
208208
open Filter
209209

210210
noncomputable def primeCountingReal (x : ℝ) : ℕ :=
211-
if (x > 0) then primeCounting ⌊x⌋.natAbs else 0
211+
if (x 0) then 0 else primeCounting ⌊x⌋
212212

213213
def S₁ (x : ℝ) : Set ℕ :=
214214
{ n | ∀ p, Nat.Prime p → p ∣ n → p ≤ x }
@@ -229,7 +229,17 @@ theorem infinity_of_primes₄ : Tendsto π atTop atTop := by
229229
sorry
230230

231231
-- This might be useful for the proof. Rename as you like.
232-
theorem monotone_primeCountingReal : Monotone primeCountingReal := by sorry
232+
theorem monotone_primeCountingReal : Monotone primeCountingReal := by
233+
intro a b hab
234+
unfold primeCountingReal
235+
by_cases ha : a ≤ 0
236+
· by_cases hb : b ≤ 0
237+
· simp [ha, hb]
238+
· simp [ha, hb]
239+
· by_cases hb : b ≤ 0
240+
· linarith
241+
· simp [ha, hb]
242+
exact monotone_primeCounting <| Nat.floor_mono hab
233243

234244
lemma H_P4_1 {k p: ℝ} (hk: k > 0) (hp: p ≥ k + 1): p / (p - 1) ≤ (k + 1) / k := by
235245
have h_k_nonzero: k ≠ 0 := ne_iff_lt_or_gt.mpr (Or.inr hk)

0 commit comments

Comments
 (0)