l3lab/ntp-mathlib huggingface dataset:
theorem toReal_eq_toReal_iff (x y : ℝ≥0∞) :
    x.toReal = y.toReal ↔ x = y ∨ x = 0 ∧ y = ⊤ ∨ x = ⊤ ∧ y = 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y : ℝ≥0∞
⊢ ENNReal.toReal x = ENNReal.toReal y ↔ x = y ∨ x = 0 ∧ y = ⊤ ∨ x = ⊤ ∧ y = 0

Next tactic:
simp only [ENNReal.toReal, NNReal.coe_eq, toNNReal_eq_toNNReal_iff]
theorem toNNReal_eq_toNNReal_iff' {x y : ℝ≥0∞} (hx : x ≠ ⊤) (hy : y ≠ ⊤) :
    x.toNNReal = y.toNNReal ↔ x = y := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y : ℝ≥0∞
hx : x ≠ ⊤
hy : y ≠ ⊤
⊢ ENNReal.toNNReal x = ENNReal.toNNReal y ↔ x = y

Next tactic:
simp only [ENNReal.toNNReal_eq_toNNReal_iff x y, hx, hy, and_false, false_and, or_false]
theorem toReal_eq_toReal_iff' {x y : ℝ≥0∞} (hx : x ≠ ⊤) (hy : y ≠ ⊤) :
    x.toReal = y.toReal ↔ x = y := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
x y : ℝ≥0∞
hx : x ≠ ⊤
hy : y ≠ ⊤
⊢ ENNReal.toReal x = ENNReal.toReal y ↔ x = y

