-- Mathlib/Algebra/BigOperators/Fin.lean
theorem prod_take_ofFn {n : ℕ} (f : Fin n → α) (i : ℕ) :
    ((ofFn f).take i).prod = ∏ j ∈ Finset.univ.filter fun j : Fin n => j.val < i, f j

Proof state:
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : i < n
this : i < (ofFn f).length
⊢ Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}

Tactic:
ext ⟨_, _⟩

Result:
case h.mk
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : i < n
this : i < (ofFn f).length
val✝ : ℕ
isLt✝ : val✝ < n
⊢ ⟨val✝, isLt✝⟩ ∈ Finset.filter (fun j => ↑j < i + 1) univ ↔
    ⟨val✝, isLt✝⟩ ∈ Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}

Proof state:
case neg
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : ¬i < n
A : take i (ofFn f) = take i.succ (ofFn f)
⊢ (take (i + 1) (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

Tactic:
have B : ∀ j : Fin n, ((j : ℕ) < i.succ) = ((j : ℕ) < i) := by
  intro j
  have : (j : ℕ) < i := lt_of_lt_of_le j.2 (not_lt.mp h)
  simp [this, lt_trans this (Nat.lt_succ_self _)]

Result:
case neg
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : ¬i < n
A : take i (ofFn f) = take i.succ (ofFn f)
B : ∀ (j : Fin n), (↑j < i.succ) = (↑j < i)
⊢ (take (i + 1) (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

Proof state:
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : ¬i < n
A : take i (ofFn f) = take i.succ (ofFn f)
j : Fin n
this : ↑j < i
⊢ (↑j < i.succ) = (↑j < i)

Tactic:
simp [this, lt_trans this (Nat.lt_succ_self _)]

Result:
no goals

Proof state:
case neg
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : ¬i < n
A : take i (ofFn f) = take i.succ (ofFn f)
B : ∀ (j : Fin n), (↑j < i.succ) = (↑j < i)
⊢ (take (i + 1) (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

Tactic:
simp [← A, B, IH]

Result:
no goals

Proof state:
case h.mk
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : i < n
this : i < (ofFn f).length
val✝ : ℕ
isLt✝ : val✝ < n
⊢ ⟨val✝, isLt✝⟩ ∈ Finset.filter (fun j => ↑j < i + 1) univ ↔
    ⟨val✝, isLt✝⟩ ∈ Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}

Tactic:
simp [Nat.lt_succ_iff_lt_or_eq]

Result:
no goals

Proof state:
case pos
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : i < n
this : i < (ofFn f).length
⊢ (take (i + 1) (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

Tactic:
rw [prod_take_succ _ _ this]

Result:
case pos
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : i < n
this : i < (ofFn f).length
⊢ (take i (ofFn f)).prod * (ofFn f)[i] = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

Proof state:
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : ¬i < (ofFn f).length
this : (ofFn f).length ≤ i
⊢ take i (ofFn f) = take i.succ (ofFn f)

Tactic:
rw [take_of_length_le this, take_of_length_le (le_trans this (Nat.le_succ _))]

Result:
no goals

Proof state:
case zero
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
⊢ (take 0 (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < 0) univ, f j

Tactic:
simp

Result:
no goals

Proof state:
case pos
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : i < n
⊢ (take (i + 1) (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

Tactic:
have : i < length (ofFn f) := by rwa [length_ofFn f]

Result:
case pos
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
h : i < n
this : i < (ofFn f).length
⊢ (take (i + 1) (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j