l3lab/ntp-mathlib huggingface dataset:
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
⊢ ↑(mk' n₁ d₁) = ↑(mk' n₂ d₂) ↔ mk' n₁ d₁ = mk' n₂ d₂

Next tactic:
refine' ⟨fun h => _, congr_arg _⟩
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
h : ↑(mk' n₁ d₁) = ↑(mk' n₂ d₂)
⊢ mk' n₁ d₁ = mk' n₂ d₂

Next tactic:
have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
h : ↑(mk' n₁ d₁) = ↑(mk' n₂ d₂)
d₁a : ↑d₁ ≠ 0
⊢ mk' n₁ d₁ = mk' n₂ d₂

Next tactic:
have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
    have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
h : ↑(mk' n₁ d₁) = ↑(mk' n₂ d₂)
d₁a : ↑d₁ ≠ 0
d₂a : ↑d₂ ≠ 0
⊢ mk' n₁ d₁ = mk' n₂ d₂

Next tactic:
rw [num_den', num_den'] at h ⊢
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
    have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
    rw [num_den', num_den'] at h ⊢
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
h : ↑(n₁ /. ↑d₁) = ↑(n₂ /. ↑d₂)
d₁a : ↑d₁ ≠ 0
d₂a : ↑d₂ ≠ 0
⊢ n₁ /. ↑d₁ = n₂ /. ↑d₂

Next tactic:
rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero] at h
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
    have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
    rw [num_den', num_den'] at h ⊢
    rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero] at h <;> 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
h : ↑n₁ / ↑↑d₁ = ↑n₂ / ↑↑d₂
d₁a : ↑d₁ ≠ 0
d₂a : ↑d₂ ≠ 0
⊢ n₁ /. ↑d₁ = n₂ /. ↑d₂

Next tactic:
simp [d₁0, d₂0] at h ⊢
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
    have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
    rw [num_den', num_den'] at h ⊢
    rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero] at h <;> 

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
h : ↑n₁ / ↑↑d₁ = ↑(n₂ /. ↑d₂)
d₁a : ↑d₁ ≠ 0
d₂a : ↑d₂ ≠ 0
⊢ ↑↑d₂ ≠ 0

Next tactic:
simp [d₁0, d₂0] at h ⊢
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
    have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
    rw [num_den', num_den'] at h ⊢
    rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero] at h <;> 

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
h : ↑(n₁ /. ↑d₁) = ↑(n₂ /. ↑d₂)
d₁a : ↑d₁ ≠ 0
d₂a : ↑d₂ ≠ 0
⊢ ↑↑d₁ ≠ 0

Next tactic:
simp [d₁0, d₂0] at h ⊢
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
  | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
    refine' ⟨fun h => _, congr_arg _⟩
    have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
    have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
    rw [num_den', num_den'] at h ⊢
    rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero] at h <;> simp [d₁0, d₂0] at h ⊢
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n₁ : ℤ
d₁ : ℕ
d₁0 : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
d₂0 : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁a : ↑d₁ ≠ 0
d₂a : ↑d₂ ≠ 0
h : ↑n₁ / ↑d₁ = ↑n₂ / ↑d₂
⊢ mkRat n₁ d₁ = mkRat n₂ d₂

Next tactic:
rwa [eq_div_iff_mul_eq d₂a, division_def, mul_assoc, (d₁.cast_commute (d₂ : α)).inv_left₀.eq, ←
      mul_assoc, ← division_def, eq_comm, eq_div_iff_mul_eq d₁a, eq_comm, ← Int.cast_ofNat d₁, ←
      Int.cast_mul, ← Int.cast_ofNat d₂, ← Int.cast_mul, Int.cast_inj, ← mkRat_eq_iff d₁0 d₂0] at h
@[simp]
theorem cast_eq_zero [CharZero α] {n : ℚ} : (n : α) = 0 ↔ n = 0 := by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n : ℚ
⊢ ↑n = 0 ↔ n = 0

Next tactic:
rw [← cast_zero, cast_inj]
@[simp, norm_cast]
theorem cast_bit1 [CharZero α] (n : ℚ) : ((bit1 n : ℚ) : α) = (bit1 n : α) := by
  

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n : ℚ
⊢ ↑(bit1 n) = bit1 ↑n

