Zulip Chat Archive

Stream: mathlib4

Topic: 10 million heartbeats (!4#3242)


Jeremy Tan (Apr 05 2023 at 16:14):

In fixing !4#3242 I think I've found a new record for most heartbeats needed to show definitional equality: 10 MILLION. 1 million doesn't work.

set_option maxHeartbeats 10000000 in -- XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX TODO
theorem tendsto_pow_atTop_nhds_0_of_lt_1 {π•œ : Type _} [LinearOrderedField π•œ] [Archimedean π•œ]
    [TopologicalSpace π•œ] [OrderTopology π•œ] {r : π•œ} (h₁ : 0 ≀ r) (hβ‚‚ : r < 1) :
    Tendsto (fun n : β„• => r ^ n) atTop (𝓝 0) := by
  cases' h₁.eq_or_lt with h h
  Β· exact (tendsto_add_atTop_iff_nat 1).mp <| by simp only [_root_.pow_succ, ← h, zero_mul,
      tendsto_const_nhds_iff]
  Β· have : Tendsto (fun n => (r⁻¹ ^ n)⁻¹) atTop (𝓝 0) :=
      tendsto_inv_atTop_zero.comp (tendsto_pow_atTop_atTop_of_one_lt <| one_lt_inv h hβ‚‚)
    exact this.congr fun n => by simp

Jeremy Tan (Apr 05 2023 at 16:16):

Surely @Matthew Ballard can help with this (and perhaps the rest of the file)?

Matthew Ballard (Apr 05 2023 at 16:21):

/me is currently depreciating an hvac system for taxes

Jeremy Tan (Apr 05 2023 at 16:33):

/me is testing that feature from PokΓ©mon Showdown

MonadMaverick (Apr 06 2023 at 03:10):

theorem tendsto_pow_atTop_nhds_0_of_lt_1 {π•œ : Type _} [LinearOrderedField π•œ] [Archimedean π•œ]
    [TopologicalSpace π•œ] [OrderTopology π•œ] {r : π•œ} (h₁ : 0 ≀ r) (hβ‚‚ : r < 1) :
    Tendsto (fun n : β„• => r ^ n) atTop (𝓝 0) :=
  h₁.eq_or_lt.elim
    (fun hr => (tendsto_add_atTop_iff_nat 1).mp <| by simp [_root_.pow_succ, ← hr, tendsto_const_nhds])
    (fun hr =>
      have := one_lt_inv hr hβ‚‚ |> tendsto_pow_atTop_atTop_of_one_lt
      (tendsto_inv_atTop_zero.comp this).congr fun n => by simp)
#align tendsto_pow_at_top_nhds_0_of_lt_1 tendsto_pow_atTop_nhds_0_of_lt_1

This seems to be fine.

MonadMaverick (Apr 06 2023 at 04:47):

All fixed. Basic.lean
I'll push my commits tonight

Jeremy Tan (Apr 06 2023 at 10:49):

You have not solved the very last error

Jeremy Tan (Apr 06 2023 at 10:50):

theorem exists_pos_tsum_mul_lt_of_countable {Ξ΅ : ℝβ‰₯0∞} (hΞ΅ : Ξ΅ β‰  0) {ΞΉ} [Countable ΞΉ] (w : ΞΉ β†’ ℝβ‰₯0∞)
    (hw : βˆ€ i, w i β‰  ∞) : βˆƒ Ξ΄ : ΞΉ β†’ ℝβ‰₯0, (βˆ€ i, 0 < Ξ΄ i) ∧ (βˆ‘' i, (w i * Ξ΄ i : ℝβ‰₯0∞)) < Ξ΅ := by
  lift w to ΞΉ β†’ ℝβ‰₯0 using hw
  rcases exists_pos_sum_of_countable hΡ ι with ⟨δ', Hpos, Hsum⟩
  have : βˆ€ i, 0 < max 1 (w i) := fun i => zero_lt_one.trans_le (le_max_left _ _)
  refine' ⟨fun i => δ' i / max 1 (w i), fun i => div_pos (Hpos _) (this i), _⟩
  refine' lt_of_le_of_lt (ENNReal.tsum_le_tsum fun i => _) Hsum
  rw [coe_div (this i).ne']
  refine' mul_le_of_le_div' (mul_le_mul_left' (ENNReal.inv_le_inv.2 _) _)
  exact coe_le_coe.2 (le_max_right _ _

MonadMaverick (Apr 06 2023 at 10:55):

really? somebody else also pushed. I'll have a look.

Jeremy Tan (Apr 06 2023 at 10:56):

Though to give you credit, I've incorporated some of your fixes in there

MonadMaverick (Apr 06 2023 at 11:11):

I think Komyyy <pol_tta@outlook.jp> pushed another fix independently.

MonadMaverick (Apr 06 2023 at 11:12):

I've pushed my version as tmp.lean.

It's strange that compiler doesn't complain about exists_pos_tsum_mul_lt_of_countable in my version.

MonadMaverick (Apr 06 2023 at 11:13):

@Pol'tta / KΓ΄ Miyahara

MonadMaverick (Apr 06 2023 at 11:43):

I've fixed the last error. @Jeremy Tan

Jeremy Tan (Apr 06 2023 at 11:43):

I've traced the problem to the inclusion of algebraMap; adding open algebraMap causes the error, and without it that last error disappears

Jeremy Tan (Apr 06 2023 at 11:43):

@YaΓ«l Dillies why?

MonadMaverick (Apr 06 2023 at 11:44):

looks like the ugly fix works

ugly one:

theorem tendsto_coe_nat_div_add_atTop {π•œ : Type _} [DivisionRing π•œ] [TopologicalSpace π•œ]
    [CharZero π•œ] [Algebra ℝ π•œ] [ContinuousSMul ℝ π•œ] [TopologicalDivisionRing π•œ] (x : π•œ) :
    Tendsto (fun n : β„• => (n : π•œ) / (n + x)) atTop (𝓝 1) := by
  refine' Tendsto.congr' ((eventually_ne_atTop 0).mp (eventually_of_forall fun n hn => _)) _
  Β· exact fun n : β„• => 1 / (1 + x / n)
  Β· field_simp [Nat.cast_ne_zero.mpr hn]
  Β· have : 𝓝 (1 : π•œ) = 𝓝 (1 / (1 + x * (0 : π•œ))) := by
      rw [MulZeroClass.mul_zero, add_zero, div_one]
    rw [this]
    refine' tendsto_const_nhds.div (tendsto_const_nhds.add _) (by simp)
    simp_rw [div_eq_mul_inv]
    refine' tendsto_const_nhds.mul _
    have : (fun n : β„• => (n : π•œ)⁻¹) = fun n : β„• => (n : π•œ)⁻¹ := by
      ext1 n
      rw [← map_natCast (algebraMap ℝ π•œ) n, ← map_invβ‚€ (algebraMap ℝ π•œ)]
    rw [this]
    have := ((continuous_algebraMap ℝ π•œ).tendsto _).comp tendsto_inverse_atTop_nhds_0_nat
    simp at this
    refine' Iff.mpr tendsto_atTop' _
    rw [tendsto_atTop'] at this
    intro s hs
    specialize this s hs
    choose a ha using this
    exists a
    intro b hb
    specialize ha b hb
    simp [Set.mem_def] at ha
    exact ha
#align tendsto_coe_nat_div_add_at_top tendsto_coe_nat_div_add_atTop
theorem tendsto_coe_nat_div_add_atTop {π•œ : Type _} [DivisionRing π•œ] [TopologicalSpace π•œ]
    [CharZero π•œ] [Algebra ℝ π•œ] [ContinuousSMul ℝ π•œ] [TopologicalDivisionRing π•œ] (x : π•œ) :
    Tendsto (fun n : β„• => (n : π•œ) / (n + x)) atTop (𝓝 1) := by
  refine' Tendsto.congr' ((eventually_ne_atTop 0).mp (eventually_of_forall fun n hn => _)) _
  Β· exact fun n : β„• => 1 / (1 + x / n)
  Β· field_simp [Nat.cast_ne_zero.mpr hn]
  Β· have : 𝓝 (1 : π•œ) = 𝓝 (1 / (1 + x * ↑(0 : ℝ))) := by
      rw [algebraMap.coe_zero, MulZeroClass.mul_zero, add_zero, div_one]
    rw [this]
    refine' tendsto_const_nhds.div (tendsto_const_nhds.add _) (by simp)
    simp_rw [div_eq_mul_inv]
    refine' tendsto_const_nhds.mul _
    have : (fun n : β„• => (n : π•œ)⁻¹) = fun n : β„• => ↑(n⁻¹ : ℝ) := by
      ext1 n
      rw [← map_natCast (algebraMap ℝ π•œ) n, ← map_invβ‚€ (algebraMap ℝ π•œ)]
      rfl
    rw [this]
    exact ((continuous_algebraMap ℝ π•œ).tendsto _).comp tendsto_inverse_atTop_nhds_0_nat
#align tendsto_coe_nat_div_add_at_top tendsto_coe_nat_div_add_atTop

MonadMaverick (Apr 06 2023 at 11:45):

must be some function name collision shenanigans

Jeremy Tan (Apr 06 2023 at 11:50):

There, all done!


Last updated: Dec 20 2023 at 11:08 UTC