Theorem: MeasureTheory.L2.inner_indicatorConstLp_eq_setIntegral_inner
File: Mathlib/MeasureTheory/Function/L2Space.lean

Proof steps:
state_before: α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁴ : RCLike 𝕜
inst✝³ : MeasurableSpace α
μ : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : NormedAddCommGroup F
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
⊢ ⟪indicatorConstLp 2 hs hμs c, f⟫_𝕜 = ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
state_after: α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁴ : RCLike 𝕜
inst✝³ : MeasurableSpace α
μ : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : NormedAddCommGroup F
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
⊢ ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ +
      ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ =
    ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
tactic: rw [inner_def, ← integral_add_compl hs (L2.integrable_inner _ f)]
state_before: α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁴ : RCLike 𝕜
inst✝³ : MeasurableSpace α
μ : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : NormedAddCommGroup F
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
⊢ ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ +
      ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ =
    ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
state_after: α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁴ : RCLike 𝕜
inst✝³ : MeasurableSpace α
μ : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : NormedAddCommGroup F
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ = ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
⊢ ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ +
      ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ =
    ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
tactic: have h_left : (∫ x in s, ⟪(indicatorConstLp 2 hs hμs c) x, f x⟫ ∂μ) = ∫ x in s, ⟪c, f x⟫ ∂μ := by
    suffices h_ae_eq : ∀ᵐ x ∂μ, x ∈ s → ⟪indicatorConstLp 2 hs hμs c x, f x⟫ = ⟪c, f x⟫ from
      setIntegral_congr_ae hs h_ae_eq
    have h_indicator : ∀ᵐ x : α ∂μ, x ∈ s → indicatorConstLp 2 hs hμs c x = c :=
      indicatorConstLp_coeFn_mem
    refine h_indicator.mono fun x hx hxs => ?_
    congr
    exact hx hxs
state_before: α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁴ : RCLike 𝕜
inst✝³ : MeasurableSpace α
μ : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : NormedAddCommGroup F
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ = ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
⊢ ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ +
      ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ =
    ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
state_after: α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁴ : RCLike 𝕜
inst✝³ : MeasurableSpace α
μ : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : NormedAddCommGroup F
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ = ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
h_right : ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ = 0
⊢ ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ +
      ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ =
    ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
tactic: have h_right : (∫ x in sᶜ, ⟪(indicatorConstLp 2 hs hμs c) x, f x⟫ ∂μ) = 0 := by
    suffices h_ae_eq : ∀ᵐ x ∂μ, x ∉ s → ⟪indicatorConstLp 2 hs hμs c x, f x⟫ = 0 by
      simp_rw [← Set.mem_compl_iff] at h_ae_eq
      suffices h_int_zero :
          (∫ x in sᶜ, inner (indicatorConstLp 2 hs hμs c x) (f x) ∂μ) = ∫ _ in sᶜ, (0 : 𝕜) ∂μ by
        rw [h_int_zero]
        simp
      exact setIntegral_congr_ae hs.compl h_ae_eq
    have h_indicator : ∀ᵐ x : α ∂μ, x ∉ s → indicatorConstLp 2 hs hμs c x = 0 :=
      indicatorConstLp_coeFn_nmem
    refine h_indicator.mono fun x hx hxs => ?_
    rw [hx hxs]
    exact inner_zero_left _
state_before: α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁴ : RCLike 𝕜
inst✝³ : MeasurableSpace α
μ : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : NormedAddCommGroup F
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ = ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
h_right : ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ = 0
⊢ ∫ (x : α) in s, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ +
      ∫ (x : α) in sᶜ, ⟪↑↑(indicatorConstLp 2 hs hμs c) x, ↑↑f x⟫_𝕜 ∂μ =
    ∫ (x : α) in s, ⟪c, ↑↑f x⟫_𝕜 ∂μ
state_after: no goals
tactic: rw [h_left, h_right, add_zero]