Next tactic:
rw [bit1, cast_add, cast_one, cast_bit0]
@[simp, norm_cast]
theorem cast_bit1 [CharZero α] (n : ℚ) : ((bit1 n : ℚ) : α) = (bit1 n : α) := by
  rw [bit1, cast_add, cast_one, cast_bit0]; 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
n : ℚ
⊢ bit0 ↑n + 1 = bit1 ↑n

Next tactic:
rfl
@[norm_cast]
theorem cast_mk (a b : ℤ) : (a /. b : α) = a / b := by
  

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝¹ : DivisionRing α
inst✝ : CharZero α
a b : ℤ
⊢ ↑(a /. b) = ↑a / ↑b

Next tactic:
simp only [divInt_eq_div, cast_div, cast_coe_int]
theorem _root_.tendsto_real_toNNReal_atTop : Tendsto Real.toNNReal atTop atTop := by
  

Proof state:
α : Type u_1
⊢ Tendsto Real.toNNReal atTop atTop

Next tactic:
rw [← tendsto_coe_atTop]
theorem _root_.tendsto_real_toNNReal_atTop : Tendsto Real.toNNReal atTop atTop := by
  rw [← tendsto_coe_atTop]
  

Proof state:
α : Type u_1
⊢ Tendsto (fun a => ↑(Real.toNNReal a)) atTop atTop

Next tactic:
exact tendsto_atTop_mono Real.le_coe_toNNReal tendsto_id
theorem nhds_zero : 𝓝 (0 : ℝ≥0) = ⨅ (a : ℝ≥0) (_ : a ≠ 0), 𝓟 (Iio a) :=
  nhds_bot_order.trans <| by 

Proof state:
α : Type u_1
⊢ ⨅ l, ⨅ (_ : ⊥ < l), 𝓟 (Set.Iio l) = ⨅ a, ⨅ (_ : a ≠ 0), 𝓟 (Set.Iio a)

Next tactic:
simp only [bot_lt_iff_ne_bot]
theorem nhds_zero : 𝓝 (0 : ℝ≥0) = ⨅ (a : ℝ≥0) (_ : a ≠ 0), 𝓟 (Iio a) :=
  nhds_bot_order.trans <| by simp only [bot_lt_iff_ne_bot]; 

Proof state:
α : Type u_1
⊢ ⨅ l, ⨅ (_ : l ≠ ⊥), 𝓟 (Set.Iio l) = ⨅ a, ⨅ (_ : a ≠ 0), 𝓟 (Set.Iio a)

Next tactic:
rfl
@[norm_cast]
theorem hasSum_coe {f : α → ℝ≥0} {r : ℝ≥0} : HasSum (fun a => (f a : ℝ)) (r : ℝ) ↔ HasSum f r := by
  

Proof state:
α : Type u_1
f : α → ℝ≥0
r : ℝ≥0
⊢ HasSum (fun a => ↑(f a)) ↑r ↔ HasSum f r

Next tactic:
simp only [HasSum, ← coe_sum, tendsto_coe]
protected theorem _root_.HasSum.toNNReal {f : α → ℝ} {y : ℝ} (hf₀ : ∀ n, 0 ≤ f n)
    (hy : HasSum f y) : HasSum (fun x => Real.toNNReal (f x)) y.toNNReal := by
  

Proof state:
α : Type u_1
f : α → ℝ
y : ℝ
hf₀ : ∀ (n : α), 0 ≤ f n
hy : HasSum f y
⊢ HasSum (fun x => Real.toNNReal (f x)) (Real.toNNReal y)

Next tactic:
lift y to ℝ≥0 using hy.nonneg hf₀
protected theorem _root_.HasSum.toNNReal {f : α → ℝ} {y : ℝ} (hf₀ : ∀ n, 0 ≤ f n)
    (hy : HasSum f y) : HasSum (fun x => Real.toNNReal (f x)) y.toNNReal := by
  lift y to ℝ≥0 using hy.nonneg hf₀
  

