l3lab/ntp-mathlib huggingface dataset:
theorem affineBasisCover_map_range (X : Scheme) (x : X)
    (r : (X.local_affine x).choose_spec.choose) :
    Set.range (X.affineBasisCover.map ⟨x, r⟩).1.base =
      (X.affineCover.map x).1.base '' (PrimeSpectrum.basicOpen r).1 := by
  erw [coe_comp, Set.range_comp]
  -- Porting note : `congr` fails to see the goal is comparing image of the same function
  refine congr_arg (_ '' ·) ?_
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
x : ↑↑X.toPresheafedSpace
r :
  ↑(Exists.choose
      (_ :
        ∃ R,
          Nonempty
            (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                (_ :
                  OpenEmbedding
                    ⇑(Opens.inclusion
                        (Exists.choose
                            (_ :
                              ∃ U R,
                                Nonempty
                                  (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                                      (_ : OpenEmbedding ⇑(Opens.inclusion U.obj)) ≅
                                    Spec.toLocallyRingedSpace.obj (op R)))).obj)) ≅
              Spec.toLocallyRingedSpace.obj (op R))))
⊢ Set.range
      ⇑(OpenCover.map
              ((fun x =>
                  affineBasisCoverOfAffine
                    (Exists.choose
                      (_ :
                        ∃ R,
                          Nonempty
                            (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                                (_ :
                                  OpenEmbedding
                                    ⇑(Opens.inclusion
                                        (Exists.choose
                                            (_ :
                                              ∃ U R,
                                                Nonempty
                                                  (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                                                      (_ : OpenEmbedding ⇑(Opens.inclusion U.obj)) ≅
                                                    Spec.toLocallyRingedSpace.obj (op R)))).obj)) ≅
                              Spec.toLocallyRingedSpace.obj (op R)))))
                { fst := x, snd := r }.fst)
              { fst := x, snd := r }.snd).val.base =
    (PrimeSpectrum.basicOpen r).carrier

Next tactic:
exact (PrimeSpectrum.localization_away_comap_range (Localization.Away r) r : _)
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
⊢ IsTopologicalBasis {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}

Next tactic:
apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · 

Proof state:
case h_open
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
⊢ ∀ u ∈ {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}, IsOpen u

Next tactic:
rintro _ ⟨a, rfl⟩
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    

Proof state:
case h_open.intro
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : (affineBasisCover X).J
⊢ IsOpen (Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base)

Next tactic:
exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · 

Proof state:
case h_nhds
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
⊢ ∀ (a : ↑↑X.toPresheafedSpace) (u : Set ↑↑X.toPresheafedSpace),
    a ∈ u → IsOpen u → ∃ v ∈ {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}, a ∈ v ∧ v ⊆ u

Next tactic:
rintro a U haU hU
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    

Proof state:
case h_nhds
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
⊢ ∃ v ∈ {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}, a ∈ v ∧ v ⊆ U

Next tactic:
rcases X.affineCover.Covers a with ⟨x, e⟩
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    

Proof state:
case h_nhds.intro
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
⊢ ∃ v ∈ {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}, a ∈ v ∧ v ⊆ U

Next tactic:
let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    

Proof state:
case h_nhds.intro
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
⊢ ∃ v ∈ {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}, a ∈ v ∧ v ⊆ U

Next tactic:
have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    have hxU' : x ∈ U' := by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
⊢ x ∈ U'

Next tactic:
rw [← e] at haU
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    have hxU' : x ∈ U' := by rw [← e] at haU; 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
haU : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x ∈ U
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
⊢ x ∈ U'

Next tactic:
exact haU
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
    

Proof state:
case h_nhds.intro
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
hxU' : x ∈ U'
⊢ ∃ v ∈ {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}, a ∈ v ∧ v ⊆ U

Next tactic:
rcases PrimeSpectrum.isBasis_basic_opens.exists_subset_of_mem_open hxU'
        ((X.affineCover.map (X.affineCover.f a)).1.base.continuous_toFun.isOpen_preimage _
          hU) with
      ⟨_, ⟨_, ⟨s, rfl⟩, rfl⟩, hxV, hVU⟩
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
    rcases PrimeSpectrum.isBasis_basic_opens.exists_subset_of_mem_open hxU'
        ((X.affineCover.map (X.affineCover.f a)).1.base.continuous_toFun.isOpen_preimage _
          hU) with
      ⟨_, ⟨_, ⟨s, rfl⟩, rfl⟩, hxV, hVU⟩
    

Proof state:
case h_nhds.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
hxU' : x ∈ U'
s :
  ↑(op
        (Exists.choose
          (_ :
            ∃ R,
              Nonempty
                (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                    (_ :
                      OpenEmbedding
                        ⇑(Opens.inclusion
                            (Exists.choose
                                (_ :
                                  ∃ U R,
                                    Nonempty
                                      (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                                          (_ : OpenEmbedding ⇑(Opens.inclusion U.obj)) ≅
                                        Spec.toLocallyRingedSpace.obj (op R)))).obj)) ≅
                  Spec.toLocallyRingedSpace.obj (op R))))).unop
hxV : x ∈ ↑(PrimeSpectrum.basicOpen s)
hVU : ↑(PrimeSpectrum.basicOpen s) ⊆ U'
⊢ ∃ v ∈ {x | ∃ a, x = Set.range ⇑(OpenCover.map (affineBasisCover X) a).val.base}, a ∈ v ∧ v ⊆ U

