algebraic_geometry.propertiesMathlib.AlgebraicGeometry.Properties

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
 import AlgebraicGeometry.AffineScheme
-import RingTheory.Nilpotent
+import RingTheory.Nilpotent.Defs
 import Topology.Sheaves.SheafCondition.Sites
 import Algebra.Category.Ring.Constructions
 import RingTheory.LocalProperties
Diff
@@ -82,9 +82,9 @@ instance stalk_isReduced_of_reduced [IsReduced X] (x : X.carrier) :
   constructor
   rintro g ⟨n, e⟩
   obtain ⟨U, hxU, s, rfl⟩ := X.presheaf.germ_exist x g
-  rw [← map_pow, ← map_zero (X.presheaf.germ ⟨x, hxU⟩)] at e 
+  rw [← map_pow, ← map_zero (X.presheaf.germ ⟨x, hxU⟩)] at e
   obtain ⟨V, hxV, iU, iV, e'⟩ := X.presheaf.germ_eq x hxU hxU _ 0 e
-  rw [map_pow, map_zero] at e' 
+  rw [map_pow, map_zero] at e'
   replace e' := (IsNilpotent.mk _ _ e').eq_zero
   erw [← concrete_category.congr_hom (X.presheaf.germ_res iU ⟨x, hxV⟩) s]
   rw [comp_apply, e', map_zero]
@@ -196,10 +196,10 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
   · intro X U hx hX s hs x
     obtain ⟨V, hx, i, H⟩ := hx x
     specialize H (X.presheaf.map i.op s)
-    erw [Scheme.basic_open_res] at H 
-    rw [hs] at H 
+    erw [Scheme.basic_open_res] at H
+    rw [hs] at H
     specialize H inf_bot_eq ⟨x, hx⟩
-    erw [TopCat.Presheaf.germ_res_apply] at H 
+    erw [TopCat.Presheaf.germ_res_apply] at H
     exact H
   · rintro X Y f hf
     have e : f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ := by
@@ -209,16 +209,16 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
     haveI := is_reduced_of_open_immersion f
     specialize H (f.1.c.app _ s) _ ⟨x, by rw [opens.mem_mk, e]; trivial⟩
     · rw [← Scheme.preimage_basic_open, hs]; ext1; simp [opens.map]
-    · erw [← PresheafedSpace.stalk_map_germ_apply f.1 ⟨_, _⟩ ⟨x, _⟩] at H 
-      apply_fun inv <| PresheafedSpace.stalk_map f.val x at H 
-      erw [CategoryTheory.IsIso.hom_inv_id_apply, map_zero] at H 
+    · erw [← PresheafedSpace.stalk_map_germ_apply f.1 ⟨_, _⟩ ⟨x, _⟩] at H
+      apply_fun inv <| PresheafedSpace.stalk_map f.val x at H
+      erw [CategoryTheory.IsIso.hom_inv_id_apply, map_zero] at H
       exact H
   · intro R hX s hs x
-    erw [basic_open_eq_of_affine', PrimeSpectrum.basicOpen_eq_bot_iff] at hs 
+    erw [basic_open_eq_of_affine', PrimeSpectrum.basicOpen_eq_bot_iff] at hs
     replace hs := hs.map (Spec_Γ_identity.app R).inv
     -- what the hell?!
     replace hs := @IsNilpotent.eq_zero _ _ _ _ (show _ from _) hs
-    rw [iso.hom_inv_id_apply] at hs 
+    rw [iso.hom_inv_id_apply] at hs
     rw [hs, map_zero]
     exact @is_reduced.component_reduced hX ⊤
 #align algebraic_geometry.eq_zero_of_basic_open_eq_bot AlgebraicGeometry.eq_zero_of_basicOpen_eq_bot
@@ -271,10 +271,10 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
   replace H : ¬IsPreirreducible (⊤ : Set X.carrier) := fun h =>
     H { to_preirreducibleSpace := ⟨h⟩
         to_nonempty := inferInstance }
-  simp_rw [isPreirreducible_iff_closed_union_closed, Classical.not_forall, not_or] at H 
+  simp_rw [isPreirreducible_iff_closed_union_closed, Classical.not_forall, not_or] at H
   rcases H with ⟨S, T, hS, hT, h₁, h₂, h₃⟩
-  erw [Classical.not_forall] at h₂ h₃ 
-  simp_rw [Classical.not_forall] at h₂ h₃ 
+  erw [Classical.not_forall] at h₂ h₃
+  simp_rw [Classical.not_forall] at h₂ h₃
   haveI : Nonempty (⟨Sᶜ, hS.1⟩ : opens X.carrier) := ⟨⟨_, h₂.some_spec.some_spec⟩⟩
   haveI : Nonempty (⟨Tᶜ, hT.1⟩ : opens X.carrier) := ⟨⟨_, h₃.some_spec.some_spec⟩⟩
   haveI : Nonempty (⟨Sᶜ, hS.1⟩ ⊔ ⟨Tᶜ, hT.1⟩ : opens X.carrier) :=
@@ -312,7 +312,7 @@ theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X
     replace e' := Subtype.eq e'
     subst e'
     replace e := congr_arg (X.presheaf.germ x) e
-    rw [RingHom.map_mul, RingHom.map_zero] at e 
+    rw [RingHom.map_mul, RingHom.map_zero] at e
     refine' zero_ne_one' (X.presheaf.stalk x.1) (isUnit_zero_iff.1 _)
     convert hx₁.mul hx₂
     exact e.symm
@@ -383,7 +383,7 @@ theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i :
   rw [injective_iff_map_eq_zero]
   intro x hx
   rw [← basic_open_eq_bot_iff] at hx ⊢
-  rw [Scheme.basic_open_res] at hx 
+  rw [Scheme.basic_open_res] at hx
   revert hx
   contrapose!
   simp_rw [← opens.not_nonempty_iff_eq_bot, Classical.not_not]
Diff
@@ -306,7 +306,7 @@ theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X
     by
     refine' ⟨fun a b e => _⟩
     simp_rw [← basic_open_eq_bot_iff, ← opens.not_nonempty_iff_eq_bot]
-    by_contra' h
+    by_contra! h
     obtain ⟨_, ⟨x, hx₁, rfl⟩, ⟨x, hx₂, e'⟩⟩ :=
       @nonempty_preirreducible_inter _ H.1 (X.basic_open a).2 (X.basic_open b).2 h.1 h.2
     replace e' := Subtype.eq e'
Diff
@@ -271,10 +271,10 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
   replace H : ¬IsPreirreducible (⊤ : Set X.carrier) := fun h =>
     H { to_preirreducibleSpace := ⟨h⟩
         to_nonempty := inferInstance }
-  simp_rw [isPreirreducible_iff_closed_union_closed, not_forall, not_or] at H 
+  simp_rw [isPreirreducible_iff_closed_union_closed, Classical.not_forall, not_or] at H 
   rcases H with ⟨S, T, hS, hT, h₁, h₂, h₃⟩
-  erw [not_forall] at h₂ h₃ 
-  simp_rw [not_forall] at h₂ h₃ 
+  erw [Classical.not_forall] at h₂ h₃ 
+  simp_rw [Classical.not_forall] at h₂ h₃ 
   haveI : Nonempty (⟨Sᶜ, hS.1⟩ : opens X.carrier) := ⟨⟨_, h₂.some_spec.some_spec⟩⟩
   haveI : Nonempty (⟨Tᶜ, hT.1⟩ : opens X.carrier) := ⟨⟨_, h₃.some_spec.some_spec⟩⟩
   haveI : Nonempty (⟨Sᶜ, hS.1⟩ ⊔ ⟨Tᶜ, hT.1⟩ : opens X.carrier) :=
Diff
@@ -3,11 +3,11 @@ Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathbin.AlgebraicGeometry.AffineScheme
-import Mathbin.RingTheory.Nilpotent
-import Mathbin.Topology.Sheaves.SheafCondition.Sites
-import Mathbin.Algebra.Category.Ring.Constructions
-import Mathbin.RingTheory.LocalProperties
+import AlgebraicGeometry.AffineScheme
+import RingTheory.Nilpotent
+import Topology.Sheaves.SheafCondition.Sites
+import Algebra.Category.Ring.Constructions
+import RingTheory.LocalProperties
 
 #align_import algebraic_geometry.properties from "leanprover-community/mathlib"@"d0b1936853671209a866fa35b9e54949c81116e2"
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module algebraic_geometry.properties
-! leanprover-community/mathlib commit d0b1936853671209a866fa35b9e54949c81116e2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.AlgebraicGeometry.AffineScheme
 import Mathbin.RingTheory.Nilpotent
@@ -14,6 +9,8 @@ import Mathbin.Topology.Sheaves.SheafCondition.Sites
 import Mathbin.Algebra.Category.Ring.Constructions
 import Mathbin.RingTheory.LocalProperties
 
+#align_import algebraic_geometry.properties from "leanprover-community/mathlib"@"d0b1936853671209a866fa35b9e54949c81116e2"
+
 /-!
 # Basic properties of schemes
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module algebraic_geometry.properties
-! leanprover-community/mathlib commit 88474d1b5af6d37c2ab728b757771bced7f5194c
+! leanprover-community/mathlib commit d0b1936853671209a866fa35b9e54949c81116e2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,9 @@ import Mathbin.RingTheory.LocalProperties
 /-!
 # Basic properties of schemes
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We provide some basic properties of schemes
 
 ## Main definition
Diff
@@ -55,13 +55,16 @@ instance : QuasiSober X.carrier :=
   · rw [Set.top_eq_univ, Set.sUnion_range, Set.eq_univ_iff_forall]
     intro x; exact ⟨_, ⟨_, rfl⟩, X.affine_cover.covers x⟩
 
+#print AlgebraicGeometry.IsReduced /-
 /-- A scheme `X` is reduced if all `𝒪ₓ(U)` are reduced. -/
 class IsReduced : Prop where
   component_reduced : ∀ U, IsReduced (X.Presheaf.obj (op U)) := by infer_instance
 #align algebraic_geometry.is_reduced AlgebraicGeometry.IsReduced
+-/
 
 attribute [instance] is_reduced.component_reduced
 
+#print AlgebraicGeometry.isReducedOfStalkIsReduced /-
 theorem isReducedOfStalkIsReduced [∀ x : X.carrier, IsReduced (X.Presheaf.stalk x)] : IsReduced X :=
   by
   refine' ⟨fun U => ⟨fun s hs => _⟩⟩
@@ -71,7 +74,9 @@ theorem isReducedOfStalkIsReduced [∀ x : X.carrier, IsReduced (X.Presheaf.stal
   change X.presheaf.germ x s = 0
   exact (hs.map _).eq_zero
 #align algebraic_geometry.is_reduced_of_stalk_is_reduced AlgebraicGeometry.isReducedOfStalkIsReduced
+-/
 
+#print AlgebraicGeometry.stalk_isReduced_of_reduced /-
 instance stalk_isReduced_of_reduced [IsReduced X] (x : X.carrier) :
     IsReduced (X.Presheaf.stalk x) := by
   constructor
@@ -84,7 +89,9 @@ instance stalk_isReduced_of_reduced [IsReduced X] (x : X.carrier) :
   erw [← concrete_category.congr_hom (X.presheaf.germ_res iU ⟨x, hxV⟩) s]
   rw [comp_apply, e', map_zero]
 #align algebraic_geometry.stalk_is_reduced_of_reduced AlgebraicGeometry.stalk_isReduced_of_reduced
+-/
 
+#print AlgebraicGeometry.isReducedOfOpenImmersion /-
 theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
     [IsReduced Y] : IsReduced X := by
   constructor
@@ -97,6 +104,7 @@ theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersi
       (as_iso <| f.1.c.app (op <| H.base_open.is_open_map.functor.obj U) :
               Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.Injective
 #align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReducedOfOpenImmersion
+-/
 
 instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.Spec.obj <| op R) :=
   by
@@ -108,6 +116,7 @@ instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.Spec.obj <| op
     isReduced_of_injective (structure_sheaf.stalk_iso R x).Hom
       (structure_sheaf.stalk_iso R x).commRingCatIsoToRingEquiv.Injective
 
+#print AlgebraicGeometry.affine_isReduced_iff /-
 theorem affine_isReduced_iff (R : CommRingCat) :
     IsReduced (Scheme.Spec.obj <| op R) ↔ IsReduced R :=
   by
@@ -120,14 +129,18 @@ theorem affine_isReduced_iff (R : CommRingCat) :
   exact
     isReduced_of_injective (to_Spec_Γ R) (as_iso <| to_Spec_Γ R).commRingCatIsoToRingEquiv.Injective
 #align algebraic_geometry.affine_is_reduced_iff AlgebraicGeometry.affine_isReduced_iff
+-/
 
+#print AlgebraicGeometry.isReducedOfIsAffineIsReduced /-
 theorem isReducedOfIsAffineIsReduced [IsAffine X] [h : IsReduced (X.Presheaf.obj (op ⊤))] :
     IsReduced X :=
   haveI : IsReduced (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) := by rw [affine_is_reduced_iff];
     exact h
   is_reduced_of_open_immersion X.iso_Spec.hom
 #align algebraic_geometry.is_reduced_of_is_affine_is_reduced AlgebraicGeometry.isReducedOfIsAffineIsReduced
+-/
 
+#print AlgebraicGeometry.reduce_to_affine_global /-
 /-- To show that a statement `P` holds for all open subsets of all schemes, it suffices to show that
 1. In any scheme `X`, if `P` holds for an open cover of `U`, then `P` holds for `U`.
 2. For an open immerison `f : X ⟶ Y`, if `P` holds for the entire space of `X`, then `P` holds for
@@ -157,7 +170,9 @@ theorem reduce_to_affine_global (P : ∀ (X : Scheme) (U : Opens X.carrier), Pro
   apply h₂'
   apply h₃
 #align algebraic_geometry.reduce_to_affine_global AlgebraicGeometry.reduce_to_affine_global
+-/
 
+#print AlgebraicGeometry.reduce_to_affine_nbhd /-
 theorem reduce_to_affine_nbhd (P : ∀ (X : Scheme) (x : X.carrier), Prop)
     (h₁ : ∀ (R : CommRingCat) (x : PrimeSpectrum R), P (Scheme.Spec.obj <| op R) x)
     (h₂ : ∀ {X Y} (f : X ⟶ Y) [IsOpenImmersionCat f] (x : X.carrier), P X x → P Y (f.1.base x)) :
@@ -168,7 +183,9 @@ theorem reduce_to_affine_nbhd (P : ∀ (X : Scheme) (x : X.carrier), Prop)
   · rw [e]
   apply h₁
 #align algebraic_geometry.reduce_to_affine_nbhd AlgebraicGeometry.reduce_to_affine_nbhd
+-/
 
+#print AlgebraicGeometry.eq_zero_of_basicOpen_eq_bot /-
 theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
     (s : X.Presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 :=
   by
@@ -205,7 +222,9 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
     rw [hs, map_zero]
     exact @is_reduced.component_reduced hX ⊤
 #align algebraic_geometry.eq_zero_of_basic_open_eq_bot AlgebraicGeometry.eq_zero_of_basicOpen_eq_bot
+-/
 
+#print AlgebraicGeometry.basicOpen_eq_bot_iff /-
 @[simp]
 theorem basicOpen_eq_bot_iff {X : Scheme} [IsReduced X] {U : Opens X.carrier}
     (s : X.Presheaf.obj <| op U) : X.basicOpen s = ⊥ ↔ s = 0 :=
@@ -214,7 +233,9 @@ theorem basicOpen_eq_bot_iff {X : Scheme} [IsReduced X] {U : Opens X.carrier}
   rintro rfl
   simp
 #align algebraic_geometry.basic_open_eq_bot_iff AlgebraicGeometry.basicOpen_eq_bot_iff
+-/
 
+#print AlgebraicGeometry.IsIntegral /-
 /-- A scheme `X` is integral if its carrier is nonempty,
 and `𝒪ₓ(U)` is an integral domain for each `U ≠ ∅`. -/
 class IsIntegral : Prop where
@@ -222,12 +243,14 @@ class IsIntegral : Prop where
   component_integral : ∀ (U : Opens X.carrier) [Nonempty U], IsDomain (X.Presheaf.obj (op U)) := by
     infer_instance
 #align algebraic_geometry.is_integral AlgebraicGeometry.IsIntegral
+-/
 
 attribute [instance] is_integral.component_integral is_integral.nonempty
 
 instance [h : IsIntegral X] : IsDomain (X.Presheaf.obj (op ⊤)) :=
   @IsIntegral.component_integral _ _ (by simp)
 
+#print AlgebraicGeometry.isReducedOfIsIntegral /-
 instance (priority := 900) isReducedOfIsIntegral [IsIntegral X] : IsReduced X :=
   by
   constructor
@@ -239,7 +262,9 @@ instance (priority := 900) isReducedOfIsIntegral [IsIntegral X] : IsReduced X :=
     infer_instance
   · haveI : Nonempty U := by simpa; infer_instance
 #align algebraic_geometry.is_reduced_of_is_integral AlgebraicGeometry.isReducedOfIsIntegral
+-/
 
+#print AlgebraicGeometry.is_irreducible_of_isIntegral /-
 instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrier :=
   by
   by_contra H
@@ -268,7 +293,9 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
       exacts [hS h, hT h]
     · intro x; exact x.rec _
 #align algebraic_geometry.is_irreducible_of_is_integral AlgebraicGeometry.is_irreducible_of_isIntegral
+-/
 
+#print AlgebraicGeometry.isIntegralOfIsIrreducibleIsReduced /-
 theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X.carrier] :
     IsIntegral X := by
   constructor; intro U hU
@@ -291,13 +318,17 @@ theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X
     exact e.symm
   exact NoZeroDivisors.to_isDomain _
 #align algebraic_geometry.is_integral_of_is_irreducible_is_reduced AlgebraicGeometry.isIntegralOfIsIrreducibleIsReduced
+-/
 
+#print AlgebraicGeometry.isIntegral_iff_is_irreducible_and_isReduced /-
 theorem isIntegral_iff_is_irreducible_and_isReduced :
     IsIntegral X ↔ IrreducibleSpace X.carrier ∧ IsReduced X :=
   ⟨fun _ => ⟨inferInstance, inferInstance⟩, fun ⟨_, _⟩ =>
     is_integral_of_is_irreducible_is_reduced X⟩
 #align algebraic_geometry.is_integral_iff_is_irreducible_and_is_reduced AlgebraicGeometry.isIntegral_iff_is_irreducible_and_isReduced
+-/
 
+#print AlgebraicGeometry.isIntegralOfOpenImmersion /-
 theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
     [IsIntegral Y] [Nonempty X.carrier] : IsIntegral X :=
   by
@@ -316,6 +347,7 @@ theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmers
               Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.IsDomain
       _
 #align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegralOfOpenImmersion
+-/
 
 instance {R : CommRingCat} [H : IsDomain R] : IrreducibleSpace (Scheme.Spec.obj <| op R).carrier :=
   by
@@ -325,6 +357,7 @@ instance {R : CommRingCat} [H : IsDomain R] : IrreducibleSpace (Scheme.Spec.obj
 instance {R : CommRingCat} [IsDomain R] : IsIntegral (Scheme.Spec.obj <| op R) :=
   isIntegralOfIsIrreducibleIsReduced _
 
+#print AlgebraicGeometry.affine_isIntegral_iff /-
 theorem affine_isIntegral_iff (R : CommRingCat) :
     IsIntegral (Scheme.Spec.obj <| op R) ↔ IsDomain R :=
   ⟨fun h =>
@@ -332,14 +365,18 @@ theorem affine_isIntegral_iff (R : CommRingCat) :
       (as_iso <| to_Spec_Γ R).commRingCatIsoToRingEquiv,
     fun h => inferInstance⟩
 #align algebraic_geometry.affine_is_integral_iff AlgebraicGeometry.affine_isIntegral_iff
+-/
 
+#print AlgebraicGeometry.isIntegralOfIsAffineIsDomain /-
 theorem isIntegralOfIsAffineIsDomain [IsAffine X] [Nonempty X.carrier]
     [h : IsDomain (X.Presheaf.obj (op ⊤))] : IsIntegral X :=
   haveI : IsIntegral (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) := by rw [affine_is_integral_iff];
     exact h
   is_integral_of_open_immersion X.iso_Spec.hom
 #align algebraic_geometry.is_integral_of_is_affine_is_domain AlgebraicGeometry.isIntegralOfIsAffineIsDomain
+-/
 
+#print AlgebraicGeometry.map_injective_of_isIntegral /-
 theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i : U ⟶ V)
     [H : Nonempty U] : Function.Injective (X.Presheaf.map i.op) :=
   by
@@ -353,6 +390,7 @@ theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i :
   apply nonempty_preirreducible_inter U.is_open (RingedSpace.basic_open _ _).IsOpen
   simpa using H
 #align algebraic_geometry.map_injective_of_is_integral AlgebraicGeometry.map_injective_of_isIntegral
+-/
 
 end AlgebraicGeometry
 
Diff
@@ -85,8 +85,8 @@ instance stalk_isReduced_of_reduced [IsReduced X] (x : X.carrier) :
   rw [comp_apply, e', map_zero]
 #align algebraic_geometry.stalk_is_reduced_of_reduced AlgebraicGeometry.stalk_isReduced_of_reduced
 
-theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] [IsReduced Y] :
-    IsReduced X := by
+theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
+    [IsReduced Y] : IsReduced X := by
   constructor
   intro U
   have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) := by ext1;
@@ -139,7 +139,7 @@ theorem reduce_to_affine_global (P : ∀ (X : Scheme) (U : Opens X.carrier), Pro
       ∀ (X : Scheme) (U : Opens X.carrier),
         (∀ x : U, ∃ (V : _) (h : x.1 ∈ V) (i : V ⟶ U), P X V) → P X U)
     (h₂ :
-      ∀ {X Y} (f : X ⟶ Y) [hf : IsOpenImmersion f],
+      ∀ {X Y} (f : X ⟶ Y) [hf : IsOpenImmersionCat f],
         ∃ (U : Set X.carrier) (V : Set Y.carrier) (hU : U = ⊤) (hV : V = Set.range f.1.base),
           P X ⟨U, hU.symm ▸ isOpen_univ⟩ → P Y ⟨V, hV.symm ▸ hf.base_open.open_range⟩)
     (h₃ : ∀ R : CommRingCat, P (Scheme.Spec.obj <| op R) ⊤) :
@@ -160,7 +160,7 @@ theorem reduce_to_affine_global (P : ∀ (X : Scheme) (U : Opens X.carrier), Pro
 
 theorem reduce_to_affine_nbhd (P : ∀ (X : Scheme) (x : X.carrier), Prop)
     (h₁ : ∀ (R : CommRingCat) (x : PrimeSpectrum R), P (Scheme.Spec.obj <| op R) x)
-    (h₂ : ∀ {X Y} (f : X ⟶ Y) [IsOpenImmersion f] (x : X.carrier), P X x → P Y (f.1.base x)) :
+    (h₂ : ∀ {X Y} (f : X ⟶ Y) [IsOpenImmersionCat f] (x : X.carrier), P X x → P Y (f.1.base x)) :
     ∀ (X : Scheme) (x : X.carrier), P X x := by
   intro X x
   obtain ⟨y, e⟩ := X.affine_cover.covers x
@@ -298,8 +298,9 @@ theorem isIntegral_iff_is_irreducible_and_isReduced :
     is_integral_of_is_irreducible_is_reduced X⟩
 #align algebraic_geometry.is_integral_iff_is_irreducible_and_is_reduced AlgebraicGeometry.isIntegral_iff_is_irreducible_and_isReduced
 
-theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] [IsIntegral Y]
-    [Nonempty X.carrier] : IsIntegral X := by
+theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
+    [IsIntegral Y] [Nonempty X.carrier] : IsIntegral X :=
+  by
   constructor
   intro U hU
   have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) := by ext1;
Diff
@@ -98,7 +98,7 @@ theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersi
               Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.Injective
 #align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReducedOfOpenImmersion
 
-instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.spec.obj <| op R) :=
+instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.Spec.obj <| op R) :=
   by
   apply (config := { instances := false }) is_reduced_of_stalk_is_reduced
   intro x; dsimp
@@ -109,7 +109,7 @@ instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.spec.obj <| op
       (structure_sheaf.stalk_iso R x).commRingCatIsoToRingEquiv.Injective
 
 theorem affine_isReduced_iff (R : CommRingCat) :
-    IsReduced (Scheme.spec.obj <| op R) ↔ IsReduced R :=
+    IsReduced (Scheme.Spec.obj <| op R) ↔ IsReduced R :=
   by
   refine' ⟨_, fun h => inferInstance⟩
   intro h
@@ -142,7 +142,7 @@ theorem reduce_to_affine_global (P : ∀ (X : Scheme) (U : Opens X.carrier), Pro
       ∀ {X Y} (f : X ⟶ Y) [hf : IsOpenImmersion f],
         ∃ (U : Set X.carrier) (V : Set Y.carrier) (hU : U = ⊤) (hV : V = Set.range f.1.base),
           P X ⟨U, hU.symm ▸ isOpen_univ⟩ → P Y ⟨V, hV.symm ▸ hf.base_open.open_range⟩)
-    (h₃ : ∀ R : CommRingCat, P (Scheme.spec.obj <| op R) ⊤) :
+    (h₃ : ∀ R : CommRingCat, P (Scheme.Spec.obj <| op R) ⊤) :
     ∀ (X : Scheme) (U : Opens X.carrier), P X U :=
   by
   intro X U
@@ -159,7 +159,7 @@ theorem reduce_to_affine_global (P : ∀ (X : Scheme) (U : Opens X.carrier), Pro
 #align algebraic_geometry.reduce_to_affine_global AlgebraicGeometry.reduce_to_affine_global
 
 theorem reduce_to_affine_nbhd (P : ∀ (X : Scheme) (x : X.carrier), Prop)
-    (h₁ : ∀ (R : CommRingCat) (x : PrimeSpectrum R), P (Scheme.spec.obj <| op R) x)
+    (h₁ : ∀ (R : CommRingCat) (x : PrimeSpectrum R), P (Scheme.Spec.obj <| op R) x)
     (h₂ : ∀ {X Y} (f : X ⟶ Y) [IsOpenImmersion f] (x : X.carrier), P X x → P Y (f.1.base x)) :
     ∀ (X : Scheme) (x : X.carrier), P X x := by
   intro X x
@@ -316,16 +316,16 @@ theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmers
       _
 #align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegralOfOpenImmersion
 
-instance {R : CommRingCat} [H : IsDomain R] : IrreducibleSpace (Scheme.spec.obj <| op R).carrier :=
+instance {R : CommRingCat} [H : IsDomain R] : IrreducibleSpace (Scheme.Spec.obj <| op R).carrier :=
   by
   convert PrimeSpectrum.irreducibleSpace
   assumption
 
-instance {R : CommRingCat} [IsDomain R] : IsIntegral (Scheme.spec.obj <| op R) :=
+instance {R : CommRingCat} [IsDomain R] : IsIntegral (Scheme.Spec.obj <| op R) :=
   isIntegralOfIsIrreducibleIsReduced _
 
 theorem affine_isIntegral_iff (R : CommRingCat) :
-    IsIntegral (Scheme.spec.obj <| op R) ↔ IsDomain R :=
+    IsIntegral (Scheme.Spec.obj <| op R) ↔ IsDomain R :=
   ⟨fun h =>
     RingEquiv.isDomain ((Scheme.Spec.obj <| op R).Presheaf.obj _)
       (as_iso <| to_Spec_Γ R).commRingCatIsoToRingEquiv,
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module algebraic_geometry.properties
-! leanprover-community/mathlib commit d39590fc8728fbf6743249802486f8c91ffe07bc
+! leanprover-community/mathlib commit 88474d1b5af6d37c2ab728b757771bced7f5194c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -316,12 +316,13 @@ theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmers
       _
 #align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegralOfOpenImmersion
 
-instance {R : CommRingCat} [H : IsDomain R] : IsIntegral (Scheme.spec.obj <| op R) :=
+instance {R : CommRingCat} [H : IsDomain R] : IrreducibleSpace (Scheme.spec.obj <| op R).carrier :=
   by
-  apply (config := { instances := false }) is_integral_of_is_irreducible_is_reduced
-  · infer_instance
-  · dsimp [Spec.Top_obj]
-    infer_instance
+  convert PrimeSpectrum.irreducibleSpace
+  assumption
+
+instance {R : CommRingCat} [IsDomain R] : IsIntegral (Scheme.spec.obj <| op R) :=
+  isIntegralOfIsIrreducibleIsReduced _
 
 theorem affine_isIntegral_iff (R : CommRingCat) :
     IsIntegral (Scheme.spec.obj <| op R) ↔ IsDomain R :=
Diff
@@ -193,7 +193,7 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
     specialize H (f.1.c.app _ s) _ ⟨x, by rw [opens.mem_mk, e]; trivial⟩
     · rw [← Scheme.preimage_basic_open, hs]; ext1; simp [opens.map]
     · erw [← PresheafedSpace.stalk_map_germ_apply f.1 ⟨_, _⟩ ⟨x, _⟩] at H 
-      apply_fun inv <| PresheafedSpace.stalk_map f.val x  at H 
+      apply_fun inv <| PresheafedSpace.stalk_map f.val x at H 
       erw [CategoryTheory.IsIso.hom_inv_id_apply, map_zero] at H 
       exact H
   · intro R hX s hs x
Diff
@@ -77,9 +77,9 @@ instance stalk_isReduced_of_reduced [IsReduced X] (x : X.carrier) :
   constructor
   rintro g ⟨n, e⟩
   obtain ⟨U, hxU, s, rfl⟩ := X.presheaf.germ_exist x g
-  rw [← map_pow, ← map_zero (X.presheaf.germ ⟨x, hxU⟩)] at e
+  rw [← map_pow, ← map_zero (X.presheaf.germ ⟨x, hxU⟩)] at e 
   obtain ⟨V, hxV, iU, iV, e'⟩ := X.presheaf.germ_eq x hxU hxU _ 0 e
-  rw [map_pow, map_zero] at e'
+  rw [map_pow, map_zero] at e' 
   replace e' := (IsNilpotent.mk _ _ e').eq_zero
   erw [← concrete_category.congr_hom (X.presheaf.germ_res iU ⟨x, hxV⟩) s]
   rw [comp_apply, e', map_zero]
@@ -137,10 +137,10 @@ theorem isReducedOfIsAffineIsReduced [IsAffine X] [h : IsReduced (X.Presheaf.obj
 theorem reduce_to_affine_global (P : ∀ (X : Scheme) (U : Opens X.carrier), Prop)
     (h₁ :
       ∀ (X : Scheme) (U : Opens X.carrier),
-        (∀ x : U, ∃ (V : _)(h : x.1 ∈ V)(i : V ⟶ U), P X V) → P X U)
+        (∀ x : U, ∃ (V : _) (h : x.1 ∈ V) (i : V ⟶ U), P X V) → P X U)
     (h₂ :
       ∀ {X Y} (f : X ⟶ Y) [hf : IsOpenImmersion f],
-        ∃ (U : Set X.carrier)(V : Set Y.carrier)(hU : U = ⊤)(hV : V = Set.range f.1.base),
+        ∃ (U : Set X.carrier) (V : Set Y.carrier) (hU : U = ⊤) (hV : V = Set.range f.1.base),
           P X ⟨U, hU.symm ▸ isOpen_univ⟩ → P Y ⟨V, hV.symm ▸ hf.base_open.open_range⟩)
     (h₃ : ∀ R : CommRingCat, P (Scheme.spec.obj <| op R) ⊤) :
     ∀ (X : Scheme) (U : Opens X.carrier), P X U :=
@@ -179,10 +179,10 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
   · intro X U hx hX s hs x
     obtain ⟨V, hx, i, H⟩ := hx x
     specialize H (X.presheaf.map i.op s)
-    erw [Scheme.basic_open_res] at H
-    rw [hs] at H
+    erw [Scheme.basic_open_res] at H 
+    rw [hs] at H 
     specialize H inf_bot_eq ⟨x, hx⟩
-    erw [TopCat.Presheaf.germ_res_apply] at H
+    erw [TopCat.Presheaf.germ_res_apply] at H 
     exact H
   · rintro X Y f hf
     have e : f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ := by
@@ -192,16 +192,16 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
     haveI := is_reduced_of_open_immersion f
     specialize H (f.1.c.app _ s) _ ⟨x, by rw [opens.mem_mk, e]; trivial⟩
     · rw [← Scheme.preimage_basic_open, hs]; ext1; simp [opens.map]
-    · erw [← PresheafedSpace.stalk_map_germ_apply f.1 ⟨_, _⟩ ⟨x, _⟩] at H
-      apply_fun inv <| PresheafedSpace.stalk_map f.val x  at H
-      erw [CategoryTheory.IsIso.hom_inv_id_apply, map_zero] at H
+    · erw [← PresheafedSpace.stalk_map_germ_apply f.1 ⟨_, _⟩ ⟨x, _⟩] at H 
+      apply_fun inv <| PresheafedSpace.stalk_map f.val x  at H 
+      erw [CategoryTheory.IsIso.hom_inv_id_apply, map_zero] at H 
       exact H
   · intro R hX s hs x
-    erw [basic_open_eq_of_affine', PrimeSpectrum.basicOpen_eq_bot_iff] at hs
+    erw [basic_open_eq_of_affine', PrimeSpectrum.basicOpen_eq_bot_iff] at hs 
     replace hs := hs.map (Spec_Γ_identity.app R).inv
     -- what the hell?!
     replace hs := @IsNilpotent.eq_zero _ _ _ _ (show _ from _) hs
-    rw [iso.hom_inv_id_apply] at hs
+    rw [iso.hom_inv_id_apply] at hs 
     rw [hs, map_zero]
     exact @is_reduced.component_reduced hX ⊤
 #align algebraic_geometry.eq_zero_of_basic_open_eq_bot AlgebraicGeometry.eq_zero_of_basicOpen_eq_bot
@@ -246,10 +246,10 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
   replace H : ¬IsPreirreducible (⊤ : Set X.carrier) := fun h =>
     H { to_preirreducibleSpace := ⟨h⟩
         to_nonempty := inferInstance }
-  simp_rw [isPreirreducible_iff_closed_union_closed, not_forall, not_or] at H
+  simp_rw [isPreirreducible_iff_closed_union_closed, not_forall, not_or] at H 
   rcases H with ⟨S, T, hS, hT, h₁, h₂, h₃⟩
-  erw [not_forall] at h₂ h₃
-  simp_rw [not_forall] at h₂ h₃
+  erw [not_forall] at h₂ h₃ 
+  simp_rw [not_forall] at h₂ h₃ 
   haveI : Nonempty (⟨Sᶜ, hS.1⟩ : opens X.carrier) := ⟨⟨_, h₂.some_spec.some_spec⟩⟩
   haveI : Nonempty (⟨Tᶜ, hT.1⟩ : opens X.carrier) := ⟨⟨_, h₃.some_spec.some_spec⟩⟩
   haveI : Nonempty (⟨Sᶜ, hS.1⟩ ⊔ ⟨Tᶜ, hT.1⟩ : opens X.carrier) :=
@@ -265,7 +265,7 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
     constructor
     · rintro ⟨hS, hT⟩
       cases h₁ (show x ∈ ⊤ by trivial)
-      exacts[hS h, hT h]
+      exacts [hS h, hT h]
     · intro x; exact x.rec _
 #align algebraic_geometry.is_irreducible_of_is_integral AlgebraicGeometry.is_irreducible_of_isIntegral
 
@@ -285,7 +285,7 @@ theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X
     replace e' := Subtype.eq e'
     subst e'
     replace e := congr_arg (X.presheaf.germ x) e
-    rw [RingHom.map_mul, RingHom.map_zero] at e
+    rw [RingHom.map_mul, RingHom.map_zero] at e 
     refine' zero_ne_one' (X.presheaf.stalk x.1) (isUnit_zero_iff.1 _)
     convert hx₁.mul hx₂
     exact e.symm
@@ -343,8 +343,8 @@ theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i :
   by
   rw [injective_iff_map_eq_zero]
   intro x hx
-  rw [← basic_open_eq_bot_iff] at hx⊢
-  rw [Scheme.basic_open_res] at hx
+  rw [← basic_open_eq_bot_iff] at hx ⊢
+  rw [Scheme.basic_open_res] at hx 
   revert hx
   contrapose!
   simp_rw [← opens.not_nonempty_iff_eq_bot, Classical.not_not]
Diff
@@ -45,8 +45,7 @@ instance : QuasiSober X.carrier :=
   by
   apply (config := { instances := false })
     quasiSober_of_open_cover (Set.range fun x => Set.range <| (X.affine_cover.map x).1.base)
-  · rintro ⟨_, i, rfl⟩
-    exact (X.affine_cover.is_open i).base_open.open_range
+  · rintro ⟨_, i, rfl⟩; exact (X.affine_cover.is_open i).base_open.open_range
   · rintro ⟨_, i, rfl⟩
     exact
       @OpenEmbedding.quasiSober _ _ _
@@ -54,8 +53,7 @@ instance : QuasiSober X.carrier :=
               (X.affine_cover.is_open i).base_open.toEmbedding).symm.OpenEmbedding
         PrimeSpectrum.quasiSober
   · rw [Set.top_eq_univ, Set.sUnion_range, Set.eq_univ_iff_forall]
-    intro x
-    exact ⟨_, ⟨_, rfl⟩, X.affine_cover.covers x⟩
+    intro x; exact ⟨_, ⟨_, rfl⟩, X.affine_cover.covers x⟩
 
 /-- A scheme `X` is reduced if all `𝒪ₓ(U)` are reduced. -/
 class IsReduced : Prop where
@@ -91,9 +89,7 @@ theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersi
     IsReduced X := by
   constructor
   intro U
-  have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) :=
-    by
-    ext1
+  have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) := by ext1;
     exact (Set.preimage_image_eq _ H.base_open.inj).symm
   rw [this]
   exact
@@ -105,12 +101,9 @@ theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersi
 instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.spec.obj <| op R) :=
   by
   apply (config := { instances := false }) is_reduced_of_stalk_is_reduced
-  intro x
-  dsimp
-  have : _root_.is_reduced (CommRingCat.of <| Localization.AtPrime (PrimeSpectrum.asIdeal x)) :=
-    by
-    dsimp
-    infer_instance
+  intro x; dsimp
+  have : _root_.is_reduced (CommRingCat.of <| Localization.AtPrime (PrimeSpectrum.asIdeal x)) := by
+    dsimp; infer_instance
   exact
     isReduced_of_injective (structure_sheaf.stalk_iso R x).Hom
       (structure_sheaf.stalk_iso R x).commRingCatIsoToRingEquiv.Injective
@@ -123,18 +116,14 @@ theorem affine_isReduced_iff (R : CommRingCat) :
   skip
   have :
     _root_.is_reduced (LocallyRingedSpace.Γ.obj (op <| Spec.to_LocallyRingedSpace.obj <| op R)) :=
-    by
-    change _root_.is_reduced ((Scheme.Spec.obj <| op R).Presheaf.obj <| op ⊤)
-    infer_instance
+    by change _root_.is_reduced ((Scheme.Spec.obj <| op R).Presheaf.obj <| op ⊤); infer_instance
   exact
     isReduced_of_injective (to_Spec_Γ R) (as_iso <| to_Spec_Γ R).commRingCatIsoToRingEquiv.Injective
 #align algebraic_geometry.affine_is_reduced_iff AlgebraicGeometry.affine_isReduced_iff
 
 theorem isReducedOfIsAffineIsReduced [IsAffine X] [h : IsReduced (X.Presheaf.obj (op ⊤))] :
     IsReduced X :=
-  haveI : IsReduced (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) :=
-    by
-    rw [affine_is_reduced_iff]
+  haveI : IsReduced (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) := by rw [affine_is_reduced_iff];
     exact h
   is_reduced_of_open_immersion X.iso_Spec.hom
 #align algebraic_geometry.is_reduced_of_is_affine_is_reduced AlgebraicGeometry.isReducedOfIsAffineIsReduced
@@ -201,14 +190,8 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
     refine' ⟨_, _, e, rfl, _⟩
     rintro H hX s hs ⟨_, x, rfl⟩
     haveI := is_reduced_of_open_immersion f
-    specialize
-      H (f.1.c.app _ s) _
-        ⟨x, by
-          rw [opens.mem_mk, e]
-          trivial⟩
-    · rw [← Scheme.preimage_basic_open, hs]
-      ext1
-      simp [opens.map]
+    specialize H (f.1.c.app _ s) _ ⟨x, by rw [opens.mem_mk, e]; trivial⟩
+    · rw [← Scheme.preimage_basic_open, hs]; ext1; simp [opens.map]
     · erw [← PresheafedSpace.stalk_map_germ_apply f.1 ⟨_, _⟩ ⟨x, _⟩] at H
       apply_fun inv <| PresheafedSpace.stalk_map f.val x  at H
       erw [CategoryTheory.IsIso.hom_inv_id_apply, map_zero] at H
@@ -254,8 +237,7 @@ instance (priority := 900) isReducedOfIsIntegral [IsIntegral X] : IsReduced X :=
     haveI := CommRingCat.subsingleton_of_isTerminal (X.sheaf.is_terminal_of_eq_empty this)
     change _root_.is_reduced (X.sheaf.val.obj (op U))
     infer_instance
-  · haveI : Nonempty U := by simpa
-    infer_instance
+  · haveI : Nonempty U := by simpa; infer_instance
 #align algebraic_geometry.is_reduced_of_is_integral AlgebraicGeometry.isReducedOfIsIntegral
 
 instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrier :=
@@ -284,14 +266,12 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
     · rintro ⟨hS, hT⟩
       cases h₁ (show x ∈ ⊤ by trivial)
       exacts[hS h, hT h]
-    · intro x
-      exact x.rec _
+    · intro x; exact x.rec _
 #align algebraic_geometry.is_irreducible_of_is_integral AlgebraicGeometry.is_irreducible_of_isIntegral
 
 theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X.carrier] :
     IsIntegral X := by
-  constructor
-  intro U hU
+  constructor; intro U hU
   haveI := (@LocallyRingedSpace.component_nontrivial X.to_LocallyRingedSpace U hU).1
   have :
     NoZeroDivisors
@@ -322,9 +302,7 @@ theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmers
     [Nonempty X.carrier] : IsIntegral X := by
   constructor
   intro U hU
-  have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) :=
-    by
-    ext1
+  have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) := by ext1;
     exact (Set.preimage_image_eq _ H.base_open.inj).symm
   rw [this]
   have : IsDomain (Y.presheaf.obj (op (H.base_open.is_open_map.functor.obj U))) :=
