-- Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unital.lean
lemma cfc_comp (g f : R → R) (a : A) (ha : p a

Proof state:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
⊢ cfc (g ∘ f) a = cfc g (cfc f a)

Tactic:
have sp_eq : spectrum R (cfcHom (show p a from ha) (ContinuousMap.mk _ hf.restrict)) =
    f '' (spectrum R a) := by
  rw [cfcHom_map_spectrum (by exact ha) _]
  ext
  simp

Result:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
sp_eq : spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }) = f '' spectrum R a
⊢ cfc (g ∘ f) a = cfc g (cfc f a)

Proof state:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
⊢ spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }) = f '' spectrum R a

Tactic:
rw [cfcHom_map_spectrum (by exact ha) _]

Result:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
⊢ Set.range ⇑{ toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ } = f '' spectrum R a

Proof state:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
sp_eq : spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }) = f '' spectrum R a
x : ↑(spectrum R a)
⊢ (spectrum R a).restrict f x ∈ spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ })

Tactic:
rw [sp_eq]

Result:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
sp_eq : spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }) = f '' spectrum R a
x : ↑(spectrum R a)
⊢ (spectrum R a).restrict f x ∈ f '' spectrum R a

Proof state:
case h
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
x✝ : R
⊢ x✝ ∈ Set.range ⇑{ toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ } ↔ x✝ ∈ f '' spectrum R a

Tactic:
simp

Result:
no goals

Proof state:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
sp_eq : spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }) = f '' spectrum R a
⊢ (cfcHom ha) { toFun := (spectrum R a).restrict (g ∘ f), continuous_toFun := ⋯ } =
    (cfcHom ⋯)
      ({ toFun := (spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ })).restrict g,
            continuous_toFun := ⋯ }.comp
        {
          toFun :=
            Set.codRestrict ((spectrum R a).restrict f)
              (spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ })) ⋯,
          continuous_toFun := ⋯ })

Tactic:
congr

Result:
no goals

Proof state:
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
⊢ p a

Tactic:
exact ha

Result:
no goals

Proof state:
case h
R : Type u_1
A : Type u_2
p : A → Prop
inst✝⁹ : CommSemiring R
inst✝⁸ : StarRing R
inst✝⁷ : MetricSpace R
inst✝⁶ : IsTopologicalSemiring R
inst✝⁵ : ContinuousStar R
inst✝⁴ : TopologicalSpace A
inst✝³ : Ring A
inst✝² : StarRing A
inst✝¹ : Algebra R A
instCFC : ContinuousFunctionalCalculus R p
inst✝ : UniqueHom R A
g f : R → R
a : A
ha : autoParam (p a) _auto✝
hg : autoParam (ContinuousOn g (f '' spectrum R a)) _auto✝
hf : autoParam (ContinuousOn f (spectrum R a)) _auto✝
this : ContinuousOn (g ∘ f) (spectrum R a)
sp_eq : spectrum R ((cfcHom ⋯) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }) = f '' spectrum R a
x : ↑(spectrum R a)
⊢ ↑x ∈ spectrum R a ∧ f ↑x = (spectrum R a).restrict f x

Tactic:
simp

Result:
no goals