Theorem: convexOn_zpow
File: Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean

tactic: simp_rw [zpow_ofNat]
state_before: n : ℕ
⊢ ConvexOn ℝ (Ioi 0) fun x => x ^ ↑n

tactic: exact (convexOn_pow n).subset Ioi_subset_Ici_self (convex_Ioi _)
state_before: n : ℕ
⊢ ConvexOn ℝ (Ioi 0) fun x => x ^ n

tactic: simp_rw [zpow_negSucc]
state_before: n : ℕ
⊢ ConvexOn ℝ (Ioi 0) fun x => x ^ -[n+1]

tactic: refine' ⟨convex_Ioi _, _⟩
state_before: n : ℕ
⊢ ConvexOn ℝ (Ioi 0) fun x => (x ^ (n + 1))⁻¹

tactic: rintro a (ha : 0 < a) b (hb : 0 < b) μ ν hμ hν h
state_before: n : ℕ
⊢ ∀ ⦃x : ℝ⦄,
    x ∈ Ioi 0 →
      ∀ ⦃y : ℝ⦄,
        y ∈ Ioi 0 →
          ∀ ⦃a b : ℝ⦄,
            0 ≤ a →
              0 ≤ b →
                a + b = 1 →
                  (fun x => (x ^ (n + 1))⁻¹) (a • x + b • y) ≤
                    a • (fun x => (x ^ (n + 1))⁻¹) x + b • (fun x => (x ^ (n + 1))⁻¹) y

tactic: field_simp [ha.ne', hb.ne']
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ (fun x => (x ^ (n + 1))⁻¹) (μ • a + ν • b) ≤ μ • (fun x => (x ^ (n + 1))⁻¹) a + ν • (fun x => (x ^ (n + 1))⁻¹) b

tactic: rw [div_le_div_iff]
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 1 / (μ * a + ν * b) ^ (n + 1) ≤ (μ * b ^ (n + 1) + ν * a ^ (n + 1)) / (a ^ (n + 1) * b ^ (n + 1))

tactic: calc
  (1 : ℝ) * (a ^ (n + 1) * b ^ (n + 1)) = ((μ + ν) ^ 2 * (a * b)) ^ (n + 1) := by rw [h]; ring
  _ ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) := ?_
  _ = (μ * b + ν * a) ^ (n + 1) * (μ * a + ν * b) ^ (n + 1) := by rw [mul_pow]
  _ ≤ (μ * b ^ (n + 1) + ν * a ^ (n + 1)) * (μ * a + ν * b) ^ (n + 1) := ?_
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 1 * (a ^ (n + 1) * b ^ (n + 1)) ≤ (μ * b ^ (n + 1) + ν * a ^ (n + 1)) * (μ * a + ν * b) ^ (n + 1)

tactic: rw [h]
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 1 * (a ^ (n + 1) * b ^ (n + 1)) = ((μ + ν) ^ 2 * (a * b)) ^ (n + 1)

tactic: ring
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 1 * (a ^ (n + 1) * b ^ (n + 1)) = (1 ^ 2 * (a * b)) ^ (n + 1)

tactic: rw [mul_pow]
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) = (μ * b + ν * a) ^ (n + 1) * (μ * a + ν * b) ^ (n + 1)

tactic: gcongr (?_ : ℝ) ^ _
state_before: case calc_1
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ ((μ + ν) ^ 2 * (a * b)) ^ (n + 1) ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1)

tactic: have : (0 : ℝ) ≤ μ * ν * (a - b) ^ 2 := by positivity
state_before: case calc_1.hab
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ (μ + ν) ^ 2 * (a * b) ≤ (μ * b + ν * a) * (μ * a + ν * b)

tactic: linarith
state_before: case calc_1.hab
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
this : 0 ≤ μ * ν * (a - b) ^ 2
⊢ (μ + ν) ^ 2 * (a * b) ≤ (μ * b + ν * a) * (μ * a + ν * b)

tactic: positivity
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 0 ≤ μ * ν * (a - b) ^ 2

tactic: gcongr
state_before: case calc_2
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ (μ * b + ν * a) ^ (n + 1) * (μ * a + ν * b) ^ (n + 1) ≤
    (μ * b ^ (n + 1) + ν * a ^ (n + 1)) * (μ * a + ν * b) ^ (n + 1)

tactic: apply (convexOn_pow (n + 1)).2 hb.le ha.le hμ hν h
state_before: case calc_2.h
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ (μ * b + ν * a) ^ (n + 1) ≤ μ * b ^ (n + 1) + ν * a ^ (n + 1)

tactic: have : 0 < μ * a + ν * b := by cases le_or_lt a b <;> nlinarith
state_before: case b0
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 0 < (μ * a + ν * b) ^ (n + 1)

tactic: positivity
state_before: case b0
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
this : 0 < μ * a + ν * b
⊢ 0 < (μ * a + ν * b) ^ (n + 1)

tactic: cases le_or_lt a b <;> nlinarith
state_before: n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 0 < μ * a + ν * b

tactic: positivity
state_before: case d0
n : ℕ
a : ℝ
ha : 0 < a
b : ℝ
hb : 0 < b
μ ν : ℝ
hμ : 0 ≤ μ
hν : 0 ≤ ν
h : μ + ν = 1
⊢ 0 < a ^ (n + 1) * b ^ (n + 1)