@@ -355,9 +333,7 @@ theorem affine_isIntegral_iff (R : CommRingCat) :
 
 theorem isIntegralOfIsAffineIsDomain [IsAffine X] [Nonempty X.carrier]
     [h : IsDomain (X.Presheaf.obj (op ⊤))] : IsIntegral X :=
-  haveI : IsIntegral (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) :=
-    by
-    rw [affine_is_integral_iff]
+  haveI : IsIntegral (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) := by rw [affine_is_integral_iff];
     exact h
   is_integral_of_open_immersion X.iso_Spec.hom
 #align algebraic_geometry.is_integral_of_is_affine_is_domain AlgebraicGeometry.isIntegralOfIsAffineIsDomain
Diff
@@ -64,15 +64,15 @@ class IsReduced : Prop where
 
 attribute [instance] is_reduced.component_reduced
 
-theorem isReduced_of_stalk_isReduced [∀ x : X.carrier, IsReduced (X.Presheaf.stalk x)] :
-    IsReduced X := by
+theorem isReducedOfStalkIsReduced [∀ x : X.carrier, IsReduced (X.Presheaf.stalk x)] : IsReduced X :=
+  by
   refine' ⟨fun U => ⟨fun s hs => _⟩⟩
   apply presheaf.section_ext X.sheaf U s 0
   intro x
   rw [RingHom.map_zero]
   change X.presheaf.germ x s = 0
   exact (hs.map _).eq_zero