Proof state:
case intro
α : Type u_1
f : α → ℝ
hf₀ : ∀ (n : α), 0 ≤ f n
y : ℝ≥0
hy : HasSum f ↑y
⊢ HasSum (fun x => Real.toNNReal (f x)) (Real.toNNReal ↑y)

Next tactic:
lift f to α → ℝ≥0 using hf₀
protected theorem _root_.HasSum.toNNReal {f : α → ℝ} {y : ℝ} (hf₀ : ∀ n, 0 ≤ f n)
    (hy : HasSum f y) : HasSum (fun x => Real.toNNReal (f x)) y.toNNReal := by
  lift y to ℝ≥0 using hy.nonneg hf₀
  lift f to α → ℝ≥0 using hf₀
  

Proof state:
case intro.intro
α : Type u_1
y : ℝ≥0
f : α → ℝ≥0
hy : HasSum (fun i => ↑(f i)) ↑y
⊢ HasSum (fun x => Real.toNNReal ((fun i => ↑(f i)) x)) (Real.toNNReal ↑y)

Next tactic:
simpa [hasSum_coe] using hy
@[norm_cast]
theorem summable_coe {f : α → ℝ≥0} : (Summable fun a => (f a : ℝ)) ↔ Summable f := by
  

Proof state:
α : Type u_1
f : α → ℝ≥0
⊢ (Summable fun a => ↑(f a)) ↔ Summable f

Next tactic:
constructor
@[norm_cast]
theorem summable_coe {f : α → ℝ≥0} : (Summable fun a => (f a : ℝ)) ↔ Summable f := by
  constructor
  

Proof state:
case mp
α : Type u_1
f : α → ℝ≥0
⊢ (Summable fun a => ↑(f a)) → Summable f
case mpr α : Type u_1 f : α → ℝ≥0 ⊢ Summable f → Summable fun a => ↑(f a)

Next tactic:
exact fun ⟨a, ha⟩ => ⟨⟨a, ha.nonneg fun x => (f x).2⟩, hasSum_coe.1 ha⟩
@[norm_cast]
theorem summable_coe {f : α → ℝ≥0} : (Summable fun a => (f a : ℝ)) ↔ Summable f := by
  constructor
  exact fun ⟨a, ha⟩ => ⟨⟨a, ha.nonneg fun x => (f x).2⟩, hasSum_coe.1 ha⟩
  

Proof state:
case mpr
α : Type u_1
f : α → ℝ≥0
⊢ Summable f → Summable fun a => ↑(f a)

Next tactic:
exact fun ⟨a, ha⟩ => ⟨a.1, hasSum_coe.2 ha⟩
@[norm_cast]
theorem coe_tsum {f : α → ℝ≥0} : ↑(∑' a, f a) = ∑' a, (f a : ℝ) :=
  if hf : Summable f then Eq.symm <| (hasSum_coe.2 <| hf.hasSum).tsum_eq
  else by 

Proof state:
α : Type u_1
f : α → ℝ≥0
hf : ¬Summable f
⊢ ↑(∑' (a : α), f a) = ∑' (a : α), ↑(f a)

Next tactic:
simp [tsum_def, hf, mt summable_coe.1 hf]
nonrec theorem tsum_mul_left (a : ℝ≥0) (f : α → ℝ≥0) : ∑' x, a * f x = a * ∑' x, f x :=
  NNReal.eq <| by 

Proof state:
α : Type u_1
a : ℝ≥0
f : α → ℝ≥0
⊢ ↑(∑' (x : α), a * f x) = ↑(a * ∑' (x : α), f x)

Next tactic:
simp only [coe_tsum, NNReal.coe_mul, tsum_mul_left]
nonrec theorem tsum_mul_right (f : α → ℝ≥0) (a : ℝ≥0) : ∑' x, f x * a = (∑' x, f x) * a :=
  NNReal.eq <| by 

Proof state:
α : Type u_1
f : α → ℝ≥0
a : ℝ≥0
⊢ ↑(∑' (x : α), f x * a) = ↑((∑' (x : α), f x) * a)

Next tactic:
simp only [coe_tsum, NNReal.coe_mul, tsum_mul_right]
theorem summable_comp_injective {β : Type*} {f : α → ℝ≥0} (hf : Summable f) {i : β → α}
    (hi : Function.Injective i) : Summable (f ∘ i) := by
  

