l3lab/ntp-mathlib huggingface dataset:
noncomputable instance (R : CommRingCat) [IsDomain R] :
    Algebra R (Scheme.Spec.obj <| op R).functionField :=
  RingHom.toAlgebra <| by change CommRingCat.of R ⟶ _; 

Proof state:
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ CommRingCat.of ↑R ⟶ Scheme.functionField (Scheme.Spec.obj (op R))

Next tactic:
apply StructureSheaf.toStalk
@[simp]
theorem genericPoint_eq_bot_of_affine (R : CommRingCat) [IsDomain R] :
    genericPoint (Scheme.Spec.obj <| op R).carrier = (⟨0, Ideal.bot_prime⟩ : PrimeSpectrum R) := by
  

Proof state:
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace = { asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }

Next tactic:
apply (genericPoint_spec (Scheme.Spec.obj <| op R).carrier).eq
@[simp]
theorem genericPoint_eq_bot_of_affine (R : CommRingCat) [IsDomain R] :
    genericPoint (Scheme.Spec.obj <| op R).carrier = (⟨0, Ideal.bot_prime⟩ : PrimeSpectrum R) := by
  apply (genericPoint_spec (Scheme.Spec.obj <| op R).carrier).eq
  

Proof state:
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ IsGenericPoint { asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) } ⊤

Next tactic:
rw [isGenericPoint_def]
@[simp]
theorem genericPoint_eq_bot_of_affine (R : CommRingCat) [IsDomain R] :
    genericPoint (Scheme.Spec.obj <| op R).carrier = (⟨0, Ideal.bot_prime⟩ : PrimeSpectrum R) := by
  apply (genericPoint_spec (Scheme.Spec.obj <| op R).carrier).eq
  rw [isGenericPoint_def]
  

Proof state:
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ closure {{ asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }} = ⊤

Next tactic:
rw [← PrimeSpectrum.zeroLocus_vanishingIdeal_eq_closure, PrimeSpectrum.vanishingIdeal_singleton]
@[simp]
theorem genericPoint_eq_bot_of_affine (R : CommRingCat) [IsDomain R] :
    genericPoint (Scheme.Spec.obj <| op R).carrier = (⟨0, Ideal.bot_prime⟩ : PrimeSpectrum R) := by
  apply (genericPoint_spec (Scheme.Spec.obj <| op R).carrier).eq
  rw [isGenericPoint_def]
  rw [← PrimeSpectrum.zeroLocus_vanishingIdeal_eq_closure, PrimeSpectrum.vanishingIdeal_singleton]
  

Proof state:
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ PrimeSpectrum.zeroLocus ↑{ asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }.asIdeal = ⊤

Next tactic:
rw [Set.top_eq_univ, ← PrimeSpectrum.zeroLocus_singleton_zero]
@[simp]
theorem genericPoint_eq_bot_of_affine (R : CommRingCat) [IsDomain R] :
    genericPoint (Scheme.Spec.obj <| op R).carrier = (⟨0, Ideal.bot_prime⟩ : PrimeSpectrum R) := by
  apply (genericPoint_spec (Scheme.Spec.obj <| op R).carrier).eq
  rw [isGenericPoint_def]
  rw [← PrimeSpectrum.zeroLocus_vanishingIdeal_eq_closure, PrimeSpectrum.vanishingIdeal_singleton]
  rw [Set.top_eq_univ, ← PrimeSpectrum.zeroLocus_singleton_zero]
  

Proof state:
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ PrimeSpectrum.zeroLocus ↑{ asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }.asIdeal = PrimeSpectrum.zeroLocus {0}

Next tactic:
rfl
instance functionField_isFractionRing_of_affine (R : CommRingCat.{u}) [IsDomain R] :
    IsFractionRing R (Scheme.Spec.obj <| op R).functionField := by
  

Proof state:
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ IsFractionRing ↑R ↑(Scheme.functionField (Scheme.Spec.obj (op R)))

Next tactic:
convert StructureSheaf.IsLocalization.to_stalk R (genericPoint _)
instance functionField_isFractionRing_of_affine (R : CommRingCat.{u}) [IsDomain R] :
    IsFractionRing R (Scheme.Spec.obj <| op R).functionField := by
  convert StructureSheaf.IsLocalization.to_stalk R (genericPoint _)
  