-#align algebraic_geometry.is_reduced_of_stalk_is_reduced AlgebraicGeometry.isReduced_of_stalk_isReduced
+#align algebraic_geometry.is_reduced_of_stalk_is_reduced AlgebraicGeometry.isReducedOfStalkIsReduced
 
 instance stalk_isReduced_of_reduced [IsReduced X] (x : X.carrier) :
     IsReduced (X.Presheaf.stalk x) := by
@@ -87,8 +87,8 @@ instance stalk_isReduced_of_reduced [IsReduced X] (x : X.carrier) :
   rw [comp_apply, e', map_zero]
 #align algebraic_geometry.stalk_is_reduced_of_reduced AlgebraicGeometry.stalk_isReduced_of_reduced
 
-theorem isReduced_of_open_immersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f]
-    [IsReduced Y] : IsReduced X := by
+theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] [IsReduced Y] :
+    IsReduced X := by
   constructor
   intro U
   have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) :=
@@ -100,7 +100,7 @@ theorem isReduced_of_open_immersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImme
     isReduced_of_injective (inv <| f.1.c.app (op <| H.base_open.is_open_map.functor.obj U))
       (as_iso <| f.1.c.app (op <| H.base_open.is_open_map.functor.obj U) :
               Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.Injective
-#align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReduced_of_open_immersion
+#align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReducedOfOpenImmersion
 
 instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.spec.obj <| op R) :=
   by