Next tactic:
refine' ⟨_, ⟨⟨_, s⟩, rfl⟩, _, _⟩
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
    rcases PrimeSpectrum.isBasis_basic_opens.exists_subset_of_mem_open hxU'
        ((X.affineCover.map (X.affineCover.f a)).1.base.continuous_toFun.isOpen_preimage _
          hU) with
      ⟨_, ⟨_, ⟨s, rfl⟩, rfl⟩, hxV, hVU⟩
    refine' ⟨_, ⟨⟨_, s⟩, rfl⟩, _, _⟩ <;> 

Proof state:
case h_nhds.intro.intro.intro.intro.intro.intro.intro.refine'_1
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
hxU' : x ∈ U'
s :
  ↑(op
        (Exists.choose
          (_ :
            ∃ R,
              Nonempty
                (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                    (_ :
                      OpenEmbedding
                        ⇑(Opens.inclusion
                            (Exists.choose
                                (_ :
                                  ∃ U R,
                                    Nonempty
                                      (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                                          (_ : OpenEmbedding ⇑(Opens.inclusion U.obj)) ≅
                                        Spec.toLocallyRingedSpace.obj (op R)))).obj)) ≅
                  Spec.toLocallyRingedSpace.obj (op R))))).unop
hxV : x ∈ ↑(PrimeSpectrum.basicOpen s)
hVU : ↑(PrimeSpectrum.basicOpen s) ⊆ U'
⊢ a ∈ Set.range ⇑(OpenCover.map (affineBasisCover X) { fst := OpenCover.f (affineCover X) a, snd := s }).val.base

Next tactic:
erw [affineBasisCover_map_range]
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
    rcases PrimeSpectrum.isBasis_basic_opens.exists_subset_of_mem_open hxU'
        ((X.affineCover.map (X.affineCover.f a)).1.base.continuous_toFun.isOpen_preimage _
          hU) with
      ⟨_, ⟨_, ⟨s, rfl⟩, rfl⟩, hxV, hVU⟩
    refine' ⟨_, ⟨⟨_, s⟩, rfl⟩, _, _⟩ <;> 

Proof state:
case h_nhds.intro.intro.intro.intro.intro.intro.intro.refine'_2
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
hxU' : x ∈ U'
s :
  ↑(op
        (Exists.choose
          (_ :
            ∃ R,
              Nonempty
                (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                    (_ :
                      OpenEmbedding
                        ⇑(Opens.inclusion
                            (Exists.choose
                                (_ :
                                  ∃ U R,
                                    Nonempty
                                      (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                                          (_ : OpenEmbedding ⇑(Opens.inclusion U.obj)) ≅
                                        Spec.toLocallyRingedSpace.obj (op R)))).obj)) ≅
                  Spec.toLocallyRingedSpace.obj (op R))))).unop
hxV : x ∈ ↑(PrimeSpectrum.basicOpen s)
hVU : ↑(PrimeSpectrum.basicOpen s) ⊆ U'
⊢ Set.range ⇑(OpenCover.map (affineBasisCover X) { fst := OpenCover.f (affineCover X) a, snd := s }).val.base ⊆ U

Next tactic:
erw [affineBasisCover_map_range]
theorem affineBasisCover_is_basis (X : Scheme) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨a, rfl⟩
    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
  · rintro a U haU hU
    rcases X.affineCover.Covers a with ⟨x, e⟩
    let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
    have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
    rcases PrimeSpectrum.isBasis_basic_opens.exists_subset_of_mem_open hxU'
        ((X.affineCover.map (X.affineCover.f a)).1.base.continuous_toFun.isOpen_preimage _
          hU) with
      ⟨_, ⟨_, ⟨s, rfl⟩, rfl⟩, hxV, hVU⟩
    refine' ⟨_, ⟨⟨_, s⟩, rfl⟩, _, _⟩ <;> erw [affineBasisCover_map_range]
    · 

Proof state:
case h_nhds.intro.intro.intro.intro.intro.intro.intro.refine'_1
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y Z : Scheme
𝒰 : OpenCover X✝
f : X✝ ⟶ Z
g : Y ⟶ Z
inst✝ : ∀ (x : 𝒰.J), HasPullback (OpenCover.map 𝒰 x ≫ f) g
X : Scheme
a : ↑↑X.toPresheafedSpace
U : Set ↑↑X.toPresheafedSpace
haU : a ∈ U
hU : IsOpen U
x : (forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace
e : (OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base x = a
U' : Set ((forget TopCat).obj ↑(OpenCover.obj (affineCover X) (OpenCover.f (affineCover X) a)).toPresheafedSpace) :=
  ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base ⁻¹' U
hxU' : x ∈ U'
s :
  ↑(op
        (Exists.choose
          (_ :
            ∃ R,
              Nonempty
                (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                    (_ :
                      OpenEmbedding
                        ⇑(Opens.inclusion
                            (Exists.choose
                                (_ :
                                  ∃ U R,
                                    Nonempty
                                      (LocallyRingedSpace.restrict X.toLocallyRingedSpace
                                          (_ : OpenEmbedding ⇑(Opens.inclusion U.obj)) ≅
                                        Spec.toLocallyRingedSpace.obj (op R)))).obj)) ≅
                  Spec.toLocallyRingedSpace.obj (op R))))).unop
hxV : x ∈ ↑(PrimeSpectrum.basicOpen s)
hVU : ↑(PrimeSpectrum.basicOpen s) ⊆ U'
⊢ a ∈ ⇑(OpenCover.map (affineCover X) (OpenCover.f (affineCover X) a)).val.base '' (PrimeSpectrum.basicOpen s).carrier

Next tactic:
exact ⟨x, hxV, e⟩