l3lab/ntp-mathlib huggingface dataset:
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
    [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
    0 ≤ ∏ x in s, f x :=
  calc
    0 ≤ ∏ x in s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
      Finset.prod_nonneg fun x _ => by
        split_ifs with hx
        · simp [hx]
        

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrderedCommRing β
f : α → β
inst✝ : DecidablePred fun x => f x ≤ 0
s : Finset α
h0 : Even (card (filter (fun x => f x ≤ 0) s))
x : α
x✝ : x ∈ s
hx : ¬f x ≤ 0
⊢ 0 ≤ 1 * f x

Next tactic:
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
    [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
    0 ≤ ∏ x in s, f x :=
  calc
    0 ≤ ∏ x in s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
      Finset.prod_nonneg fun x _ => by
        split_ifs with hx
        · simp [hx]
        simp? at hx ⊢ says 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrderedCommRing β
f : α → β
inst✝ : DecidablePred fun x => f x ≤ 0
s : Finset α
h0 : Even (card (filter (fun x => f x ≤ 0) s))
x : α
x✝ : x ∈ s
hx : ¬f x ≤ 0
⊢ 0 ≤ 1 * f x

Next tactic:
simp only [not_le, one_mul] at hx ⊢
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
    [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
    0 ≤ ∏ x in s, f x :=
  calc
    0 ≤ ∏ x in s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
      Finset.prod_nonneg fun x _ => by
        split_ifs with hx
        · simp [hx]
        simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
        

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrderedCommRing β
f : α → β
inst✝ : DecidablePred fun x => f x ≤ 0
s : Finset α
h0 : Even (card (filter (fun x => f x ≤ 0) s))
x : α
x✝ : x ∈ s
hx : 0 < f x
⊢ 0 ≤ f x

Next tactic:
exact le_of_lt hx
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
    [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
    0 ≤ ∏ x in s, f x :=
  calc
    0 ≤ ∏ x in s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
      Finset.prod_nonneg fun x _ => by
        split_ifs with hx
        · simp [hx]
        simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
        exact le_of_lt hx
    _ = _ := by
      

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrderedCommRing β
f : α → β
inst✝ : DecidablePred fun x => f x ≤ 0
s : Finset α
h0 : Even (card (filter (fun x => f x ≤ 0) s))
⊢ ∏ x in s, (if f x ≤ 0 then -1 else 1) * f x = ∏ x in s, f x

Next tactic:
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
        Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  

Proof state:
m : ℤ
n : ℕ
hn : Even n
⊢ 0 ≤ ∏ k in Finset.range n, (m - ↑k)

Next tactic:
rcases hn with ⟨n, rfl⟩
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  

Proof state:
case intro
m : ℤ
n : ℕ
⊢ 0 ≤ ∏ k in Finset.range (n + n), (m - ↑k)

Next tactic:
induction' n with n ihn
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · 

Proof state:
case intro.zero
m : ℤ
⊢ 0 ≤ ∏ k in Finset.range (Nat.zero + Nat.zero), (m - ↑k)

Next tactic:
simp
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  

Proof state:
case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k in Finset.range (n + n), (m - ↑k)
⊢ 0 ≤ ∏ k in Finset.range (Nat.succ n + Nat.succ n), (m - ↑k)

Next tactic:
rw [← two_mul] at ihn
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  

Proof state:
case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k in Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ ∏ k in Finset.range (Nat.succ n + Nat.succ n), (m - ↑k)

Next tactic:
rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
  

Proof state:
case intro.succ
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k in Finset.range (2 * n), (m - ↑k)
⊢ 0 ≤ (∏ x in Finset.range ((1 + 1) * n), (m - ↑x)) * ((m - ↑((1 + 1) * n)) * (m - ↑((1 + 1) * n + 1)))

Next tactic:
refine' mul_nonneg ihn _
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
  refine' mul_nonneg ihn _; 

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

Next tactic:
generalize (1 + 1) * n = k
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
  refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
  

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

Next tactic:
rcases le_or_lt m k with hmk | hmk
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
  refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
  rcases le_or_lt m k with hmk | hmk
  · 

Proof state:
case intro.succ.inl
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k in Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))

Next tactic:
have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
  refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
  rcases le_or_lt m k with hmk | hmk
  · have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
    

Proof state:
case intro.succ.inl
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k in Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
this : m ≤ ↑k + 1
⊢ 0 ≤ (m - ↑k) * (m - ↑(k + 1))

Next tactic:
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
  refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
  rcases le_or_lt m k with hmk | hmk
  · have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
    convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
    

Proof state:
case intro.succ.inl.convert_2
m : ℤ
n : ℕ
ihn : 0 ≤ ∏ k in Finset.range (2 * n), (m - ↑k)
k : ℕ
hmk : m ≤ ↑k
this : m ≤ ↑k + 1
⊢ m - ↑(k + 1) ≤ 0

Next tactic:
convert sub_nonpos_of_le this
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
    0 ≤ ∏ k in Finset.range n, (m - k) := by
  rcases hn with ⟨n, rfl⟩
  induction' n with n ihn
  · simp
  rw [← two_mul] at ihn
  rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
    Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
  refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
  rcases le_or_lt m k with hmk | hmk
  · have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
    convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
    convert sub_nonpos_of_le this
  · 

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

Next tactic:
exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
    0 < ∏ k in Finset.range n, (m - k) := by
  

Proof state:
m : ℤ
n : ℕ
hn : Even n
hm : m ∉ Ico 0 ↑n
⊢ 0 < ∏ k in Finset.range n, (m - ↑k)

Next tactic:
refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
    0 < ∏ k in Finset.range n, (m - k) := by
  refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
  

Proof state:
m : ℤ
n : ℕ
hn : Even n
hm : m ∉ Ico 0 ↑n
h : 0 = ∏ k in Finset.range n, (m - ↑k)
⊢ m ∈ Ico 0 ↑n

Next tactic:
rw [eq_comm, Finset.prod_eq_zero_iff] at h
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
    0 < ∏ k in Finset.range n, (m - k) := by
  refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
  rw [eq_comm, Finset.prod_eq_zero_iff] at h
  

Proof state:
m : ℤ
n : ℕ
hn : Even n
hm : m ∉ Ico 0 ↑n
h : ∃ a ∈ Finset.range n, m - ↑a = 0
⊢ m ∈ Ico 0 ↑n

Next tactic:
obtain ⟨a, ha, h⟩ := h
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
    0 < ∏ k in Finset.range n, (m - k) := by
  refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
  rw [eq_comm, Finset.prod_eq_zero_iff] at h
  obtain ⟨a, ha, h⟩ := h
  

Proof state:
case intro.intro
m : ℤ
n : ℕ
hn : Even n
hm : m ∉ Ico 0 ↑n
a : ℕ
ha : a ∈ Finset.range n
h : m - ↑a = 0
⊢ m ∈ Ico 0 ↑n

Next tactic:
rw [sub_eq_zero.1 h]
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
    0 < ∏ k in Finset.range n, (m - k) := by
  refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
  rw [eq_comm, Finset.prod_eq_zero_iff] at h
  obtain ⟨a, ha, h⟩ := h
  rw [sub_eq_zero.1 h]
  

Proof state:
case intro.intro
m : ℤ
n : ℕ
hn : Even n
hm : m ∉ Ico 0 ↑n
a : ℕ
ha : a ∈ Finset.range n
h : m - ↑a = 0
⊢ ↑a ∈ Ico 0 ↑n

Next tactic:
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  

Proof state:
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
⊢ StrictConvexOn ℝ (Ioi 0) fun x => x ^ m

Next tactic:
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · 

Proof state:
case hf
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
⊢ ContinuousOn (fun x => x ^ m) (Ioi 0)

Next tactic:
exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
⊢ ∀ x ∈ Ioi 0, 0 < deriv^[2] (fun x => x ^ m) x

Next tactic:
intro x hx
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : x ∈ Ioi 0
⊢ 0 < deriv^[2] (fun x => x ^ m) x

Next tactic:
rw [mem_Ioi] at hx
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
⊢ 0 < deriv^[2] (fun x => x ^ m) x

Next tactic:
rw [iter_deriv_zpow]
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
⊢ 0 < (∏ i in Finset.range 2, (↑m - ↑i)) * x ^ (m - ↑2)

Next tactic:
refine' mul_pos _ (zpow_pos_of_pos hx _)
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
⊢ 0 < ∏ i in Finset.range 2, (↑m - ↑i)

Next tactic:
norm_cast
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  norm_cast
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
⊢ 0 < ∏ i in Finset.range 2, (m - ↑i)

Next tactic:
refine' int_prod_range_pos (by decide) fun hm => _
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  norm_cast
  refine' int_prod_range_pos (by 

Proof state:
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
⊢ Even 2

Next tactic:
decide
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  norm_cast
  refine' int_prod_range_pos (by decide) fun hm => _
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
hm : m ∈ Ico 0 ↑2
⊢ False

Next tactic:
rw [← Finset.coe_Ico] at hm
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  norm_cast
  refine' int_prod_range_pos (by decide) fun hm => _
  rw [← Finset.coe_Ico] at hm
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
hm : m ∈ ↑(Finset.Ico 0 ↑2)
⊢ False

Next tactic:
norm_cast at hm
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  norm_cast
  refine' int_prod_range_pos (by decide) fun hm => _
  rw [← Finset.coe_Ico] at hm
  norm_cast at hm
  

Proof state:
case hf''
m : ℤ
hm₀ : m ≠ 0
hm₁ : m ≠ 1
x : ℝ
hx : 0 < x
hm : m ∈ Finset.Ico 0 2
⊢ False

Next tactic:
fin_cases hm
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  norm_cast
  refine' int_prod_range_pos (by decide) fun hm => _
  rw [← Finset.coe_Ico] at hm
  norm_cast at hm
  fin_cases hm <;> 

Proof state:
case hf''.head
x : ℝ
hx : 0 < x
hm₀ : (Function.Embedding.trans Nat.castEmbedding (addLeftEmbedding 0)) 0 ≠ 0
hm₁ : (Function.Embedding.trans Nat.castEmbedding (addLeftEmbedding 0)) 0 ≠ 1
⊢ False

Next tactic:
simp_all
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
    StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
  apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
  · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
  intro x hx
  rw [mem_Ioi] at hx
  rw [iter_deriv_zpow]
  refine' mul_pos _ (zpow_pos_of_pos hx _)
  norm_cast
  refine' int_prod_range_pos (by decide) fun hm => _
  rw [← Finset.coe_Ico] at hm
  norm_cast at hm
  fin_cases hm <;> 

Proof state:
case hf''.tail.head
x : ℝ
hx : 0 < x
hm₀ : (Function.Embedding.trans Nat.castEmbedding (addLeftEmbedding 0)) 1 ≠ 0
hm₁ : (Function.Embedding.trans Nat.castEmbedding (addLeftEmbedding 0)) 1 ≠ 1
⊢ False

Next tactic:
simp_all
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
    HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x := by
  

Proof state:
x : ℝ
hx : x ≠ 0
⊢ HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x

Next tactic:
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
    HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x := by
  convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
  

Proof state:
case h.e'_7
x : ℝ
hx : x ≠ 0
⊢ (2 + log x) / (2 * sqrt x) = 1 / (2 * sqrt x) * log x + sqrt x * x⁻¹

Next tactic:
rw [add_div, div_mul_right (sqrt x) two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
    div_eq_mul_one_div, mul_comm]
theorem deriv_sqrt_mul_log (x : ℝ) :
    deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
  

Proof state:
x : ℝ
⊢ deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x)

Next tactic:
cases' lt_or_le 0 x with hx hx
theorem deriv_sqrt_mul_log (x : ℝ) :
    deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
  cases' lt_or_le 0 x with hx hx
  · 

Proof state:
case inl
x : ℝ
hx : 0 < x
⊢ deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x)

