Theorem: _private.Mathlib.Combinatorics.SetFamily.AhlswedeZhang.0.Fintype.sum_div_mul_card_choose_card
File: Mathlib/Combinatorics/SetFamily/AhlswedeZhang.lean

Proof steps:
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
⊢ ∑ s : Finset α, ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
    ↑(card α) * ∑ k ∈ range (card α), (↑k)⁻¹ + 1
state_after: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
⊢ ∑ i ∈ range (univ.card + 1),
      ∑ x ∈ powersetCard i univ, ↑(card α) / ((↑(card α) - ↑x.card) * ↑((card α).choose x.card)) =
    ↑(card α) * ∑ k ∈ range (card α), (↑k)⁻¹ + 1
tactic: rw [← powerset_univ, powerset_card_disjiUnion, sum_disjiUnion]
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
⊢ ∑ i ∈ range (univ.card + 1),
      ∑ x ∈ powersetCard i univ, ↑(card α) / ((↑(card α) - ↑x.card) * ↑((card α).choose x.card)) =
    ↑(card α) * ∑ k ∈ range (card α), (↑k)⁻¹ + 1
state_after: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
⊢ ∑ i ∈ range (univ.card + 1),
      ∑ x ∈ powersetCard i univ, ↑(card α) / ((↑(card α) - ↑x.card) * ↑((card α).choose x.card)) =
    ↑(card α) * ∑ k ∈ range (card α), (↑k)⁻¹ + 1
tactic: have : ∀ {x : ℕ}, ∀ s ∈ powersetCard x (univ : Finset α),
    (card α / ((card α - Finset.card s) * (card α).choose (Finset.card s)) : ℚ) =
      card α / ((card α - x) * (card α).choose x) := by
    intros n s hs
    rw [mem_powersetCard_univ.1 hs]
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
⊢ ∑ i ∈ range (univ.card + 1),
      ∑ x ∈ powersetCard i univ, ↑(card α) / ((↑(card α) - ↑x.card) * ↑((card α).choose x.card)) =
    ↑(card α) * ∑ k ∈ range (card α), (↑k)⁻¹ + 1
state_after: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
⊢ ∑ x ∈ range (card α + 1), ↑(card α) * (↑((card α).choose x) / ((↑(card α) - ↑x) * ↑((card α).choose x))) =
    ↑(card α) * ∑ k ∈ range (card α), (↑k)⁻¹ + 1
tactic: simp_rw [sum_congr rfl this, sum_const, card_powersetCard, card_univ, nsmul_eq_mul, mul_div,
    mul_comm, ← mul_div]
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
⊢ ∑ x ∈ range (card α + 1), ↑(card α) * (↑((card α).choose x) / ((↑(card α) - ↑x) * ↑((card α).choose x))) =
    ↑(card α) * ∑ k ∈ range (card α), (↑k)⁻¹ + 1
state_after: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
⊢ ↑(card α) * ∑ i ∈ range (card α + 1), ↑((card α).choose i) / ((↑(card α) - ↑i) * ↑((card α).choose i)) =
    ↑(card α) * ∑ x ∈ range (card α).succ, (↑x)⁻¹
tactic: rw [← mul_sum, ← mul_inv_cancel (cast_ne_zero.mpr card_ne_zero : (card α : ℚ) ≠ 0), ← mul_add,
    add_comm _ ((card α)⁻¹ : ℚ), ← sum_insert (f := fun x : ℕ ↦ (x⁻¹ : ℚ)) not_mem_range_self,
    ← range_succ]
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
⊢ ↑(card α) * ∑ i ∈ range (card α + 1), ↑((card α).choose i) / ((↑(card α) - ↑i) * ↑((card α).choose i)) =
    ↑(card α) * ∑ x ∈ range (card α).succ, (↑x)⁻¹
state_after: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this✝ :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
this : ∀ n ∈ range (card α + 1), ↑((card α).choose n) / ((↑(card α) - ↑n) * ↑((card α).choose n)) = (↑(card α) - ↑n)⁻¹
⊢ ↑(card α) * ∑ i ∈ range (card α + 1), ↑((card α).choose i) / ((↑(card α) - ↑i) * ↑((card α).choose i)) =
    ↑(card α) * ∑ x ∈ range (card α).succ, (↑x)⁻¹
tactic: have (n) (hn : n ∈ range (card α + 1)) :
      ((card α).choose n / ((card α - n) * (card α).choose n) : ℚ) = (card α - n : ℚ)⁻¹ := by
    rw [div_mul_cancel_right₀]
    exact cast_ne_zero.2 (choose_pos $ mem_range_succ_iff.1 hn).ne'
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this✝ :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
this : ∀ n ∈ range (card α + 1), ↑((card α).choose n) / ((↑(card α) - ↑n) * ↑((card α).choose n)) = (↑(card α) - ↑n)⁻¹
⊢ ↑(card α) * ∑ i ∈ range (card α + 1), ↑((card α).choose i) / ((↑(card α) - ↑i) * ↑((card α).choose i)) =
    ↑(card α) * ∑ x ∈ range (card α).succ, (↑x)⁻¹
state_after: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this✝ :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
this : ∀ n ∈ range (card α + 1), ↑((card α).choose n) / ((↑(card α) - ↑n) * ↑((card α).choose n)) = (↑(card α) - ↑n)⁻¹
⊢ ∑ x ∈ range (card α + 1), (↑(card α) - ↑x)⁻¹ = ∑ x ∈ range (card α).succ, (↑x)⁻¹ ∨ card α = 0
tactic: simp only [sum_congr rfl this, mul_eq_mul_left_iff, cast_eq_zero]
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this✝ :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
this : ∀ n ∈ range (card α + 1), ↑((card α).choose n) / ((↑(card α) - ↑n) * ↑((card α).choose n)) = (↑(card α) - ↑n)⁻¹
⊢ ∑ x ∈ range (card α + 1), (↑(card α) - ↑x)⁻¹ = ∑ x ∈ range (card α).succ, (↑x)⁻¹ ∨ card α = 0
state_after: case h.e'_1.h.e'_2.a
α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this✝ :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
this : ∀ n ∈ range (card α + 1), ↑((card α).choose n) / ((↑(card α) - ↑n) * ↑((card α).choose n)) = (↑(card α) - ↑n)⁻¹
a : ℕ
ha : a ∈ range (card α + 1)
⊢ (↑(card α) - ↑a)⁻¹ = (↑(card α + 1 - 1 - a))⁻¹
tactic: convert Or.inl $ sum_range_reflect _ _ with a ha
state_before: case h.e'_1.h.e'_2.a
α : Type u_1
inst✝¹ : Fintype α
inst✝ : Nonempty α
m n : ℕ
this✝ :
  ∀ {x : ℕ},
    ∀ s ∈ powersetCard x univ,
      ↑(card α) / ((↑(card α) - ↑s.card) * ↑((card α).choose s.card)) =
        ↑(card α) / ((↑(card α) - ↑x) * ↑((card α).choose x))
this : ∀ n ∈ range (card α + 1), ↑((card α).choose n) / ((↑(card α) - ↑n) * ↑((card α).choose n)) = (↑(card α) - ↑n)⁻¹
a : ℕ
ha : a ∈ range (card α + 1)
⊢ (↑(card α) - ↑a)⁻¹ = (↑(card α + 1 - 1 - a))⁻¹
state_after: no goals
tactic: rw [add_tsub_cancel_right, cast_sub (mem_range_succ_iff.mp ha)]