-- Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Restrict.lean
theorem cfc (f : C(S, R)) (halg : IsUniformEmbedding (algebraMap R S)) (h0 : p 0)
    (h : ∀ a, p a ↔ q a ∧ SpectrumRestricts a f) :
    ContinuousFunctionalCalculus R p where
  predicate_zero := h0
  spectrum_nonempty a ha := ((h a).mp ha).2.image ▸
    (ContinuousFunctionalCalculus.spectrum_nonempty a ((h a).mp ha).1 |>.image f)
  compactSpace_spectrum a

Proof state:
R : Type u_1
S : Type u_2
A : Type u_3
p q : A → Prop
inst✝²⁰ : Semifield R
inst✝¹⁹ : StarRing R
inst✝¹⁸ : MetricSpace R
inst✝¹⁷ : IsTopologicalSemiring R
inst✝¹⁶ : ContinuousStar R
inst✝¹⁵ : Semifield S
inst✝¹⁴ : StarRing S
inst✝¹³ : MetricSpace S
inst✝¹² : IsTopologicalSemiring S
inst✝¹¹ : ContinuousStar S
inst✝¹⁰ : Ring A
inst✝⁹ : StarRing A
inst✝⁸ : Algebra S A
inst✝⁷ : Algebra R S
inst✝⁶ : Algebra R A
inst✝⁵ : IsScalarTower R S A
inst✝⁴ : StarModule R S
inst✝³ : ContinuousSMul R S
inst✝² : TopologicalSpace A
inst✝¹ : ContinuousFunctionalCalculus S q
inst✝ : CompleteSpace R
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ SpectrumRestricts a ⇑f
a : A
ha : p a
g : C(↑(spectrum R a), R)
⊢ q ((starAlgHom (cfcHom ⋯) ⋯) g) ∧ SpectrumRestricts ((starAlgHom (cfcHom ⋯) ⋯) g) ⇑f

Tactic:
refine ⟨cfcHom_predicate _ _, ?_⟩

Result:
R : Type u_1
S : Type u_2
A : Type u_3
p q : A → Prop
inst✝²⁰ : Semifield R
inst✝¹⁹ : StarRing R
inst✝¹⁸ : MetricSpace R
inst✝¹⁷ : IsTopologicalSemiring R
inst✝¹⁶ : ContinuousStar R
inst✝¹⁵ : Semifield S
inst✝¹⁴ : StarRing S
inst✝¹³ : MetricSpace S
inst✝¹² : IsTopologicalSemiring S
inst✝¹¹ : ContinuousStar S
inst✝¹⁰ : Ring A
inst✝⁹ : StarRing A
inst✝⁸ : Algebra S A
inst✝⁷ : Algebra R S
inst✝⁶ : Algebra R A
inst✝⁵ : IsScalarTower R S A
inst✝⁴ : StarModule R S
inst✝³ : ContinuousSMul R S
inst✝² : TopologicalSpace A
inst✝¹ : ContinuousFunctionalCalculus S q
inst✝ : CompleteSpace R
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ SpectrumRestricts a ⇑f
a : A
ha : p a
g : C(↑(spectrum R a), R)
⊢ SpectrumRestricts ((starAlgHom (cfcHom ⋯) ⋯) g) ⇑f

Proof state:
case h.mp.intro
R : Type u_1
S : Type u_2
A : Type u_3
p q : A → Prop
inst✝²⁰ : Semifield R
inst✝¹⁹ : StarRing R
inst✝¹⁸ : MetricSpace R
inst✝¹⁷ : IsTopologicalSemiring R
inst✝¹⁶ : ContinuousStar R
inst✝¹⁵ : Semifield S
inst✝¹⁴ : StarRing S
inst✝¹³ : MetricSpace S
inst✝¹² : IsTopologicalSemiring S
inst✝¹¹ : ContinuousStar S
inst✝¹⁰ : Ring A
inst✝⁹ : StarRing A
inst✝⁸ : Algebra S A
inst✝⁷ : Algebra R S
inst✝⁶ : Algebra R A
inst✝⁵ : IsScalarTower R S A
inst✝⁴ : StarModule R S
inst✝³ : ContinuousSMul R S
inst✝² : TopologicalSpace A
inst✝¹ : ContinuousFunctionalCalculus S q
inst✝ : CompleteSpace R
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ SpectrumRestricts a ⇑f
a : A
ha : p a
g : C(↑(spectrum R a), R)
x : R
y : ↑(spectrum S a)
hy :
  ({ toFun := ⇑(StarAlgHom.ofId R S), continuous_toFun := ⋯ }.comp
        (g.comp { toFun := Subtype.map ⇑f ⋯, continuous_toFun := ⋯ }))
      y =
    (algebraMap R S) x
this :
  f
      (({ toFun := ⇑(StarAlgHom.ofId R S), continuous_toFun := ⋯ }.comp
          (g.comp { toFun := Subtype.map ⇑f ⋯, continuous_toFun := ⋯ }))
        y) =
    f ((algebraMap R S) x)
⊢ x ∈ range ⇑g

Tactic:
simp only [ContinuousMap.coe_mk, ContinuousMap.comp_apply, StarAlgHom.ofId_apply] at this