Next tactic:
exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
theorem deriv_sqrt_mul_log (x : ℝ) :
    deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
  cases' lt_or_le 0 x with hx hx
  · exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
  · 

Proof state:
case inr
x : ℝ
hx : x ≤ 0
⊢ deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x)

Next tactic:
rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
theorem deriv_sqrt_mul_log (x : ℝ) :
    deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
  cases' lt_or_le 0 x with hx hx
  · exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
  · rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
    

Proof state:
case inr
x : ℝ
hx : x ≤ 0
⊢ deriv (fun x => sqrt x * log x) x = 0

Next tactic:
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
theorem deriv_sqrt_mul_log (x : ℝ) :
    deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
  cases' lt_or_le 0 x with hx hx
  · exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
  · rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
    refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
    

Proof state:
case inr
x : ℝ
hx : x ≤ 0
⊢ HasDerivWithinAt (fun x => sqrt x * log x) 0 (Iic 0) x

Next tactic:
refine' (hasDerivWithinAt_const x _ 0).congr_of_mem (fun x hx => _) hx
theorem deriv_sqrt_mul_log (x : ℝ) :
    deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
  cases' lt_or_le 0 x with hx hx
  · exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
  · rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
    refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
    refine' (hasDerivWithinAt_const x _ 0).congr_of_mem (fun x hx => _) hx
    

