l3lab/ntp-mathlib huggingface dataset:
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        

Proof state:
case b0.ha
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
i : ℕ
_hi : i ∈ filter (fun x => j < c ^ x) (range N)
⊢ 0 < ↑⌊c ^ i⌋₊

Next tactic:
refine' zero_lt_one.trans_le _
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        

Proof state:
case b0.ha
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
i : ℕ
_hi : i ∈ filter (fun x => j < c ^ x) (range N)
⊢ 1 ≤ ↑⌊c ^ i⌋₊

Next tactic:
simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · 

Proof state:
case d0
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
i : ℕ
_hi : i ∈ filter (fun x => j < c ^ x) (range N)
⊢ 0 < (c ^ i) ^ 2

Next tactic:
exact sq_pos_of_pos (pow_pos cpos _)
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      

Proof state:
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
i : ℕ
_hi : i ∈ filter (fun x => j < c ^ x) (range N)
⊢ 1 * (c ^ i) ^ 2 ≤ (1 - c⁻¹)⁻¹ ^ 2 * ↑⌊c ^ i⌋₊ ^ 2

Next tactic:
rw [one_mul, ← mul_pow]
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      

Proof state:
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
i : ℕ
_hi : i ∈ filter (fun x => j < c ^ x) (range N)
⊢ (c ^ i) ^ 2 ≤ ((1 - c⁻¹)⁻¹ * ↑⌊c ^ i⌋₊) ^ 2

Next tactic:
apply pow_le_pow_left (pow_nonneg cpos.le _)
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      

Proof state:
case hab
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
i : ℕ
_hi : i ∈ filter (fun x => j < c ^ x) (range N)
⊢ c ^ i ≤ (1 - c⁻¹)⁻¹ * ↑⌊c ^ i⌋₊

Next tactic:
rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
      

Proof state:
case hab
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
i : ℕ
_hi : i ∈ filter (fun x => j < c ^ x) (range N)
⊢ (1 - c⁻¹) * c ^ i ≤ ↑⌊c ^ i⌋₊

Next tactic:
exact mul_pow_le_nat_floor_pow hc i
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
      exact mul_pow_le_nat_floor_pow hc i
    _ ≤ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2 := by
      