Result:
case h.mp.intro
R : Type u_1
S : Type u_2
A : Type u_3
p q : A → Prop
inst✝²⁰ : Semifield R
inst✝¹⁹ : StarRing R
inst✝¹⁸ : MetricSpace R
inst✝¹⁷ : IsTopologicalSemiring R
inst✝¹⁶ : ContinuousStar R
inst✝¹⁵ : Semifield S
inst✝¹⁴ : StarRing S
inst✝¹³ : MetricSpace S
inst✝¹² : IsTopologicalSemiring S
inst✝¹¹ : ContinuousStar S
inst✝¹⁰ : Ring A
inst✝⁹ : StarRing A
inst✝⁸ : Algebra S A
inst✝⁷ : Algebra R S
inst✝⁶ : Algebra R A
inst✝⁵ : IsScalarTower R S A
inst✝⁴ : StarModule R S
inst✝³ : ContinuousSMul R S
inst✝² : TopologicalSpace A
inst✝¹ : ContinuousFunctionalCalculus S q
inst✝ : CompleteSpace R
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ SpectrumRestricts a ⇑f
a : A
ha : p a
g : C(↑(spectrum R a), R)
x : R
y : ↑(spectrum S a)
hy :
  ({ toFun := ⇑(StarAlgHom.ofId R S), continuous_toFun := ⋯ }.comp
        (g.comp { toFun := Subtype.map ⇑f ⋯, continuous_toFun := ⋯ }))
      y =
    (algebraMap R S) x
this : f ((algebraMap R S) (g (Subtype.map ⇑f ⋯ y))) = f ((algebraMap R S) x)
⊢ x ∈ range ⇑g

Proof state:
R : Type u_1
S : Type u_2
A : Type u_3
p q : A → Prop
inst✝²⁰ : Semifield R
inst✝¹⁹ : StarRing R
inst✝¹⁸ : MetricSpace R
inst✝¹⁷ : IsTopologicalSemiring R
inst✝¹⁶ : ContinuousStar R
inst✝¹⁵ : Semifield S
inst✝¹⁴ : StarRing S
inst✝¹³ : MetricSpace S
inst✝¹² : IsTopologicalSemiring S
inst✝¹¹ : ContinuousStar S
inst✝¹⁰ : Ring A
inst✝⁹ : StarRing A
inst✝⁸ : Algebra S A
inst✝⁷ : Algebra R S
inst✝⁶ : Algebra R A
inst✝⁵ : IsScalarTower R S A
inst✝⁴ : StarModule R S
inst✝³ : ContinuousSMul R S
inst✝² : TopologicalSpace A
inst✝¹ : ContinuousFunctionalCalculus S q
inst✝ : CompleteSpace R
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ SpectrumRestricts a ⇑f
a : A
ha : p a
⊢ IsClosedEmbedding ⇑(starAlgHom (cfcHom ⋯) ⋯)

Tactic:
exact ((h a).mp ha).2.isClosedEmbedding_starAlgHom
  (cfcHom_isClosedEmbedding ((h a).mp ha).1) halg

Result:
no goals

Proof state:
R : Type u_1
S : Type u_2
A : Type u_3
p q : A → Prop
inst✝²⁰ : Semifield R
inst✝¹⁹ : StarRing R
inst✝¹⁸ : MetricSpace R
inst✝¹⁷ : IsTopologicalSemiring R
inst✝¹⁶ : ContinuousStar R
inst✝¹⁵ : Semifield S
inst✝¹⁴ : StarRing S
inst✝¹³ : MetricSpace S
inst✝¹² : IsTopologicalSemiring S
inst✝¹¹ : ContinuousStar S
inst✝¹⁰ : Ring A
inst✝⁹ : StarRing A
inst✝⁸ : Algebra S A
inst✝⁷ : Algebra R S
inst✝⁶ : Algebra R A
inst✝⁵ : IsScalarTower R S A
inst✝⁴ : StarModule R S
inst✝³ : ContinuousSMul R S
inst✝² : TopologicalSpace A
inst✝¹ : ContinuousFunctionalCalculus S q
inst✝ : CompleteSpace R
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ SpectrumRestricts a ⇑f
a : A
ha : p a
g : C(↑(spectrum R a), R)
s : S
hs : s ∈ spectrum S ((starAlgHom (cfcHom ⋯) ⋯) g)
⊢ (algebraMap R S) (f s) = s

Tactic:
rw [SpectrumRestricts.starAlgHom_apply, cfcHom_map_spectrum] at hs

Result:
R : Type u_1
S : Type u_2
A : Type u_3
p q : A → Prop
inst✝²⁰ : Semifield R
inst✝¹⁹ : StarRing R
inst✝¹⁸ : MetricSpace R
inst✝¹⁷ : IsTopologicalSemiring R
inst✝¹⁶ : ContinuousStar R
inst✝¹⁵ : Semifield S
inst✝¹⁴ : StarRing S
inst✝¹³ : MetricSpace S
inst✝¹² : IsTopologicalSemiring S
inst✝¹¹ : ContinuousStar S
inst✝¹⁰ : Ring A
inst✝⁹ : StarRing A
inst✝⁸ : Algebra S A
inst✝⁷ : Algebra R S
inst✝⁶ : Algebra R A
inst✝⁵ : IsScalarTower R S A
inst✝⁴ : StarModule R S
inst✝³ : ContinuousSMul R S
inst✝² : TopologicalSpace A
inst✝¹ : ContinuousFunctionalCalculus S q
inst✝ : CompleteSpace R
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ SpectrumRestricts a ⇑f
a : A
ha : p a
g : C(↑(spectrum R a), R)
s : S
hs :
  s ∈
    range
      ⇑({ toFun := ⇑(StarAlgHom.ofId R S), continuous_toFun := ⋯ }.comp
          (g.comp { toFun := Subtype.map ⇑f ⋯, continuous_toFun := ⋯ }))
⊢ (algebraMap R S) (f s) = s