@@ -130,14 +130,14 @@ theorem affine_isReduced_iff (R : CommRingCat) :
     isReduced_of_injective (to_Spec_Γ R) (as_iso <| to_Spec_Γ R).commRingCatIsoToRingEquiv.Injective
 #align algebraic_geometry.affine_is_reduced_iff AlgebraicGeometry.affine_isReduced_iff
 
-theorem isReduced_of_isAffine_isReduced [IsAffine X] [h : IsReduced (X.Presheaf.obj (op ⊤))] :
+theorem isReducedOfIsAffineIsReduced [IsAffine X] [h : IsReduced (X.Presheaf.obj (op ⊤))] :
     IsReduced X :=
   haveI : IsReduced (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) :=
     by
     rw [affine_is_reduced_iff]
     exact h
   is_reduced_of_open_immersion X.iso_Spec.hom
-#align algebraic_geometry.is_reduced_of_is_affine_is_reduced AlgebraicGeometry.isReduced_of_isAffine_isReduced
+#align algebraic_geometry.is_reduced_of_is_affine_is_reduced AlgebraicGeometry.isReducedOfIsAffineIsReduced
 
 /-- To show that a statement `P` holds for all open subsets of all schemes, it suffices to show that
 1. In any scheme `X`, if `P` holds for an open cover of `U`, then `P` holds for `U`.