Proof state:
case a
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ IsFractionRing ↑R ↑(Scheme.functionField (Scheme.Spec.obj (op R))) ↔
    IsLocalization.AtPrime
      (↑(Presheaf.stalk (Sheaf.presheaf (Spec.structureSheaf ↑R))
          (genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace)))
      (genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace).asIdeal

Next tactic:
delta IsFractionRing IsLocalization.AtPrime
instance functionField_isFractionRing_of_affine (R : CommRingCat.{u}) [IsDomain R] :
    IsFractionRing R (Scheme.Spec.obj <| op R).functionField := by
  convert StructureSheaf.IsLocalization.to_stalk R (genericPoint _)
  delta IsFractionRing IsLocalization.AtPrime
  -- Porting note: `congr` does not work for `Iff`
  

Proof state:
case a
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ IsLocalization (nonZeroDivisors ↑R) ↑(Scheme.functionField (Scheme.Spec.obj (op R))) ↔
    IsLocalization (Ideal.primeCompl (genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace).asIdeal)
      ↑(Presheaf.stalk (Sheaf.presheaf (Spec.structureSheaf ↑R))
          (genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace))

Next tactic:
apply Eq.to_iff
instance functionField_isFractionRing_of_affine (R : CommRingCat.{u}) [IsDomain R] :
    IsFractionRing R (Scheme.Spec.obj <| op R).functionField := by
  convert StructureSheaf.IsLocalization.to_stalk R (genericPoint _)
  delta IsFractionRing IsLocalization.AtPrime
  -- Porting note: `congr` does not work for `Iff`
  apply Eq.to_iff
  

Proof state:
case a.a
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ IsLocalization (nonZeroDivisors ↑R) ↑(Scheme.functionField (Scheme.Spec.obj (op R))) =
    IsLocalization (Ideal.primeCompl (genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace).asIdeal)
      ↑(Presheaf.stalk (Sheaf.presheaf (Spec.structureSheaf ↑R))
          (genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace))

Next tactic:
congr 1
instance functionField_isFractionRing_of_affine (R : CommRingCat.{u}) [IsDomain R] :
    IsFractionRing R (Scheme.Spec.obj <| op R).functionField := by
  convert StructureSheaf.IsLocalization.to_stalk R (genericPoint _)
  delta IsFractionRing IsLocalization.AtPrime
  -- Porting note: `congr` does not work for `Iff`
  apply Eq.to_iff
  congr 1
  

Proof state:
case a.a.e_M
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ nonZeroDivisors ↑R = Ideal.primeCompl (genericPoint ↑↑(Scheme.Spec.obj (op R)).toPresheafedSpace).asIdeal

Next tactic:
rw [genericPoint_eq_bot_of_affine]
instance functionField_isFractionRing_of_affine (R : CommRingCat.{u}) [IsDomain R] :
    IsFractionRing R (Scheme.Spec.obj <| op R).functionField := by
  convert StructureSheaf.IsLocalization.to_stalk R (genericPoint _)
  delta IsFractionRing IsLocalization.AtPrime
  -- Porting note: `congr` does not work for `Iff`
  apply Eq.to_iff
  congr 1
  rw [genericPoint_eq_bot_of_affine]
  

Proof state:
case a.a.e_M
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
⊢ nonZeroDivisors ↑R = Ideal.primeCompl { asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }.asIdeal

Next tactic:
ext
instance functionField_isFractionRing_of_affine (R : CommRingCat.{u}) [IsDomain R] :
    IsFractionRing R (Scheme.Spec.obj <| op R).functionField := by
  convert StructureSheaf.IsLocalization.to_stalk R (genericPoint _)
  delta IsFractionRing IsLocalization.AtPrime
  -- Porting note: `congr` does not work for `Iff`
  apply Eq.to_iff
  congr 1
  rw [genericPoint_eq_bot_of_affine]
  ext
  

Proof state:
case a.a.e_M.h
X : Scheme
R : CommRingCat
inst✝ : IsDomain ↑R
x✝ : ↑R
⊢ x✝ ∈ nonZeroDivisors ↑R ↔ x✝ ∈ Ideal.primeCompl { asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }.asIdeal

Next tactic:
exact mem_nonZeroDivisors_iff_ne_zero
theorem IsAffineOpen.primeIdealOf_genericPoint {X : Scheme} [IsIntegral X] {U : Opens X.carrier}
    (hU : IsAffineOpen U) [h : Nonempty U] :
    hU.primeIdealOf
        ⟨genericPoint X.carrier,
          ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by 