Next tactic:
simp only [ENNReal.toReal, NNReal.coe_eq, toNNReal_eq_toNNReal_iff' hx hy]
theorem iInf_ne_top [CompleteLattice α] (f : ℝ≥0∞ → α) :
    ⨅ (x) (_ : x ≠ ∞), f x = ⨅ x : ℝ≥0, f x := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
inst✝ : CompleteLattice α
f : ℝ≥0∞ → α
⊢ ⨅ x, ⨅ (_ : x ≠ ⊤), f x = ⨅ x, f ↑x

Next tactic:
rw [iInf_subtype', cinfi_ne_top]
/-- An `Algebra` over `ℝ≥0∞` restricts to an `Algebra` over `ℝ≥0`. -/
noncomputable instance {A : Type*} [Semiring A] [Algebra ℝ≥0∞ A] : Algebra ℝ≥0 A where
  smul := (· • ·)
  commutes' r x := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra ℝ≥0∞ A
r : ℝ≥0
x : A
⊢ (RingHom.comp (algebraMap ℝ≥0∞ A) ofNNRealHom) r * x = x * (RingHom.comp (algebraMap ℝ≥0∞ A) ofNNRealHom) r

Next tactic:
simp [Algebra.commutes]
/-- An `Algebra` over `ℝ≥0∞` restricts to an `Algebra` over `ℝ≥0`. -/
noncomputable instance {A : Type*} [Semiring A] [Algebra ℝ≥0∞ A] : Algebra ℝ≥0 A where
  smul := (· • ·)
  commutes' r x := by simp [Algebra.commutes]
  smul_def' r x := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra ℝ≥0∞ A
r : ℝ≥0
x : A
⊢ r • x = (RingHom.comp (algebraMap ℝ≥0∞ A) ofNNRealHom) r * x

Next tactic:
simp [← Algebra.smul_def (r : ℝ≥0∞) x, smul_def]
theorem coe_smul {R} (r : R) (s : ℝ≥0) [SMul R ℝ≥0] [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0 ℝ≥0]
    [IsScalarTower R ℝ≥0 ℝ≥0∞] : (↑(r • s) : ℝ≥0∞) = (r : R) • (s : ℝ≥0∞) := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
R : Type u_3
r : R
s : ℝ≥0
inst✝³ : SMul R ℝ≥0
inst✝² : SMul R ℝ≥0∞
inst✝¹ : IsScalarTower R ℝ≥0 ℝ≥0
inst✝ : IsScalarTower R ℝ≥0 ℝ≥0∞
⊢ ↑(r • s) = r • ↑s

Next tactic:
rw [← smul_one_smul ℝ≥0 r (s : ℝ≥0∞), smul_def, smul_eq_mul, ← ENNReal.coe_mul, smul_mul_assoc,
    one_mul]
theorem toNNReal_add {r₁ r₂ : ℝ≥0∞} (h₁ : r₁ ≠ ∞) (h₂ : r₂ ≠ ∞) :
    (r₁ + r₂).toNNReal = r₁.toNNReal + r₂.toNNReal := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
r₁ r₂ : ℝ≥0∞
h₁ : r₁ ≠ ⊤
h₂ : r₂ ≠ ⊤
⊢ ENNReal.toNNReal (r₁ + r₂) = ENNReal.toNNReal r₁ + ENNReal.toNNReal r₂

Next tactic:
lift r₁ to ℝ≥0 using h₁
theorem toNNReal_add {r₁ r₂ : ℝ≥0∞} (h₁ : r₁ ≠ ∞) (h₂ : r₂ ≠ ∞) :
    (r₁ + r₂).toNNReal = r₁.toNNReal + r₂.toNNReal := by
  lift r₁ to ℝ≥0 using h₁
  

Proof state:
case intro
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
r₂ : ℝ≥0∞
h₂ : r₂ ≠ ⊤
r₁ : ℝ≥0
⊢ ENNReal.toNNReal (↑r₁ + r₂) = ENNReal.toNNReal ↑r₁ + ENNReal.toNNReal r₂

Next tactic:
lift r₂ to ℝ≥0 using h₂
theorem toNNReal_add {r₁ r₂ : ℝ≥0∞} (h₁ : r₁ ≠ ∞) (h₂ : r₂ ≠ ∞) :
    (r₁ + r₂).toNNReal = r₁.toNNReal + r₂.toNNReal := by
  lift r₁ to ℝ≥0 using h₁
  lift r₂ to ℝ≥0 using h₂
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q r₁ r₂ : ℝ≥0
⊢ ENNReal.toNNReal (↑r₁ + ↑r₂) = ENNReal.toNNReal ↑r₁ + ENNReal.toNNReal ↑r₂

Next tactic:
rfl
theorem not_lt_top {x : ℝ≥0∞} : ¬x < ∞ ↔ x = ∞ := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
x : ℝ≥0∞
⊢ ¬x < ⊤ ↔ x = ⊤

Next tactic:
rw [lt_top_iff_ne_top, Classical.not_not]
theorem add_ne_top : a + b ≠ ∞ ↔ a ≠ ∞ ∧ b ≠ ∞ := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ a + b ≠ ⊤ ↔ a ≠ ⊤ ∧ b ≠ ⊤

Next tactic:
simpa only [lt_top_iff_ne_top] using add_lt_top
theorem mul_top' : a * ∞ = if a = 0 then 0 else ∞ := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ a * ⊤ = if a = 0 then 0 else ⊤

Next tactic:
convert WithTop.mul_top' a
theorem top_mul' : ∞ * a = if a = 0 then 0 else ∞ := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⊤ * a = if a = 0 then 0 else ⊤

Next tactic:
convert WithTop.top_mul' a
theorem smul_top {R} [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
    [NoZeroSMulDivisors R ℝ≥0∞] [DecidableEq R] (c : R) :
    c • ∞ = if c = 0 then 0 else ∞ := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
R : Type u_3
inst✝⁴ : Zero R
inst✝³ : SMulWithZero R ℝ≥0∞
inst✝² : IsScalarTower R ℝ≥0∞ ℝ≥0∞
inst✝¹ : NoZeroSMulDivisors R ℝ≥0∞
inst✝ : DecidableEq R
c : R
⊢ c • ⊤ = if c = 0 then 0 else ⊤

Next tactic:
rw [← smul_one_mul, mul_top']
theorem smul_top {R} [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
    [NoZeroSMulDivisors R ℝ≥0∞] [DecidableEq R] (c : R) :
    c • ∞ = if c = 0 then 0 else ∞ := by
  rw [← smul_one_mul, mul_top']
  -- porting note: need the primed version of `one_ne_zero` now
  

Proof state:
α : Type u_1
β : Type u_2
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
R : Type u_3
inst✝⁴ : Zero R
inst✝³ : SMulWithZero R ℝ≥0∞
inst✝² : IsScalarTower R ℝ≥0∞ ℝ≥0∞
inst✝¹ : NoZeroSMulDivisors R ℝ≥0∞
inst✝ : DecidableEq R
c : R
⊢ (if c • 1 = 0 then 0 else ⊤) = if c = 0 then 0 else ⊤

Next tactic:
simp_rw [smul_eq_zero, or_iff_left (one_ne_zero' ℝ≥0∞)]
theorem top_pow {n : ℕ} (h : 0 < n) : ∞ ^ n = ∞ :=
  Nat.le_induction (pow_one _) (fun m _ hm => by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
h : 0 < n
m : ℕ
x✝ : Nat.succ 0 ≤ m
hm : ⊤ ^ m = ⊤
⊢ ⊤ ^ (m + 1) = ⊤

Next tactic:
rw [pow_succ, hm, top_mul_top]
theorem mul_ne_top : a ≠ ∞ → b ≠ ∞ → a * b ≠ ∞ := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ a ≠ ⊤ → b ≠ ⊤ → a * b ≠ ⊤

Next tactic:
simpa only [lt_top_iff_ne_top] using mul_lt_top
theorem lt_top_of_mul_ne_top_right (h : a * b ≠ ∞) (ha : a ≠ 0) : b < ∞ :=
  lt_top_of_mul_ne_top_left (by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
h : a * b ≠ ⊤
ha : a ≠ 0
⊢ b * a ≠ ⊤

Next tactic:
rwa [mul_comm]
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
⊢ a * b < ⊤ ↔ a < ⊤ ∧ b < ⊤ ∨ a = 0 ∨ b = 0

Next tactic:
constructor
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
⊢ a * b < ⊤ → a < ⊤ ∧ b < ⊤ ∨ a = 0 ∨ b = 0

Next tactic:
intro h
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    

Proof state:
case mp
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
h : a * b < ⊤
⊢ a < ⊤ ∧ b < ⊤ ∨ a = 0 ∨ b = 0

Next tactic:
rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
    

Proof state:
case mp
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
h : a * b < ⊤
⊢ ¬b = 0 → ¬a = 0 → a < ⊤ ∧ b < ⊤

Next tactic:
intro hb ha
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
    intro hb ha
    

Proof state:
case mp
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
h : a * b < ⊤
hb : ¬b = 0
ha : ¬a = 0
⊢ a < ⊤ ∧ b < ⊤

Next tactic:
exact ⟨lt_top_of_mul_ne_top_left h.ne hb, lt_top_of_mul_ne_top_right h.ne ha⟩
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
    intro hb ha
    exact ⟨lt_top_of_mul_ne_top_left h.ne hb, lt_top_of_mul_ne_top_right h.ne ha⟩
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
⊢ a < ⊤ ∧ b < ⊤ ∨ a = 0 ∨ b = 0 → a * b < ⊤

Next tactic:
rintro (⟨ha, hb⟩ | rfl | rfl) <;> [exact mul_lt_top ha.ne hb.ne; simp; simp]
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
    intro hb ha
    exact ⟨lt_top_of_mul_ne_top_left h.ne hb, lt_top_of_mul_ne_top_right h.ne ha⟩
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
⊢ a < ⊤ ∧ b < ⊤ ∨ a = 0 ∨ b = 0 → a * b < ⊤

Next tactic:
rintro (⟨ha, hb⟩ | rfl | rfl)
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
    intro hb ha
    exact ⟨lt_top_of_mul_ne_top_left h.ne hb, lt_top_of_mul_ne_top_right h.ne ha⟩
  · rintro (⟨ha, hb⟩ | rfl | rfl) <;> [

Proof state:
case mpr.inl.intro
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a b : ℝ≥0∞
ha : a < ⊤
hb : b < ⊤
⊢ a * b < ⊤

Next tactic:
exact mul_lt_top ha.ne hb.ne
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
    intro hb ha
    exact ⟨lt_top_of_mul_ne_top_left h.ne hb, lt_top_of_mul_ne_top_right h.ne ha⟩
  · rintro (⟨ha, hb⟩ | rfl | rfl) <;> [exact mul_lt_top ha.ne hb.ne; 

Proof state:
case mpr.inr.inl
α : Type u_1
β : Type u_2
a b✝ c d : ℝ≥0∞
r p q : ℝ≥0
b : ℝ≥0∞
⊢ 0 * b < ⊤

Next tactic:
simp
theorem mul_lt_top_iff {a b : ℝ≥0∞} : a * b < ∞ ↔ a < ∞ ∧ b < ∞ ∨ a = 0 ∨ b = 0 := by
  constructor
  · intro h
    rw [← or_assoc, or_iff_not_imp_right, or_iff_not_imp_right]
    intro hb ha
    exact ⟨lt_top_of_mul_ne_top_left h.ne hb, lt_top_of_mul_ne_top_right h.ne ha⟩
  · rintro (⟨ha, hb⟩ | rfl | rfl) <;> [exact mul_lt_top ha.ne hb.ne; simp; 

Proof state:
case mpr.inr.inr
α : Type u_1
β : Type u_2
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
a : ℝ≥0∞
⊢ a * 0 < ⊤

Next tactic:
simp
theorem mul_self_lt_top_iff {a : ℝ≥0∞} : a * a < ⊤ ↔ a < ⊤ := by
  

Proof state:
α : Type u_1
β : Type u_2
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
a : ℝ≥0∞
⊢ a * a < ⊤ ↔ a < ⊤

Next tactic:
rw [ENNReal.mul_lt_top_iff, and_self, or_self, or_iff_left_iff_imp]
theorem mul_self_lt_top_iff {a : ℝ≥0∞} : a * a < ⊤ ↔ a < ⊤ := by
  rw [ENNReal.mul_lt_top_iff, and_self, or_self, or_iff_left_iff_imp]
  

Proof state:
α : Type u_1
β : Type u_2
a✝ b c d : ℝ≥0∞
r p q : ℝ≥0
a : ℝ≥0∞
⊢ a = 0 → a < ⊤

Next tactic:
rintro rfl
theorem mul_self_lt_top_iff {a : ℝ≥0∞} : a * a < ⊤ ↔ a < ⊤ := by
  rw [ENNReal.mul_lt_top_iff, and_self, or_self, or_iff_left_iff_imp]
  rintro rfl
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ 0 < ⊤

Next tactic:
exact zero_lt_top
@[simp] theorem pow_eq_top_iff {n : ℕ} : a ^ n = ∞ ↔ a = ∞ ∧ n ≠ 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
⊢ a ^ n = ⊤ ↔ a = ⊤ ∧ n ≠ 0

Next tactic:
rcases n.eq_zero_or_pos with rfl | (hn : 0 < n)
@[simp] theorem pow_eq_top_iff {n : ℕ} : a ^ n = ∞ ↔ a = ∞ ∧ n ≠ 0 := by
  rcases n.eq_zero_or_pos with rfl | (hn : 0 < n)
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ a ^ 0 = ⊤ ↔ a = ⊤ ∧ 0 ≠ 0

Next tactic:
simp
@[simp] theorem pow_eq_top_iff {n : ℕ} : a ^ n = ∞ ↔ a = ∞ ∧ n ≠ 0 := by
  rcases n.eq_zero_or_pos with rfl | (hn : 0 < n)
  · simp
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
hn : 0 < n
⊢ a ^ n = ⊤ ↔ a = ⊤ ∧ n ≠ 0

Next tactic:
induction a using recTopCoe
@[simp] theorem pow_eq_top_iff {n : ℕ} : a ^ n = ∞ ↔ a = ∞ ∧ n ≠ 0 := by
  rcases n.eq_zero_or_pos with rfl | (hn : 0 < n)
  · simp
  · induction a using recTopCoe
    · 

Proof state:
case inr.top
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
hn : 0 < n
⊢ ⊤ ^ n = ⊤ ↔ ⊤ = ⊤ ∧ n ≠ 0

Next tactic:
simp only [Ne.def, hn.ne', top_pow hn, not_false_eq_true, and_self]
@[simp] theorem pow_eq_top_iff {n : ℕ} : a ^ n = ∞ ↔ a = ∞ ∧ n ≠ 0 := by
  rcases n.eq_zero_or_pos with rfl | (hn : 0 < n)
  · simp
  · induction a using recTopCoe
    · simp only [Ne.def, hn.ne', top_pow hn, not_false_eq_true, and_self]
    · 

Proof state:
case inr.coe
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
hn : 0 < n
x✝ : ℝ≥0
⊢ ↑x✝ ^ n = ⊤ ↔ ↑x✝ = ⊤ ∧ n ≠ 0

Next tactic:
simp only [← coe_pow, coe_ne_top, false_and]
theorem pow_lt_top : a < ∞ → ∀ n : ℕ, a ^ n < ∞ := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ a < ⊤ → ∀ (n : ℕ), a ^ n < ⊤

Next tactic:
simpa only [lt_top_iff_ne_top] using pow_ne_top
@[simp, norm_cast] lemma ofReal_coe_nat (n : ℕ) : ENNReal.ofReal n = n := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
⊢ ENNReal.ofReal ↑n = ↑n

Next tactic:
simp [ENNReal.ofReal]
@[simp, norm_cast]
theorem toNNReal_nat (n : ℕ) : (n : ℝ≥0∞).toNNReal = n := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
⊢ ENNReal.toNNReal ↑n = ↑n

Next tactic:
rw [← ENNReal.coe_nat n, ENNReal.toNNReal_coe]
@[simp, norm_cast]
theorem toReal_nat (n : ℕ) : (n : ℝ≥0∞).toReal = n := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
n : ℕ
⊢ ENNReal.toReal ↑n = ↑n

Next tactic:
rw [← ENNReal.ofReal_coe_nat n, ENNReal.toReal_ofReal (Nat.cast_nonneg _)]
theorem toReal_le_coe_of_le_coe {a : ℝ≥0∞} {b : ℝ≥0} (h : a ≤ b) : a.toReal ≤ b := by
  

Proof state:
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q : ℝ≥0
a : ℝ≥0∞
b : ℝ≥0
h : a ≤ ↑b
⊢ ENNReal.toReal a ≤ ↑b

Next tactic:
lift a to ℝ≥0 using ne_top_of_le_ne_top coe_ne_top h
theorem toReal_le_coe_of_le_coe {a : ℝ≥0∞} {b : ℝ≥0} (h : a ≤ b) : a.toReal ≤ b := by
  lift a to ℝ≥0 using ne_top_of_le_ne_top coe_ne_top h
  

Proof state:
case intro
α : Type u_1
β : Type u_2
a✝ b✝ c d : ℝ≥0∞
r p q b a : ℝ≥0
h : ↑a ≤ ↑b
⊢ ENNReal.toReal ↑a ≤ ↑b

Next tactic:
simpa using h
protected theorem pow_ne_zero : a ≠ 0 → ∀ n : ℕ, a ^ n ≠ 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ a ≠ 0 → ∀ (n : ℕ), a ^ n ≠ 0

Next tactic:
simpa only [pos_iff_ne_zero] using ENNReal.pow_pos
theorem not_lt_zero : ¬a < 0 := by 

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ¬a < 0

Next tactic:
simp
theorem lt_add_right (ha : a ≠ ∞) (hb : b ≠ 0) : a < a + b := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
ha : a ≠ ⊤
hb : b ≠ 0
⊢ a < a + b

Next tactic:
rwa [← pos_iff_ne_zero, ← ENNReal.add_lt_add_iff_left ha, add_zero] at hb
theorem lt_iff_exists_rat_btwn :
    a < b ↔ ∃ q : ℚ, 0 ≤ q ∧ a < Real.toNNReal q ∧ (Real.toNNReal q : ℝ≥0∞) < b :=
  ⟨fun h => by
    

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
h : a < b
⊢ ∃ q, 0 ≤ q ∧ a < ↑(Real.toNNReal ↑q) ∧ ↑(Real.toNNReal ↑q) < b

Next tactic:
rcases lt_iff_exists_coe.1 h with ⟨p, rfl, _⟩
theorem lt_iff_exists_rat_btwn :
    a < b ↔ ∃ q : ℚ, 0 ≤ q ∧ a < Real.toNNReal q ∧ (Real.toNNReal q : ℝ≥0∞) < b :=
  ⟨fun h => by
    rcases lt_iff_exists_coe.1 h with ⟨p, rfl, _⟩
    

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
b c d : ℝ≥0∞
r p✝ q p : ℝ≥0
right✝ h : ↑p < b
⊢ ∃ q, 0 ≤ q ∧ ↑p < ↑(Real.toNNReal ↑q) ∧ ↑(Real.toNNReal ↑q) < b

Next tactic:
rcases exists_between h with ⟨c, pc, cb⟩
theorem lt_iff_exists_rat_btwn :
    a < b ↔ ∃ q : ℚ, 0 ≤ q ∧ a < Real.toNNReal q ∧ (Real.toNNReal q : ℝ≥0∞) < b :=
  ⟨fun h => by
    rcases lt_iff_exists_coe.1 h with ⟨p, rfl, _⟩
    rcases exists_between h with ⟨c, pc, cb⟩
    

Proof state:
case intro.intro.intro.intro
α : Type u_1
β : Type u_2
b c✝ d : ℝ≥0∞
r p✝ q p : ℝ≥0
right✝ h : ↑p < b
c : ℝ≥0∞
pc : ↑p < c
cb : c < b
⊢ ∃ q, 0 ≤ q ∧ ↑p < ↑(Real.toNNReal ↑q) ∧ ↑(Real.toNNReal ↑q) < b

Next tactic:
rcases lt_iff_exists_coe.1 cb with ⟨r, rfl, _⟩
theorem lt_iff_exists_rat_btwn :
    a < b ↔ ∃ q : ℚ, 0 ≤ q ∧ a < Real.toNNReal q ∧ (Real.toNNReal q : ℝ≥0∞) < b :=
  ⟨fun h => by
    rcases lt_iff_exists_coe.1 h with ⟨p, rfl, _⟩
    rcases exists_between h with ⟨c, pc, cb⟩
    rcases lt_iff_exists_coe.1 cb with ⟨r, rfl, _⟩
    

Proof state:
case intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
b c d : ℝ≥0∞
r✝ p✝ q p : ℝ≥0
right✝¹ h : ↑p < b
r : ℝ≥0
right✝ : ↑r < b
pc : ↑p < ↑r
cb : ↑r < b
⊢ ∃ q, 0 ≤ q ∧ ↑p < ↑(Real.toNNReal ↑q) ∧ ↑(Real.toNNReal ↑q) < b

Next tactic:
rcases (NNReal.lt_iff_exists_rat_btwn _ _).1 (coe_lt_coe.1 pc) with ⟨q, hq0, pq, qr⟩
theorem lt_iff_exists_rat_btwn :
    a < b ↔ ∃ q : ℚ, 0 ≤ q ∧ a < Real.toNNReal q ∧ (Real.toNNReal q : ℝ≥0∞) < b :=
  ⟨fun h => by
    rcases lt_iff_exists_coe.1 h with ⟨p, rfl, _⟩
    rcases exists_between h with ⟨c, pc, cb⟩
    rcases lt_iff_exists_coe.1 cb with ⟨r, rfl, _⟩
    rcases (NNReal.lt_iff_exists_rat_btwn _ _).1 (coe_lt_coe.1 pc) with ⟨q, hq0, pq, qr⟩
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
b c d : ℝ≥0∞
r✝ p✝ q✝ p : ℝ≥0
right✝¹ h : ↑p < b
r : ℝ≥0
right✝ : ↑r < b
pc : ↑p < ↑r
cb : ↑r < b
q : ℚ
hq0 : 0 ≤ q
pq : p < Real.toNNReal ↑q
qr : Real.toNNReal ↑q < r
⊢ ∃ q, 0 ≤ q ∧ ↑p < ↑(Real.toNNReal ↑q) ∧ ↑(Real.toNNReal ↑q) < b

Next tactic:
exact ⟨q, hq0, coe_lt_coe.2 pq, lt_trans (coe_lt_coe.2 qr) cb⟩
theorem lt_iff_exists_add_pos_lt : a < b ↔ ∃ r : ℝ≥0, 0 < r ∧ a + r < b := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ a < b ↔ ∃ r, 0 < r ∧ a + ↑r < b

Next tactic:
refine' ⟨fun hab => _, fun ⟨r, _, hr⟩ => lt_of_le_of_lt le_self_add hr⟩
theorem lt_iff_exists_add_pos_lt : a < b ↔ ∃ r : ℝ≥0, 0 < r ∧ a + r < b := by
  refine' ⟨fun hab => _, fun ⟨r, _, hr⟩ => lt_of_le_of_lt le_self_add hr⟩
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
hab : a < b
⊢ ∃ r, 0 < r ∧ a + ↑r < b

Next tactic:
rcases lt_iff_exists_nnreal_btwn.1 hab with ⟨c, ac, cb⟩
theorem lt_iff_exists_add_pos_lt : a < b ↔ ∃ r : ℝ≥0, 0 < r ∧ a + r < b := by
  refine' ⟨fun hab => _, fun ⟨r, _, hr⟩ => lt_of_le_of_lt le_self_add hr⟩
  rcases lt_iff_exists_nnreal_btwn.1 hab with ⟨c, ac, cb⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
a b c✝ d : ℝ≥0∞
r p q : ℝ≥0
hab : a < b
c : ℝ≥0
ac : a < ↑c
cb : ↑c < b
⊢ ∃ r, 0 < r ∧ a + ↑r < b

Next tactic:
lift a to ℝ≥0 using ac.ne_top
theorem lt_iff_exists_add_pos_lt : a < b ↔ ∃ r : ℝ≥0, 0 < r ∧ a + r < b := by
  refine' ⟨fun hab => _, fun ⟨r, _, hr⟩ => lt_of_le_of_lt le_self_add hr⟩
  rcases lt_iff_exists_nnreal_btwn.1 hab with ⟨c, ac, cb⟩
  lift a to ℝ≥0 using ac.ne_top
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
b c✝ d : ℝ≥0∞
r p q c : ℝ≥0
cb : ↑c < b
a : ℝ≥0
hab : ↑a < b
ac : ↑a < ↑c
⊢ ∃ r, 0 < r ∧ ↑a + ↑r < b

Next tactic:
rw [coe_lt_coe] at ac
theorem lt_iff_exists_add_pos_lt : a < b ↔ ∃ r : ℝ≥0, 0 < r ∧ a + r < b := by
  refine' ⟨fun hab => _, fun ⟨r, _, hr⟩ => lt_of_le_of_lt le_self_add hr⟩
  rcases lt_iff_exists_nnreal_btwn.1 hab with ⟨c, ac, cb⟩
  lift a to ℝ≥0 using ac.ne_top
  rw [coe_lt_coe] at ac
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
b c✝ d : ℝ≥0∞
r p q c : ℝ≥0
cb : ↑c < b
a : ℝ≥0
hab : ↑a < b
ac : a < c
⊢ ∃ r, 0 < r ∧ ↑a + ↑r < b

Next tactic:
refine ⟨c - a, tsub_pos_iff_lt.2 ac, ?_⟩
theorem lt_iff_exists_add_pos_lt : a < b ↔ ∃ r : ℝ≥0, 0 < r ∧ a + r < b := by
  refine' ⟨fun hab => _, fun ⟨r, _, hr⟩ => lt_of_le_of_lt le_self_add hr⟩
  rcases lt_iff_exists_nnreal_btwn.1 hab with ⟨c, ac, cb⟩
  lift a to ℝ≥0 using ac.ne_top
  rw [coe_lt_coe] at ac
  refine ⟨c - a, tsub_pos_iff_lt.2 ac, ?_⟩
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
b c✝ d : ℝ≥0∞
r p q c : ℝ≥0
cb : ↑c < b
a : ℝ≥0
hab : ↑a < b
ac : a < c
⊢ ↑a + ↑(c - a) < b

Next tactic:
rwa [← coe_add, add_tsub_cancel_of_le ac.le]
theorem le_of_forall_pos_le_add (h : ∀ ε : ℝ≥0, 0 < ε → b < ∞ → a ≤ b + ε) : a ≤ b := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
h : ∀ (ε : ℝ≥0), 0 < ε → b < ⊤ → a ≤ b + ↑ε
⊢ a ≤ b

Next tactic:
contrapose! h
theorem le_of_forall_pos_le_add (h : ∀ ε : ℝ≥0, 0 < ε → b < ∞ → a ≤ b + ε) : a ≤ b := by
  contrapose! h
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
h : b < a
⊢ ∃ ε, 0 < ε ∧ b < ⊤ ∧ b + ↑ε < a

Next tactic:
rcases lt_iff_exists_add_pos_lt.1 h with ⟨r, hr0, hr⟩
theorem le_of_forall_pos_le_add (h : ∀ ε : ℝ≥0, 0 < ε → b < ∞ → a ≤ b + ε) : a ≤ b := by
  contrapose! h
  rcases lt_iff_exists_add_pos_lt.1 h with ⟨r, hr0, hr⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
h : b < a
r : ℝ≥0
hr0 : 0 < r
hr : b + ↑r < a
⊢ ∃ ε, 0 < ε ∧ b < ⊤ ∧ b + ↑ε < a

Next tactic:
exact ⟨r, hr0, h.trans_le le_top, hr⟩
protected theorem exists_nat_gt {r : ℝ≥0∞} (h : r ≠ ∞) : ∃ n : ℕ, r < n := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r✝ p q : ℝ≥0
r : ℝ≥0∞
h : r ≠ ⊤
⊢ ∃ n, r < ↑n

Next tactic:
lift r to ℝ≥0 using h
protected theorem exists_nat_gt {r : ℝ≥0∞} (h : r ≠ ∞) : ∃ n : ℕ, r < n := by
  lift r to ℝ≥0 using h
  

Proof state:
case intro
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r✝ p q r : ℝ≥0
⊢ ∃ n, ↑r < ↑n

Next tactic:
rcases exists_nat_gt r with ⟨n, hn⟩
protected theorem exists_nat_gt {r : ℝ≥0∞} (h : r ≠ ∞) : ∃ n : ℕ, r < n := by
  lift r to ℝ≥0 using h
  rcases exists_nat_gt r with ⟨n, hn⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r✝ p q r : ℝ≥0
n : ℕ
hn : r < ↑n
⊢ ∃ n, ↑r < ↑n

Next tactic:
exact ⟨n, coe_lt_coe_nat.2 hn⟩
@[simp]
theorem iUnion_Iio_coe_nat : ⋃ n : ℕ, Iio (n : ℝ≥0∞) = {∞}ᶜ := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⋃ n, Iio ↑n = {⊤}ᶜ

Next tactic:
ext x
@[simp]
theorem iUnion_Iio_coe_nat : ⋃ n : ℕ, Iio (n : ℝ≥0∞) = {∞}ᶜ := by
  ext x
  

Proof state:
case h
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
x : ℝ≥0∞
⊢ x ∈ ⋃ n, Iio ↑n ↔ x ∈ {⊤}ᶜ

Next tactic:
rw [mem_iUnion]
@[simp]
theorem iUnion_Iio_coe_nat : ⋃ n : ℕ, Iio (n : ℝ≥0∞) = {∞}ᶜ := by
  ext x
  rw [mem_iUnion]
  

Proof state:
case h
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
x : ℝ≥0∞
⊢ (∃ i, x ∈ Iio ↑i) ↔ x ∈ {⊤}ᶜ

Next tactic:
exact ⟨fun ⟨n, hn⟩ => ne_top_of_lt hn, ENNReal.exists_nat_gt⟩
@[simp]
theorem iUnion_Ioc_coe_nat : ⋃ n : ℕ, Ioc a n = Ioi a \ {∞} := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⋃ n, Ioc a ↑n = Ioi a \ {⊤}

Next tactic:
simp only [← Ioi_inter_Iic, ← inter_iUnion, iUnion_Iic_coe_nat, diff_eq]
@[simp]
theorem iUnion_Ioo_coe_nat : ⋃ n : ℕ, Ioo a n = Ioi a \ {∞} := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⋃ n, Ioo a ↑n = Ioi a \ {⊤}

Next tactic:
simp only [← Ioi_inter_Iio, ← inter_iUnion, iUnion_Iio_coe_nat, diff_eq]
@[simp]
theorem iUnion_Icc_coe_nat : ⋃ n : ℕ, Icc a n = Ici a \ {∞} := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⋃ n, Icc a ↑n = Ici a \ {⊤}

Next tactic:
simp only [← Ici_inter_Iic, ← inter_iUnion, iUnion_Iic_coe_nat, diff_eq]
@[simp]
theorem iUnion_Ico_coe_nat : ⋃ n : ℕ, Ico a n = Ici a \ {∞} := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⋃ n, Ico a ↑n = Ici a \ {⊤}

Next tactic:
simp only [← Ici_inter_Iio, ← inter_iUnion, iUnion_Iio_coe_nat, diff_eq]
@[simp]
theorem iInter_Ici_coe_nat : ⋂ n : ℕ, Ici (n : ℝ≥0∞) = {∞} := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⋂ n, Ici ↑n = {⊤}

Next tactic:
simp only [← compl_Iio, ← compl_iUnion, iUnion_Iio_coe_nat, compl_compl]
@[simp]
theorem iInter_Ioi_coe_nat : ⋂ n : ℕ, Ioi (n : ℝ≥0∞) = {∞} := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
⊢ ⋂ n, Ioi ↑n = {⊤}

Next tactic:
simp only [← compl_Iic, ← compl_iUnion, iUnion_Iic_coe_nat, compl_compl]
@[gcongr] theorem add_lt_add (ac : a < c) (bd : b < d) : a + b < c + d := by
  

Proof state:
α : Type u_1
β : Type u_2
a b c d : ℝ≥0∞
r p q : ℝ≥0
ac : a < c
bd : b < d
⊢ a + b < c + d

Next tactic:
lift a to ℝ≥0 using ac.ne_top