@@ -245,7 +245,7 @@ attribute [instance] is_integral.component_integral is_integral.nonempty
 instance [h : IsIntegral X] : IsDomain (X.Presheaf.obj (op ⊤)) :=
   @IsIntegral.component_integral _ _ (by simp)
 
-instance (priority := 900) isReduced_of_isIntegral [IsIntegral X] : IsReduced X :=
+instance (priority := 900) isReducedOfIsIntegral [IsIntegral X] : IsReduced X :=
   by
   constructor
   intro U
@@ -256,7 +256,7 @@ instance (priority := 900) isReduced_of_isIntegral [IsIntegral X] : IsReduced X
     infer_instance
   · haveI : Nonempty U := by simpa
     infer_instance
-#align algebraic_geometry.is_reduced_of_is_integral AlgebraicGeometry.isReduced_of_isIntegral
+#align algebraic_geometry.is_reduced_of_is_integral AlgebraicGeometry.isReducedOfIsIntegral
 
 instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrier :=
   by
@@ -288,7 +288,7 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
       exact x.rec _
 #align algebraic_geometry.is_irreducible_of_is_integral AlgebraicGeometry.is_irreducible_of_isIntegral
 
-theorem isIntegral_of_is_irreducible_isReduced [IsReduced X] [H : IrreducibleSpace X.carrier] :
+theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X.carrier] :
     IsIntegral X := by
   constructor
   intro U hU