Proof state:
α : Type u_1
β : Type u_2
f : α → ℝ≥0
hf : Summable f
i : β → α
hi : Function.Injective i
⊢ Summable (f ∘ i)

Next tactic:
rw [← summable_coe] at hf ⊢
theorem summable_comp_injective {β : Type*} {f : α → ℝ≥0} (hf : Summable f) {i : β → α}
    (hi : Function.Injective i) : Summable (f ∘ i) := by
  rw [← summable_coe] at hf ⊢
  

Proof state:
α : Type u_1
β : Type u_2
f : α → ℝ≥0
hf : Summable fun a => ↑(f a)
i : β → α
hi : Function.Injective i
⊢ Summable fun a => ↑((f ∘ i) a)

Next tactic:
exact hf.comp_injective hi
nonrec theorem summable_nat_add_iff {f : ℕ → ℝ≥0} (k : ℕ) :
    (Summable fun i => f (i + k)) ↔ Summable f := by
  

Proof state:
α : Type u_1
f : ℕ → ℝ≥0
k : ℕ
⊢ (Summable fun i => f (i + k)) ↔ Summable f

Next tactic:
rw [← summable_coe, ← summable_coe]
nonrec theorem summable_nat_add_iff {f : ℕ → ℝ≥0} (k : ℕ) :
    (Summable fun i => f (i + k)) ↔ Summable f := by
  rw [← summable_coe, ← summable_coe]
  

Proof state:
α : Type u_1
f : ℕ → ℝ≥0
k : ℕ
⊢ (Summable fun a => ↑(f (a + k))) ↔ Summable fun a => ↑(f a)

Next tactic:
exact @summable_nat_add_iff ℝ _ _ _ (fun i => (f i : ℝ)) k
nonrec theorem hasSum_nat_add_iff {f : ℕ → ℝ≥0} (k : ℕ) {a : ℝ≥0} :
    HasSum (fun n => f (n + k)) a ↔ HasSum f (a + ∑ i in range k, f i) := by
  

Proof state:
α : Type u_1
f : ℕ → ℝ≥0
k : ℕ
a : ℝ≥0
⊢ HasSum (fun n => f (n + k)) a ↔ HasSum f (a + ∑ i in Finset.range k, f i)

Next tactic:
rw [← hasSum_coe, hasSum_nat_add_iff (f := fun n => toReal (f n)) k]
nonrec theorem hasSum_nat_add_iff {f : ℕ → ℝ≥0} (k : ℕ) {a : ℝ≥0} :
    HasSum (fun n => f (n + k)) a ↔ HasSum f (a + ∑ i in range k, f i) := by
  rw [← hasSum_coe, hasSum_nat_add_iff (f := fun n => toReal (f n)) k]; 

Proof state:
α : Type u_1
f : ℕ → ℝ≥0
k : ℕ
a : ℝ≥0
⊢ HasSum (fun n => ↑(f n)) (↑a + ∑ i in Finset.range k, ↑(f i)) ↔ HasSum f (a + ∑ i in Finset.range k, f i)

Next tactic:
norm_cast
theorem tendsto_cofinite_zero_of_summable {α} {f : α → ℝ≥0} (hf : Summable f) :
    Tendsto f cofinite (𝓝 0) := by
  

Proof state:
α : Type u_1
f : α → ℝ≥0
hf : Summable f
⊢ Tendsto f cofinite (𝓝 0)

Next tactic:
simp only [← summable_coe, ← tendsto_coe] at hf ⊢
theorem tendsto_cofinite_zero_of_summable {α} {f : α → ℝ≥0} (hf : Summable f) :
    Tendsto f cofinite (𝓝 0) := by
  simp only [← summable_coe, ← tendsto_coe] at hf ⊢
  

Proof state:
α : Type u_1
f : α → ℝ≥0
hf : Summable fun a => ↑(f a)
⊢ Tendsto (fun a => ↑(f a)) cofinite (𝓝 ↑0)

Next tactic:
exact hf.tendsto_cofinite_zero
theorem tendsto_atTop_zero_of_summable {f : ℕ → ℝ≥0} (hf : Summable f) : Tendsto f atTop (𝓝 0) := by
  

