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

tactic: rw [lintegral]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
⊢ ∫⁻ (a : α), f a ∂μ = ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
⊢ ⨆ g, ⨆ (_ : ↑g ≤ fun a => f a), g.lintegral μ =
    ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ

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

tactic: by_cases h : ∀ᵐ a ∂μ, φ a ≠ ∞
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
⊢ φ.lintegral μ ≤ ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ
state_after: case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
⊢ φ.lintegral μ ≤ ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ

case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
⊢ φ.lintegral μ ≤ ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ

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

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

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_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
ψ : α →ₛ ℝ≥0 := SimpleFunc.map ENNReal.toNNReal φ
h : ↑(SimpleFunc.map ofNNReal ψ) =ᶠ[ae μ] ↑φ
⊢ φ.lintegral μ ≤ ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ
state_after: case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
ψ : α →ₛ ℝ≥0 := SimpleFunc.map ENNReal.toNNReal φ
h : ↑(SimpleFunc.map ofNNReal ψ) =ᶠ[ae μ] ↑φ
this : ∀ (x : α), ↑(↑ψ x) ≤ f x
⊢ φ.lintegral μ ≤ ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ

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_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
ψ : α →ₛ ℝ≥0 := SimpleFunc.map ENNReal.toNNReal φ
h : ↑(SimpleFunc.map ofNNReal ψ) =ᶠ[ae μ] ↑φ
this : ∀ (x : α), ↑(↑ψ x) ≤ f x
⊢ φ.lintegral μ ≤ ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ
state_after: no goals

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

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_2
γ : Type u_3
δ : Type u_4
m✝ : MeasurableSpace α
μ✝ ν : Measure α
m : MeasurableSpace α
f : α → ℝ≥0∞
μ : Measure α
φ : α →ₛ ℝ≥0∞
hφ : ↑φ ≤ fun a => f a
h : ¬∀ᵐ (a : α) ∂μ, ↑φ a ≠ ⊤
h_meas : μ (↑φ ⁻¹' {⊤}) ≠ 0
⊢ φ.lintegral μ ≤ ⨆ φ, ⨆ (_ : ∀ (x : α), ↑(↑φ x) ≤ f x), (SimpleFunc.map ofNNReal φ).lintegral μ
state_after: case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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.map ofNNReal i).lintegral μ

tactic: obtain ⟨n, hn⟩ : ∃ n : ℕ, b < n * μ (φ ⁻¹' {∞}) := exists_nat_mul_gt h_meas (ne_of_lt hb)
state_before: case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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.map ofNNReal i).lintegral μ
state_after: case neg.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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.map ofNNReal i).lintegral μ

tactic: use (const α (n : ℝ≥0)).restrict (φ ⁻¹' {∞})
state_before: case neg.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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.map ofNNReal i).lintegral μ
state_after: case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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 : α), ↑(↑((const α ↑n).restrict (↑φ ⁻¹' {⊤})) x) ≤ f x),
      (SimpleFunc.map ofNNReal ((const α ↑n).restrict (↑φ ⁻¹' {⊤}))).lintegral μ

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_natCast,
  restrict_const_lintegral]
state_before: case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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 : α), ↑(↑((const α ↑n).restrict (↑φ ⁻¹' {⊤})) x) ≤ f x),
      (SimpleFunc.map ofNNReal ((const α ↑n).restrict (↑φ ⁻¹' {⊤}))).lintegral μ
state_after: case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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: refine ⟨indicator_le fun x hx => le_trans ?_ (hφ _), hn⟩
state_before: case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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 * μ (↑φ ⁻¹' {⊤})
state_after: case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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 [mem_preimage, mem_singleton_iff] at hx
state_before: case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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
state_after: case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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 h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
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
state_after: no goals