Proof state:
X✝ : Scheme
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
h : Nonempty ↥U
⊢ Set.Nonempty (⊤ ∩ ↑U)

Next tactic:
simpa using h
theorem IsAffineOpen.primeIdealOf_genericPoint {X : Scheme} [IsIntegral X] {U : Opens X.carrier}
    (hU : IsAffineOpen U) [h : Nonempty U] :
    hU.primeIdealOf
        ⟨genericPoint X.carrier,
          ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ =
      genericPoint (Scheme.Spec.obj <| op <| X.presheaf.obj <| op U).carrier := by
  

Proof state:
X✝ : Scheme
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
h : Nonempty ↥U
⊢ primeIdealOf hU
      { val := genericPoint ↑↑X.toPresheafedSpace, property := (_ : genericPoint ↑↑X.toPresheafedSpace ∈ ↑U) } =
    genericPoint ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace

Next tactic:
haveI : IsAffine _ := hU
theorem IsAffineOpen.primeIdealOf_genericPoint {X : Scheme} [IsIntegral X] {U : Opens X.carrier}
    (hU : IsAffineOpen U) [h : Nonempty U] :
    hU.primeIdealOf
        ⟨genericPoint X.carrier,
          ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ =
      genericPoint (Scheme.Spec.obj <| op <| X.presheaf.obj <| op U).carrier := by
  haveI : IsAffine _ := hU
  

Proof state:
X✝ : Scheme
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
h : Nonempty ↥U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
⊢ primeIdealOf hU
      { val := genericPoint ↑↑X.toPresheafedSpace, property := (_ : genericPoint ↑↑X.toPresheafedSpace ∈ ↑U) } =
    genericPoint ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace

Next tactic:
delta IsAffineOpen.primeIdealOf
theorem IsAffineOpen.primeIdealOf_genericPoint {X : Scheme} [IsIntegral X] {U : Opens X.carrier}
    (hU : IsAffineOpen U) [h : Nonempty U] :
    hU.primeIdealOf
        ⟨genericPoint X.carrier,
          ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ =
      genericPoint (Scheme.Spec.obj <| op <| X.presheaf.obj <| op U).carrier := by
  haveI : IsAffine _ := hU
  delta IsAffineOpen.primeIdealOf
  

Proof state:
X✝ : Scheme
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
h : Nonempty ↥U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
⊢ ((Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))).hom ≫
            Scheme.Spec.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.base
      { val := genericPoint ↑↑X.toPresheafedSpace, property := (_ : genericPoint ↑↑X.toPresheafedSpace ∈ ↑U) } =
    genericPoint ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace

Next tactic:
convert
    genericPoint_eq_of_isOpenImmersion
      ((X.restrict U.openEmbedding).isoSpec.hom ≫
        Scheme.Spec.map (X.presheaf.map (eqToHom U.openEmbedding_obj_top).op).op)
theorem IsAffineOpen.primeIdealOf_genericPoint {X : Scheme} [IsIntegral X] {U : Opens X.carrier}
    (hU : IsAffineOpen U) [h : Nonempty U] :
    hU.primeIdealOf
        ⟨genericPoint X.carrier,
          ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ =
      genericPoint (Scheme.Spec.obj <| op <| X.presheaf.obj <| op U).carrier := by
  haveI : IsAffine _ := hU
  delta IsAffineOpen.primeIdealOf
  convert
    genericPoint_eq_of_isOpenImmersion
      ((X.restrict U.openEmbedding).isoSpec.hom ≫
        Scheme.Spec.map (X.presheaf.map (eqToHom U.openEmbedding_obj_top).op).op)
  -- Porting note: this was `ext1`
  

Proof state:
case h.e'_2.h.h.e'_6
X✝ : Scheme
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
h : Nonempty ↥U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
e_1✝ :
  PrimeSpectrum ↑(X.presheaf.obj (op U)) =
    (forget TopCat).obj ↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace
⊢ { val := genericPoint ↑↑X.toPresheafedSpace, property := (_ : genericPoint ↑↑X.toPresheafedSpace ∈ ↑U) } =
    genericPoint ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace

