algebraic_geometry.SpecMathlib.AlgebraicGeometry.Spec

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)

(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)

(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)

(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
@@ -3,7 +3,7 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
 -/
-import AlgebraicGeometry.LocallyRingedSpace
+import Geometry.RingedSpace.LocallyRingedSpace
 import AlgebraicGeometry.StructureSheaf
 import RingTheory.Localization.LocalizationLocalization
 import Topology.Sheaves.SheafCondition.Sites
Diff
@@ -274,9 +274,9 @@ def Spec.locallyRingedSpaceMap {R S : CommRingCat} (f : R ⟶ S) :
       by
       -- Here, we are showing that the map on prime spectra induced by `f` is really a morphism of
       -- *locally* ringed spaces, i.e. that the induced map on the stalks is a local ring homomorphism.
-      rw [← local_ring_hom_comp_stalk_iso_apply] at ha 
+      rw [← local_ring_hom_comp_stalk_iso_apply] at ha
       replace ha := (stalk_iso S p).Hom.isUnit_map ha
-      rw [iso.inv_hom_id_apply] at ha 
+      rw [iso.inv_hom_id_apply] at ha
       replace ha := IsLocalRingHom.map_nonunit _ ha
       convert RingHom.isUnit_map (stalk_iso R (PrimeSpectrum.comap f p)).inv ha
       rw [iso.hom_inv_id_apply]
@@ -433,13 +433,13 @@ theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
   obtain ⟨U, hp, s, e⟩ := TopCat.Presheaf.germ_exist _ _ y
   obtain ⟨_, ⟨r, rfl⟩, hpr : p ∈ PrimeSpectrum.basicOpen r, hrU : PrimeSpectrum.basicOpen r ≤ U⟩ :=
     PrimeSpectrum.isTopologicalBasis_basic_opens.exists_subset_of_mem_open (show p ∈ ↑U from hp) U.2
-  change PrimeSpectrum.basicOpen r ≤ U at hrU 
+  change PrimeSpectrum.basicOpen r ≤ U at hrU
   replace e :=
     ((Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).germ_res_apply (hom_of_le hrU)
           ⟨p, hpr⟩ _).trans
       e
   set s' := (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op s with h
-  rw [← h] at e 
+  rw [← h] at e
   clear_value s'; clear! U
   obtain ⟨⟨s, ⟨_, n, rfl⟩⟩, hsn⟩ :=
     @IsLocalization.surj _ _ _ _ _ _
@@ -452,8 +452,8 @@ theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
       (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).germ_res_apply (hom_of_le le_top)
         ⟨p, hpr⟩]
   rw [← e, ← map_mul, mul_comm]
-  dsimp only [Subtype.coe_mk] at hsn 
-  rw [← map_pow (algebraMap R S)] at hsn 
+  dsimp only [Subtype.coe_mk] at hsn
+  rw [← map_pow (algebraMap R S)] at hsn
   congr 1
 #align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom_aux
 -/
@@ -469,15 +469,15 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
   · intro x hx
     rw [to_pushforward_stalk_alg_hom_apply, RingHom.toFun_eq_coe, ←
       (to_pushforward_stalk (algebraMap R S) p).map_zero, to_pushforward_stalk, comp_apply,
-      comp_apply, map_zero] at hx 
+      comp_apply, map_zero] at hx
     obtain ⟨U, hpU, i₁, i₂, e⟩ := TopCat.Presheaf.germ_eq _ _ _ _ _ _ hx
     obtain ⟨_, ⟨r, rfl⟩, hpr, hrU⟩ :=
       PrimeSpectrum.isTopologicalBasis_basic_opens.exists_subset_of_mem_open (show p ∈ U.1 from hpU)
         U.2
-    change PrimeSpectrum.basicOpen r ≤ U at hrU 
-    apply_fun (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op at e 
+    change PrimeSpectrum.basicOpen r ≤ U at hrU
+    apply_fun (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op at e
     simp only [TopCat.Presheaf.pushforwardObj_map, functor.op_map, map_zero, ← comp_apply,
-      to_open_res] at e 
+      to_open_res] at e
     have : to_open S (PrimeSpectrum.basicOpen <| algebraMap R S r) x = 0 := by refine' Eq.trans _ e;
       rfl
     have :=
Diff
@@ -3,12 +3,12 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
 -/
-import Mathbin.AlgebraicGeometry.LocallyRingedSpace
-import Mathbin.AlgebraicGeometry.StructureSheaf
-import Mathbin.RingTheory.Localization.LocalizationLocalization
-import Mathbin.Topology.Sheaves.SheafCondition.Sites
-import Mathbin.Topology.Sheaves.Functors
-import Mathbin.Algebra.Module.LocalizedModule
+import AlgebraicGeometry.LocallyRingedSpace
+import AlgebraicGeometry.StructureSheaf
+import RingTheory.Localization.LocalizationLocalization
+import Topology.Sheaves.SheafCondition.Sites
+import Topology.Sheaves.Functors
+import Algebra.Module.LocalizedModule
 
 #align_import algebraic_geometry.Spec from "leanprover-community/mathlib"@"8af7091a43227e179939ba132e54e54e9f3b089a"
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
-
-! This file was ported from Lean 3 source module algebraic_geometry.Spec
-! leanprover-community/mathlib commit 8af7091a43227e179939ba132e54e54e9f3b089a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.AlgebraicGeometry.LocallyRingedSpace
 import Mathbin.AlgebraicGeometry.StructureSheaf
@@ -15,6 +10,8 @@ import Mathbin.Topology.Sheaves.SheafCondition.Sites
 import Mathbin.Topology.Sheaves.Functors
 import Mathbin.Algebra.Module.LocalizedModule
 
+#align_import algebraic_geometry.Spec from "leanprover-community/mathlib"@"8af7091a43227e179939ba132e54e54e9f3b089a"
+
 /-!
 # $Spec$ as a functor to locally ringed spaces.
 
Diff
@@ -429,8 +429,8 @@ def toPushforwardStalkAlgHom :
 #align algebraic_geometry.structure_sheaf.to_pushforward_stalk_alg_hom AlgebraicGeometry.StructureSheaf.toPushforwardStalkAlgHom
 -/
 
-#print AlgebraicGeometry.StructureSheaf.is_localized_module_toPushforwardStalkAlgHom_aux /-
-theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
+#print AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom_aux /-
+theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
     ∃ x : S × p.asIdeal.primeCompl, x.2 • y = toPushforwardStalkAlgHom R S p x.1 :=
   by
   obtain ⟨U, hp, s, e⟩ := TopCat.Presheaf.germ_exist _ _ y
@@ -458,7 +458,7 @@ theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
   dsimp only [Subtype.coe_mk] at hsn 
   rw [← map_pow (algebraMap R S)] at hsn 
   congr 1
-#align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.is_localized_module_toPushforwardStalkAlgHom_aux
+#align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom_aux
 -/
 
 #print AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom /-
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
 
 ! This file was ported from Lean 3 source module algebraic_geometry.Spec
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
+! leanprover-community/mathlib commit 8af7091a43227e179939ba132e54e54e9f3b089a
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -18,6 +18,9 @@ import Mathbin.Algebra.Module.LocalizedModule
 /-!
 # $Spec$ as a functor to locally ringed spaces.
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We define the functor $Spec$ from commutative rings to locally ringed spaces.
 
 ## Implementation notes
Diff
@@ -52,28 +52,37 @@ open StructureSheaf
 
 open Spec (structureSheaf)
 
+#print AlgebraicGeometry.Spec.topObj /-
 /-- The spectrum of a commutative ring, as a topological space.
 -/
 def Spec.topObj (R : CommRingCat) : TopCat :=
   TopCat.of (PrimeSpectrum R)
 #align algebraic_geometry.Spec.Top_obj AlgebraicGeometry.Spec.topObj
+-/
 
+#print AlgebraicGeometry.Spec.topMap /-
 /-- The induced map of a ring homomorphism on the ring spectra, as a morphism of topological spaces.
 -/
 def Spec.topMap {R S : CommRingCat} (f : R ⟶ S) : Spec.topObj S ⟶ Spec.topObj R :=
   PrimeSpectrum.comap f
 #align algebraic_geometry.Spec.Top_map AlgebraicGeometry.Spec.topMap
+-/
 
+#print AlgebraicGeometry.Spec.topMap_id /-
 @[simp]
 theorem Spec.topMap_id (R : CommRingCat) : Spec.topMap (𝟙 R) = 𝟙 (Spec.topObj R) :=
   PrimeSpectrum.comap_id
 #align algebraic_geometry.Spec.Top_map_id AlgebraicGeometry.Spec.topMap_id
+-/
 
+#print AlgebraicGeometry.Spec.topMap_comp /-
 theorem Spec.topMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
     Spec.topMap (f ≫ g) = Spec.topMap g ≫ Spec.topMap f :=
   PrimeSpectrum.comap_comp _ _
 #align algebraic_geometry.Spec.Top_map_comp AlgebraicGeometry.Spec.topMap_comp
+-/
 
+#print AlgebraicGeometry.Spec.toTop /-
 /-- The spectrum, as a contravariant functor from commutative rings to topological spaces.
 -/
 @[simps]
@@ -84,7 +93,9 @@ def Spec.toTop : CommRingCatᵒᵖ ⥤ TopCat
   map_id' R := by rw [unop_id, Spec.Top_map_id]
   map_comp' R S T f g := by rw [unop_comp, Spec.Top_map_comp]
 #align algebraic_geometry.Spec.to_Top AlgebraicGeometry.Spec.toTop
+-/
 
+#print AlgebraicGeometry.Spec.sheafedSpaceObj /-
 /-- The spectrum of a commutative ring, as a `SheafedSpace`.
 -/
 @[simps]
@@ -94,7 +105,9 @@ def Spec.sheafedSpaceObj (R : CommRingCat) : SheafedSpace CommRingCat
   Presheaf := (structureSheaf R).1
   IsSheaf := (structureSheaf R).2
 #align algebraic_geometry.Spec.SheafedSpace_obj AlgebraicGeometry.Spec.sheafedSpaceObj
+-/
 
+#print AlgebraicGeometry.Spec.sheafedSpaceMap /-
 /-- The induced map of a ring homomorphism on the ring spectra, as a morphism of sheafed spaces.
 -/
 @[simps]
@@ -107,7 +120,9 @@ def Spec.sheafedSpaceMap {R S : CommRingCat.{u}} (f : R ⟶ S) :
         comap f (unop U) ((TopologicalSpace.Opens.map (Spec.topMap f)).obj (unop U)) fun p => id
       naturality' := fun U V i => RingHom.ext fun s => Subtype.eq <| funext fun p => rfl }
 #align algebraic_geometry.Spec.SheafedSpace_map AlgebraicGeometry.Spec.sheafedSpaceMap
+-/
 
+#print AlgebraicGeometry.Spec.sheafedSpaceMap_id /-
 @[simp]
 theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
     Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
@@ -119,7 +134,9 @@ theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
         · rw [Spec.Top_map_id, TopologicalSpace.Opens.map_id_obj_unop]
         simpa [eq_to_hom_map]
 #align algebraic_geometry.Spec.SheafedSpace_map_id AlgebraicGeometry.Spec.sheafedSpaceMap_id
+-/
 
+#print AlgebraicGeometry.Spec.sheafedSpaceMap_comp /-
 theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
     Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
   AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <|
@@ -127,7 +144,9 @@ theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶
       funext fun U => by dsimp; rw [CategoryTheory.Functor.map_id]; rw [category.comp_id];
         erw [comap_comp f g]; rfl
 #align algebraic_geometry.Spec.SheafedSpace_map_comp AlgebraicGeometry.Spec.sheafedSpaceMap_comp
+-/
 
+#print AlgebraicGeometry.Spec.toSheafedSpace /-
 /-- Spec, as a contravariant functor from commutative rings to sheafed spaces.
 -/
 @[simps]
@@ -138,35 +157,47 @@ def Spec.toSheafedSpace : CommRingCatᵒᵖ ⥤ SheafedSpace CommRingCat
   map_id' R := by rw [unop_id, Spec.SheafedSpace_map_id]
   map_comp' R S T f g := by rw [unop_comp, Spec.SheafedSpace_map_comp]
 #align algebraic_geometry.Spec.to_SheafedSpace AlgebraicGeometry.Spec.toSheafedSpace
+-/
 
+#print AlgebraicGeometry.Spec.toPresheafedSpace /-
 /-- Spec, as a contravariant functor from commutative rings to presheafed spaces.
 -/
 def Spec.toPresheafedSpace : CommRingCatᵒᵖ ⥤ PresheafedSpace.{u} CommRingCat.{u} :=
   Spec.toSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace
 #align algebraic_geometry.Spec.to_PresheafedSpace AlgebraicGeometry.Spec.toPresheafedSpace
+-/
 
+#print AlgebraicGeometry.Spec.toPresheafedSpace_obj /-
 @[simp]
 theorem Spec.toPresheafedSpace_obj (R : CommRingCatᵒᵖ) :
     Spec.toPresheafedSpace.obj R = (Spec.sheafedSpaceObj (unop R)).toPresheafedSpace :=
   rfl
 #align algebraic_geometry.Spec.to_PresheafedSpace_obj AlgebraicGeometry.Spec.toPresheafedSpace_obj
+-/
 
+#print AlgebraicGeometry.Spec.toPresheafedSpace_obj_op /-
 theorem Spec.toPresheafedSpace_obj_op (R : CommRingCat) :
     Spec.toPresheafedSpace.obj (op R) = (Spec.sheafedSpaceObj R).toPresheafedSpace :=
   rfl
 #align algebraic_geometry.Spec.to_PresheafedSpace_obj_op AlgebraicGeometry.Spec.toPresheafedSpace_obj_op
+-/
 
+#print AlgebraicGeometry.Spec.toPresheafedSpace_map /-
 @[simp]
 theorem Spec.toPresheafedSpace_map (R S : CommRingCatᵒᵖ) (f : R ⟶ S) :
     Spec.toPresheafedSpace.map f = Spec.sheafedSpaceMap f.unop :=
   rfl
 #align algebraic_geometry.Spec.to_PresheafedSpace_map AlgebraicGeometry.Spec.toPresheafedSpace_map
+-/
 
+#print AlgebraicGeometry.Spec.toPresheafedSpace_map_op /-
 theorem Spec.toPresheafedSpace_map_op (R S : CommRingCat) (f : R ⟶ S) :
     Spec.toPresheafedSpace.map f.op = Spec.sheafedSpaceMap f :=
   rfl
 #align algebraic_geometry.Spec.to_PresheafedSpace_map_op AlgebraicGeometry.Spec.toPresheafedSpace_map_op
+-/
 
+#print AlgebraicGeometry.Spec.basicOpen_hom_ext /-
 theorem Spec.basicOpen_hom_ext {X : RingedSpace} {R : CommRingCat}
     {α β : X ⟶ Spec.sheafedSpaceObj R} (w : α.base = β.base)
     (h :
@@ -183,7 +214,9 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace} {R : CommRingCat}
     simpa using h r
   exact w
 #align algebraic_geometry.Spec.basic_open_hom_ext AlgebraicGeometry.Spec.basicOpen_hom_ext
+-/
 
+#print AlgebraicGeometry.Spec.locallyRingedSpaceObj /-
 /-- The spectrum of a commutative ring, as a `LocallyRingedSpace`.
 -/
 @[simps]
@@ -193,7 +226,9 @@ def Spec.locallyRingedSpaceObj (R : CommRingCat) : LocallyRingedSpace :=
       @RingEquiv.localRing _ (show LocalRing (Localization.AtPrime _) by infer_instance) _
         (Iso.commRingCatIsoToRingEquiv <| stalkIso R x).symm }
 #align algebraic_geometry.Spec.LocallyRingedSpace_obj AlgebraicGeometry.Spec.locallyRingedSpaceObj
