-- Module: Mathlib.AlgebraicGeometry.OpenImmersion
Goal:
X : Scheme
x : ↥X
U : X.Opens
hxU : x ∈ U
V : TopologicalSpace.Opens (↑X.toTopCat : Type u)
hxV : x ∈ V
R : CommRingCat
e :
  X.restrict (U :=
      Functor.obj (Opens.toTopCat X.toTopCat)
        (↑(Subtype.mk (p := fun (U : TopologicalSpace.Opens (↑X.toTopCat : Type u)) ↦ x ∈ U) V hxV) :
          TopologicalSpace.Opens (↑X.toTopCat : Type u)))
      ⋯ ≅
    Spec.toLocallyRingedSpace.obj (op R)
this :
  Membership.mem (α := (↑(↑(Spec.toLocallyRingedSpace.obj (op R)).toPresheafedSpace : TopCat) : Type u))
    ((Opens.map (e.inv.base ≫ V.inclusion')).obj U)
    ((ConcreteCategory.hom (FC := fun (X Y : TopCat.{u}) ↦ C((↑X : Type u), (↑Y : Type u))) (CC := TopCat.carrier)
            e.hom.base :
          (a : (↑(↑(X.restrict ⋯).toPresheafedSpace : TopCat) : Type u)) →
            (↑(↑(Spec.toLocallyRingedSpace.obj (op R)).toPresheafedSpace : TopCat) : Type u))
        (Subtype.mk (p := fun (x_1 : (↑X.toTopCat : Type u)) ↦
          x_1 ∈
            (↑(Subtype.mk (p := fun (U : TopologicalSpace.Opens (↑X.toTopCat : Type u)) ↦ x ∈ U) V hxV) :
              TopologicalSpace.Opens (↑X.toTopCat : Type u)))
          x hxV) :
      (↑(↑(Spec.toLocallyRingedSpace.obj (op R)).toPresheafedSpace : TopCat) : Type u))
r : (↑R : Type u)
hr :
  Membership.mem (α := PrimeSpectrum (↑(unop (op R)) : Type u))
    (↑(PrimeSpectrum.basicOpen r) : Set (PrimeSpectrum (↑(unop (op R)) : Type u)))
    ((ConcreteCategory.hom (FC := fun (X Y : TopCat.{u}) ↦ C((↑X : Type u), (↑Y : Type u))) (CC := TopCat.carrier)
            e.hom.base :
          (a : (↑(↑(X.restrict ⋯).toPresheafedSpace : TopCat) : Type u)) →
            (↑(↑(Spec.toLocallyRingedSpace.obj (op R)).toPresheafedSpace : TopCat) : Type u))
        (Subtype.mk (p := fun (x_1 : (↑X.toTopCat : Type u)) ↦
          x_1 ∈
            (↑(Subtype.mk (p := fun (U : TopologicalSpace.Opens (↑X.toTopCat : Type u)) ↦ x ∈ U) V hxV) :
              TopologicalSpace.Opens (↑X.toTopCat : Type u)))
          x hxV) :
      (↑(↑(Spec.toLocallyRingedSpace.obj (op R)).toPresheafedSpace : TopCat) : Type u))
hr' :
  (↑(PrimeSpectrum.basicOpen r) : Set (PrimeSpectrum (↑(unop (op R)) : Type u))) ⊆
    (↑((Opens.map (e.inv.base ≫ V.inclusion')).obj U) :
      Set (↑(↑(Spec.toLocallyRingedSpace.obj (op R)).toPresheafedSpace : TopCat) : Type u))
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  CategoryStruct.comp (Y := Spec (CommRingCat.of (↑R : Type u)))
    (Spec.map (CommRingCat.ofHom (algebraMap (↑R : Type u) (Localization.Away r))))
    { toLRSHom' := e.inv ≫ X.ofRestrict ⋯ }
rw :
  Membership.mem (γ := Set ↥X)
      (Set.image (α := ↥(Spec (CommRingCat.of (↑R : Type u)))) (⇑{ toLRSHom' := e.inv ≫ X.ofRestrict ⋯ })
        (Set.range (ι := ↥(Spec (CommRingCat.of (Localization.Away r))))
          ⇑(Spec.map (CommRingCat.ofHom (algebraMap (↑R : Type u) (Localization.Away r))))))
      x ∧
    Set.image (α := ↥(Spec (CommRingCat.of (↑R : Type u)))) (⇑{ toLRSHom' := e.inv ≫ X.ofRestrict ⋯ })
        (Set.range (ι := ↥(Spec (CommRingCat.of (Localization.Away r))))
          ⇑(Spec.map (CommRingCat.ofHom (algebraMap (↑R : Type u) (Localization.Away r))))) ⊆
      (↑U : Set ↥X)
⊢ Membership.mem (γ := Set ↥X) (Set.range (ι := ↥(Spec (CommRingCat.of (Localization.Away r)))) ⇑f) x ∧
    Set.range (ι := ↥(Spec (CommRingCat.of (Localization.Away r)))) ⇑f ⊆ (↑U : Set ↥X)

Tactic:
rw [Scheme.Hom.comp_base, TopCat.coe_comp, Set.range_comp]

Premises used: Set.range_comp, AlgebraicGeometry.Scheme.Hom.comp_base, TopCat.coe_comp