Theorem: List.prod_take_ofFn
File: Mathlib/Algebra/BigOperators/Fin.lean

tactic: simp
state_before: case zero
α : Type u_1
β : Type u_2
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
⊢ (take 0 (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < 0) univ, f j
state_after: no goals

tactic: by_cases h : i < n
state_before: case succ
α : Type u_1
β : Type u_2
inst✝ : CommMonoid α
n : ℕ
f : Fin n → α
i : ℕ
IH : (take i (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j
⊢ (take (i + 1) (ofFn f)).prod = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j
state_after: case pos
α : Type u_1
β : Type u_2
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

case neg
α : Type u_1
β : Type u_2
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]
state_before: case pos
α : Type u_1
β : Type u_2
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
state_after: case pos
α : Type u_1
β : Type u_2
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]
state_before: case pos
α : Type u_1
β : Type u_2
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
state_after: case pos
α : Type u_1
β : Type u_2
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

tactic: have A : ((Finset.univ : Finset (Fin n)).filter fun j => j.val < i + 1) =
    ((Finset.univ : Finset (Fin n)).filter fun j => j.val < i) ∪ {(⟨i, h⟩ : Fin n)} := by
  ext ⟨_, _⟩
  simp [Nat.lt_succ_iff_lt_or_eq]
state_before: case pos
α : Type u_1
β : Type u_2
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
state_after: case pos
α : Type u_1
β : Type u_2
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
A : Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}
⊢ (take i (ofFn f)).prod * (ofFn f)[i] = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

tactic: have B : _root_.Disjoint (Finset.filter (fun j : Fin n => j.val < i) Finset.univ)
    (singleton (⟨i, h⟩ : Fin n)) := by simp
state_before: case pos
α : Type u_1
β : Type u_2
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
A : Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}
⊢ (take i (ofFn f)).prod * (ofFn f)[i] = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j
state_after: case pos
α : Type u_1
β : Type u_2
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
A : Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}
B : _root_.Disjoint (Finset.filter (fun j => ↑j < i) univ) {⟨i, h⟩}
⊢ (take i (ofFn f)).prod * (ofFn f)[i] = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j

tactic: rw [A, Finset.prod_union B, IH]
state_before: case pos
α : Type u_1
β : Type u_2
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
A : Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}
B : _root_.Disjoint (Finset.filter (fun j => ↑j < i) univ) {⟨i, h⟩}
⊢ (take i (ofFn f)).prod * (ofFn f)[i] = ∏ j ∈ Finset.filter (fun j => ↑j < i + 1) univ, f j
state_after: case pos
α : Type u_1
β : Type u_2
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
A : Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}
B : _root_.Disjoint (Finset.filter (fun j => ↑j < i) univ) {⟨i, h⟩}
⊢ (∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j) * (ofFn f)[i] =
    (∏ x ∈ Finset.filter (fun j => ↑j < i) univ, f x) * ∏ x ∈ {⟨i, h⟩}, f x

tactic: simp
state_before: case pos
α : Type u_1
β : Type u_2
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
A : Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}
B : _root_.Disjoint (Finset.filter (fun j => ↑j < i) univ) {⟨i, h⟩}
⊢ (∏ j ∈ Finset.filter (fun j => ↑j < i) univ, f j) * (ofFn f)[i] =
    (∏ x ∈ Finset.filter (fun j => ↑j < i) univ, f x) * ∏ x ∈ {⟨i, h⟩}, f x
state_after: no goals

tactic: rwa [length_ofFn f]
state_before: α : Type u_1
β : Type u_2
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
⊢ i < (ofFn f).length
state_after: no goals

tactic: ext ⟨_, _⟩
state_before: α : Type u_1
β : Type u_2
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⟩}
state_after: case a.mk
α : Type u_1
β : Type u_2
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]
state_before: case a.mk
α : Type u_1
β : Type u_2
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⟩}
state_after: no goals

tactic: simp
state_before: α : Type u_1
β : Type u_2
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
A : Finset.filter (fun j => ↑j < i + 1) univ = Finset.filter (fun j => ↑j < i) univ ∪ {⟨i, h⟩}
⊢ _root_.Disjoint (Finset.filter (fun j => ↑j < i) univ) {⟨i, h⟩}
state_after: no goals

tactic: have A : (ofFn f).take i = (ofFn f).take i.succ := by
  rw [← length_ofFn f] at h
  have : length (ofFn f) ≤ i := not_lt.mp h
  rw [take_all_of_le this, take_all_of_le (le_trans this (Nat.le_succ _))]
state_before: case neg
α : Type u_1
β : Type u_2
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
state_after: case neg
α : Type u_1
β : Type u_2
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 _)]
state_before: case neg
α : Type u_1
β : Type u_2
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
state_after: case neg
α : Type u_1
β : Type u_2
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]
state_before: case neg
α : Type u_1
β : Type u_2
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
state_after: no goals

tactic: rw [← length_ofFn f] at h
state_before: α : Type u_1
β : Type u_2
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 (ofFn f) = take i.succ (ofFn f)
state_after: α : Type u_1
β : Type u_2
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
⊢ take i (ofFn f) = take i.succ (ofFn f)

tactic: have : length (ofFn f) ≤ i := not_lt.mp h
state_before: α : Type u_1
β : Type u_2
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
⊢ take i (ofFn f) = take i.succ (ofFn f)
state_after: α : Type u_1
β : Type u_2
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_all_of_le this, take_all_of_le (le_trans this (Nat.le_succ _))]
state_before: α : Type u_1
β : Type u_2
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)
state_after: no goals

tactic: intro j
state_before: α : Type u_1
β : Type u_2
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), (↑j < i.succ) = (↑j < i)
state_after: α : Type u_1
β : Type u_2
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
⊢ (↑j < i.succ) = (↑j < i)

tactic: have : (j : ℕ) < i := lt_of_lt_of_le j.2 (not_lt.mp h)
state_before: α : Type u_1
β : Type u_2
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
⊢ (↑j < i.succ) = (↑j < i)
state_after: α : Type u_1
β : Type u_2
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 _)]
state_before: α : Type u_1
β : Type u_2
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)
state_after: no goals