@@ -310,7 +310,7 @@ theorem isIntegral_of_is_irreducible_isReduced [IsReduced X] [H : IrreducibleSpa
     convert hx₁.mul hx₂
     exact e.symm
   exact NoZeroDivisors.to_isDomain _
-#align algebraic_geometry.is_integral_of_is_irreducible_is_reduced AlgebraicGeometry.isIntegral_of_is_irreducible_isReduced
+#align algebraic_geometry.is_integral_of_is_irreducible_is_reduced AlgebraicGeometry.isIntegralOfIsIrreducibleIsReduced
 
 theorem isIntegral_iff_is_irreducible_and_isReduced :
     IsIntegral X ↔ IrreducibleSpace X.carrier ∧ IsReduced X :=
@@ -318,9 +318,8 @@ theorem isIntegral_iff_is_irreducible_and_isReduced :
     is_integral_of_is_irreducible_is_reduced X⟩
 #align algebraic_geometry.is_integral_iff_is_irreducible_and_is_reduced AlgebraicGeometry.isIntegral_iff_is_irreducible_and_isReduced
 
-theorem isIntegral_of_open_immersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f]
-    [IsIntegral Y] [Nonempty X.carrier] : IsIntegral X :=
-  by
+theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] [IsIntegral Y]
+    [Nonempty X.carrier] : IsIntegral X := by
   constructor
   intro U hU
   have : U = (opens.map f.1.base).obj (H.base_open.is_open_map.functor.obj U) :=
@@ -337,7 +336,7 @@ theorem isIntegral_of_open_immersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImm
     (as_iso <| f.1.c.app (op <| H.base_open.is_open_map.functor.obj U) :
               Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.IsDomain
       _
-#align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegral_of_open_immersion
+#align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegralOfOpenImmersion
 
 instance {R : CommRingCat} [H : IsDomain R] : IsIntegral (Scheme.spec.obj <| op R) :=
   by
@@ -354,14 +353,14 @@ theorem affine_isIntegral_iff (R : CommRingCat) :
     fun h => inferInstance⟩
 #align algebraic_geometry.affine_is_integral_iff AlgebraicGeometry.affine_isIntegral_iff
 
-theorem isIntegral_of_isAffine_isDomain [IsAffine X] [Nonempty X.carrier]
+theorem isIntegralOfIsAffineIsDomain [IsAffine X] [Nonempty X.carrier]
     [h : IsDomain (X.Presheaf.obj (op ⊤))] : IsIntegral X :=
   haveI : IsIntegral (Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))) :=
     by
     rw [affine_is_integral_iff]
     exact h
   is_integral_of_open_immersion X.iso_Spec.hom
-#align algebraic_geometry.is_integral_of_is_affine_is_domain AlgebraicGeometry.isIntegral_of_isAffine_isDomain
+#align algebraic_geometry.is_integral_of_is_affine_is_domain AlgebraicGeometry.isIntegralOfIsAffineIsDomain
 
 theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i : U ⟶ V)
     [H : Nonempty U] : Function.Injective (X.Presheaf.map i.op) :=
Diff
@@ -53,7 +53,7 @@ instance : QuasiSober X.carrier :=
         (Homeomorph.ofEmbedding _
               (X.affine_cover.is_open i).base_open.toEmbedding).symm.OpenEmbedding
         PrimeSpectrum.quasiSober
-  · rw [Set.top_eq_univ, Set.unionₛ_range, Set.eq_univ_iff_forall]
+  · rw [Set.top_eq_univ, Set.sUnion_range, Set.eq_univ_iff_forall]
     intro x
     exact ⟨_, ⟨_, rfl⟩, X.affine_cover.covers x⟩
 
Diff
@@ -99,7 +99,7 @@ theorem isReduced_of_open_immersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImme
   exact
     isReduced_of_injective (inv <| f.1.c.app (op <| H.base_open.is_open_map.functor.obj U))
       (as_iso <| f.1.c.app (op <| H.base_open.is_open_map.functor.obj U) :
-              Y.presheaf.obj _ ≅ _).symm.commRingIsoToRingEquiv.Injective
+              Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.Injective
 #align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReduced_of_open_immersion
 
 instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.spec.obj <| op R) :=
