-- Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Restrict.lean
lemma cfc_eq_restrict (f : C(S, R)) (halg : IsUniformEmbedding (algebraMap R S)) {a : A} (hpa : p a)
    (hqa : q a) (h : SpectrumRestricts a f) (g : R → R) :
    cfc g a = cfc (fun x ↦ algebraMap R S (g (f x))) 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
inst✝¹ : ContinuousFunctionalCalculus R p
inst✝ : ContinuousMap.UniqueHom R A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
a : A
hpa : p a
hqa : q a
h : SpectrumRestricts a ⇑f
g : R → R
hg : ¬ContinuousOn g (spectrum R a)
⊢ ¬ContinuousOn (fun x => (algebraMap R S) (g (f x))) (spectrum S a)

Tactic:
refine fun hg' ↦ hg ?_

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
inst✝¹ : ContinuousFunctionalCalculus R p
inst✝ : ContinuousMap.UniqueHom R A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
a : A
hpa : p a
hqa : q a
h : SpectrumRestricts a ⇑f
g : R → R
hg : ¬ContinuousOn g (spectrum R a)
hg' : ContinuousOn (fun x => (algebraMap R S) (g (f x))) (spectrum S a)
⊢ ContinuousOn g (spectrum R a)

Proof state:
case 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
inst✝¹ : ContinuousFunctionalCalculus R p
inst✝ : ContinuousMap.UniqueHom R A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
a : A
hpa : p a
hqa : q a
h : SpectrumRestricts a ⇑f
g : R → R
hg : ContinuousOn g (spectrum R a)
x : { x // x ∈ spectrum S a }
⊢ Function.extend Subtype.val
      (⇑({ toFun := ⇑(StarAlgHom.ofId R S), continuous_toFun := ⋯ }.comp
          ({ toFun := (spectrum R a).restrict g, continuous_toFun := ⋯ }.comp
            { toFun := Subtype.map ⇑f ⋯, continuous_toFun := ⋯ })))
      0 ↑x =
    (algebraMap R S) (g (f ↑x))

Tactic:
simp [Function.comp, Subtype.val_injective.extend_apply]

Result:
no goals

Proof state:
case neg
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
inst✝¹ : ContinuousFunctionalCalculus R p
inst✝ : ContinuousMap.UniqueHom R A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
a : A
hpa : p a
hqa : q a
h : SpectrumRestricts a ⇑f
g : R → R
hg : ¬ContinuousOn g (spectrum R a)
⊢ cfc g a = cfc (fun x => (algebraMap R S) (g (f x))) a

Tactic:
have : ¬ ContinuousOn (fun x ↦ algebraMap R S (g (f x)) : S → S) (spectrum S a) := by
  refine fun hg' ↦ hg ?_
  rw [halg.isEmbedding.continuousOn_iff]
  simpa [halg.isEmbedding.continuousOn_iff, Function.comp_def, h.left_inv _] using
    hg'.comp halg.isEmbedding.continuous.continuousOn (fun _ : R ↦ spectrum.algebraMap_mem S)

Result:
case neg
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
inst✝¹ : ContinuousFunctionalCalculus R p
inst✝ : ContinuousMap.UniqueHom R A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
a : A
hpa : p a
hqa : q a
h : SpectrumRestricts a ⇑f
g : R → R
hg : ¬ContinuousOn g (spectrum R a)
this : ¬ContinuousOn (fun x => (algebraMap R S) (g (f x))) (spectrum S a)
⊢ cfc g a = cfc (fun x => (algebraMap R S) (g (f x))) 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
inst✝¹ : ContinuousFunctionalCalculus R p
inst✝ : ContinuousMap.UniqueHom R A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
a : A
hpa : p a
hqa : q a
h : SpectrumRestricts a ⇑f
g : R → R
hg : ¬ContinuousOn g (spectrum R a)
hg' : ContinuousOn (fun x => (algebraMap R S) (g (f x))) (spectrum S a)
⊢ ContinuousOn (⇑(algebraMap R S) ∘ g) (spectrum R a)

Tactic:
simpa [halg.isEmbedding.continuousOn_iff, Function.comp_def, h.left_inv _] using
  hg'.comp halg.isEmbedding.continuous.continuousOn (fun _ : R ↦ spectrum.algebraMap_mem S)

Result:
no goals