Theorem: AlgebraicGeometry.Scheme.exists_affine_mem_range_and_range_subset
File: Mathlib/AlgebraicGeometry/OpenImmersion.lean

tactic: obtain ⟨⟨V, hxV⟩, R, ⟨e⟩⟩ := X.2 x
state_before: C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U
state_after: case intro.mk.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U

tactic: have : e.hom.1.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.1.base ≫ V.inclusion)).obj U :=
  show ((e.hom ≫ e.inv).1.base ⟨x, hxV⟩).1 ∈ U from e.hom_inv_id ▸ hxU
state_before: case intro.mk.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U
state_after: case intro.mk.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U

tactic: obtain ⟨_, ⟨_, ⟨r : R, rfl⟩, rfl⟩, hr, hr'⟩ :=
  PrimeSpectrum.isBasis_basic_opens.exists_subset_of_mem_open this (Opens.is_open' _)
state_before: case intro.mk.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U
state_after: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U

tactic: let f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap R (Localization.Away r))) ≫ (e.inv ≫ X.ofRestrict _ : _)
state_before: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U
state_after: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U

tactic: refine ⟨.of (Localization.Away r), f, inferInstance, ?_⟩
state_before: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ ∃ R f, IsOpenImmersion f ∧ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U
state_after: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U

tactic: rw [Scheme.comp_val_base, LocallyRingedSpace.comp_val, SheafedSpace.comp_base, TopCat.coe_comp,
  Set.range_comp]
state_before: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ x ∈ Set.range ⇑f.val.base ∧ Set.range ⇑f.val.base ⊆ ↑U
state_after: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ x ∈
      ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) ''
        Set.range ⇑(Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r)))).val.base ∧
    ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) ''
        Set.range ⇑(Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r)))).val.base ⊆
      ↑U

tactic: erw [PrimeSpectrum.localization_away_comap_range (Localization.Away r) r]
state_before: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ x ∈
      ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) ''
        Set.range ⇑(Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r)))).val.base ∧
    ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) ''
        Set.range ⇑(Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r)))).val.base ⊆
      ↑U
state_after: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ x ∈ ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) '' ↑(PrimeSpectrum.basicOpen r) ∧
    ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) '' ↑(PrimeSpectrum.basicOpen r) ⊆ ↑U

tactic: exact ⟨⟨_, hr, congr(($(e.hom_inv_id).1.base ⟨x, hxV⟩).1)⟩, Set.image_subset_iff.mpr hr'⟩
state_before: case intro.mk.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
x : ↑↑X.toPresheafedSpace
U : Opens ↑↑X.toPresheafedSpace
hxU : x ∈ U
V : Opens ↑X.toTopCat
hxV : x ∈ V
R : CommRingCat
e : X.restrict ⋯ ≅ Spec.toLocallyRingedSpace.obj { unop := R }
this : e.hom.val.base ⟨x, hxV⟩ ∈ (Opens.map (e.inv.val.base ≫ V.inclusion)).obj U
r : ↑R
hr : e.hom.val.base ⟨x, hxV⟩ ∈ ↑(PrimeSpectrum.basicOpen r)
hr' : ↑(PrimeSpectrum.basicOpen r) ⊆ ↑((Opens.map (e.inv.val.base ≫ V.inclusion)).obj U)
f : Spec (CommRingCat.of (Localization.Away r)) ⟶ X :=
  Spec.map (CommRingCat.ofHom (algebraMap (↑R) (Localization.Away r))) ≫ e.inv ≫ X.ofRestrict ⋯
⊢ x ∈ ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) '' ↑(PrimeSpectrum.basicOpen r) ∧
    ⇑(e.inv.val.base ≫ (X.ofRestrict ⋯).val.base) '' ↑(PrimeSpectrum.basicOpen r) ⊆ ↑U
state_after: no goals