-- 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 ∧ QuasispectrumRestricts a f) :
    NonUnitalContinuousFunctionalCalculus R p where
  predicate_zero := h0
  compactSpace_quasispectrum 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✝¹⁹ : Field S
inst✝¹⁸ : StarRing S
inst✝¹⁷ : MetricSpace S
inst✝¹⁶ : IsTopologicalRing S
inst✝¹⁵ : ContinuousStar S
inst✝¹⁴ : NonUnitalRing A
inst✝¹³ : StarRing A
inst✝¹² : Module S A
inst✝¹¹ : IsScalarTower S A A
inst✝¹⁰ : SMulCommClass S A A
inst✝⁹ : Algebra R S
inst✝⁸ : Module R A
inst✝⁷ : IsScalarTower R S A
inst✝⁶ : StarModule R S
inst✝⁵ : ContinuousSMul R S
inst✝⁴ : TopologicalSpace A
inst✝³ : NonUnitalContinuousFunctionalCalculus S q
inst✝² : CompleteSpace R
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ QuasispectrumRestricts a ⇑f
a : A
ha : p a
⊢ ∃ φ,
    IsClosedEmbedding ⇑φ ∧
      φ { toContinuousMap := ContinuousMap.restrict (σₙ R a) (ContinuousMap.id R), map_zero' := ⋯ } = a ∧
        (∀ (f : C(↑(σₙ R a), R)₀), σₙ R (φ f) = range ⇑f) ∧ ∀ (f : C(↑(σₙ R a), R)₀), p (φ f)

Tactic:
refine ⟨((h a).mp ha).2.nonUnitalStarAlgHom (cfcₙHom ((h a).mp ha).1 (R := S)),
  ?hom_isClosedEmbedding, ?hom_id, ?hom_map_spectrum, ?predicate_hom⟩

Result:
case hom_isClosedEmbedding
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✝¹⁹ : Field S
inst✝¹⁸ : StarRing S
inst✝¹⁷ : MetricSpace S
inst✝¹⁶ : IsTopologicalRing S
inst✝¹⁵ : ContinuousStar S
inst✝¹⁴ : NonUnitalRing A
inst✝¹³ : StarRing A
inst✝¹² : Module S A
inst✝¹¹ : IsScalarTower S A A
inst✝¹⁰ : SMulCommClass S A A
inst✝⁹ : Algebra R S
inst✝⁸ : Module R A
inst✝⁷ : IsScalarTower R S A
inst✝⁶ : StarModule R S
inst✝⁵ : ContinuousSMul R S
inst✝⁴ : TopologicalSpace A
inst✝³ : NonUnitalContinuousFunctionalCalculus S q
inst✝² : CompleteSpace R
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ QuasispectrumRestricts a ⇑f
a : A
ha : p a
⊢ IsClosedEmbedding ⇑(nonUnitalStarAlgHom (cfcₙHom ⋯) ⋯)

case hom_id
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✝¹⁹ : Field S
inst✝¹⁸ : StarRing S
inst✝¹⁷ : MetricSpace S
inst✝¹⁶ : IsTopologicalRing S
inst✝¹⁵ : ContinuousStar S
inst✝¹⁴ : NonUnitalRing A
inst✝¹³ : StarRing A
inst✝¹² : Module S A
inst✝¹¹ : IsScalarTower S A A
inst✝¹⁰ : SMulCommClass S A A
inst✝⁹ : Algebra R S
inst✝⁸ : Module R A
inst✝⁷ : IsScalarTower R S A
inst✝⁶ : StarModule R S
inst✝⁵ : ContinuousSMul R S
inst✝⁴ : TopologicalSpace A
inst✝³ : NonUnitalContinuousFunctionalCalculus S q
inst✝² : CompleteSpace R
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ QuasispectrumRestricts a ⇑f
a : A
ha : p a
⊢ (nonUnitalStarAlgHom (cfcₙHom ⋯) ⋯)
      { toContinuousMap := ContinuousMap.restrict (σₙ R a) (ContinuousMap.id R), map_zero' := ⋯ } =
    a

case hom_map_spectrum
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✝¹⁹ : Field S
inst✝¹⁸ : StarRing S
inst✝¹⁷ : MetricSpace S
inst✝¹⁶ : IsTopologicalRing S
inst✝¹⁵ : ContinuousStar S
inst✝¹⁴ : NonUnitalRing A
inst✝¹³ : StarRing A
inst✝¹² : Module S A
inst✝¹¹ : IsScalarTower S A A
inst✝¹⁰ : SMulCommClass S A A
inst✝⁹ : Algebra R S
inst✝⁸ : Module R A
inst✝⁷ : IsScalarTower R S A
inst✝⁶ : StarModule R S
inst✝⁵ : ContinuousSMul R S
inst✝⁴ : TopologicalSpace A
inst✝³ : NonUnitalContinuousFunctionalCalculus S q
inst✝² : CompleteSpace R
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ QuasispectrumRestricts a ⇑f
a : A
ha : p a
⊢ ∀ (f_1 : C(↑(σₙ R a), R)₀), σₙ R ((nonUnitalStarAlgHom (cfcₙHom ⋯) ⋯) f_1) = range ⇑f_1

case predicate_hom
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✝¹⁹ : Field S
inst✝¹⁸ : StarRing S
inst✝¹⁷ : MetricSpace S
inst✝¹⁶ : IsTopologicalRing S
inst✝¹⁵ : ContinuousStar S
inst✝¹⁴ : NonUnitalRing A
inst✝¹³ : StarRing A
inst✝¹² : Module S A
inst✝¹¹ : IsScalarTower S A A
inst✝¹⁰ : SMulCommClass S A A
inst✝⁹ : Algebra R S
inst✝⁸ : Module R A
inst✝⁷ : IsScalarTower R S A
inst✝⁶ : StarModule R S
inst✝⁵ : ContinuousSMul R S
inst✝⁴ : TopologicalSpace A
inst✝³ : NonUnitalContinuousFunctionalCalculus S q
inst✝² : CompleteSpace R
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ QuasispectrumRestricts a ⇑f
a : A
ha : p a
⊢ ∀ (f_1 : C(↑(σₙ R a), R)₀), p ((nonUnitalStarAlgHom (cfcₙHom ⋯) ⋯) f_1)

Proof state:
case predicate_hom
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✝¹⁹ : Field S
inst✝¹⁸ : StarRing S
inst✝¹⁷ : MetricSpace S
inst✝¹⁶ : IsTopologicalRing S
inst✝¹⁵ : ContinuousStar S
inst✝¹⁴ : NonUnitalRing A
inst✝¹³ : StarRing A
inst✝¹² : Module S A
inst✝¹¹ : IsScalarTower S A A
inst✝¹⁰ : SMulCommClass S A A
inst✝⁹ : Algebra R S
inst✝⁸ : Module R A
inst✝⁷ : IsScalarTower R S A
inst✝⁶ : StarModule R S
inst✝⁵ : ContinuousSMul R S
inst✝⁴ : TopologicalSpace A
inst✝³ : NonUnitalContinuousFunctionalCalculus S q
inst✝² : CompleteSpace R
inst✝¹ : IsScalarTower R A A
inst✝ : SMulCommClass R A A
f : C(S, R)
halg : IsUniformEmbedding ⇑(algebraMap R S)
h0 : p 0
h : ∀ (a : A), p a ↔ q a ∧ QuasispectrumRestricts a ⇑f
a : A
ha : p a
⊢ ∀ (f_1 : C(↑(σₙ R a), R)₀), p ((nonUnitalStarAlgHom (cfcₙHom ⋯) ⋯) f_1)

Tactic:
case predicate_hom =>
  intro g
  rw [h]
  refine ⟨cfcₙHom_predicate _ _, ?_⟩
  refine { rightInvOn := fun s hs ↦ ?_, left_inv := ((h a).mp ha).2.left_inv }
  rw [nonUnitalStarAlgHom_apply,
    cfcₙHom_map_quasispectrum] at hs
  obtain ⟨r, rfl⟩ := hs
  simp [((h a).mp ha).2.left_inv _]

Result:
no goals