Theorem: StrictConvexOn.ae_eq_const_or_map_average_lt
File: Mathlib/Analysis/Convex/Integral.lean

tactic: have : ∀ {t}, μ t ≠ 0 → (⨍ x in t, f x ∂μ) ∈ s ∧ g (⨍ x in t, f x ∂μ) ≤ ⨍ x in t, g (f x) ∂μ :=
  fun ht =>
  hg.convexOn.set_average_mem_epigraph hgc hsc ht (measure_ne_top _ _) (ae_restrict_of_ae hfs)
    hfi.integrableOn hgi.integrableOn
state_before: α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
⊢ f =ᶠ[ae μ] const α (⨍ (x : α), f x ∂μ) ∨ g (⨍ (x : α), f x ∂μ) < ⨍ (x : α), g (f x) ∂μ

tactic: refine' (ae_eq_const_or_exists_average_ne_compl hfi).imp_right _
state_before: α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
this : ∀ {t : Set α}, ↑↑μ t ≠ 0 → (⨍ (x : α) in t, f x ∂μ) ∈ s ∧ g (⨍ (x : α) in t, f x ∂μ) ≤ ⨍ (x : α) in t, g (f x) ∂μ
⊢ f =ᶠ[ae μ] const α (⨍ (x : α), f x ∂μ) ∨ g (⨍ (x : α), f x ∂μ) < ⨍ (x : α), g (f x) ∂μ

tactic: rintro ⟨t, hm, h₀, h₀', hne⟩
state_before: α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
this : ∀ {t : Set α}, ↑↑μ t ≠ 0 → (⨍ (x : α) in t, f x ∂μ) ∈ s ∧ g (⨍ (x : α) in t, f x ∂μ) ≤ ⨍ (x : α) in t, g (f x) ∂μ
⊢ (∃ t, MeasurableSet t ∧ ↑↑μ t ≠ 0 ∧ ↑↑μ (tᶜ) ≠ 0 ∧ (⨍ (x : α) in t, f x ∂μ) ≠ ⨍ (x : α) in tᶜ, f x ∂μ) →
    g (⨍ (x : α), f x ∂μ) < ⨍ (x : α), g (f x) ∂μ

tactic: rcases average_mem_openSegment_compl_self hm.nullMeasurableSet h₀ h₀' (hfi.prod_mk hgi) with
  ⟨a, b, ha, hb, hab, h_avg⟩
state_before: case intro.intro.intro.intro
α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t✝ : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
this : ∀ {t : Set α}, ↑↑μ t ≠ 0 → (⨍ (x : α) in t, f x ∂μ) ∈ s ∧ g (⨍ (x : α) in t, f x ∂μ) ≤ ⨍ (x : α) in t, g (f x) ∂μ
t : Set α
hm : MeasurableSet t
h₀ : ↑↑μ t ≠ 0
h₀' : ↑↑μ (tᶜ) ≠ 0
hne : (⨍ (x : α) in t, f x ∂μ) ≠ ⨍ (x : α) in tᶜ, f x ∂μ
⊢ g (⨍ (x : α), f x ∂μ) < ⨍ (x : α), g (f x) ∂μ

tactic: rw [average_pair hfi hgi, average_pair hfi.integrableOn hgi.integrableOn,
  average_pair hfi.integrableOn hgi.integrableOn, Prod.smul_mk,
  Prod.smul_mk, Prod.mk_add_mk, Prod.mk.inj_iff] at h_avg
state_before: case intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t✝ : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
this : ∀ {t : Set α}, ↑↑μ t ≠ 0 → (⨍ (x : α) in t, f x ∂μ) ∈ s ∧ g (⨍ (x : α) in t, f x ∂μ) ≤ ⨍ (x : α) in t, g (f x) ∂μ
t : Set α
hm : MeasurableSet t
h₀ : ↑↑μ t ≠ 0
h₀' : ↑↑μ (tᶜ) ≠ 0
hne : (⨍ (x : α) in t, f x ∂μ) ≠ ⨍ (x : α) in tᶜ, f x ∂μ
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
h_avg :
  ((a • ⨍ (x : α) in t, (f x, (g ∘ f) x) ∂μ) + b • ⨍ (x : α) in tᶜ, (f x, (g ∘ f) x) ∂μ) =
    ⨍ (x : α), (f x, (g ∘ f) x) ∂μ
⊢ g (⨍ (x : α), f x ∂μ) < ⨍ (x : α), g (f x) ∂μ