@@ -113,7 +113,7 @@ instance {R : CommRingCat} [H : IsReduced R] : IsReduced (Scheme.spec.obj <| op
     infer_instance
   exact
     isReduced_of_injective (structure_sheaf.stalk_iso R x).Hom
-      (structure_sheaf.stalk_iso R x).commRingIsoToRingEquiv.Injective
+      (structure_sheaf.stalk_iso R x).commRingCatIsoToRingEquiv.Injective
 
 theorem affine_isReduced_iff (R : CommRingCat) :
     IsReduced (Scheme.spec.obj <| op R) ↔ IsReduced R :=
@@ -127,7 +127,7 @@ theorem affine_isReduced_iff (R : CommRingCat) :
     change _root_.is_reduced ((Scheme.Spec.obj <| op R).Presheaf.obj <| op ⊤)
     infer_instance
   exact
-    isReduced_of_injective (to_Spec_Γ R) (as_iso <| to_Spec_Γ R).commRingIsoToRingEquiv.Injective
+    isReduced_of_injective (to_Spec_Γ R) (as_iso <| to_Spec_Γ R).commRingCatIsoToRingEquiv.Injective
 #align algebraic_geometry.affine_is_reduced_iff AlgebraicGeometry.affine_isReduced_iff
 
 theorem isReduced_of_isAffine_isReduced [IsAffine X] [h : IsReduced (X.Presheaf.obj (op ⊤))] :
@@ -335,7 +335,7 @@ theorem isIntegral_of_open_immersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImm
     refine' ⟨⟨_, _, hU.some.prop, rfl⟩⟩
   exact
     (as_iso <| f.1.c.app (op <| H.base_open.is_open_map.functor.obj U) :
-              Y.presheaf.obj _ ≅ _).symm.commRingIsoToRingEquiv.IsDomain
+              Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.IsDomain
       _
 #align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegral_of_open_immersion
 
@@ -350,7 +350,7 @@ theorem affine_isIntegral_iff (R : CommRingCat) :
     IsIntegral (Scheme.spec.obj <| op R) ↔ IsDomain R :=
   ⟨fun h =>
     RingEquiv.isDomain ((Scheme.Spec.obj <| op R).Presheaf.obj _)
-      (as_iso <| to_Spec_Γ R).commRingIsoToRingEquiv,
+      (as_iso <| to_Spec_Γ R).commRingCatIsoToRingEquiv,
     fun h => inferInstance⟩
 #align algebraic_geometry.affine_is_integral_iff AlgebraicGeometry.affine_isIntegral_iff
 

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 2 (#12361)

A PR analogous to #12338: reformatting proofs following the multiple goals linter of #12339.

Diff
@@ -187,8 +187,8 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
     replace hs := hs.map (SpecΓIdentity.app R).inv
     -- what the hell?!
     replace hs := @IsNilpotent.eq_zero _ _ _ _ (show _ from ?_) hs
-    rw [Iso.hom_inv_id_apply] at hs
-    rw [hs, map_zero]
+    · rw [Iso.hom_inv_id_apply] at hs
+      rw [hs, map_zero]
     exact @IsReduced.component_reduced _ hX ⊤
 #align algebraic_geometry.eq_zero_of_basic_open_eq_bot AlgebraicGeometry.eq_zero_of_basicOpen_eq_bot
 
@@ -242,10 +242,10 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
   let e : X.presheaf.obj _ ≅ CommRingCat.of _ :=
     (X.sheaf.isProductOfDisjoint ⟨_, hS.1⟩ ⟨_, hT.1⟩ ?_).conePointUniqueUpToIso
       (CommRingCat.prodFanIsLimit _ _)
-  apply (config := { allowSynthFailures := true }) false_of_nontrivial_of_product_domain
-  · exact e.symm.commRingCatIsoToRingEquiv.toMulEquiv.isDomain _
-  · apply X.toLocallyRingedSpace.component_nontrivial
-  · apply X.toLocallyRingedSpace.component_nontrivial
+  · apply (config := { allowSynthFailures := true }) false_of_nontrivial_of_product_domain
+    · exact e.symm.commRingCatIsoToRingEquiv.toMulEquiv.isDomain _
+    · apply X.toLocallyRingedSpace.component_nontrivial
+    · apply X.toLocallyRingedSpace.component_nontrivial
   · ext x
     constructor
     · rintro ⟨hS, hT⟩
perf: speed up some algebraic geometry with explicit universes (#12494)
Diff
@@ -23,6 +23,8 @@ We provide some basic properties of schemes
   are reduced.
 -/
 
+universe u
+
 
 open TopologicalSpace Opposite CategoryTheory CategoryTheory.Limits TopCat
 
@@ -89,7 +91,7 @@ theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersi
       Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.injective
 #align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReducedOfOpenImmersion
 
-instance {R : CommRingCat} [H : _root_.IsReduced R] : IsReduced (Scheme.Spec.obj <| op R) := by
+instance {R : CommRingCat.{u}} [H : _root_.IsReduced R] : IsReduced (Scheme.Spec.obj <| op R) := by
   apply (config := { allowSynthFailures := true }) isReducedOfStalkIsReduced
   intro x; dsimp
   have : _root_.IsReduced (CommRingCat.of <| Localization.AtPrime (PrimeSpectrum.asIdeal x)) := by
chore: split RingTheory.Nilpotent (#12184)

Mathlib.RingTheory.Nilpotent has a few very simple definitions (Mathlib.Data.Nat.Lattice is sufficient to state them), but needs some pretty heavy imports (ideals, linear algebra) towards the end. This change moves the heavier parts into a new file.

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
 import Mathlib.AlgebraicGeometry.AffineScheme
-import Mathlib.RingTheory.Nilpotent
+import Mathlib.RingTheory.Nilpotent.Lemmas
 import Mathlib.Topology.Sheaves.SheafCondition.Sites
 import Mathlib.Algebra.Category.Ring.Constructions
 import Mathlib.RingTheory.LocalProperties
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11801)
Diff
@@ -323,7 +323,7 @@ theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i :
   rw [Scheme.basicOpen_res] at hx
   revert hx
   contrapose!
-  simp_rw [Ne.def, ← Opens.not_nonempty_iff_eq_bot, Classical.not_not]
+  simp_rw [Ne, ← Opens.not_nonempty_iff_eq_bot, Classical.not_not]
   apply nonempty_preirreducible_inter U.isOpen (RingedSpace.basicOpen _ _).isOpen
   simpa using H
 #align algebraic_geometry.map_injective_of_is_integral AlgebraicGeometry.map_injective_of_isIntegral
chore: rename open_range to isOpen_range, closed_range to isClosed_range (#11438)

All these lemmas refer to the range of some function being open/range (i.e. isOpen or isClosed).

Diff
@@ -40,7 +40,7 @@ instance : T0Space X.carrier := by
 instance : QuasiSober X.carrier := by
   apply (config := { allowSynthFailures := true })
     quasiSober_of_open_cover (Set.range fun x => Set.range <| (X.affineCover.map x).1.base)
-  · rintro ⟨_, i, rfl⟩; exact (X.affineCover.IsOpen i).base_open.open_range
+  · rintro ⟨_, i, rfl⟩; exact (X.affineCover.IsOpen i).base_open.isOpen_range
   · rintro ⟨_, i, rfl⟩
     exact @OpenEmbedding.quasiSober _ _ _ _ _ (Homeomorph.ofEmbedding _
       (X.affineCover.IsOpen i).base_open.toEmbedding).symm.openEmbedding PrimeSpectrum.quasiSober
@@ -126,7 +126,7 @@ theorem reduce_to_affine_global (P : ∀ (X : Scheme) (_ : Opens X.carrier), Pro
       (∀ x : U, ∃ (V : _) (_ : x.1 ∈ V) (_ : V ⟶ U), P X V) → P X U)
     (h₂ : ∀ {X Y} (f : X ⟶ Y) [hf : IsOpenImmersion f],
       ∃ (U : Set X.carrier) (V : Set Y.carrier) (hU : U = ⊤) (hV : V = Set.range f.1.base),
-        P X ⟨U, hU.symm ▸ isOpen_univ⟩ → P Y ⟨V, hV.symm ▸ hf.base_open.open_range⟩)
+        P X ⟨U, hU.symm ▸ isOpen_univ⟩ → P Y ⟨V, hV.symm ▸ hf.base_open.isOpen_range⟩)
     (h₃ : ∀ R : CommRingCat, P (Scheme.Spec.obj <| op R) ⊤) :
     ∀ (X : Scheme) (U : Opens X.carrier), P X U := by
   intro X U
@@ -134,7 +134,7 @@ theorem reduce_to_affine_global (P : ∀ (X : Scheme) (_ : Opens X.carrier), Pro
   intro x
   obtain ⟨_, ⟨j, rfl⟩, hx, i⟩ :=
     X.affineBasisCover_is_basis.exists_subset_of_mem_open (SetLike.mem_coe.2 x.prop) U.isOpen
-  let U' : Opens _ := ⟨_, (X.affineBasisCover.IsOpen j).base_open.open_range⟩
+  let U' : Opens _ := ⟨_, (X.affineBasisCover.IsOpen j).base_open.isOpen_range⟩
   let i' : U' ⟶ U := homOfLE i
   refine' ⟨U', hx, i', _⟩
   obtain ⟨_, _, rfl, rfl, h₂'⟩ := h₂ (X.affineBasisCover.map j)
chore(Order): Make more arguments explicit (#11033)

Those lemmas have historically been very annoying to use in rw since all their arguments were implicit. One too many people complained about it on Zulip, so I'm changing them.

Downstream code broken by this change can fix it by adding appropriately many _s.

Also marks CauSeq.ext @[ext].

Order.BoundedOrder

  • top_sup_eq
  • sup_top_eq
  • bot_sup_eq
  • sup_bot_eq
  • top_inf_eq
  • inf_top_eq
  • bot_inf_eq
  • inf_bot_eq

Order.Lattice

  • sup_idem
  • sup_comm
  • sup_assoc
  • sup_left_idem
  • sup_right_idem
  • inf_idem
  • inf_comm
  • inf_assoc
  • inf_left_idem
  • inf_right_idem
  • sup_inf_left
  • sup_inf_right
  • inf_sup_left
  • inf_sup_right

Order.MinMax

  • max_min_distrib_left
  • max_min_distrib_right
  • min_max_distrib_left
  • min_max_distrib_right

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -165,7 +165,7 @@ theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X
     specialize H (X.presheaf.map i.op s)
     erw [Scheme.basicOpen_res] at H
     rw [hs] at H
-    specialize H inf_bot_eq ⟨x, hx⟩
+    specialize H (inf_bot_eq _) ⟨x, hx⟩
     erw [TopCat.Presheaf.germ_res_apply] at H
     exact H
   · rintro X Y f hf
chore: remove terminal, terminal refines (#10762)

I replaced a few "terminal" refine/refine's with exact.

The strategy was very simple-minded: essentially any refine whose following line had smaller indentation got replaced by exact and then I cleaned up the mess.

This PR certainly leaves some further terminal refines, but maybe the current change is beneficial.

Diff
@@ -250,7 +250,7 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
       cases' h₁ (show x ∈ ⊤ by trivial) with h h
       exacts [hS h, hT h]
     · intro x
-      refine' x.rec (by contradiction)
+      exact x.rec (by contradiction)
 #align algebraic_geometry.is_irreducible_of_is_integral AlgebraicGeometry.is_irreducible_of_isIntegral
 
 theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X.carrier] :
@@ -290,7 +290,7 @@ theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmers
   rw [this]
   have : IsDomain (Y.presheaf.obj (op (H.base_open.isOpenMap.functor.obj U))) := by
     apply (config := { allowSynthFailures := true }) IsIntegral.component_integral
-    refine' ⟨⟨_, _, hU.some.prop, rfl⟩⟩
+    exact ⟨⟨_, _, hU.some.prop, rfl⟩⟩
   exact (asIso <| f.1.c.app (op <| H.base_open.isOpenMap.functor.obj U) :
     Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.toMulEquiv.isDomain _
 #align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegralOfOpenImmersion
chore: remove uses of cases' (#9171)

I literally went through and regex'd some uses of cases', replacing them with rcases; this is meant to be a low effort PR as I hope that tools can do this in the future.

rcases is an easier replacement than cases, though with better tools we could in future do a second pass converting simple rcases added here (and existing ones) to cases.

Diff
@@ -215,7 +215,7 @@ instance [h : IsIntegral X] : IsDomain (X.presheaf.obj (op ⊤)) :=
 instance (priority := 900) isReducedOfIsIntegral [IsIntegral X] : IsReduced X := by
   constructor
   intro U
-  cases' U.1.eq_empty_or_nonempty with h h
+  rcases U.1.eq_empty_or_nonempty with h | h
   · have : U = ⊥ := SetLike.ext' h
     haveI := CommRingCat.subsingleton_of_isTerminal (X.sheaf.isTerminalOfEqEmpty this)
     change _root_.IsReduced (X.sheaf.val.obj (op U))
perf (AlgebraicGeometry.Properties): Speed up one declaration (#9035)

This speeds up on declaration by breaking up a defeq check into a single task.

Co-authored-by: Johan Commelin <johan@commelin.net>

Diff
@@ -94,6 +94,7 @@ instance {R : CommRingCat} [H : _root_.IsReduced R] : IsReduced (Scheme.Spec.obj
   intro x; dsimp
   have : _root_.IsReduced (CommRingCat.of <| Localization.AtPrime (PrimeSpectrum.asIdeal x)) := by
     dsimp; infer_instance
+  rw [show (Scheme.Spec.obj <| op R).presheaf = (Spec.structureSheaf R).presheaf from rfl]
   exact isReduced_of_injective (StructureSheaf.stalkIso R x).hom
     (StructureSheaf.stalkIso R x).commRingCatIsoToRingEquiv.injective
 
chore: rename by_contra' to by_contra! (#8797)

To fit with the "please try harder" convention of ! tactics.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -261,7 +261,7 @@ theorem isIntegralOfIsIrreducibleIsReduced [IsReduced X] [H : IrreducibleSpace X
       (X.toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj (op U)) := by
     refine' ⟨fun {a b} e => _⟩
     simp_rw [← basicOpen_eq_bot_iff, ← Opens.not_nonempty_iff_eq_bot]
-    by_contra' h
+    by_contra! h
     obtain ⟨_, ⟨x, hx₁, rfl⟩, ⟨x, hx₂, e'⟩⟩ :=
       nonempty_preirreducible_inter (X.basicOpen a).2 (X.basicOpen b).2 h.1 h.2
     replace e' := Subtype.eq e'
chore: removing unneeded maxHeartbeats (#7761)

Due to recent changes in core we can reduce or remove many set_option maxHeartbeats statements.

I have tried to be careful to not leave anything too close to the line, so don't be surprised if some of these can still be reduced further.

This reduces us from 96 maxHeartbeats statements to 44. (There are 10 false positives in meta or testing code.)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -89,7 +89,6 @@ theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersi
       Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.injective
 #align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReducedOfOpenImmersion
 
-set_option maxHeartbeats 250000 in
 instance {R : CommRingCat} [H : _root_.IsReduced R] : IsReduced (Scheme.Spec.obj <| op R) := by
   apply (config := { allowSynthFailures := true }) isReducedOfStalkIsReduced
   intro x; dsimp
chore: update/remove heart beat bumps (#6860)

We clean up heart beat bumps after #6474.

Diff
@@ -89,7 +89,7 @@ theorem isReducedOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersi
       Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.injective
 #align algebraic_geometry.is_reduced_of_open_immersion AlgebraicGeometry.isReducedOfOpenImmersion
 
-set_option maxHeartbeats 300000 in
+set_option maxHeartbeats 250000 in
 instance {R : CommRingCat} [H : _root_.IsReduced R] : IsReduced (Scheme.Spec.obj <| op R) := by
   apply (config := { allowSynthFailures := true }) isReducedOfStalkIsReduced
   intro x; dsimp
feat: generalize algebraic pullback instances (#6536)

Generalizes RingEquiv.noZeroDivisors and RingEquiv.isDomain to MulEquiv

Adds Function.Injective.isLeft/RightCancelMulZero, MulEquiv.toZeroHomClass, and MulEquiv.isField (the last one is useful for #6309)

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>

Diff
@@ -241,7 +241,7 @@ instance is_irreducible_of_isIntegral [IsIntegral X] : IrreducibleSpace X.carrie
     (X.sheaf.isProductOfDisjoint ⟨_, hS.1⟩ ⟨_, hT.1⟩ ?_).conePointUniqueUpToIso
       (CommRingCat.prodFanIsLimit _ _)
   apply (config := { allowSynthFailures := true }) false_of_nontrivial_of_product_domain
-  · exact e.symm.commRingCatIsoToRingEquiv.isDomain _
+  · exact e.symm.commRingCatIsoToRingEquiv.toMulEquiv.isDomain _
   · apply X.toLocallyRingedSpace.component_nontrivial
   · apply X.toLocallyRingedSpace.component_nontrivial
   · ext x
@@ -292,7 +292,7 @@ theorem isIntegralOfOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmers
     apply (config := { allowSynthFailures := true }) IsIntegral.component_integral
     refine' ⟨⟨_, _, hU.some.prop, rfl⟩⟩
   exact (asIso <| f.1.c.app (op <| H.base_open.isOpenMap.functor.obj U) :
-    Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.isDomain _
+    Y.presheaf.obj _ ≅ _).symm.commRingCatIsoToRingEquiv.toMulEquiv.isDomain _
 #align algebraic_geometry.is_integral_of_open_immersion AlgebraicGeometry.isIntegralOfOpenImmersion
 
 instance {R : CommRingCat} [H : IsDomain R] :
@@ -304,8 +304,8 @@ instance {R : CommRingCat} [IsDomain R] : IsIntegral (Scheme.Spec.obj <| op R) :
 
 theorem affine_isIntegral_iff (R : CommRingCat) :
     IsIntegral (Scheme.Spec.obj <| op R) ↔ IsDomain R :=
-  ⟨fun _ => RingEquiv.isDomain ((Scheme.Spec.obj <| op R).presheaf.obj (op ⊤))
-    (asIso <| toSpecΓ R).commRingCatIsoToRingEquiv, fun _ => inferInstance⟩
+  ⟨fun _ => MulEquiv.isDomain ((Scheme.Spec.obj <| op R).presheaf.obj (op ⊤))
+    (asIso <| toSpecΓ R).commRingCatIsoToRingEquiv.toMulEquiv, fun _ => inferInstance⟩
 #align algebraic_geometry.affine_is_integral_iff AlgebraicGeometry.affine_isIntegral_iff
 
 theorem isIntegralOfIsAffineIsDomain [IsAffine X] [Nonempty X.carrier]
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module algebraic_geometry.properties
-! leanprover-community/mathlib commit 88474d1b5af6d37c2ab728b757771bced7f5194c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.AlgebraicGeometry.AffineScheme
 import Mathlib.RingTheory.Nilpotent
@@ -14,6 +9,8 @@ import Mathlib.Topology.Sheaves.SheafCondition.Sites
 import Mathlib.Algebra.Category.Ring.Constructions
 import Mathlib.RingTheory.LocalProperties
 
+#align_import algebraic_geometry.properties from "leanprover-community/mathlib"@"88474d1b5af6d37c2ab728b757771bced7f5194c"
+
 /-!
 # Basic properties of schemes
 
feat: port AlgebraicGeometry.Properties (#5585)

Dependencies 11 + 924

925 files ported (98.8%)
382902 lines ported (98.6%)
Show graph

The unported dependencies are