Proof state:
f : ℕ → ℝ≥0
hf : Summable f
⊢ Tendsto f atTop (𝓝 0)

Next tactic:
rw [← Nat.cofinite_eq_atTop]
theorem tendsto_atTop_zero_of_summable {f : ℕ → ℝ≥0} (hf : Summable f) : Tendsto f atTop (𝓝 0) := by
  rw [← Nat.cofinite_eq_atTop]
  

Proof state:
f : ℕ → ℝ≥0
hf : Summable f
⊢ Tendsto f cofinite (𝓝 0)

Next tactic:
exact tendsto_cofinite_zero_of_summable hf
/-- The sum over the complement of a finset tends to `0` when the finset grows to cover the whole
space. This does not need a summability assumption, as otherwise all sums are zero. -/
nonrec theorem tendsto_tsum_compl_atTop_zero {α : Type*} (f : α → ℝ≥0) :
    Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0) := by
  

Proof state:
α : Type u_1
f : α → ℝ≥0
⊢ Tendsto (fun s => ∑' (b : { x // x ∉ s }), f ↑b) atTop (𝓝 0)

Next tactic:
simp_rw [← tendsto_coe, coe_tsum, NNReal.coe_zero]
/-- The sum over the complement of a finset tends to `0` when the finset grows to cover the whole
space. This does not need a summability assumption, as otherwise all sums are zero. -/
nonrec theorem tendsto_tsum_compl_atTop_zero {α : Type*} (f : α → ℝ≥0) :
    Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0) := by
  simp_rw [← tendsto_coe, coe_tsum, NNReal.coe_zero]
  