Next tactic:
apply Subtype.ext
theorem IsAffineOpen.primeIdealOf_genericPoint {X : Scheme} [IsIntegral X] {U : Opens X.carrier}
    (hU : IsAffineOpen U) [h : Nonempty U] :
    hU.primeIdealOf
        ⟨genericPoint X.carrier,
          ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ =
      genericPoint (Scheme.Spec.obj <| op <| X.presheaf.obj <| op U).carrier := by
  haveI : IsAffine _ := hU
  delta IsAffineOpen.primeIdealOf
  convert
    genericPoint_eq_of_isOpenImmersion
      ((X.restrict U.openEmbedding).isoSpec.hom ≫
        Scheme.Spec.map (X.presheaf.map (eqToHom U.openEmbedding_obj_top).op).op)
  -- Porting note: this was `ext1`
  apply Subtype.ext
  

Proof state:
case h.e'_2.h.h.e'_6.a
X✝ : Scheme
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
h : Nonempty ↥U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
e_1✝ :
  PrimeSpectrum ↑(X.presheaf.obj (op U)) =
    (forget TopCat).obj ↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace
⊢ ↑{ val := genericPoint ↑↑X.toPresheafedSpace, property := (_ : genericPoint ↑↑X.toPresheafedSpace ∈ ↑U) } =
    ↑(genericPoint ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace)

Next tactic:
exact (genericPoint_eq_of_isOpenImmersion (X.ofRestrict U.openEmbedding)).symm
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
⊢ IsFractionRing ↑(X.presheaf.obj (op U)) ↑(Scheme.functionField X)

Next tactic:
haveI : IsAffine _ := hU
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
⊢ IsFractionRing ↑(X.presheaf.obj (op U)) ↑(Scheme.functionField X)

Next tactic:
haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ IsFractionRing ↑(X.presheaf.obj (op U)) ↑(Scheme.functionField X)

Next tactic:
haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; rw [Opens.openEmbedding_obj_top]; infer_instance)
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by 

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ IsDomain ↑((X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj (op ⊤))

Next tactic:
dsimp
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; 

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ IsDomain ↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤)))

Next tactic:
rw [Opens.openEmbedding_obj_top]
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; rw [Opens.openEmbedding_obj_top]; 

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ IsDomain ↑(X.presheaf.obj (op U))

Next tactic:
infer_instance
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; rw [Opens.openEmbedding_obj_top]; infer_instance)
  

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝¹ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this✝ : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
this : IsIntegral (X ∣_ᵤ U)
⊢ IsFractionRing ↑(X.presheaf.obj (op U)) ↑(Scheme.functionField X)

Next tactic:
delta IsFractionRing Scheme.functionField
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; rw [Opens.openEmbedding_obj_top]; infer_instance)
  delta IsFractionRing Scheme.functionField
  

Proof state:
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝¹ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this✝ : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
this : IsIntegral (X ∣_ᵤ U)
⊢ IsLocalization (nonZeroDivisors ↑(X.presheaf.obj (op U)))
    ↑(Presheaf.stalk X.presheaf (genericPoint ↑↑X.toPresheafedSpace))

Next tactic:
convert hU.isLocalization_stalk ⟨genericPoint X.carrier, _⟩ using 1
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; rw [Opens.openEmbedding_obj_top]; infer_instance)
  delta IsFractionRing Scheme.functionField
  convert hU.isLocalization_stalk ⟨genericPoint X.carrier, _⟩ using 1
  

Proof state:
case h.e'_3.h
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝¹ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this✝ : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
this : IsIntegral (X ∣_ᵤ U)
⊢ nonZeroDivisors ↑(X.presheaf.obj (op U)) =
    Ideal.primeCompl
      (IsAffineOpen.primeIdealOf hU
          { val := genericPoint ↑↑X.toPresheafedSpace,
            property := (_ : genericPoint ↑↑X.toPresheafedSpace ∈ ↑U) }).asIdeal

Next tactic:
rw [hU.primeIdealOf_genericPoint, genericPoint_eq_bot_of_affine]
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; rw [Opens.openEmbedding_obj_top]; infer_instance)
  delta IsFractionRing Scheme.functionField
  convert hU.isLocalization_stalk ⟨genericPoint X.carrier, _⟩ using 1
  rw [hU.primeIdealOf_genericPoint, genericPoint_eq_bot_of_affine]
  

