Lean / Reader
Lean reader

HarmonicStatement.lean

56 lines6 declarationsno sorryimports HarmonicRatio FibonacciHarmonic

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports HarmonicRatio, FibonacciHarmonic, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import HarmonicRatio
  2. import FibonacciHarmonic
  3. open Filter
  4. open scoped Topology goldenRatio
  5. namespace HarmonicGroups
  6. /-- The length of the nth group, with the first group indexed by 1 as in
  7. the OEIS entry. Index 0 has the harmless value zero. -/
  8. noncomputable def groupLength (R : ℝ) (hR : 0 < R) (n : ℕ) : ℕ :=
  9. greedy R hR n - greedy R hR (n-1)
  10. theorem groupLength_ratio {R : ℝ} (hR : 0 < R) :
  11. Tendsto (fun n : ℕ => (groupLength R hR (n+2) : ℝ) / groupLength R hR (n+1))
  12. atTop (𝓝 (Real.exp R)) := by
  13. simpa [groupLength] using ratio_tendsto hR (greedy_spec R hR)
  14. private theorem golden_valid :
  15. IsGreedy (Real.log φ) (fun n => Nat.fib (n+2) - 1) where
  16. start := by decide
  17. strict := by
  18. apply strictMono_nat_of_lt_succ
  19. intro n
  20. have h := Nat.fib_add_two_strictMono (Nat.lt_succ_self n)
  21. have hpos : 0 < Nat.fib (n+2) := Nat.fib_pos.mpr (by omega)
  22. dsimp at h
  23. omega
  24. reached n := (golden_fib_threshold (n+2) (by omega)).1
  25. before n := (golden_fib_threshold (n+2) (by omega)).2
  26. theorem golden_endpoints (n : ℕ) :
  27. greedy (Real.log φ) (Real.log_pos Real.one_lt_goldenRatio) n = Nat.fib (n+2) - 1 :=
  28. congrFun (greedy_unique golden_valid).symm n
  29. theorem golden_groupLength (n : ℕ) :
  30. groupLength (Real.log φ) (Real.log_pos Real.one_lt_goldenRatio) n = Nat.fib n := by
  31. cases n with
  32. | zero => simp [groupLength]
  33. | succ n =>
  34. simp only [groupLength, Nat.add_one_sub_one, golden_endpoints]
  35. have sum : Nat.fib ((n+1)+2) = Nat.fib (n+1) + Nat.fib (n+2) := Nat.fib_add_two
  36. have hpos : 0 < Nat.fib (n+2) := Nat.fib_pos.mpr (by omega)
  37. omega
  38. /-- Both conjectures stated in OEIS A245800. -/
  39. theorem A245800 :
  40. (∀ (R : ℝ) (hR : 0 < R),
  41. Tendsto (fun n : ℕ => (groupLength R hR (n+2) : ℝ) / groupLength R hR (n+1))
  42. atTop (𝓝 (Real.exp R))) ∧
  43. (∀ n : ℕ, groupLength (Real.log φ) (Real.log_pos Real.one_lt_goldenRatio) n = Nat.fib n) :=
  44. ⟨fun _ hR => groupLength_ratio hR, golden_groupLength⟩
  45. #print axioms A245800
  46. end HarmonicGroups