Proof state:
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
⊢ ∑ i in filter (fun x => j < c ^ x) (range N), (1 - c⁻¹)⁻¹ ^ 2 * (1 / (c ^ i) ^ 2) ≤
    (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2

Next tactic:
rw [← mul_sum, ← mul_div_assoc']
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
      exact mul_pow_le_nat_floor_pow hc i
    _ ≤ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2 := by
      rw [← mul_sum, ← mul_div_assoc']
      

Proof state:
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
⊢ (1 - c⁻¹)⁻¹ ^ 2 * ∑ x in filter (fun x => j < c ^ x) (range N), 1 / (c ^ x) ^ 2 ≤
    (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹ / j ^ 2)

Next tactic:
refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
      exact mul_pow_le_nat_floor_pow hc i
    _ ≤ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2 := by
      rw [← mul_sum, ← mul_div_assoc']
      refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
      

Proof state:
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
⊢ ∑ x in filter (fun x => j < c ^ x) (range N), 1 / (c ^ x) ^ 2 ≤ c ^ 3 * (c - 1)⁻¹ / j ^ 2

Next tactic:
exact sum_div_pow_sq_le_div_sq N hj hc
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
      exact mul_pow_le_nat_floor_pow hc i
    _ ≤ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2 := by
      rw [← mul_sum, ← mul_div_assoc']
      refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
      exact sum_div_pow_sq_le_div_sq N hj hc
    _ = c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
      

Proof state:
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
⊢ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2 = c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2

Next tactic:
congr 1
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
      exact mul_pow_le_nat_floor_pow hc i
    _ ≤ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2 := by
      rw [← mul_sum, ← mul_div_assoc']
      refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
      exact sum_div_pow_sq_le_div_sq N hj hc
    _ = c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
      congr 1
      

Proof state:
case e_a
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
⊢ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) = c ^ 5 * (c - 1)⁻¹ ^ 3

Next tactic:
field_simp [cpos.ne', (sub_pos.2 hc).ne']
/-- The sum of `1/⌊c^i⌋₊^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative
constant. -/
theorem sum_div_nat_floor_pow_sq_le_div_sq (N : ℕ) {j : ℝ} (hj : 0 < j) {c : ℝ} (hc : 1 < c) :
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
      c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
  have cpos : 0 < c := zero_lt_one.trans hc
  have A : 0 < 1 - c⁻¹ := sub_pos.2 (inv_lt_one hc)
  calc
    (∑ i in (range N).filter (j < ⌊c ^ ·⌋₊), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2) ≤
        ∑ i in (range N).filter (j < c ^ ·), (1 : ℝ) / (⌊c ^ i⌋₊ : ℝ) ^ 2 := by
      apply sum_le_sum_of_subset_of_nonneg
      · intro i hi
        simp only [mem_filter, mem_range] at hi
        simpa only [hi.1, mem_filter, mem_range, true_and_iff] using
          hi.2.trans_le (Nat.floor_le (pow_nonneg cpos.le _))
      · intro i _hi _hident
        exact div_nonneg zero_le_one (sq_nonneg _)
    _ ≤ ∑ i in (range N).filter (j < c ^ ·), (1 - c⁻¹)⁻¹ ^ 2 * ((1 : ℝ) / (c ^ i) ^ 2) := by
      refine' sum_le_sum fun i _hi => _
      rw [mul_div_assoc', mul_one, div_le_div_iff]; rotate_left
      · apply sq_pos_of_pos
        refine' zero_lt_one.trans_le _
        simp only [Nat.le_floor, one_le_pow_of_one_le, hc.le, Nat.one_le_cast, Nat.cast_one]
      · exact sq_pos_of_pos (pow_pos cpos _)
      rw [one_mul, ← mul_pow]
      apply pow_le_pow_left (pow_nonneg cpos.le _)
      rw [← div_eq_inv_mul, le_div_iff A, mul_comm]
      exact mul_pow_le_nat_floor_pow hc i
    _ ≤ (1 - c⁻¹)⁻¹ ^ 2 * (c ^ 3 * (c - 1)⁻¹) / j ^ 2 := by
      rw [← mul_sum, ← mul_div_assoc']
      refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
      exact sum_div_pow_sq_le_div_sq N hj hc
    _ = c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 := by
      congr 1
      field_simp [cpos.ne', (sub_pos.2 hc).ne']
      

Proof state:
case e_a
N : ℕ
j : ℝ
hj : 0 < j
c : ℝ
hc : 1 < c
cpos : 0 < c
A : 0 < 1 - c⁻¹
⊢ c ^ 2 * c ^ 3 * (c - 1) ^ 3 = c ^ 5 * ((c - 1) ^ 2 * (c - 1))

Next tactic:
ring!
/-- create a `FinEnum` instance from an exhaustive list without duplicates -/
def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) : FinEnum α
    where
  card := xs.length
  equiv :=
    ⟨fun x => ⟨xs.indexOf x, by 

Proof state:
α : Type u
β : α → Type v
inst✝ : DecidableEq α
xs : List α
h : ∀ (x : α), x ∈ xs
h' : List.Nodup xs
x : α
⊢ List.indexOf x xs < List.length xs

Next tactic:
rw [List.indexOf_lt_length]
/-- create a `FinEnum` instance from an exhaustive list without duplicates -/
def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) : FinEnum α
    where
  card := xs.length
  equiv :=
    ⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length]; 

Proof state:
α : Type u
β : α → Type v
inst✝ : DecidableEq α
xs : List α
h : ∀ (x : α), x ∈ xs
h' : List.Nodup xs
x : α
⊢ x ∈ xs

Next tactic:
apply h
/-- create a `FinEnum` instance from an exhaustive list without duplicates -/
def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) : FinEnum α
    where
  card := xs.length
  equiv :=
    ⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length]; apply h⟩, fun ⟨i, h⟩ =>
      xs.nthLe _ h, fun x => by 

Proof state:
α : Type u
β : α → Type v
inst✝ : DecidableEq α
xs : List α
h : ∀ (x : α), x ∈ xs
h' : List.Nodup xs
x : α
⊢ (fun x =>
        match x with
        | { val := i, isLt := h } => List.nthLe xs i h)
      ((fun x => { val := List.indexOf x xs, isLt := (_ : List.indexOf x xs < List.length xs) }) x) =
    x

Next tactic:
simp