Proof state:
case h.e'_3.h
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝¹ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this✝ : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
this : IsIntegral (X ∣_ᵤ U)
⊢ nonZeroDivisors ↑(X.presheaf.obj (op U)) = Ideal.primeCompl { asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }.asIdeal

Next tactic:
ext
theorem functionField_isFractionRing_of_isAffineOpen [IsIntegral X] (U : Opens X.carrier)
    (hU : IsAffineOpen U) [hU' : Nonempty U] :
    IsFractionRing (X.presheaf.obj <| op U) X.functionField := by
  haveI : IsAffine _ := hU
  haveI : Nonempty (X.restrict U.openEmbedding).carrier := hU'
  haveI : IsIntegral (X.restrict U.openEmbedding) :=
    @isIntegralOfIsAffineIsDomain _ _ _
      (by dsimp; rw [Opens.openEmbedding_obj_top]; infer_instance)
  delta IsFractionRing Scheme.functionField
  convert hU.isLocalization_stalk ⟨genericPoint X.carrier, _⟩ using 1
  rw [hU.primeIdealOf_genericPoint, genericPoint_eq_bot_of_affine]
  ext; 

Proof state:
case h.e'_3.h.h
X : Scheme
inst✝ : IsIntegral X
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hU' : Nonempty ↥U
this✝¹ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ⇑(Opens.inclusion U)))
this✝ : Nonempty ↑↑(X ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
this : IsIntegral (X ∣_ᵤ U)
x✝ : ↑(X.presheaf.obj (op U))
⊢ x✝ ∈ nonZeroDivisors ↑(X.presheaf.obj (op U)) ↔
    x✝ ∈ Ideal.primeCompl { asIdeal := 0, IsPrime := (_ : Ideal.IsPrime ⊥) }.asIdeal

Next tactic:
exact mem_nonZeroDivisors_iff_ne_zero
instance widePullbackShape_connected (J : Type v₁) : IsConnected (WidePullbackShape J) := by
  

Proof state:
J : Type v₁
⊢ IsConnected (WidePullbackShape J)

Next tactic:
apply IsConnected.of_induct
instance widePullbackShape_connected (J : Type v₁) : IsConnected (WidePullbackShape J) := by
  apply IsConnected.of_induct
  

Proof state:
case h
J : Type v₁
⊢ ∀ (p : Set (WidePullbackShape J)),
    ?j₀ ∈ p → (∀ {j₁ j₂ : WidePullbackShape J}, (j₁ ⟶ j₂) → (j₁ ∈ p ↔ j₂ ∈ p)) → ∀ (j : WidePullbackShape J), j ∈ p
case j₀ J : Type v₁ ⊢ WidePullbackShape J

Next tactic:
introv hp t
instance widePullbackShape_connected (J : Type v₁) : IsConnected (WidePullbackShape J) := by
  apply IsConnected.of_induct
  introv hp t
  

Proof state:
case h
J : Type v₁
p : Set (WidePullbackShape J)
hp : ?j₀ ∈ p
t : ∀ {j₁ j₂ : WidePullbackShape J}, (j₁ ⟶ j₂) → (j₁ ∈ p ↔ j₂ ∈ p)
j : WidePullbackShape J
⊢ j ∈ p
case j₀ J : Type v₁ ⊢ WidePullbackShape J

Next tactic:
cases j
instance widePullbackShape_connected (J : Type v₁) : IsConnected (WidePullbackShape J) := by
  apply IsConnected.of_induct
  introv hp t
  cases j
  · 

Proof state:
case h.none
J : Type v₁
p : Set (WidePullbackShape J)
hp : ?j₀ ∈ p
t : ∀ {j₁ j₂ : WidePullbackShape J}, (j₁ ⟶ j₂) → (j₁ ∈ p ↔ j₂ ∈ p)
⊢ none ∈ p

Next tactic:
exact hp
instance widePullbackShape_connected (J : Type v₁) : IsConnected (WidePullbackShape J) := by
  apply IsConnected.of_induct
  introv hp t
  cases j
  · exact hp
  · 

Proof state:
case h.some
J : Type v₁
p : Set (WidePullbackShape J)
hp : none ∈ p
t : ∀ {j₁ j₂ : WidePullbackShape J}, (j₁ ⟶ j₂) → (j₁ ∈ p ↔ j₂ ∈ p)
val✝ : J
⊢ some val✝ ∈ p

Next tactic:
rwa [t (WidePullbackShape.Hom.term _)]