-- Mathlib/MeasureTheory/Function/L2Space.lean
theorem inner_indicatorConstLp_eq_setIntegral_inner (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⟫ ∂μ

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
⊢ ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ +
      ∫ (x : α) in sᶜ, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ =
    ∫ (x : α) in s, inner 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

Result:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ
⊢ ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ +
      ∫ (x : α) in sᶜ, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ =
    ∫ (x : α) in s, inner c (↑↑f x) ∂μ

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ
h_ae_eq : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = 0
⊢ ∫ (x : α) in sᶜ, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in sᶜ, 0 ∂μ

Tactic:
exact setIntegral_congr_ae hs.compl h_ae_eq

Result:
no goals

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_indicator : ∀ᵐ (x : α) ∂μ, x ∈ s → ↑↑(indicatorConstLp 2 hs hμs c) x = c
x : α
hx : x ∈ s → ↑↑(indicatorConstLp 2 hs hμs c) x = c
hxs : x ∈ s
⊢ inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = inner c (↑↑f x)

Tactic:
congr

Result:
case e_a
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_indicator : ∀ᵐ (x : α) ∂μ, x ∈ s → ↑↑(indicatorConstLp 2 hs hμs c) x = c
x : α
hx : x ∈ s → ↑↑(indicatorConstLp 2 hs hμs c) x = c
hxs : x ∈ s
⊢ ↑↑(indicatorConstLp 2 hs hμs c) x = c

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
⊢ ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ

Tactic:
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

Result:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
⊢ ∀ᵐ (x : α) ∂μ, x ∈ s → inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = inner c (↑↑f x)

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ
h_ae_eq : ∀ᵐ (x : α) ∂μ, x ∉ s → inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = 0
⊢ ∫ (x : α) in sᶜ, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = 0

Tactic:
simp_rw [← Set.mem_compl_iff] at h_ae_eq

Result:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ
h_ae_eq : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = 0
⊢ ∫ (x : α) in sᶜ, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = 0

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_indicator : ∀ᵐ (x : α) ∂μ, x ∈ s → ↑↑(indicatorConstLp 2 hs hμs c) x = c
⊢ ∀ᵐ (x : α) ∂μ, x ∈ s → inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = inner c (↑↑f x)

Tactic:
refine h_indicator.mono fun x hx hxs => ?_

Result:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_indicator : ∀ᵐ (x : α) ∂μ, x ∈ s → ↑↑(indicatorConstLp 2 hs hμs c) x = c
x : α
hx : x ∈ s → ↑↑(indicatorConstLp 2 hs hμs c) x = c
hxs : x ∈ s
⊢ inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = inner c (↑↑f x)

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ
h_indicator : ∀ᵐ (x : α) ∂μ, x ∉ s → ↑↑(indicatorConstLp 2 hs hμs c) x = 0
⊢ ∀ᵐ (x : α) ∂μ, x ∉ s → inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = 0

Tactic:
refine h_indicator.mono fun x hx hxs => ?_

Result:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ
h_indicator : ∀ᵐ (x : α) ∂μ, x ∉ s → ↑↑(indicatorConstLp 2 hs hμs c) x = 0
x : α
hx : x ∉ s → ↑↑(indicatorConstLp 2 hs hμs c) x = 0
hxs : x ∉ s
⊢ inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = 0

Proof state:
α : Type u_1
E : Type u_2
𝕜 : Type u_4
inst✝³ : RCLike 𝕜
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
s : Set α
f : ↥(Lp E 2 μ)
hs : MeasurableSet s
c : E
hμs : μ s ≠ ⊤
h_left : ∫ (x : α) in s, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in s, inner c (↑↑f x) ∂μ
h_ae_eq : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) = 0
h_int_zero : ∫ (x : α) in sᶜ, inner (↑↑(indicatorConstLp 2 hs hμs c) x) (↑↑f x) ∂μ = ∫ (x : α) in sᶜ, 0 ∂μ
⊢ ∫ (x : α) in sᶜ, 0 ∂μ = 0

Tactic:
simp

Result:
no goals