Proof state:
α : Type u_1
f : α → ℝ≥0
⊢ Tendsto (fun a => ∑' (a_1 : { x // x ∉ a }), ↑(f ↑a_1)) atTop (𝓝 0)

Next tactic:
exact tendsto_tsum_compl_atTop_zero fun a : α => (f a : ℝ)
/-- `x ↦ x ^ n` as an order isomorphism of `ℝ≥0`. -/
def powOrderIso (n : ℕ) (hn : n ≠ 0) : ℝ≥0 ≃o ℝ≥0 :=
  StrictMono.orderIsoOfSurjective (fun x ↦ x ^ n) (fun x y h =>
      pow_left_strictMonoOn hn (zero_le x) (zero_le y) h) <|
    (continuous_id.pow _).surjective (tendsto_pow_atTop hn) <| by
      

Proof state:
n : ℕ
hn : n ≠ 0
⊢ Tendsto (fun b => id b ^ n) atBot atBot

Next tactic:
simpa [OrderBot.atBot_eq, pos_iff_ne_zero]
theorem iUnionLift_of_mem (x : T) {i : ι} (hx : (x : α) ∈ S i) :
    iUnionLift S f hf T hT x = f i ⟨x, hx⟩ := by 

Proof state:
α : Type u_1
ι : Sort u_3
β : Sort u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
x : ↑T
i : ι
hx : ↑x ∈ S i
⊢ iUnionLift S f hf T hT x = f i { val := ↑x, property := hx }

Next tactic:
cases' x with x hx
theorem iUnionLift_of_mem (x : T) {i : ι} (hx : (x : α) ∈ S i) :
    iUnionLift S f hf T hT x = f i ⟨x, hx⟩ := by cases' x with x hx; 

Proof state:
case mk
α : Type u_1
ι : Sort u_3
β : Sort u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
i : ι
x : α
hx✝ : x ∈ T
hx : ↑{ val := x, property := hx✝ } ∈ S i
⊢ iUnionLift S f hf T hT { val := x, property := hx✝ } = f i { val := ↑{ val := x, property := hx✝ }, property := hx }

Next tactic:
exact hf _ _ _ _ _
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  

Proof state:
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
⊢ iUnionLift S f hf T hT ⁻¹' t = inclusion hT ⁻¹' ⋃ i, inclusion (_ : S i ⊆ ⋃ i, S i) '' (f i ⁻¹' t)

Next tactic:
ext x
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  

Proof state:
case h
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
⊢ x ∈ iUnionLift S f hf T hT ⁻¹' t ↔ x ∈ inclusion hT ⁻¹' ⋃ i, inclusion (_ : S i ⊆ ⋃ i, S i) '' (f i ⁻¹' t)

Next tactic:
simp only [mem_preimage, mem_iUnion, mem_image]
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  simp only [mem_preimage, mem_iUnion, mem_image]
  

Proof state:
case h
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
⊢ iUnionLift S f hf T hT x ∈ t ↔ ∃ i x_1, f i x_1 ∈ t ∧ inclusion (_ : S i ⊆ ⋃ i, S i) x_1 = inclusion hT x

Next tactic:
constructor
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  simp only [mem_preimage, mem_iUnion, mem_image]
  constructor
  · 

Proof state:
case h.mp
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
⊢ iUnionLift S f hf T hT x ∈ t → ∃ i x_1, f i x_1 ∈ t ∧ inclusion (_ : S i ⊆ ⋃ i, S i) x_1 = inclusion hT x

Next tactic:
rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  simp only [mem_preimage, mem_iUnion, mem_image]
  constructor
  · rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
    

Proof state:
case h.mp.intro
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
i : ι
hi : ↑x ∈ S i
⊢ iUnionLift S f hf T hT x ∈ t → ∃ i x_1, f i x_1 ∈ t ∧ inclusion (_ : S i ⊆ ⋃ i, S i) x_1 = inclusion hT x

Next tactic:
refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  simp only [mem_preimage, mem_iUnion, mem_image]
  constructor
  · rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
    refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩
    

Proof state:
case h.mp.intro
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
i : ι
hi : ↑x ∈ S i
h : iUnionLift S f hf T hT x ∈ t
⊢ f i { val := ↑x, property := hi } ∈ t

Next tactic:
rwa [iUnionLift_of_mem x hi] at h
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  simp only [mem_preimage, mem_iUnion, mem_image]
  constructor
  · rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
    refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩
    rwa [iUnionLift_of_mem x hi] at h
  · 

Proof state:
case h.mpr
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
⊢ (∃ i x_1, f i x_1 ∈ t ∧ inclusion (_ : S i ⊆ ⋃ i, S i) x_1 = inclusion hT x) → iUnionLift S f hf T hT x ∈ t

Next tactic:
rintro ⟨i, ⟨y, hi⟩, h, hxy⟩
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  simp only [mem_preimage, mem_iUnion, mem_image]
  constructor
  · rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
    refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩
    rwa [iUnionLift_of_mem x hi] at h
  · rintro ⟨i, ⟨y, hi⟩, h, hxy⟩
    

Proof state:
case h.mpr.intro.intro.mk.intro
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
i : ι
y : α
hi : y ∈ S i
h : f i { val := y, property := hi } ∈ t
hxy : inclusion (_ : S i ⊆ ⋃ i, S i) { val := y, property := hi } = inclusion hT x
⊢ iUnionLift S f hf T hT x ∈ t

Next tactic:
obtain rfl : y = x := congr_arg Subtype.val hxy
theorem preimage_iUnionLift (t : Set β) :
    iUnionLift S f hf T hT ⁻¹' t =
      inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
  ext x
  simp only [mem_preimage, mem_iUnion, mem_image]
  constructor
  · rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
    refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩
    rwa [iUnionLift_of_mem x hi] at h
  · rintro ⟨i, ⟨y, hi⟩, h, hxy⟩
    obtain rfl : y = x := congr_arg Subtype.val hxy
    

Proof state:
case h.mpr.intro.intro.mk.intro
α : Type u_1
ι : Sort u_3
β : Type u_2
S : ι → Set α
f : (i : ι) → ↑(S i) → β
hf :
  ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j),
    f i { val := x, property := hxi } = f j { val := x, property := hxj }
T : Set α
hT : T ⊆ iUnion S
hT' : T = iUnion S
t : Set β
x : ↑T
i : ι
hi : ↑x ∈ S i
h : f i { val := ↑x, property := hi } ∈ t
hxy : inclusion (_ : S i ⊆ ⋃ i, S i) { val := ↑x, property := hi } = inclusion hT x
⊢ iUnionLift S f hf T hT x ∈ t

Next tactic:
rwa [iUnionLift_of_mem x hi]