-- Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Integral.lean
/-- The continuous functional calculus commutes with integration. -/
lemma cfc_integral [TopologicalSpace X] [OpensMeasurableSpace X] (f : X → 𝕜 → 𝕜)
    (bound : X → ℝ) (a : A) [SecondCountableTopologyEither X C(spectrum 𝕜 a, 𝕜)]
    (hf₁ : ∀ x, ContinuousOn (f x) (spectrum 𝕜 a))
    (hf₂ : Continuous (fun x ↦ (⟨_, hf₁ x |>.restrict⟩ : C(spectrum 𝕜 a, 𝕜))))
    (hbound : ∀ x, ∀ z ∈ spectrum 𝕜 a, ‖f x z‖ ≤ ‖bound x‖)
    (hbound_finite_integral : HasFiniteIntegral bound μ) (ha : p a

Proof state:
X : Type u_1
𝕜 : Type u_2
A : Type u_3
p : A → Prop
inst✝¹⁰ : RCLike 𝕜
inst✝⁹ : MeasurableSpace X
μ : Measure X
inst✝⁸ : NormedRing A
inst✝⁷ : StarRing A
inst✝⁶ : NormedAlgebra 𝕜 A
inst✝⁵ : NormedAlgebra ℝ A
inst✝⁴ : CompleteSpace A
inst✝³ : ContinuousFunctionalCalculus 𝕜 p
inst✝² : TopologicalSpace X
inst✝¹ : OpensMeasurableSpace X
f : X → 𝕜 → 𝕜
bound : X → ℝ
a : A
inst✝ : SecondCountableTopologyEither X C(↑(spectrum 𝕜 a), 𝕜)
hf₁ : ∀ (x : X), ContinuousOn (f x) (spectrum 𝕜 a)
hf₂ : Continuous fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
hbound : ∀ (x : X), ∀ z ∈ spectrum 𝕜 a, ‖f x z‖ ≤ ‖bound x‖
hbound_finite_integral : HasFiniteIntegral bound μ
ha : autoParam (p a) _auto✝
fc : X → C(↑(spectrum 𝕜 a), 𝕜) := fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
fc_integrable : Integrable fc μ
h_int_fc : ((spectrum 𝕜 a).restrict fun x => ∫ (x_1 : X), f x_1 x ∂μ) = ⇑(∫ (x : X), fc x ∂μ)
⊢ ContinuousOn (fun r => ∫ (x : X), f x r ∂μ) (spectrum 𝕜 a)

Tactic:
rw [continuousOn_iff_continuous_restrict]

Result:
X : Type u_1
𝕜 : Type u_2
A : Type u_3
p : A → Prop
inst✝¹⁰ : RCLike 𝕜
inst✝⁹ : MeasurableSpace X
μ : Measure X
inst✝⁸ : NormedRing A
inst✝⁷ : StarRing A
inst✝⁶ : NormedAlgebra 𝕜 A
inst✝⁵ : NormedAlgebra ℝ A
inst✝⁴ : CompleteSpace A
inst✝³ : ContinuousFunctionalCalculus 𝕜 p
inst✝² : TopologicalSpace X
inst✝¹ : OpensMeasurableSpace X
f : X → 𝕜 → 𝕜
bound : X → ℝ
a : A
inst✝ : SecondCountableTopologyEither X C(↑(spectrum 𝕜 a), 𝕜)
hf₁ : ∀ (x : X), ContinuousOn (f x) (spectrum 𝕜 a)
hf₂ : Continuous fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
hbound : ∀ (x : X), ∀ z ∈ spectrum 𝕜 a, ‖f x z‖ ≤ ‖bound x‖
hbound_finite_integral : HasFiniteIntegral bound μ
ha : autoParam (p a) _auto✝
fc : X → C(↑(spectrum 𝕜 a), 𝕜) := fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
fc_integrable : Integrable fc μ
h_int_fc : ((spectrum 𝕜 a).restrict fun x => ∫ (x_1 : X), f x_1 x ∂μ) = ⇑(∫ (x : X), fc x ∂μ)
⊢ Continuous ((spectrum 𝕜 a).restrict fun r => ∫ (x : X), f x r ∂μ)

Proof state:
X : Type u_1
𝕜 : Type u_2
A : Type u_3
p : A → Prop
inst✝¹⁰ : RCLike 𝕜
inst✝⁹ : MeasurableSpace X
μ : Measure X
inst✝⁸ : NormedRing A
inst✝⁷ : StarRing A
inst✝⁶ : NormedAlgebra 𝕜 A
inst✝⁵ : NormedAlgebra ℝ A
inst✝⁴ : CompleteSpace A
inst✝³ : ContinuousFunctionalCalculus 𝕜 p
inst✝² : TopologicalSpace X
inst✝¹ : OpensMeasurableSpace X
f : X → 𝕜 → 𝕜
bound : X → ℝ
a : A
inst✝ : SecondCountableTopologyEither X C(↑(spectrum 𝕜 a), 𝕜)
hf₁ : ∀ (x : X), ContinuousOn (f x) (spectrum 𝕜 a)
hf₂ : Continuous fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
hbound : ∀ (x : X), ∀ z ∈ spectrum 𝕜 a, ‖f x z‖ ≤ ‖bound x‖
hbound_finite_integral : HasFiniteIntegral bound μ
ha : autoParam (p a) _auto✝
fc : X → C(↑(spectrum 𝕜 a), 𝕜) := fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
fc_integrable : Integrable fc μ
h_int_fc : ((spectrum 𝕜 a).restrict fun x => ∫ (x_1 : X), f x_1 x ∂μ) = ⇑(∫ (x : X), fc x ∂μ)
hcont₂ : ContinuousOn (fun r => ∫ (x : X), f x r ∂μ) (spectrum 𝕜 a)
⊢ (cfcHom ha) { toFun := (spectrum 𝕜 a).restrict fun r => ∫ (x : X), f x r ∂μ, continuous_toFun := ⋯ } =
    (cfcHom ha) (∫ (x : X), fc x ∂μ)

Tactic:
congr

Result:
no goals

Proof state:
X : Type u_1
𝕜 : Type u_2
A : Type u_3
p : A → Prop
inst✝¹⁰ : RCLike 𝕜
inst✝⁹ : MeasurableSpace X
μ : Measure X
inst✝⁸ : NormedRing A
inst✝⁷ : StarRing A
inst✝⁶ : NormedAlgebra 𝕜 A
inst✝⁵ : NormedAlgebra ℝ A
inst✝⁴ : CompleteSpace A
inst✝³ : ContinuousFunctionalCalculus 𝕜 p
inst✝² : TopologicalSpace X
inst✝¹ : OpensMeasurableSpace X
f : X → 𝕜 → 𝕜
bound : X → ℝ
a : A
inst✝ : SecondCountableTopologyEither X C(↑(spectrum 𝕜 a), 𝕜)
hf₁ : ∀ (x : X), ContinuousOn (f x) (spectrum 𝕜 a)
hf₂ : Continuous fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
hbound : ∀ (x : X), ∀ z ∈ spectrum 𝕜 a, ‖f x z‖ ≤ ‖bound x‖
hbound_finite_integral : HasFiniteIntegral bound μ
ha : autoParam (p a) _auto✝
fc : X → C(↑(spectrum 𝕜 a), 𝕜) := fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
fc_integrable : Integrable fc μ
h_int_fc : ((spectrum 𝕜 a).restrict fun x => ∫ (x_1 : X), f x_1 x ∂μ) = ⇑(∫ (x : X), fc x ∂μ)
⊢ Continuous ((spectrum 𝕜 a).restrict fun r => ∫ (x : X), f x r ∂μ)

Tactic:
convert map_continuous (∫ x, fc x ∂μ)

Result:
no goals

Proof state:
X : Type u_1
𝕜 : Type u_2
A : Type u_3
p : A → Prop
inst✝¹⁰ : RCLike 𝕜
inst✝⁹ : MeasurableSpace X
μ : Measure X
inst✝⁸ : NormedRing A
inst✝⁷ : StarRing A
inst✝⁶ : NormedAlgebra 𝕜 A
inst✝⁵ : NormedAlgebra ℝ A
inst✝⁴ : CompleteSpace A
inst✝³ : ContinuousFunctionalCalculus 𝕜 p
inst✝² : TopologicalSpace X
inst✝¹ : OpensMeasurableSpace X
f : X → 𝕜 → 𝕜
bound : X → ℝ
a : A
inst✝ : SecondCountableTopologyEither X C(↑(spectrum 𝕜 a), 𝕜)
hf₁ : ∀ (x : X), ContinuousOn (f x) (spectrum 𝕜 a)
hf₂ : Continuous fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
hbound : ∀ (x : X), ∀ z ∈ spectrum 𝕜 a, ‖f x z‖ ≤ ‖bound x‖
hbound_finite_integral : HasFiniteIntegral bound μ
ha : autoParam (p a) _auto✝
fc : X → C(↑(spectrum 𝕜 a), 𝕜) := fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
⊢ HasFiniteIntegral fc μ

Tactic:
refine hbound_finite_integral.mono <| .of_forall fun x ↦ ?_

Result:
X : Type u_1
𝕜 : Type u_2
A : Type u_3
p : A → Prop
inst✝¹⁰ : RCLike 𝕜
inst✝⁹ : MeasurableSpace X
μ : Measure X
inst✝⁸ : NormedRing A
inst✝⁷ : StarRing A
inst✝⁶ : NormedAlgebra 𝕜 A
inst✝⁵ : NormedAlgebra ℝ A
inst✝⁴ : CompleteSpace A
inst✝³ : ContinuousFunctionalCalculus 𝕜 p
inst✝² : TopologicalSpace X
inst✝¹ : OpensMeasurableSpace X
f : X → 𝕜 → 𝕜
bound : X → ℝ
a : A
inst✝ : SecondCountableTopologyEither X C(↑(spectrum 𝕜 a), 𝕜)
hf₁ : ∀ (x : X), ContinuousOn (f x) (spectrum 𝕜 a)
hf₂ : Continuous fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
hbound : ∀ (x : X), ∀ z ∈ spectrum 𝕜 a, ‖f x z‖ ≤ ‖bound x‖
hbound_finite_integral : HasFiniteIntegral bound μ
ha : autoParam (p a) _auto✝
fc : X → C(↑(spectrum 𝕜 a), 𝕜) := fun x => { toFun := (spectrum 𝕜 a).restrict (f x), continuous_toFun := ⋯ }
x : X
⊢ ‖fc x‖ ≤ ‖bound x‖