Theorem: MeasureTheory.lintegral_eq_nnreal
File: Mathlib/MeasureTheory/Integral/Lebesgue.lean

tactic: rw [lintegral]
state_before: α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
⊢ (∫⁻ (a : α), f a ∂μ) =
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: refine'
  le_antisymm (iSup₂_le fun φ hφ => _) (iSup_mono' fun φ => ⟨φ.map ((↑) : ℝ≥0 → ℝ≥0∞), le_rfl⟩)
state_before: α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
⊢ (⨆ (g : α →ₛ ℝ≥0∞) (_ : ↑g ≤ fun a => f a), SimpleFunc.lintegral g μ) =
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: by_cases h : ∀ᵐ a ∂μ, φ a ≠ ∞
state_before: α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
⊢ SimpleFunc.lintegral φ μ ≤
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: let ψ := φ.map ENNReal.toNNReal
state_before: case pos
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
⊢ SimpleFunc.lintegral φ μ ≤
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: replace h : ψ.map ((↑) : ℝ≥0 → ℝ≥0∞) =ᵐ[μ] φ := h.mono fun a => ENNReal.coe_toNNReal
state_before: case pos
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
ψ : α →ₛ ℝ≥0 := SimpleFunc.map ENNReal.toNNReal φ
⊢ SimpleFunc.lintegral φ μ ≤
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: have : ∀ x, ↑(ψ x) ≤ f x := fun x => le_trans ENNReal.coe_toNNReal_le_self (hφ x)
state_before: case pos
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
ψ : α →ₛ ℝ≥0 := SimpleFunc.map ENNReal.toNNReal φ
h : ↑(SimpleFunc.map ENNReal.some ψ) =ᵐ[μ] ↑φ
⊢ SimpleFunc.lintegral φ μ ≤
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: exact
  le_iSup_of_le (φ.map ENNReal.toNNReal) (le_iSup_of_le this (ge_of_eq <| lintegral_congr h))
state_before: case pos
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
ψ : α →ₛ ℝ≥0 := SimpleFunc.map ENNReal.toNNReal φ
h : ↑(SimpleFunc.map ENNReal.some ψ) =ᵐ[μ] ↑φ
this : ∀ (x : α), ↑(↑ψ x) ≤ f x
⊢ SimpleFunc.lintegral φ μ ≤
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: have h_meas : μ (φ ⁻¹' {∞}) ≠ 0 := mt measure_zero_iff_ae_nmem.1 h
state_before: case neg
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
⊢ SimpleFunc.lintegral φ μ ≤
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: refine' le_trans le_top (ge_of_eq <| (iSup_eq_top _).2 fun b hb => _)
state_before: case neg
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
⊢ SimpleFunc.lintegral φ μ ≤
    ⨆ (φ : α →ₛ ℝ≥0) (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some φ) μ

tactic: obtain ⟨n, hn⟩ : ∃ n : ℕ, b < n * μ (φ ⁻¹' {∞})
state_before: case neg
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
⊢ ∃ i, b < ⨆ (_ : ∀ (x : α), ↑(↑i x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some i) μ

tactic: exact exists_nat_mul_gt h_meas (ne_of_lt hb)
state_before: α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
⊢ ∃ n, b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})

case neg.intro
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
n : ℕ
hn : b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})
⊢ ∃ i, b < ⨆ (_ : ∀ (x : α), ↑(↑i x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some i) μ

tactic: use (const α (n : ℝ≥0)).restrict (φ ⁻¹' {∞})
state_before: case neg.intro
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
n : ℕ
hn : b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})
⊢ ∃ i, b < ⨆ (_ : ∀ (x : α), ↑(↑i x) ≤ f x), SimpleFunc.lintegral (SimpleFunc.map ENNReal.some i) μ

tactic: simp only [lt_iSup_iff, exists_prop, coe_restrict, φ.measurableSet_preimage, coe_const,
  ENNReal.coe_indicator, map_coe_ennreal_restrict, SimpleFunc.map_const, ENNReal.coe_nat,
  restrict_const_lintegral]
state_before: case neg.intro
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
n : ℕ
hn : b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})
⊢ b <
    ⨆ (_ : ∀ (x : α), ↑(↑(restrict (const α ↑n) (↑φ ⁻¹' {⊤})) x) ≤ f x),
      SimpleFunc.lintegral (SimpleFunc.map ENNReal.some (restrict (const α ↑n) (↑φ ⁻¹' {⊤}))) μ

tactic: refine' ⟨indicator_le fun x hx => le_trans _ (hφ _), hn⟩
state_before: case neg.intro
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
n : ℕ
hn : b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})
⊢ (∀ (x : α), indicator (↑φ ⁻¹' {⊤}) (fun x => ↑(Function.const α (↑n) x)) x ≤ f x) ∧ b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})

tactic: simp only [mem_preimage, mem_singleton_iff] at hx
state_before: case neg.intro
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
n : ℕ
hn : b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})
x : α
hx : x ∈ ↑φ ⁻¹' {⊤}
⊢ ↑(Function.const α (↑n) x) ≤ ↑φ x

tactic: simp only [hx, le_top]
state_before: case neg.intro
α : Type u_1
β : Type ?u.80536
γ : Type ?u.80539
δ : Type ?u.80542
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : ↑↑μ (↑φ ⁻¹' {⊤}) ≠ 0
b : ℝ≥0∞
hb : b < ⊤
n : ℕ
hn : b < ↑n * ↑↑μ (↑φ ⁻¹' {⊤})
x : α
hx : ↑φ x = ⊤
⊢ ↑(Function.const α (↑n) x) ≤ ↑φ x