tactic: simp only [Function.comp] at h_avg
state_before: case intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t✝ : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
this : ∀ {t : Set α}, ↑↑μ t ≠ 0 → (⨍ (x : α) in t, f x ∂μ) ∈ s ∧ g (⨍ (x : α) in t, f x ∂μ) ≤ ⨍ (x : α) in t, g (f x) ∂μ
t : Set α
hm : MeasurableSet t
h₀ : ↑↑μ t ≠ 0
h₀' : ↑↑μ (tᶜ) ≠ 0
hne : (⨍ (x : α) in t, f x ∂μ) ≠ ⨍ (x : α) in tᶜ, f x ∂μ
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
h_avg :
  (((a • ⨍ (x : α) in t, f x ∂μ) + b • ⨍ (x : α) in tᶜ, f x ∂μ) = ⨍ (x : α), f x ∂μ) ∧
    ((a • ⨍ (x : α) in t, (g ∘ f) x ∂μ) + b • ⨍ (x : α) in tᶜ, (g ∘ f) x ∂μ) = ⨍ (x : α), (g ∘ f) x ∂μ
⊢ g (⨍ (x : α), f x ∂μ) < ⨍ (x : α), g (f x) ∂μ

tactic: rw [← h_avg.1, ← h_avg.2]
state_before: case intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t✝ : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
this : ∀ {t : Set α}, ↑↑μ t ≠ 0 → (⨍ (x : α) in t, f x ∂μ) ∈ s ∧ g (⨍ (x : α) in t, f x ∂μ) ≤ ⨍ (x : α) in t, g (f x) ∂μ
t : Set α
hm : MeasurableSet t
h₀ : ↑↑μ t ≠ 0
h₀' : ↑↑μ (tᶜ) ≠ 0
hne : (⨍ (x : α) in t, f x ∂μ) ≠ ⨍ (x : α) in tᶜ, f x ∂μ
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
h_avg :
  (((a • ⨍ (x : α) in t, f x ∂μ) + b • ⨍ (x : α) in tᶜ, f x ∂μ) = ⨍ (x : α), f x ∂μ) ∧
    ((a • ⨍ (x : α) in t, g (f x) ∂μ) + b • ⨍ (x : α) in tᶜ, g (f x) ∂μ) = ⨍ (x : α), g (f x) ∂μ
⊢ g (⨍ (x : α), f x ∂μ) < ⨍ (x : α), g (f x) ∂μ

tactic: calc
  g ((a • ⨍ x in t, f x ∂μ) + b • ⨍ x in tᶜ, f x ∂μ) <
      a * g (⨍ x in t, f x ∂μ) + b * g (⨍ x in tᶜ, f x ∂μ) :=
    hg.2 (this h₀).1 (this h₀').1 hne ha hb hab
  _ ≤ (a * ⨍ x in t, g (f x) ∂μ) + b * ⨍ x in tᶜ, g (f x) ∂μ :=
    add_le_add (mul_le_mul_of_nonneg_left (this h₀).2 ha.le)
      (mul_le_mul_of_nonneg_left (this h₀').2 hb.le)
state_before: case intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
E : Type u_2
F : Type ?u.2189402
m0 : MeasurableSpace α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : CompleteSpace E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
μ : MeasureTheory.Measure α
s : Set E
t✝ : Set α
f : α → E
g : E → ℝ
C : ℝ
inst✝ : IsFiniteMeasure μ
hg : StrictConvexOn ℝ s g
hgc : ContinuousOn g s
hsc : IsClosed s
hfs : ∀ᵐ (x : α) ∂μ, f x ∈ s
hfi : Integrable f
hgi : Integrable (g ∘ f)
this : ∀ {t : Set α}, ↑↑μ t ≠ 0 → (⨍ (x : α) in t, f x ∂μ) ∈ s ∧ g (⨍ (x : α) in t, f x ∂μ) ≤ ⨍ (x : α) in t, g (f x) ∂μ
t : Set α
hm : MeasurableSet t
h₀ : ↑↑μ t ≠ 0
h₀' : ↑↑μ (tᶜ) ≠ 0
hne : (⨍ (x : α) in t, f x ∂μ) ≠ ⨍ (x : α) in tᶜ, f x ∂μ
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
h_avg :
  (((a • ⨍ (x : α) in t, f x ∂μ) + b • ⨍ (x : α) in tᶜ, f x ∂μ) = ⨍ (x : α), f x ∂μ) ∧
    ((a • ⨍ (x : α) in t, g (f x) ∂μ) + b • ⨍ (x : α) in tᶜ, g (f x) ∂μ) = ⨍ (x : α), g (f x) ∂μ
⊢ g ((a • ⨍ (x : α) in t, f x ∂μ) + b • ⨍ (x : α) in tᶜ, f x ∂μ) <
    (a • ⨍ (x : α) in t, g (f x) ∂μ) + b • ⨍ (x : α) in tᶜ, g (f x) ∂μ