Theorem: int_prod_range_nonneg
File: Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean

tactic: rcases hn with ⟨n, rfl⟩
state_before: m : ℤ
n : ℕ
hn : Even n
⊢ 0 ≤ ∏ k ∈ Finset.range n, (m - ↑k)
state_after: case intro
m : ℤ
n : ℕ
⊢ 0 ≤ ∏ k ∈ Finset.range (n + n), (m - ↑k)

tactic: induction' n with n ihn
state_before: case intro
m : ℤ
n : ℕ
⊢ 0 ≤ ∏ k ∈ Finset.range (n + n), (m - ↑k)
state_after: case intro.zero
m : ℤ
⊢ 0 ≤ ∏ k ∈ Finset.range (0 + 0), (m - ↑k)

case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (n + n), (m - ↑k)
⊢ 0 ≤ ∏ k ∈ Finset.range (n + 1 + (n + 1)), (m - ↑k)

tactic: rw [← two_mul] at ihn
state_before: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (n + n), (m - ↑k)
⊢ 0 ≤ ∏ k ∈ Finset.range (n + 1 + (n + 1)), (m - ↑k)
state_after: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ ∏ k ∈ Finset.range (n + 1 + (n + 1)), (m - ↑k)

tactic: rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
  Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
state_before: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ ∏ k ∈ Finset.range (n + 1 + (n + 1)), (m - ↑k)
state_after: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ (∏ x ∈ Finset.range ((1 + 1) * n), (m - ↑x)) * ((m - ↑((1 + 1) * n)) * (m - ↑((1 + 1) * n + 1)))

tactic: refine mul_nonneg ihn ?_
state_before: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ (∏ x ∈ Finset.range ((1 + 1) * n), (m - ↑x)) * ((m - ↑((1 + 1) * n)) * (m - ↑((1 + 1) * n + 1)))
state_after: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ (m - ↑((1 + 1) * n)) * (m - ↑((1 + 1) * n + 1))

tactic: generalize (1 + 1) * n = k
state_before: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ (m - ↑((1 + 1) * n)) * (m - ↑((1 + 1) * n + 1))
state_after: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))

tactic: rcases le_or_lt m k with hmk | hmk
state_before: case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))
state_after: case intro.succ.inl
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))

case intro.succ.inr
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : ↑k < m
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))

tactic: simp
state_before: case intro.zero
m : ℤ
⊢ 0 ≤ ∏ k ∈ Finset.range (0 + 0), (m - ↑k)
state_after: no goals

tactic: have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
state_before: case intro.succ.inl
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))
state_after: case intro.succ.inl
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
this : m ≤ ↑k + 1
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))

tactic: convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
state_before: case intro.succ.inl
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
this : m ≤ ↑k + 1
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))
state_after: case intro.succ.inl.convert_2
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
this : m ≤ ↑k + 1
⊢ m - ↑(k + 1) ≤ 0

tactic: convert sub_nonpos_of_le this
state_before: case intro.succ.inl.convert_2
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
this : m ≤ ↑k + 1
⊢ m - ↑(k + 1) ≤ 0
state_after: no goals

tactic: exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
state_before: case intro.succ.inr
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k ∈ Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : ↑k < m
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))
state_after: no goals