+-/
 
+#print AlgebraicGeometry.stalkMap_toStalk /-
 @[elementwise]
 theorem stalkMap_toStalk {R S : CommRingCat} (f : R ⟶ S) (p : PrimeSpectrum S) :
     toStalk R (PrimeSpectrum.comap f p) ≫ PresheafedSpace.stalkMap (Spec.sheafedSpaceMap f) p =
@@ -204,7 +239,9 @@ theorem stalkMap_toStalk {R S : CommRingCat} (f : R ⟶ S) (p : PrimeSpectrum S)
     Spec.SheafedSpace_map_c_app, to_open_comp_comap_assoc]
   rfl
 #align algebraic_geometry.stalk_map_to_stalk AlgebraicGeometry.stalkMap_toStalk
+-/
 
+#print AlgebraicGeometry.localRingHom_comp_stalkIso /-
 /-- Under the isomorphisms `stalk_iso`, the map `stalk_map (Spec.SheafedSpace_map f) p` corresponds
 to the induced local ring homomorphism `localization.local_ring_hom`.
 -/
@@ -223,7 +260,9 @@ theorem localRingHom_comp_stalkIso {R S : CommRingCat} (f : R ⟶ S) (p : PrimeS
         rw [stalk_iso_hom, stalk_iso_inv, comp_apply, comp_apply, localization_to_stalk_of,
           stalk_map_to_stalk_apply, stalk_to_fiber_ring_hom_to_stalk]
 #align algebraic_geometry.local_ring_hom_comp_stalk_iso AlgebraicGeometry.localRingHom_comp_stalkIso
+-/
 
+#print AlgebraicGeometry.Spec.locallyRingedSpaceMap /-
 /--
 The induced map of a ring homomorphism on the prime spectra, as a morphism of locally ringed spaces.
 -/
@@ -242,21 +281,27 @@ def Spec.locallyRingedSpaceMap {R S : CommRingCat} (f : R ⟶ S) :
       convert RingHom.isUnit_map (stalk_iso R (PrimeSpectrum.comap f p)).inv ha
       rw [iso.hom_inv_id_apply]
 #align algebraic_geometry.Spec.LocallyRingedSpace_map AlgebraicGeometry.Spec.locallyRingedSpaceMap
+-/
 
+#print AlgebraicGeometry.Spec.locallyRingedSpaceMap_id /-
 @[simp]
 theorem Spec.locallyRingedSpaceMap_id (R : CommRingCat) :
     Spec.locallyRingedSpaceMap (𝟙 R) = 𝟙 (Spec.locallyRingedSpaceObj R) :=
   LocallyRingedSpace.Hom.ext _ _ <| by
     rw [Spec.LocallyRingedSpace_map_val, Spec.SheafedSpace_map_id]; rfl
 #align algebraic_geometry.Spec.LocallyRingedSpace_map_id AlgebraicGeometry.Spec.locallyRingedSpaceMap_id
+-/
 
+#print AlgebraicGeometry.Spec.locallyRingedSpaceMap_comp /-
 theorem Spec.locallyRingedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
     Spec.locallyRingedSpaceMap (f ≫ g) =
       Spec.locallyRingedSpaceMap g ≫ Spec.locallyRingedSpaceMap f :=
   LocallyRingedSpace.Hom.ext _ _ <| by
     rw [Spec.LocallyRingedSpace_map_val, Spec.SheafedSpace_map_comp]; rfl
 #align algebraic_geometry.Spec.LocallyRingedSpace_map_comp AlgebraicGeometry.Spec.locallyRingedSpaceMap_comp
+-/
 
+#print AlgebraicGeometry.Spec.toLocallyRingedSpace /-
 /-- Spec, as a contravariant functor from commutative rings to locally ringed spaces.
 -/
 @[simps]
@@ -267,35 +312,45 @@ def Spec.toLocallyRingedSpace : CommRingCatᵒᵖ ⥤ LocallyRingedSpace
   map_id' R := by rw [unop_id, Spec.LocallyRingedSpace_map_id]
   map_comp' R S T f g := by rw [unop_comp, Spec.LocallyRingedSpace_map_comp]
 #align algebraic_geometry.Spec.to_LocallyRingedSpace AlgebraicGeometry.Spec.toLocallyRingedSpace
+-/
 
 section SpecΓ
 
 open AlgebraicGeometry.LocallyRingedSpace
 
+#print AlgebraicGeometry.toSpecΓ /-
 /-- The counit morphism `R ⟶ Γ(Spec R)` given by `algebraic_geometry.structure_sheaf.to_open`.  -/
 @[simps (config := { rhsMd := Tactic.Transparency.semireducible })]
 def toSpecΓ (R : CommRingCat) : R ⟶ Γ.obj (op (Spec.toLocallyRingedSpace.obj (op R))) :=
   StructureSheaf.toOpen R ⊤
 #align algebraic_geometry.to_Spec_Γ AlgebraicGeometry.toSpecΓ
+-/
 
+#print AlgebraicGeometry.isIso_toSpecΓ /-
 instance isIso_toSpecΓ (R : CommRingCat) : IsIso (toSpecΓ R) := by cases R;
   apply structure_sheaf.is_iso_to_global
 #align algebraic_geometry.is_iso_to_Spec_Γ AlgebraicGeometry.isIso_toSpecΓ
+-/
 
+#print AlgebraicGeometry.Spec_Γ_naturality /-
 @[reassoc]
 theorem Spec_Γ_naturality {R S : CommRingCat} (f : R ⟶ S) :
     f ≫ toSpecΓ S = toSpecΓ R ≫ Γ.map (Spec.toLocallyRingedSpace.map f.op).op := by ext; symm;
   apply Localization.localRingHom_to_map
 #align algebraic_geometry.Spec_Γ_naturality AlgebraicGeometry.Spec_Γ_naturality
+-/
 
+#print AlgebraicGeometry.SpecΓIdentity /-
 /-- The counit (`Spec_Γ_identity.inv.op`) of the adjunction `Γ ⊣ Spec` is an isomorphism. -/
 @[simps hom_app inv_app]
-def specΓIdentity : Spec.toLocallyRingedSpace.rightOp ⋙ Γ ≅ 𝟭 _ :=
+def SpecΓIdentity : Spec.toLocallyRingedSpace.rightOp ⋙ Γ ≅ 𝟭 _ :=
   Iso.symm <| NatIso.ofComponents (fun R => asIso (toSpecΓ R) : _) fun _ _ => Spec_Γ_naturality
-#align algebraic_geometry.Spec_Γ_identity AlgebraicGeometry.specΓIdentity
+#align algebraic_geometry.Spec_Γ_identity AlgebraicGeometry.SpecΓIdentity
+-/
 
 end SpecΓ
 
+#print AlgebraicGeometry.Spec_map_localization_isIso /-
 /-- The stalk map of `Spec M⁻¹R ⟶ Spec R` is an iso for each `p : Spec M⁻¹R`. -/
 theorem Spec_map_localization_isIso (R : CommRingCat) (M : Submonoid R)
     (x : PrimeSpectrum (Localization M)) :
@@ -316,11 +371,13 @@ theorem Spec_map_localization_isIso (R : CommRingCat) (M : Submonoid R)
       by infer_instance
   infer_instance
 #align algebraic_geometry.Spec_map_localization_is_iso AlgebraicGeometry.Spec_map_localization_isIso
+-/
 
 namespace StructureSheaf
 
 variable {R S : CommRingCat.{u}} (f : R ⟶ S) (p : PrimeSpectrum R)
 
+#print AlgebraicGeometry.StructureSheaf.toPushforwardStalk /-
 /-- For an algebra `f : R →+* S`, this is the ring homomorphism `S →+* (f∗ 𝒪ₛ)ₚ` for a `p : Spec R`.
 This is shown to be the localization at `p` in `is_localized_module_to_pushforward_stalk_alg_hom`.
 -/
@@ -328,7 +385,9 @@ def toPushforwardStalk : S ⟶ (Spec.topMap f _* (structureSheaf S).1).stalk p :
   StructureSheaf.toOpen S ⊤ ≫
     @TopCat.Presheaf.germ _ _ _ _ (Spec.topMap f _* (structureSheaf S).1) ⊤ ⟨p, trivial⟩
 #align algebraic_geometry.structure_sheaf.to_pushforward_stalk AlgebraicGeometry.StructureSheaf.toPushforwardStalk
+-/
 
+#print AlgebraicGeometry.StructureSheaf.toPushforwardStalk_comp /-
 @[reassoc]
 theorem toPushforwardStalk_comp :
     f ≫ StructureSheaf.toPushforwardStalk f p =
@@ -340,18 +399,22 @@ theorem toPushforwardStalk_comp :
   rw [TopCat.Presheaf.stalkFunctor_map_germ]
   exact Spec_Γ_naturality_assoc f _
 #align algebraic_geometry.structure_sheaf.to_pushforward_stalk_comp AlgebraicGeometry.StructureSheaf.toPushforwardStalk_comp
+-/
 
 instance : Algebra R ((Spec.topMap f _* (structureSheaf S).1).stalk p) :=
   (f ≫ StructureSheaf.toPushforwardStalk f p).toAlgebra
 
+#print AlgebraicGeometry.StructureSheaf.algebraMap_pushforward_stalk /-
 theorem algebraMap_pushforward_stalk :
     algebraMap R ((Spec.topMap f _* (structureSheaf S).1).stalk p) =
       f ≫ StructureSheaf.toPushforwardStalk f p :=
   rfl
 #align algebraic_geometry.structure_sheaf.algebra_map_pushforward_stalk AlgebraicGeometry.StructureSheaf.algebraMap_pushforward_stalk
+-/
 
 variable (R S) [Algebra R S]
 
+#print AlgebraicGeometry.StructureSheaf.toPushforwardStalkAlgHom /-
 /--
 This is the `alg_hom` version of `to_pushforward_stalk`, which is the map `S ⟶ (f∗ 𝒪ₛ)ₚ` for some
 algebra `R ⟶ S` and some `p : Spec R`.
@@ -361,7 +424,9 @@ def toPushforwardStalkAlgHom :
     S →ₐ[R] (Spec.topMap (algebraMap R S) _* (structureSheaf S).1).stalk p :=
   { StructureSheaf.toPushforwardStalk (algebraMap R S) p with commutes' := fun _ => rfl }
 #align algebraic_geometry.structure_sheaf.to_pushforward_stalk_alg_hom AlgebraicGeometry.StructureSheaf.toPushforwardStalkAlgHom
+-/
 
+#print AlgebraicGeometry.StructureSheaf.is_localized_module_toPushforwardStalkAlgHom_aux /-
 theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
     ∃ x : S × p.asIdeal.primeCompl, x.2 • y = toPushforwardStalkAlgHom R S p x.1 :=
   by
@@ -391,7 +456,9 @@ theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
   rw [← map_pow (algebraMap R S)] at hsn 
   congr 1
 #align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.is_localized_module_toPushforwardStalkAlgHom_aux
+-/
 
+#print AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom /-
 instance isLocalizedModule_toPushforwardStalkAlgHom :
     IsLocalizedModule p.asIdeal.primeCompl (toPushforwardStalkAlgHom R S p).toLinearMap :=
   by
@@ -422,6 +489,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
     rw [Submonoid.smul_def, Algebra.smul_def, Submonoid.coe_pow, Subtype.coe_mk, map_pow]
     exact e
 #align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom
+-/
 
 end StructureSheaf
 
Diff
@@ -408,7 +408,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
       PrimeSpectrum.isTopologicalBasis_basic_opens.exists_subset_of_mem_open (show p ∈ U.1 from hpU)
         U.2
     change PrimeSpectrum.basicOpen r ≤ U at hrU 
-    apply_fun (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op  at e 
+    apply_fun (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op at e 
     simp only [TopCat.Presheaf.pushforwardObj_map, functor.op_map, map_zero, ← comp_apply,
       to_open_res] at e 
     have : to_open S (PrimeSpectrum.basicOpen <| algebraMap R S r) x = 0 := by refine' Eq.trans _ e;
Diff
@@ -235,9 +235,9 @@ def Spec.locallyRingedSpaceMap {R S : CommRingCat} (f : R ⟶ S) :
       by
       -- Here, we are showing that the map on prime spectra induced by `f` is really a morphism of
       -- *locally* ringed spaces, i.e. that the induced map on the stalks is a local ring homomorphism.
-      rw [← local_ring_hom_comp_stalk_iso_apply] at ha
+      rw [← local_ring_hom_comp_stalk_iso_apply] at ha 
       replace ha := (stalk_iso S p).Hom.isUnit_map ha
-      rw [iso.inv_hom_id_apply] at ha
+      rw [iso.inv_hom_id_apply] at ha 
       replace ha := IsLocalRingHom.map_nonunit _ ha
       convert RingHom.isUnit_map (stalk_iso R (PrimeSpectrum.comap f p)).inv ha
       rw [iso.hom_inv_id_apply]
@@ -368,13 +368,13 @@ theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
   obtain ⟨U, hp, s, e⟩ := TopCat.Presheaf.germ_exist _ _ y
   obtain ⟨_, ⟨r, rfl⟩, hpr : p ∈ PrimeSpectrum.basicOpen r, hrU : PrimeSpectrum.basicOpen r ≤ U⟩ :=
     PrimeSpectrum.isTopologicalBasis_basic_opens.exists_subset_of_mem_open (show p ∈ ↑U from hp) U.2
-  change PrimeSpectrum.basicOpen r ≤ U at hrU
+  change PrimeSpectrum.basicOpen r ≤ U at hrU 
   replace e :=
     ((Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).germ_res_apply (hom_of_le hrU)
           ⟨p, hpr⟩ _).trans
       e
   set s' := (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op s with h
-  rw [← h] at e
+  rw [← h] at e 
   clear_value s'; clear! U
   obtain ⟨⟨s, ⟨_, n, rfl⟩⟩, hsn⟩ :=
     @IsLocalization.surj _ _ _ _ _ _
@@ -387,8 +387,8 @@ theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
       (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).germ_res_apply (hom_of_le le_top)
         ⟨p, hpr⟩]
   rw [← e, ← map_mul, mul_comm]
-  dsimp only [Subtype.coe_mk] at hsn
-  rw [← map_pow (algebraMap R S)] at hsn
+  dsimp only [Subtype.coe_mk] at hsn 
+  rw [← map_pow (algebraMap R S)] at hsn 
   congr 1
 #align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.is_localized_module_toPushforwardStalkAlgHom_aux
 
@@ -402,15 +402,15 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
   · intro x hx
     rw [to_pushforward_stalk_alg_hom_apply, RingHom.toFun_eq_coe, ←
       (to_pushforward_stalk (algebraMap R S) p).map_zero, to_pushforward_stalk, comp_apply,
-      comp_apply, map_zero] at hx
+      comp_apply, map_zero] at hx 
     obtain ⟨U, hpU, i₁, i₂, e⟩ := TopCat.Presheaf.germ_eq _ _ _ _ _ _ hx
     obtain ⟨_, ⟨r, rfl⟩, hpr, hrU⟩ :=
       PrimeSpectrum.isTopologicalBasis_basic_opens.exists_subset_of_mem_open (show p ∈ U.1 from hpU)
         U.2
-    change PrimeSpectrum.basicOpen r ≤ U at hrU
-    apply_fun (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op  at e
+    change PrimeSpectrum.basicOpen r ≤ U at hrU 
+    apply_fun (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op  at e 
     simp only [TopCat.Presheaf.pushforwardObj_map, functor.op_map, map_zero, ← comp_apply,
-      to_open_res] at e
+      to_open_res] at e 
     have : to_open S (PrimeSpectrum.basicOpen <| algebraMap R S r) x = 0 := by refine' Eq.trans _ e;
       rfl
     have :=
Diff
@@ -419,7 +419,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
         this
     obtain ⟨⟨_, n, rfl⟩, e⟩ := (IsLocalization.mk'_eq_zero_iff _ _).mp this
     refine' ⟨⟨r, hpr⟩ ^ n, _⟩
-    rw [Submonoid.smul_def, Algebra.smul_def, [anonymous], Subtype.coe_mk, map_pow]
+    rw [Submonoid.smul_def, Algebra.smul_def, Submonoid.coe_pow, Subtype.coe_mk, map_pow]
     exact e
 #align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom
 
Diff
@@ -124,12 +124,8 @@ theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶
     Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
   AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <|
     NatTrans.ext _ _ <|
-      funext fun U => by
-        dsimp
-        rw [CategoryTheory.Functor.map_id]
-        rw [category.comp_id]
-        erw [comap_comp f g]
-        rfl
+      funext fun U => by dsimp; rw [CategoryTheory.Functor.map_id]; rw [category.comp_id];
+        erw [comap_comp f g]; rfl
 #align algebraic_geometry.Spec.SheafedSpace_map_comp AlgebraicGeometry.Spec.sheafedSpaceMap_comp
 
 /-- Spec, as a contravariant functor from commutative rings to sheafed spaces.
@@ -250,19 +246,15 @@ def Spec.locallyRingedSpaceMap {R S : CommRingCat} (f : R ⟶ S) :
 @[simp]
 theorem Spec.locallyRingedSpaceMap_id (R : CommRingCat) :
     Spec.locallyRingedSpaceMap (𝟙 R) = 𝟙 (Spec.locallyRingedSpaceObj R) :=
-  LocallyRingedSpace.Hom.ext _ _ <|
-    by
-    rw [Spec.LocallyRingedSpace_map_val, Spec.SheafedSpace_map_id]
-    rfl
+  LocallyRingedSpace.Hom.ext _ _ <| by
+    rw [Spec.LocallyRingedSpace_map_val, Spec.SheafedSpace_map_id]; rfl
 #align algebraic_geometry.Spec.LocallyRingedSpace_map_id AlgebraicGeometry.Spec.locallyRingedSpaceMap_id
 
 theorem Spec.locallyRingedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
     Spec.locallyRingedSpaceMap (f ≫ g) =
       Spec.locallyRingedSpaceMap g ≫ Spec.locallyRingedSpaceMap f :=
-  LocallyRingedSpace.Hom.ext _ _ <|
-    by
-    rw [Spec.LocallyRingedSpace_map_val, Spec.SheafedSpace_map_comp]
-    rfl
+  LocallyRingedSpace.Hom.ext _ _ <| by
+    rw [Spec.LocallyRingedSpace_map_val, Spec.SheafedSpace_map_comp]; rfl
 #align algebraic_geometry.Spec.LocallyRingedSpace_map_comp AlgebraicGeometry.Spec.locallyRingedSpaceMap_comp
 
 /-- Spec, as a contravariant functor from commutative rings to locally ringed spaces.
@@ -286,18 +278,13 @@ def toSpecΓ (R : CommRingCat) : R ⟶ Γ.obj (op (Spec.toLocallyRingedSpace.obj
   StructureSheaf.toOpen R ⊤
 #align algebraic_geometry.to_Spec_Γ AlgebraicGeometry.toSpecΓ
 
-instance isIso_toSpecΓ (R : CommRingCat) : IsIso (toSpecΓ R) :=
-  by
-  cases R
+instance isIso_toSpecΓ (R : CommRingCat) : IsIso (toSpecΓ R) := by cases R;
   apply structure_sheaf.is_iso_to_global
 #align algebraic_geometry.is_iso_to_Spec_Γ AlgebraicGeometry.isIso_toSpecΓ
 
 @[reassoc]
 theorem Spec_Γ_naturality {R S : CommRingCat} (f : R ⟶ S) :
-    f ≫ toSpecΓ S = toSpecΓ R ≫ Γ.map (Spec.toLocallyRingedSpace.map f.op).op :=
-  by
-  ext
-  symm
+    f ≫ toSpecΓ S = toSpecΓ R ≫ Γ.map (Spec.toLocallyRingedSpace.map f.op).op := by ext; symm;
   apply Localization.localRingHom_to_map
 #align algebraic_geometry.Spec_Γ_naturality AlgebraicGeometry.Spec_Γ_naturality
 
@@ -409,8 +396,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
     IsLocalizedModule p.asIdeal.primeCompl (toPushforwardStalkAlgHom R S p).toLinearMap :=
   by
   apply IsLocalizedModule.mkOfAlgebra
-  · intro x hx
-    rw [algebra_map_pushforward_stalk, to_pushforward_stalk_comp, comp_apply]
+  · intro x hx; rw [algebra_map_pushforward_stalk, to_pushforward_stalk_comp, comp_apply]
     exact (IsLocalization.map_units ((structure_sheaf R).Presheaf.stalk p) ⟨x, hx⟩).map _
   · apply is_localized_module_to_pushforward_stalk_alg_hom_aux
   · intro x hx
@@ -425,9 +411,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
     apply_fun (Spec.Top_map (algebraMap R S) _* (structure_sheaf S).1).map (hom_of_le hrU).op  at e
     simp only [TopCat.Presheaf.pushforwardObj_map, functor.op_map, map_zero, ← comp_apply,
       to_open_res] at e
-    have : to_open S (PrimeSpectrum.basicOpen <| algebraMap R S r) x = 0 :=
-      by
-      refine' Eq.trans _ e
+    have : to_open S (PrimeSpectrum.basicOpen <| algebraMap R S r) x = 0 := by refine' Eq.trans _ e;
       rfl
     have :=
       (@IsLocalization.mk'_one _ _ _ _ _ _
Diff
@@ -292,7 +292,7 @@ instance isIso_toSpecΓ (R : CommRingCat) : IsIso (toSpecΓ R) :=
   apply structure_sheaf.is_iso_to_global
 #align algebraic_geometry.is_iso_to_Spec_Γ AlgebraicGeometry.isIso_toSpecΓ
 
-@[reassoc.1]
+@[reassoc]
 theorem Spec_Γ_naturality {R S : CommRingCat} (f : R ⟶ S) :
     f ≫ toSpecΓ S = toSpecΓ R ≫ Γ.map (Spec.toLocallyRingedSpace.map f.op).op :=
   by
@@ -342,7 +342,7 @@ def toPushforwardStalk : S ⟶ (Spec.topMap f _* (structureSheaf S).1).stalk p :
     @TopCat.Presheaf.germ _ _ _ _ (Spec.topMap f _* (structureSheaf S).1) ⊤ ⟨p, trivial⟩
 #align algebraic_geometry.structure_sheaf.to_pushforward_stalk AlgebraicGeometry.StructureSheaf.toPushforwardStalk
 
-@[reassoc.1]
+@[reassoc]
 theorem toPushforwardStalk_comp :
     f ≫ StructureSheaf.toPushforwardStalk f p =
       StructureSheaf.toStalk R p ≫
Diff
@@ -111,7 +111,7 @@ def Spec.sheafedSpaceMap {R S : CommRingCat.{u}} (f : R ⟶ S) :
 @[simp]
 theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
     Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
-  PresheafedSpace.ext _ _ (Spec.topMap_id R) <|
+  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <|
     NatTrans.ext _ _ <|
       funext fun U => by
         dsimp
@@ -122,7 +122,7 @@ theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
 
 theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
     Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
-  PresheafedSpace.ext _ _ (Spec.topMap_comp f g) <|
+  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <|
     NatTrans.ext _ _ <|
       funext fun U => by
         dsimp
Diff
@@ -405,7 +405,7 @@ theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
   congr 1
 #align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.is_localized_module_toPushforwardStalkAlgHom_aux
 
-instance isLocalizedModuleToPushforwardStalkAlgHom :
+instance isLocalizedModule_toPushforwardStalkAlgHom :
     IsLocalizedModule p.asIdeal.primeCompl (toPushforwardStalkAlgHom R S p).toLinearMap :=
   by
   apply IsLocalizedModule.mkOfAlgebra
@@ -437,7 +437,7 @@ instance isLocalizedModuleToPushforwardStalkAlgHom :
     refine' ⟨⟨r, hpr⟩ ^ n, _⟩
     rw [Submonoid.smul_def, Algebra.smul_def, [anonymous], Subtype.coe_mk, map_pow]
     exact e
-#align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom AlgebraicGeometry.StructureSheaf.isLocalizedModuleToPushforwardStalkAlgHom
+#align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom
 
 end StructureSheaf
 
Diff
@@ -195,7 +195,7 @@ def Spec.locallyRingedSpaceObj (R : CommRingCat) : LocallyRingedSpace :=
   { Spec.sheafedSpaceObj R with
     LocalRing := fun x =>
       @RingEquiv.localRing _ (show LocalRing (Localization.AtPrime _) by infer_instance) _
-        (Iso.commRingIsoToRingEquiv <| stalkIso R x).symm }
+        (Iso.commRingCatIsoToRingEquiv <| stalkIso R x).symm }
 #align algebraic_geometry.Spec.LocallyRingedSpace_obj AlgebraicGeometry.Spec.locallyRingedSpaceObj
 
 @[elementwise]
@@ -325,7 +325,7 @@ theorem Spec_map_localization_isIso (R : CommRingCat) (M : Submonoid R)
     show
       is_iso
         (IsLocalization.localizationLocalizationAtPrimeIsoLocalization M
-                x.as_ideal).toRingEquiv.toCommRingIso.Hom
+                x.as_ideal).toRingEquiv.toCommRingCatIso.Hom
       by infer_instance
   infer_instance
 #align algebraic_geometry.Spec_map_localization_is_iso AlgebraicGeometry.Spec_map_localization_isIso
Diff
@@ -4,13 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
 
 ! This file was ported from Lean 3 source module algebraic_geometry.Spec
-! leanprover-community/mathlib commit d39590fc8728fbf6743249802486f8c91ffe07bc
+! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.AlgebraicGeometry.LocallyRingedSpace
 import Mathbin.AlgebraicGeometry.StructureSheaf
-import Mathbin.Logic.Equiv.TransferInstance
 import Mathbin.RingTheory.Localization.LocalizationLocalization
 import Mathbin.Topology.Sheaves.SheafCondition.Sites
 import Mathbin.Topology.Sheaves.Functors

Changes in mathlib4

mathlib3
mathlib4
chore: restore simps that used to work (#12126)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -192,13 +192,7 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
       ((TopCat.Sheaf.pushforward _ β.base).obj X.sheaf).hom_ext _ PrimeSpectrum.isBasis_basic_opens
     intro r
     apply (StructureSheaf.to_basicOpen_epi R r).1
-    -- Porting note: was a one-liner `simpa using h r`
-    specialize h r
-    simp only [sheafedSpaceObj_carrier, Functor.op_obj, unop_op, TopCat.Presheaf.pushforwardObj_obj,
-      sheafedSpaceObj_presheaf, Category.assoc] at h
-    rw [NatTrans.comp_app, ← h]
-    congr
-    simp
+    simpa using h r
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec.basic_open_hom_ext AlgebraicGeometry.Spec.basicOpen_hom_ext
 
style: reduce spacing variation in "porting note" comments (#10886)

In this pull request, I have systematically eliminated the leading whitespace preceding the colon (:) within all unlabelled or unclassified porting notes. This adjustment facilitates a more efficient review process for the remaining notes by ensuring no entries are overlooked due to formatting inconsistencies.

Diff
@@ -75,7 +75,7 @@ theorem Spec.topMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec.Top_map_comp AlgebraicGeometry.Spec.topMap_comp
 
--- Porting note : `simps!` generate some garbage lemmas, so choose manually,
+-- Porting note: `simps!` generate some garbage lemmas, so choose manually,
 -- if more is needed, add them here
 /-- The spectrum, as a contravariant functor from commutative rings to topological spaces.
 -/
@@ -127,7 +127,7 @@ theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶
     Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
   AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <| by
     ext
-    -- Porting note : was one liner
+    -- Porting note: was one liner
     -- `dsimp, rw category_theory.functor.map_id, rw category.comp_id, erw comap_comp f g, refl`
     rw [NatTrans.comp_app, sheafedSpaceMap_c_app, whiskerRight_app, eqToHom_refl]
     erw [(sheafedSpaceObj T).presheaf.map_id, Category.comp_id, comap_comp]
@@ -192,7 +192,7 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
       ((TopCat.Sheaf.pushforward _ β.base).obj X.sheaf).hom_ext _ PrimeSpectrum.isBasis_basic_opens
     intro r
     apply (StructureSheaf.to_basicOpen_epi R r).1
-    -- Porting note : was a one-liner `simpa using h r`
+    -- Porting note: was a one-liner `simpa using h r`
     specialize h r
     simp only [sheafedSpaceObj_carrier, Functor.op_obj, unop_op, TopCat.Presheaf.pushforwardObj_obj,
       sheafedSpaceObj_presheaf, Category.assoc] at h
@@ -202,7 +202,7 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec.basic_open_hom_ext AlgebraicGeometry.Spec.basicOpen_hom_ext
 
--- Porting note : `simps!` generate some garbage lemmas, so choose manually,
+-- Porting note: `simps!` generate some garbage lemmas, so choose manually,
 -- if more is needed, add them here
 /-- The spectrum of a commutative ring, as a `LocallyRingedSpace`.
 -/
@@ -263,7 +263,7 @@ def Spec.locallyRingedSpaceMap {R S : CommRingCat} (f : R ⟶ S) :
       replace ha := (stalkIso S p).hom.isUnit_map ha
       rw [← comp_apply, show localizationToStalk S p = (stalkIso S p).inv from rfl,
         Iso.inv_hom_id, id_apply] at ha
-      -- Porting note : `f` had to be made explicit
+      -- Porting note: `f` had to be made explicit
       replace ha := IsLocalRingHom.map_nonunit
         (f := (Localization.localRingHom (PrimeSpectrum.comap f p).asIdeal p.asIdeal f _)) _ ha
       convert RingHom.isUnit_map (stalkIso R (PrimeSpectrum.comap f p)).inv ha
@@ -321,7 +321,7 @@ set_option linter.uppercaseLean3 false in
 @[reassoc]
 theorem Spec_Γ_naturality {R S : CommRingCat} (f : R ⟶ S) :
     f ≫ toSpecΓ S = toSpecΓ R ≫ Γ.map (Spec.toLocallyRingedSpace.map f.op).op := by
-  -- Porting note : `ext` failed to pick up one of the three lemmas
+  -- Porting note: `ext` failed to pick up one of the three lemmas
   refine RingHom.ext fun x => Subtype.ext <| funext fun x' => ?_; symm;
   apply Localization.localRingHom_to_map
 set_option linter.uppercaseLean3 false in
@@ -331,7 +331,7 @@ set_option linter.uppercaseLean3 false in
 @[simps! hom_app inv_app]
 def SpecΓIdentity : Spec.toLocallyRingedSpace.rightOp ⋙ Γ ≅ 𝟭 _ :=
   Iso.symm <| NatIso.ofComponents (fun R =>
-    -- Porting note : In Lean3, this `IsIso` is synthesized automatically
+    -- Porting note: In Lean3, this `IsIso` is synthesized automatically
     letI : IsIso (toSpecΓ R) := StructureSheaf.isIso_to_global _
     asIso (toSpecΓ R)) fun {X Y} f => by convert Spec_Γ_naturality (R := X) (S := Y) f
 set_option linter.uppercaseLean3 false in
@@ -410,7 +410,7 @@ set_option linter.uppercaseLean3 false in
 theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
     ∃ x : S × p.asIdeal.primeCompl, x.2 • y = toPushforwardStalkAlgHom R S p x.1 := by
   obtain ⟨U, hp, s, e⟩ := TopCat.Presheaf.germ_exist
-    -- Porting note : originally the first variable does not need to be explicit
+    -- Porting note: originally the first variable does not need to be explicit
     (Spec.topMap (algebraMap ↑R ↑S) _* (structureSheaf S).val) _ y
   obtain ⟨_, ⟨r, rfl⟩, hpr : p ∈ PrimeSpectrum.basicOpen r, hrU : PrimeSpectrum.basicOpen r ≤ U⟩ :=
     PrimeSpectrum.isTopologicalBasis_basic_opens.exists_subset_of_mem_open (show p ∈ U from hp) U.2
@@ -432,7 +432,7 @@ theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
     erw [← (Spec.topMap (algebraMap R S) _* (structureSheaf S).1).germ_res_apply (homOfLE le_top)
       ⟨p, hpr⟩]
   rw [← e]
-  -- Porting note : without this `change`, Lean doesn't know how to rewrite `map_mul`
+  -- Porting note: without this `change`, Lean doesn't know how to rewrite `map_mul`
   let f := TopCat.Presheaf.germ (Spec.topMap (algebraMap R S) _* (structureSheaf S).val) ⟨p, hpr⟩
   change f _ * f _ = f _
   rw [← map_mul, mul_comm]
@@ -453,7 +453,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
   · intro x hx
     rw [toPushforwardStalkAlgHom_apply, ← (toPushforwardStalk (algebraMap R S) p).map_zero,
       toPushforwardStalk] at hx
-    -- Porting note : this `change` is manually rewriting `comp_apply`
+    -- Porting note: this `change` is manually rewriting `comp_apply`
     change _ = (TopCat.Presheaf.germ (Spec.topMap (algebraMap ↑R ↑S) _* (structureSheaf ↑S).val)
       (⟨p, trivial⟩ : (⊤ : TopologicalSpace.Opens (PrimeSpectrum R))) (toOpen S ⊤ 0)) at hx
     rw [map_zero] at hx
@@ -475,7 +475,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
     obtain ⟨⟨_, n, rfl⟩, e⟩ := (IsLocalization.mk'_eq_zero_iff _ _).mp this
     refine' ⟨⟨r, hpr⟩ ^ n, _⟩
     rw [Submonoid.smul_def, Algebra.smul_def]
-    -- Porting note : manually rewrite `Submonoid.coe_pow`
+    -- Porting note: manually rewrite `Submonoid.coe_pow`
     change (algebraMap R S) (r ^ n) * x = 0
     rw [map_pow]
     exact e
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -419,8 +419,8 @@ theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
     ((Spec.topMap (algebraMap R S) _* (structureSheaf S).1).germ_res_apply (homOfLE hrU)
           ⟨p, hpr⟩ _).trans e
   set s' := (Spec.topMap (algebraMap R S) _* (structureSheaf S).1).map (homOfLE hrU).op s with h
-  replace e : ((Spec.topMap (algebraMap R S) _* (structureSheaf S).val).germ ⟨p, hpr⟩) s' = y
-  · rw [h]; exact e
+  replace e : ((Spec.topMap (algebraMap R S) _* (structureSheaf S).val).germ ⟨p, hpr⟩) s' = y := by
+    rw [h]; exact e
   clear_value s'; clear! U
   obtain ⟨⟨s, ⟨_, n, rfl⟩⟩, hsn⟩ :=
     @IsLocalization.surj _ _ _ _ _ _
refactor(Data/FunLike): use unbundled inheritance from FunLike (#8386)

The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike is EquivLike, since that has a custom coe_injective' field that is easier to implement. All other classes should take FunLike or EquivLike as a parameter.

Zulip thread

Important changes

Previously, morphism classes would be Type-valued and extend FunLike:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

After this PR, they should be Prop-valued and take FunLike as a parameter:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  [FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

(Note that A B stay marked as outParam even though they are not purely required to be so due to the FunLike parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam is slightly faster.)

Similarly, MyEquivClass should take EquivLike as a parameter.

As a result, every mention of [MyHomClass F A B] should become [FunLike F A B] [MyHomClass F A B].

Remaining issues

Slower (failing) search

While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul is more expensive. This is due to suboptimal processing of arguments. For example:

variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)

theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y

example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _

Before this PR, applying map_mul f gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Since M and N are out_params, [MulHomClass F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found.

After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Now [FunLike F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found, before trying MulHomClass F M N which fails. Since the Mul hierarchy is very big, this can be slow to fail, especially when there is no such Mul instance.

A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N] because MulHomClass fails or succeeds much faster than the others.

As a consequence, the simpNF linter is much slower since by design it tries and fails to apply many map_ lemmas. The same issue occurs a few times in existing calls to simp [map_mul], where map_mul is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.

simp not firing sometimes

This affects map_smulₛₗ and related definitions. For simp lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw can find every argument to map_smulₛₗ successfully but simp can't: leanprover/lean4#3701.

Missing instances due to unification failing

Especially in the category theory library, we might sometimes have a type A which is also accessible as a synonym (Bundled A hA).1. Instance synthesis doesn't always work if we have f : A →* B but x * y : (Bundled A hA).1 or vice versa. This seems to be mostly fixed by keeping A B as outParams in MulHomClass F A B. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1 instead of using the syntax in the discrimination tree.)

Workaround for issues

The timeouts can be worked around for now by specifying which map_mul we mean, either as map_mul f for some explicit f, or as e.g. MonoidHomClass.map_mul.

map_smulₛₗ not firing as simp lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ a simp lemma instead of the generic map_smulₛₗ. Writing simp [map_smulₛₗ _] also works.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -241,9 +241,10 @@ theorem localRingHom_comp_stalkIso {R S : CommRingCat} (f : R ⟶ S) (p : PrimeS
   (stalkIso R (PrimeSpectrum.comap f p)).eq_inv_comp.mp <|
     (stalkIso S p).comp_inv_eq.mpr <|
       Localization.localRingHom_unique _ _ _ _ fun x => by
-        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-        rw [stalkIso_hom, stalkIso_inv]; erw [comp_apply, comp_apply]; rw [localizationToStalk_of]
-        erw [stalkMap_toStalk_apply f p x, stalkToFiberRingHom_toStalk]
+        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 and #8386
+        rw [stalkIso_hom, stalkIso_inv]
+        erw [comp_apply, comp_apply, localizationToStalk_of, stalkMap_toStalk_apply f p x,
+            stalkToFiberRingHom_toStalk]
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.local_ring_hom_comp_stalk_iso AlgebraicGeometry.localRingHom_comp_stalkIso
 
chore: improvements to Presheaf simp lemmas (#9542)

Various things break in the simpset for Presheaf when the simp algorithm changes in leanprover/lean4#3124. These backwards compatible fixes are, I think, improvements anyway.

One could further add a Presheaf.id_app lemma, and do further cleanup in the proofs which now use dsimp [-Presheaf.comp_app], but I'd prefer if these are done in a followup PR in order to not hold up #9500.

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

Diff
@@ -117,7 +117,7 @@ theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
   AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
     ext U
     dsimp
-    erw [NatTrans.comp_app, sheafedSpaceMap_c_app, PresheafedSpace.id_c_app, comap_id]; swap
+    erw [PresheafedSpace.id_c_app, comap_id]; swap
     · rw [Spec.topMap_id, TopologicalSpace.Opens.map_id_obj_unop]
     simp [eqToHom_map]
 set_option linter.uppercaseLean3 false in
chore: space after (#8178)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -196,7 +196,7 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
     specialize h r
     simp only [sheafedSpaceObj_carrier, Functor.op_obj, unop_op, TopCat.Presheaf.pushforwardObj_obj,
       sheafedSpaceObj_presheaf, Category.assoc] at h
-    rw [NatTrans.comp_app, ←h]
+    rw [NatTrans.comp_app, ← h]
     congr
     simp
 set_option linter.uppercaseLean3 false in
@@ -450,7 +450,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
     exact (IsLocalization.map_units ((structureSheaf R).presheaf.stalk p) ⟨x, hx⟩).map _
   · apply isLocalizedModule_toPushforwardStalkAlgHom_aux
   · intro x hx
-    rw [toPushforwardStalkAlgHom_apply, ←(toPushforwardStalk (algebraMap R S) p).map_zero,
+    rw [toPushforwardStalkAlgHom_apply, ← (toPushforwardStalk (algebraMap R S) p).map_zero,
       toPushforwardStalk] at hx
     -- Porting note : this `change` is manually rewriting `comp_apply`
     change _ = (TopCat.Presheaf.germ (Spec.topMap (algebraMap ↑R ↑S) _* (structureSheaf ↑S).val)
perf(FunLike.Basic): beta reduce CoeFun.coe (#7905)

This eliminates (fun a ↦ β) α in the type when applying a FunLike.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -262,9 +262,9 @@ def Spec.locallyRingedSpaceMap {R S : CommRingCat} (f : R ⟶ S) :
       replace ha := (stalkIso S p).hom.isUnit_map ha
       rw [← comp_apply, show localizationToStalk S p = (stalkIso S p).inv from rfl,
         Iso.inv_hom_id, id_apply] at ha
-      -- Porting note : `R` had to be made explicit
+      -- Porting note : `f` had to be made explicit
       replace ha := IsLocalRingHom.map_nonunit
-        (R := Localization.AtPrime (PrimeSpectrum.comap f p).asIdeal) _ ha
+        (f := (Localization.localRingHom (PrimeSpectrum.comap f p).asIdeal p.asIdeal f _)) _ ha
       convert RingHom.isUnit_map (stalkIso R (PrimeSpectrum.comap f p)).inv ha
       erw [← comp_apply, show stalkToFiberRingHom R _ = (stalkIso _ _).hom from rfl,
         Iso.hom_inv_id, id_apply]
feat(Topology/Sheaves/Functors): Specialize pullback-pushforward adjunction to sheaves over topological spaces. (#7722)

Port of https://github.com/leanprover-community/mathlib/pull/17561

Co-authored-by: Andrew Yang <36414270+erdOne@users.noreply.github.com>

Diff
@@ -189,7 +189,7 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
   ext : 1
   · exact w
   · apply
-      ((TopCat.Sheaf.pushforward β.base).obj X.sheaf).hom_ext _ PrimeSpectrum.isBasis_basic_opens
+      ((TopCat.Sheaf.pushforward _ β.base).obj X.sheaf).hom_ext _ PrimeSpectrum.isBasis_basic_opens
     intro r
     apply (StructureSheaf.to_basicOpen_epi R r).1
     -- Porting note : was a one-liner `simpa using h r`
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -241,7 +241,8 @@ theorem localRingHom_comp_stalkIso {R S : CommRingCat} (f : R ⟶ S) (p : PrimeS
   (stalkIso R (PrimeSpectrum.comap f p)).eq_inv_comp.mp <|
     (stalkIso S p).comp_inv_eq.mpr <|
       Localization.localRingHom_unique _ _ _ _ fun x => by
-        rw [stalkIso_hom, stalkIso_inv, comp_apply, comp_apply, localizationToStalk_of]
+        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+        rw [stalkIso_hom, stalkIso_inv]; erw [comp_apply, comp_apply]; rw [localizationToStalk_of]
         erw [stalkMap_toStalk_apply f p x, stalkToFiberRingHom_toStalk]
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.local_ring_hom_comp_stalk_iso AlgebraicGeometry.localRingHom_comp_stalkIso
@@ -308,6 +309,9 @@ def toSpecΓ (R : CommRingCat) : R ⟶ Γ.obj (op (Spec.toLocallyRingedSpace.obj
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.to_Spec_Γ AlgebraicGeometry.toSpecΓ
 
+-- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing
+attribute [nolint simpNF] AlgebraicGeometry.toSpecΓ_apply_coe
+
 instance isIso_toSpecΓ (R : CommRingCat) : IsIso (toSpecΓ R) := by
   cases R; apply StructureSheaf.isIso_to_global
 set_option linter.uppercaseLean3 false in
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -241,8 +241,7 @@ theorem localRingHom_comp_stalkIso {R S : CommRingCat} (f : R ⟶ S) (p : PrimeS
   (stalkIso R (PrimeSpectrum.comap f p)).eq_inv_comp.mp <|
     (stalkIso S p).comp_inv_eq.mpr <|
       Localization.localRingHom_unique _ _ _ _ fun x => by
-        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-        rw [stalkIso_hom, stalkIso_inv]; erw [comp_apply, comp_apply]; rw [localizationToStalk_of]
+        rw [stalkIso_hom, stalkIso_inv, comp_apply, comp_apply, localizationToStalk_of]
         erw [stalkMap_toStalk_apply f p x, stalkToFiberRingHom_toStalk]
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.local_ring_hom_comp_stalk_iso AlgebraicGeometry.localRingHom_comp_stalkIso
@@ -309,9 +308,6 @@ def toSpecΓ (R : CommRingCat) : R ⟶ Γ.obj (op (Spec.toLocallyRingedSpace.obj
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.to_Spec_Γ AlgebraicGeometry.toSpecΓ
 
--- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing
-attribute [nolint simpNF] AlgebraicGeometry.toSpecΓ_apply_coe
-
 instance isIso_toSpecΓ (R : CommRingCat) : IsIso (toSpecΓ R) := by
   cases R; apply StructureSheaf.isIso_to_global
 set_option linter.uppercaseLean3 false in
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

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

Diff
@@ -241,7 +241,8 @@ theorem localRingHom_comp_stalkIso {R S : CommRingCat} (f : R ⟶ S) (p : PrimeS
   (stalkIso R (PrimeSpectrum.comap f p)).eq_inv_comp.mp <|
     (stalkIso S p).comp_inv_eq.mpr <|
       Localization.localRingHom_unique _ _ _ _ fun x => by
-        rw [stalkIso_hom, stalkIso_inv, comp_apply, comp_apply, localizationToStalk_of]
+        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+        rw [stalkIso_hom, stalkIso_inv]; erw [comp_apply, comp_apply]; rw [localizationToStalk_of]
         erw [stalkMap_toStalk_apply f p x, stalkToFiberRingHom_toStalk]
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.local_ring_hom_comp_stalk_iso AlgebraicGeometry.localRingHom_comp_stalkIso
@@ -308,6 +309,9 @@ def toSpecΓ (R : CommRingCat) : R ⟶ Γ.obj (op (Spec.toLocallyRingedSpace.obj
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.to_Spec_Γ AlgebraicGeometry.toSpecΓ
 
+-- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing
+attribute [nolint simpNF] AlgebraicGeometry.toSpecΓ_apply_coe
+
 instance isIso_toSpecΓ (R : CommRingCat) : IsIso (toSpecΓ R) := by
   cases R; apply StructureSheaf.isIso_to_global
 set_option linter.uppercaseLean3 false in
chore: move (locally) ringed spaces out of AlgebraicGeometry (#7330)

Create new folder Geometry.RingedSpace for (locally) ringed spaces and move about half of the contents of AlgebraicGeometry there. Files renamed:

AlgebraicGeometry.OpenImmersion.Scheme → AlgebraicGeometry.OpenImmersion
AlgebraicGeometry.RingedSpace → Geometry.RingedSpace.Basic
AlgebraicGeometry.LocallyRingedSpace → Geometry.RingedSpace.LocallyRingedSpace
AlgebraicGeometry.LocallyRingedSpace.HasColimits → Geometry.RingedSpace.LocallyRingedSpace.HasColimits
AlgebraicGeometry.OpenImmersion.Basic → Geometry.RingedSpace.OpenImmersion
AlgebraicGeometry.PresheafedSpace → Geometry.RingedSpace.PresheafedSpace
AlgebraicGeometry.PresheafedSpace.Gluing → Geometry.RingedSpace.PresheafedSpace.Gluing
AlgebraicGeometry.PresheafedSpace.HasColimits → Geometry.RingedSpace.PresheafedSpace.HasColimits
AlgebraicGeometry.SheafedSpace → Geometry.RingedSpace.SheafedSpace
AlgebraicGeometry.Stalks → Geometry.RingedSpace.Stalks

See Zulip.

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
 -/
-import Mathlib.AlgebraicGeometry.LocallyRingedSpace
+import Mathlib.Geometry.RingedSpace.LocallyRingedSpace
 import Mathlib.AlgebraicGeometry.StructureSheaf
 import Mathlib.RingTheory.Localization.LocalizationLocalization
 import Mathlib.Topology.Sheaves.SheafCondition.Sites
perf (AlgebraicGeometry): tricks to mildly improve performance (#7306)

These changes mildly improve performance. They are put in place until AlgebraicGeometry is refactored.

Diff
@@ -328,7 +328,7 @@ def SpecΓIdentity : Spec.toLocallyRingedSpace.rightOp ⋙ Γ ≅ 𝟭 _ :=
   Iso.symm <| NatIso.ofComponents (fun R =>
     -- Porting note : In Lean3, this `IsIso` is synthesized automatically
     letI : IsIso (toSpecΓ R) := StructureSheaf.isIso_to_global _
-    asIso (toSpecΓ R)) fun {X Y} f => by exact Spec_Γ_naturality (R := X) (S := Y) f
+    asIso (toSpecΓ R)) fun {X Y} f => by convert Spec_Γ_naturality (R := X) (S := Y) f
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec_Γ_identity AlgebraicGeometry.SpecΓIdentity
 
chore: fix grammar mistakes (#6121)
Diff
@@ -316,7 +316,7 @@ set_option linter.uppercaseLean3 false in
 @[reassoc]
 theorem Spec_Γ_naturality {R S : CommRingCat} (f : R ⟶ S) :
     f ≫ toSpecΓ S = toSpecΓ R ≫ Γ.map (Spec.toLocallyRingedSpace.map f.op).op := by
-  -- Porting note : `ext` failed to pickup one the three lemmas
+  -- Porting note : `ext` failed to pick up one of the three lemmas
   refine RingHom.ext fun x => Subtype.ext <| funext fun x' => ?_; symm;
   apply Localization.localRingHom_to_map
 set_option linter.uppercaseLean3 false in
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) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
-
-! This file was ported from Lean 3 source module algebraic_geometry.Spec
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.AlgebraicGeometry.LocallyRingedSpace
 import Mathlib.AlgebraicGeometry.StructureSheaf
@@ -15,6 +10,8 @@ import Mathlib.Topology.Sheaves.SheafCondition.Sites
 import Mathlib.Topology.Sheaves.Functors
 import Mathlib.Algebra.Module.LocalizedModule
 
+#align_import algebraic_geometry.Spec from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
+
 /-!
 # $Spec$ as a functor to locally ringed spaces.
 
chore: bump to nightly-2023-07-01 (#5409)

Open in Gitpod

Co-authored-by: Komyyy <pol_tta@outlook.jp> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -190,8 +190,6 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
         toOpen R U ≫ β.c.app (op U)) :
     α = β := by
   ext : 1
-  -- See https://github.com/leanprover/std4/pull/158
-  swap
   · exact w
   · apply
       ((TopCat.Sheaf.pushforward β.base).obj X.sheaf).hom_ext _ PrimeSpectrum.isBasis_basic_opens
chore: fix focusing dots (#5708)

This PR is the result of running

find . -type f -name "*.lean" -exec sed -i -E 's/^( +)\. /\1· /' {} \;
find . -type f -name "*.lean" -exec sed -i -E 'N;s/^( +·)\n +(.*)$/\1 \2/;P;D' {} \;

which firstly replaces . focusing dots with · and secondly removes isolated instances of such dots, unifying them with the following line. A new rule is placed in the style linter to verify this.

Diff
@@ -420,7 +420,7 @@ theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
           ⟨p, hpr⟩ _).trans e
   set s' := (Spec.topMap (algebraMap R S) _* (structureSheaf S).1).map (homOfLE hrU).op s with h
   replace e : ((Spec.topMap (algebraMap R S) _* (structureSheaf S).val).germ ⟨p, hpr⟩) s' = y
-  . rw [h]; exact e
+  · rw [h]; exact e
   clear_value s'; clear! U
   obtain ⟨⟨s, ⟨_, n, rfl⟩⟩, hsn⟩ :=
     @IsLocalization.surj _ _ _ _ _ _
feat: more consistent use of ext, and updating porting notes. (#5242)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -189,13 +189,16 @@ theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
       (toOpen R U ≫ α.c.app (op U)) ≫ X.presheaf.map (eqToHom (by rw [w])) =
         toOpen R U ≫ β.c.app (op U)) :
     α = β := by
-  refine PresheafedSpace.ext (α := α) (β := β) w ?_
+  ext : 1
+  -- See https://github.com/leanprover/std4/pull/158
+  swap
+  · exact w
   · apply
       ((TopCat.Sheaf.pushforward β.base).obj X.sheaf).hom_ext _ PrimeSpectrum.isBasis_basic_opens
     intro r
     apply (StructureSheaf.to_basicOpen_epi R r).1
-    specialize h r
     -- Porting note : was a one-liner `simpa using h r`
+    specialize h r
     simp only [sheafedSpaceObj_carrier, Functor.op_obj, unop_op, TopCat.Presheaf.pushforwardObj_obj,
       sheafedSpaceObj_presheaf, Category.assoc] at h
     rw [NatTrans.comp_app, ←h]
chore: add @[ext] lemmas for NatTrans synonyms (#5228)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -117,25 +117,24 @@ set_option linter.uppercaseLean3 false in
 @[simp]
 theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
     Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
-  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <|
-    NatTrans.ext _ _ <|
-      funext fun U => by
-        dsimp
-        erw [NatTrans.comp_app, sheafedSpaceMap_c_app, PresheafedSpace.id_c_app, comap_id]; swap
-        · rw [Spec.topMap_id, TopologicalSpace.Opens.map_id_obj_unop]
-        simp [eqToHom_map]
+  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
+    ext U
+    dsimp
+    erw [NatTrans.comp_app, sheafedSpaceMap_c_app, PresheafedSpace.id_c_app, comap_id]; swap
+    · rw [Spec.topMap_id, TopologicalSpace.Opens.map_id_obj_unop]
+    simp [eqToHom_map]
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec.SheafedSpace_map_id AlgebraicGeometry.Spec.sheafedSpaceMap_id
 
 theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
     Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
-  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <|
-    NatTrans.ext _ _ <| funext fun U => by
-      -- Porting note : was one liner
-      -- `dsimp, rw category_theory.functor.map_id, rw category.comp_id, erw comap_comp f g, refl`
-      rw [NatTrans.comp_app, sheafedSpaceMap_c_app, whiskerRight_app, eqToHom_refl]
-      erw [(sheafedSpaceObj T).presheaf.map_id, Category.comp_id, comap_comp]
-      rfl
+  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <| by
+    ext
+    -- Porting note : was one liner
+    -- `dsimp, rw category_theory.functor.map_id, rw category.comp_id, erw comap_comp f g, refl`
+    rw [NatTrans.comp_app, sheafedSpaceMap_c_app, whiskerRight_app, eqToHom_refl]
+    erw [(sheafedSpaceObj T).presheaf.map_id, Category.comp_id, comap_comp]
+    rfl
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec.SheafedSpace_map_comp AlgebraicGeometry.Spec.sheafedSpaceMap_comp
 
@@ -144,9 +143,9 @@ set_option linter.uppercaseLean3 false in
 @[simps]
 def Spec.toSheafedSpace : CommRingCatᵒᵖ ⥤ SheafedSpace CommRingCat where
   obj R := Spec.sheafedSpaceObj (unop R)
-  map {R S} f := Spec.sheafedSpaceMap f.unop
+  map f := Spec.sheafedSpaceMap f.unop
   map_id R := by dsimp; rw [Spec.sheafedSpaceMap_id]
-  map_comp {R S T} f g := by dsimp; rw [Spec.sheafedSpaceMap_comp]
+  map_comp f g := by dsimp; rw [Spec.sheafedSpaceMap_comp]
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec.to_SheafedSpace AlgebraicGeometry.Spec.toSheafedSpace
 
@@ -185,11 +184,10 @@ set_option linter.uppercaseLean3 false in
 
 theorem Spec.basicOpen_hom_ext {X : RingedSpace.{u}} {R : CommRingCat.{u}}
     {α β : X ⟶ Spec.sheafedSpaceObj R} (w : α.base = β.base)
-    (h :
-      ∀ r : R,
-        let U := PrimeSpectrum.basicOpen r
-        (toOpen R U ≫ α.c.app (op U)) ≫ X.presheaf.map (eqToHom (by rw [w])) =
-          toOpen R U ≫ β.c.app (op U)) :
+    (h : ∀ r : R,
+      let U := PrimeSpectrum.basicOpen r
+      (toOpen R U ≫ α.c.app (op U)) ≫ X.presheaf.map (eqToHom (by rw [w])) =
+        toOpen R U ≫ β.c.app (op U)) :
     α = β := by
   refine PresheafedSpace.ext (α := α) (β := β) w ?_
   · apply
@@ -295,9 +293,9 @@ set_option linter.uppercaseLean3 false in
 @[simps]
 def Spec.toLocallyRingedSpace : CommRingCatᵒᵖ ⥤ LocallyRingedSpace where
   obj R := Spec.locallyRingedSpaceObj (unop R)
-  map {R S} f := Spec.locallyRingedSpaceMap f.unop
+  map f := Spec.locallyRingedSpaceMap f.unop
   map_id R := by dsimp; rw [Spec.locallyRingedSpaceMap_id]
-  map_comp {R S T} f g := by dsimp; rw [Spec.locallyRingedSpaceMap_comp]
+  map_comp f g := by dsimp; rw [Spec.locallyRingedSpaceMap_comp]
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec.to_LocallyRingedSpace AlgebraicGeometry.Spec.toLocallyRingedSpace
 
chore: add links to porting notes (#5111)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -346,6 +346,7 @@ theorem Spec_map_localization_isIso (R : CommRingCat) (M : Submonoid R)
         (Spec.toPresheafedSpace.map (CommRingCat.ofHom (algebraMap R (Localization M))).op) x) := by
   erw [← localRingHom_comp_stalkIso]
   -- Porting note: replaced `apply (config := { instances := false })`.
+  -- See https://github.com/leanprover/lean4/issues/2273
   refine @IsIso.comp_isIso _ _ _ _ _ _ _ _ (?_)
   refine @IsIso.comp_isIso _ _ _ _ _ _ _ (?_) _
   /- I do not know why this is defeq to the goal, but I'm happy to accept that it is. -/
chore: tidy various files (#5104)
Diff
@@ -24,16 +24,16 @@ We define the functor $Spec$ from commutative rings to locally ringed spaces.
 
 We define $Spec$ in three consecutive steps, each with more structure than the last:
 
-1. `Spec.to_Top`, valued in the category of topological spaces,
-2. `Spec.to_SheafedSpace`, valued in the category of sheafed spaces and
-3. `Spec.to_LocallyRingedSpace`, valued in the category of locally ringed spaces.
+1. `Spec.toTop`, valued in the category of topological spaces,
+2. `Spec.toSheafedSpace`, valued in the category of sheafed spaces and
+3. `Spec.toLocallyRingedSpace`, valued in the category of locally ringed spaces.
 
-Additionally, we provide `Spec.to_PresheafedSpace` as a composition of `Spec.to_SheafedSpace` with
+Additionally, we provide `Spec.toPresheafedSpace` as a composition of `Spec.toSheafedSpace` with
 a forgetful functor.
 
 ## Related results
 
-The adjunction `Γ ⊣ Spec` is constructed in `algebraic_geometry/Gamma_Spec_adjunction.lean`.
+The adjunction `Γ ⊣ Spec` is constructed in `Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean`.
 
 -/
 
@@ -230,8 +230,8 @@ theorem stalkMap_toStalk {R S : CommRingCat} (f : R ⟶ S) (p : PrimeSpectrum S)
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.stalk_map_to_stalk AlgebraicGeometry.stalkMap_toStalk
 
-/-- Under the isomorphisms `stalk_iso`, the map `stalk_map (Spec.SheafedSpace_map f) p` corresponds
-to the induced local ring homomorphism `localization.local_ring_hom`.
+/-- Under the isomorphisms `stalkIso`, the map `stalkMap (Spec.sheafedSpaceMap f) p` corresponds
+to the induced local ring homomorphism `Localization.localRingHom`.
 -/
 @[elementwise]
 theorem localRingHom_comp_stalkIso {R S : CommRingCat} (f : R ⟶ S) (p : PrimeSpectrum S) :
@@ -305,7 +305,7 @@ section SpecΓ
 
 open AlgebraicGeometry.LocallyRingedSpace
 
-/-- The counit morphism `R ⟶ Γ(Spec R)` given by `algebraic_geometry.structure_sheaf.to_open`.  -/
+/-- The counit morphism `R ⟶ Γ(Spec R)` given by `AlgebraicGeometry.StructureSheaf.toOpen`.  -/
 @[simps!]
 def toSpecΓ (R : CommRingCat) : R ⟶ Γ.obj (op (Spec.toLocallyRingedSpace.obj (op R))) :=
   StructureSheaf.toOpen R ⊤
@@ -326,7 +326,7 @@ theorem Spec_Γ_naturality {R S : CommRingCat} (f : R ⟶ S) :
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec_Γ_naturality AlgebraicGeometry.Spec_Γ_naturality
 
-/-- The counit (`Spec_Γ_identity.inv.op`) of the adjunction `Γ ⊣ Spec` is an isomorphism. -/
+/-- The counit (`SpecΓIdentity.inv.op`) of the adjunction `Γ ⊣ Spec` is an isomorphism. -/
 @[simps! hom_app inv_app]
 def SpecΓIdentity : Spec.toLocallyRingedSpace.rightOp ⋙ Γ ≅ 𝟭 _ :=
   Iso.symm <| NatIso.ofComponents (fun R =>
@@ -345,19 +345,14 @@ theorem Spec_map_localization_isIso (R : CommRingCat) (M : Submonoid R)
       (PresheafedSpace.stalkMap
         (Spec.toPresheafedSpace.map (CommRingCat.ofHom (algebraMap R (Localization M))).op) x) := by
   erw [← localRingHom_comp_stalkIso]
-  -- Porting note : `apply (config := { instances := false })` seems not to exist any more and
-  -- `refine` complains about metavariables, so used a hack
-  set f := _
-  set g := _
-  set h := _
-  change IsIso (f ≫ g ≫ h)
-  haveI hf : IsIso f := inferInstance
-  haveI hg : IsIso g := show
+  -- Porting note: replaced `apply (config := { instances := false })`.
+  refine @IsIso.comp_isIso _ _ _ _ _ _ _ _ (?_)
+  refine @IsIso.comp_isIso _ _ _ _ _ _ _ (?_) _
+  /- I do not know why this is defeq to the goal, but I'm happy to accept that it is. -/
+  show
     IsIso (IsLocalization.localizationLocalizationAtPrimeIsoLocalization M
       x.asIdeal).toRingEquiv.toCommRingCatIso.hom
-    by infer_instance
-  haveI hh : IsIso h := inferInstance
-  apply IsIso.comp_isIso
+  infer_instance
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.Spec_map_localization_is_iso AlgebraicGeometry.Spec_map_localization_isIso
 
@@ -366,7 +361,7 @@ namespace StructureSheaf
 variable {R S : CommRingCat.{u}} (f : R ⟶ S) (p : PrimeSpectrum R)
 
 /-- For an algebra `f : R →+* S`, this is the ring homomorphism `S →+* (f∗ 𝒪ₛ)ₚ` for a `p : Spec R`.
-This is shown to be the localization at `p` in `is_localized_module_to_pushforward_stalk_alg_hom`.
+This is shown to be the localization at `p` in `isLocalizedModule_toPushforwardStalkAlgHom`.
 -/
 def toPushforwardStalk : S ⟶ (Spec.topMap f _* (structureSheaf S).1).stalk p :=
   StructureSheaf.toOpen S ⊤ ≫
@@ -400,7 +395,7 @@ variable (R S)
 variable [Algebra R S]
 
 /--
-This is the `alg_hom` version of `to_pushforward_stalk`, which is the map `S ⟶ (f∗ 𝒪ₛ)ₚ` for some
+This is the `AlgHom` version of `toPushforwardStalk`, which is the map `S ⟶ (f∗ 𝒪ₛ)ₚ` for some
 algebra `R ⟶ S` and some `p : Spec R`.
 -/
 @[simps!]
@@ -410,7 +405,7 @@ def toPushforwardStalkAlgHom :
 set_option linter.uppercaseLean3 false in
 #align algebraic_geometry.structure_sheaf.to_pushforward_stalk_alg_hom AlgebraicGeometry.StructureSheaf.toPushforwardStalkAlgHom
 
-theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
+theorem isLocalizedModule_toPushforwardStalkAlgHom_aux (y) :
     ∃ x : S × p.asIdeal.primeCompl, x.2 • y = toPushforwardStalkAlgHom R S p x.1 := by
   obtain ⟨U, hp, s, e⟩ := TopCat.Presheaf.germ_exist
     -- Porting note : originally the first variable does not need to be explicit
@@ -443,7 +438,7 @@ theorem is_localized_module_toPushforwardStalkAlgHom_aux (y) :
   rw [← map_pow (algebraMap R S)] at hsn
   congr 1
 set_option linter.uppercaseLean3 false in
-#align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.is_localized_module_toPushforwardStalkAlgHom_aux
+#align algebraic_geometry.structure_sheaf.is_localized_module_to_pushforward_stalk_alg_hom_aux AlgebraicGeometry.StructureSheaf.isLocalizedModule_toPushforwardStalkAlgHom_aux
 
 instance isLocalizedModule_toPushforwardStalkAlgHom :
     IsLocalizedModule p.asIdeal.primeCompl (toPushforwardStalkAlgHom R S p).toLinearMap := by
@@ -452,7 +447,7 @@ instance isLocalizedModule_toPushforwardStalkAlgHom :
     change IsUnit ((TopCat.Presheaf.stalkFunctor CommRingCat p).map
       (Spec.sheafedSpaceMap (algebraMap ↑R ↑S)).c _)
     exact (IsLocalization.map_units ((structureSheaf R).presheaf.stalk p) ⟨x, hx⟩).map _
-  · apply is_localized_module_toPushforwardStalkAlgHom_aux
+  · apply isLocalizedModule_toPushforwardStalkAlgHom_aux
   · intro x hx
     rw [toPushforwardStalkAlgHom_apply, ←(toPushforwardStalk (algebraMap R S) p).map_zero,
       toPushforwardStalk] at hx
feat: port AlgebraicGeometry.Spec (#4599)

Dependencies 11 + 903

904 files ported (98.8%)
372776 lines ported (98.6%)
Show graph

The unported dependencies are