Proof state:
case inr
x✝ : ℝ
hx✝ : x✝ ≤ 0
x : ℝ
hx : x ∈ Iic 0
⊢ sqrt x * log x = 0

Next tactic:
rw [sqrt_eq_zero_of_nonpos hx, zero_mul]
theorem deriv2_sqrt_mul_log (x : ℝ) :
    deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
  

Proof state:
x : ℝ
⊢ deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3)

Next tactic:
simp only [Nat.iterate, deriv_sqrt_mul_log']
theorem deriv2_sqrt_mul_log (x : ℝ) :
    deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
  simp only [Nat.iterate, deriv_sqrt_mul_log']
  

Proof state:
x : ℝ
⊢ deriv (fun x => (2 + log x) / (2 * sqrt x)) x = -log x / (4 * sqrt x ^ 3)

Next tactic:
rcases le_or_lt x 0 with hx | hx
theorem deriv2_sqrt_mul_log (x : ℝ) :
    deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
  simp only [Nat.iterate, deriv_sqrt_mul_log']
  rcases le_or_lt x 0 with hx | hx
  · 

Proof state:
case inl
x : ℝ
hx : x ≤ 0
⊢ deriv (fun x => (2 + log x) / (2 * sqrt x)) x = -log x / (4 * sqrt x ^ 3)

Next tactic:
rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, mul_zero, div_zero]
theorem deriv2_sqrt_mul_log (x : ℝ) :
    deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
  simp only [Nat.iterate, deriv_sqrt_mul_log']
  rcases le_or_lt x 0 with hx | hx
  · rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, mul_zero, div_zero]
    

Proof state:
case inl
x : ℝ
hx : x ≤ 0
⊢ deriv (fun x => (2 + log x) / (2 * sqrt x)) x = 0

Next tactic:
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
theorem deriv2_sqrt_mul_log (x : ℝ) :
    deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
  simp only [Nat.iterate, deriv_sqrt_mul_log']
  rcases le_or_lt x 0 with hx | hx
  · rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, mul_zero, div_zero]
    refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
    

Proof state:
case inl
x : ℝ
hx : x ≤ 0
⊢ HasDerivWithinAt (fun x => (2 + log x) / (2 * sqrt x)) 0 (Iic 0) x

Next tactic:
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx