topology.sheaves.stalksMathlib.Topology.Sheaves.Stalks

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)

(last sync)

chore(topology/sheaves): revert universe generalizations from #19153 (#19230)

This reverts commit 13361559.

These are just too difficult to forward port as is because of the max u v =?= max u ?v issue https://github.com/leanprover/lean4/issues/2297.

We have another candidate approach to this, using a new UnivLE typeclass, and I would prefer if we investigated that without the pressure of the port at the same time.

This will delay @hrmacbeth's plans to define meromorphic functions, perhaps.

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

Diff
@@ -419,7 +419,7 @@ begin
   choose V m i₁ i₂ heq using λ x : U, F.presheaf.germ_eq x.1 x.2 x.2 s t (h x),
   -- Since `F` is a sheaf, we can prove the equality locally, if we can show that these
   -- neighborhoods form a cover of `U`.
-  apply Top.sheaf.eq_of_locally_eq'.{u v v} F V U i₁,
+  apply F.eq_of_locally_eq' V U i₁,
   { intros x hxU,
     rw [opens.mem_supr],
     exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩ },
@@ -488,9 +488,9 @@ begin
     rw [opens.mem_supr],
     exact ⟨⟨x, hxU⟩, mV ⟨x, hxU⟩⟩ },
   -- Since `F` is a sheaf, we can glue all the local preimages together to get a global preimage.
-  obtain ⟨s, s_spec, -⟩ := Top.sheaf.exists_unique_gluing'.{u v v} F V U iVU V_cover sf _,
+  obtain ⟨s, s_spec, -⟩ := F.exists_unique_gluing' V U iVU V_cover sf _,
   { use s,
-    apply Top.sheaf.eq_of_locally_eq'.{u v v} G V U iVU V_cover,
+    apply G.eq_of_locally_eq' V U iVU V_cover,
     intro x,
     rw [← comp_apply, ← f.1.naturality, comp_apply, s_spec, heq] },
   { intros x y,

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

chore(topology/sheaves/*): universe generalizations (#19153)

Necessary but sadly insufficient for the request at https://leanprover.zulipchat.com/#narrow/stream/144837-PR-reviews/topic/.2319146.20sheaves.20on.20manifolds

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

Diff
@@ -419,7 +419,7 @@ begin
   choose V m i₁ i₂ heq using λ x : U, F.presheaf.germ_eq x.1 x.2 x.2 s t (h x),
   -- Since `F` is a sheaf, we can prove the equality locally, if we can show that these
   -- neighborhoods form a cover of `U`.
-  apply F.eq_of_locally_eq' V U i₁,
+  apply Top.sheaf.eq_of_locally_eq'.{u v v} F V U i₁,
   { intros x hxU,
     rw [opens.mem_supr],
     exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩ },
@@ -488,9 +488,9 @@ begin
     rw [opens.mem_supr],
     exact ⟨⟨x, hxU⟩, mV ⟨x, hxU⟩⟩ },
   -- Since `F` is a sheaf, we can glue all the local preimages together to get a global preimage.
-  obtain ⟨s, s_spec, -⟩ := F.exists_unique_gluing' V U iVU V_cover sf _,
+  obtain ⟨s, s_spec, -⟩ := Top.sheaf.exists_unique_gluing'.{u v v} F V U iVU V_cover sf _,
   { use s,
-    apply G.eq_of_locally_eq' V U iVU V_cover,
+    apply Top.sheaf.eq_of_locally_eq'.{u v v} G V U iVU V_cover,
     intro x,
     rw [← comp_apply, ← f.1.naturality, comp_apply, s_spec, heq] },
   { intros x y,

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -485,7 +485,8 @@ theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F
 #align Top.presheaf.stalk_functor_map_injective_of_app_injective TopCat.Presheaf.stalkFunctor_map_injective_of_app_injective
 -/
 
-variable [HasLimits C] [PreservesLimits (forget C)] [ReflectsIsomorphisms (forget C)]
+variable [HasLimits C] [PreservesLimits (forget C)]
+  [CategoryTheory.Functor.ReflectsIsomorphisms (forget C)]
 
 #print TopCat.Presheaf.section_ext /-
 /-- Let `F` be a sheaf valued in a concrete category, whose forgetful functor reflects isomorphisms,
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2019 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
 -/
-import Topology.Category.Top.OpenNhds
+import Topology.Category.TopCat.OpenNhds
 import Topology.Sheaves.Presheaf
 import Topology.Sheaves.SheafCondition.UniqueGluing
 import CategoryTheory.Adjunction.Evaluation
@@ -12,7 +12,7 @@ import CategoryTheory.Limits.Preserves.Filtered
 import CategoryTheory.Limits.Final
 import Tactic.Elementwise
 import Algebra.Category.Ring.Colimits
-import CategoryTheory.Sites.Pushforward
+import CategoryTheory.Sites.Pullback
 
 #align_import topology.sheaves.stalks from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
 
Diff
@@ -476,9 +476,9 @@ theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F
   by
   rcases germ_exist F x s with ⟨U₁, hxU₁, s, rfl⟩
   rcases germ_exist F x t with ⟨U₂, hxU₂, t, rfl⟩
-  simp only [stalk_functor_map_germ_apply _ ⟨x, _⟩] at hst 
+  simp only [stalk_functor_map_germ_apply _ ⟨x, _⟩] at hst
   obtain ⟨W, hxW, iWU₁, iWU₂, heq⟩ := G.germ_eq x hxU₁ hxU₂ _ _ hst
-  rw [← comp_apply, ← comp_apply, ← f.naturality, ← f.naturality, comp_apply, comp_apply] at heq 
+  rw [← comp_apply, ← comp_apply, ← f.naturality, ← f.naturality, comp_apply, comp_apply] at heq
   replace heq := h W HEq
   convert congr_arg (F.germ ⟨x, hxW⟩) HEq
   exacts [(F.germ_res_apply iWU₁ ⟨x, hxW⟩ s).symm, (F.germ_res_apply iWU₂ ⟨x, hxW⟩ t).symm]
@@ -625,7 +625,7 @@ theorem app_surjective_of_stalkFunctor_map_bijective {F G : Sheaf C X} (f : F 
   -- ... and this preimage must come from some section `s₁` defined on some open neighborhood `V₁`
   obtain ⟨V₁, hxV₁, s₁, hs₁⟩ := F.presheaf.germ_exist x.1 s₀
   subst hs₁; rename' hs₀ => hs₁
-  erw [stalk_functor_map_germ_apply V₁ ⟨x.1, hxV₁⟩ f.1 s₁] at hs₁ 
+  erw [stalk_functor_map_germ_apply V₁ ⟨x.1, hxV₁⟩ f.1 s₁] at hs₁
   -- Now, the germ of `f.app (op V₁) s₁` equals the germ of `t`, hence they must coincide on
   -- some open neighborhood `V₂`.
   obtain ⟨V₂, hxV₂, iV₂V₁, iV₂U, heq⟩ := G.presheaf.germ_eq x.1 hxV₁ x.2 _ _ hs₁
Diff
@@ -3,16 +3,16 @@ Copyright (c) 2019 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Justus Springer
 -/
-import Mathbin.Topology.Category.Top.OpenNhds
-import Mathbin.Topology.Sheaves.Presheaf
-import Mathbin.Topology.Sheaves.SheafCondition.UniqueGluing
-import Mathbin.CategoryTheory.Adjunction.Evaluation
-import Mathbin.CategoryTheory.Limits.Types
-import Mathbin.CategoryTheory.Limits.Preserves.Filtered
-import Mathbin.CategoryTheory.Limits.Final
-import Mathbin.Tactic.Elementwise
-import Mathbin.Algebra.Category.Ring.Colimits
-import Mathbin.CategoryTheory.Sites.Pushforward
+import Topology.Category.Top.OpenNhds
+import Topology.Sheaves.Presheaf
+import Topology.Sheaves.SheafCondition.UniqueGluing
+import CategoryTheory.Adjunction.Evaluation
+import CategoryTheory.Limits.Types
+import CategoryTheory.Limits.Preserves.Filtered
+import CategoryTheory.Limits.Final
+import Tactic.Elementwise
+import Algebra.Category.Ring.Colimits
+import CategoryTheory.Sites.Pushforward
 
 #align_import topology.sheaves.stalks from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
 
Diff
@@ -364,12 +364,12 @@ theorem germ_stalkSpecializes (F : X.Presheaf C) {U : Opens X} {y : U} {x : X} (
 #align Top.presheaf.germ_stalk_specializes TopCat.Presheaf.germ_stalkSpecializes
 -/
 
-#print TopCat.Presheaf.germ_stalk_specializes' /-
+#print TopCat.Presheaf.germ_stalkSpecializes' /-
 @[simp, reassoc, elementwise]
-theorem germ_stalk_specializes' (F : X.Presheaf C) {U : Opens X} {x y : X} (h : x ⤳ y)
-    (hy : y ∈ U) : F.germ ⟨y, hy⟩ ≫ F.stalkSpecializes h = F.germ ⟨x, h.mem_open U.IsOpen hy⟩ :=
+theorem germ_stalkSpecializes' (F : X.Presheaf C) {U : Opens X} {x y : X} (h : x ⤳ y) (hy : y ∈ U) :
+    F.germ ⟨y, hy⟩ ≫ F.stalkSpecializes h = F.germ ⟨x, h.mem_open U.IsOpen hy⟩ :=
   colimit.ι_desc _ _
-#align Top.presheaf.germ_stalk_specializes' TopCat.Presheaf.germ_stalk_specializes'
+#align Top.presheaf.germ_stalk_specializes' TopCat.Presheaf.germ_stalkSpecializes'
 -/
 
 #print TopCat.Presheaf.stalkSpecializes_refl /-
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2019 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 topology.sheaves.stalks
-! leanprover-community/mathlib commit 5dc6092d09e5e489106865241986f7f2ad28d4c8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Topology.Category.Top.OpenNhds
 import Mathbin.Topology.Sheaves.Presheaf
@@ -19,6 +14,8 @@ import Mathbin.Tactic.Elementwise
 import Mathbin.Algebra.Category.Ring.Colimits
 import Mathbin.CategoryTheory.Sites.Pushforward
 
+#align_import topology.sheaves.stalks from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
+
 /-!
 # Stalks
 
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 topology.sheaves.stalks
-! leanprover-community/mathlib commit 13361559d66b84f80b6d5a1c4a26aa5054766725
+! leanprover-community/mathlib commit 5dc6092d09e5e489106865241986f7f2ad28d4c8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -502,7 +502,7 @@ theorem section_ext (F : Sheaf C X) (U : Opens X) (s t : F.1.obj (op U))
   choose V m i₁ i₂ heq using fun x : U => F.presheaf.germ_eq x.1 x.2 x.2 s t (h x)
   -- Since `F` is a sheaf, we can prove the equality locally, if we can show that these
   -- neighborhoods form a cover of `U`.
-  apply TopCat.Sheaf.eq_of_locally_eq'.{u, v, v} F V U i₁
+  apply F.eq_of_locally_eq' V U i₁
   · intro x hxU
     rw [opens.mem_supr]
     exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩
@@ -597,9 +597,9 @@ theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f :
     rw [opens.mem_supr]
     exact ⟨⟨x, hxU⟩, mV ⟨x, hxU⟩⟩
   -- Since `F` is a sheaf, we can glue all the local preimages together to get a global preimage.
-  obtain ⟨s, s_spec, -⟩ := TopCat.Sheaf.existsUnique_gluing'.{u, v, v} F V U iVU V_cover sf _
+  obtain ⟨s, s_spec, -⟩ := F.exists_unique_gluing' V U iVU V_cover sf _
   · use s
-    apply TopCat.Sheaf.eq_of_locally_eq'.{u, v, v} G V U iVU V_cover
+    apply G.eq_of_locally_eq' V U iVU V_cover
     intro x
     rw [← comp_apply, ← f.1.naturality, comp_apply, s_spec, HEq]
   · intro x y
Diff
@@ -313,7 +313,7 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
   inv_hom_id' :=
     by
     delta stalk_pullback_hom stalk_pullback_inv stalk_functor presheaf.pullback stalk_pushforward
-    ext (U j)
+    ext U j
     induction U using Opposite.rec'
     cases U; cases j; rcases j_right with ⟨⟨⟩⟩
     erw [colimit.map_desc, colimit.map_desc, colimit.ι_desc_assoc, colimit.ι_desc_assoc,
Diff
@@ -79,10 +79,12 @@ namespace TopCat.Presheaf
 
 variable (C)
 
+#print TopCat.Presheaf.stalkFunctor /-
 /-- Stalks are functorial with respect to morphisms of presheaves over a fixed `X`. -/
 def stalkFunctor (x : X) : X.Presheaf C ⥤ C :=
   (whiskeringLeft _ _ C).obj (OpenNhds.inclusion x).op ⋙ colim
 #align Top.presheaf.stalk_functor TopCat.Presheaf.stalkFunctor
+-/
 
 variable {C}
 
@@ -95,25 +97,32 @@ def stalk (ℱ : X.Presheaf C) (x : X) : C :=
 #align Top.presheaf.stalk TopCat.Presheaf.stalk
 -/
 
+#print TopCat.Presheaf.stalkFunctor_obj /-
 -- -- colimit ((open_nhds.inclusion x).op ⋙ ℱ)
 @[simp]
 theorem stalkFunctor_obj (ℱ : X.Presheaf C) (x : X) : (stalkFunctor C x).obj ℱ = ℱ.stalk x :=
   rfl
 #align Top.presheaf.stalk_functor_obj TopCat.Presheaf.stalkFunctor_obj
+-/
 
+#print TopCat.Presheaf.germ /-
 /-- The germ of a section of a presheaf over an open at a point of that open.
 -/
 def germ (F : X.Presheaf C) {U : Opens X} (x : U) : F.obj (op U) ⟶ stalk F x :=
   colimit.ι ((OpenNhds.inclusion x.1).op ⋙ F) (op ⟨U, x.2⟩)
 #align Top.presheaf.germ TopCat.Presheaf.germ
+-/
 
+#print TopCat.Presheaf.germ_res /-
 @[simp, elementwise]
 theorem germ_res (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) :
     F.map i.op ≫ germ F x = germ F (i x : V) :=
   let i' : (⟨U, x.2⟩ : OpenNhds x.1) ⟶ ⟨V, (i x : V).2⟩ := i
   colimit.w ((OpenNhds.inclusion x.1).op ⋙ F) i'.op
 #align Top.presheaf.germ_res TopCat.Presheaf.germ_res
+-/
 
+#print TopCat.Presheaf.stalk_hom_ext /-
 /-- A morphism from the stalk of `F` at `x` to some object `Y` is completely determined by its
 composition with the `germ` morphisms.
 -/
@@ -121,15 +130,19 @@ theorem stalk_hom_ext (F : X.Presheaf C) {x} {Y : C} {f₁ f₂ : F.stalk x ⟶
     (ih : ∀ (U : Opens X) (hxU : x ∈ U), F.germ ⟨x, hxU⟩ ≫ f₁ = F.germ ⟨x, hxU⟩ ≫ f₂) : f₁ = f₂ :=
   colimit.hom_ext fun U => by induction U using Opposite.rec'; cases' U with U hxU; exact ih U hxU
 #align Top.presheaf.stalk_hom_ext TopCat.Presheaf.stalk_hom_ext
+-/
 
+#print TopCat.Presheaf.stalkFunctor_map_germ /-
 @[simp, reassoc, elementwise]
 theorem stalkFunctor_map_germ {F G : X.Presheaf C} (U : Opens X) (x : U) (f : F ⟶ G) :
     germ F x ≫ (stalkFunctor C x.1).map f = f.app (op U) ≫ germ G x :=
   colimit.ι_map (whiskerLeft (OpenNhds.inclusion x.1).op f) (op ⟨U, x.2⟩)
 #align Top.presheaf.stalk_functor_map_germ TopCat.Presheaf.stalkFunctor_map_germ
+-/
 
 variable (C)
 
+#print TopCat.Presheaf.stalkPushforward /-
 /-- For a presheaf `F` on a space `X`, a continuous map `f : X ⟶ Y` induces a morphisms between the
 stalk of `f _ * F` at `f x` and the stalk of `F` at `x`.
 -/
@@ -141,7 +154,9 @@ def stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) (x : X) : (f _* F).stalk (
   exact colimit.pre _ (open_nhds.map f x).op
   exact colim.map (whisker_right (nat_trans.op (open_nhds.inclusion_map_iso f x).inv) F)
 #align Top.presheaf.stalk_pushforward TopCat.Presheaf.stalkPushforward
+-/
 
+#print TopCat.Presheaf.stalkPushforward_germ /-
 @[simp, elementwise, reassoc]
 theorem stalkPushforward_germ (f : X ⟶ Y) (F : X.Presheaf C) (U : Opens Y)
     (x : (Opens.map f).obj U) : (f _* F).germ ⟨f x, x.2⟩ ≫ F.stalkPushforward C f x = F.germ x :=
@@ -150,6 +165,7 @@ theorem stalkPushforward_germ (f : X ⟶ Y) (F : X.Presheaf C) (U : Opens Y)
   erw [CategoryTheory.Functor.map_id, category.id_comp]
   rfl
 #align Top.presheaf.stalk_pushforward_germ TopCat.Presheaf.stalkPushforward_germ
+-/
 
 -- Here are two other potential solutions, suggested by @fpvandoorn at
 -- <https://github.com/leanprover-community/mathlib/pull/1018#discussion_r283978240>
@@ -169,6 +185,7 @@ namespace StalkPushforward
 attribute [local tidy] tactic.op_induction'
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic tactic.op_induction' -/
+#print TopCat.Presheaf.stalkPushforward.id /-
 @[simp]
 theorem id (ℱ : X.Presheaf C) (x : X) :
     ℱ.stalkPushforward C (𝟙 X) x = (stalkFunctor C x).map (Pushforward.id ℱ).Hom :=
@@ -184,7 +201,9 @@ theorem id (ℱ : X.Presheaf C) (x : X) :
   -- FIXME A simp lemma which unfortunately doesn't fire:
   erw [CategoryTheory.Functor.map_id]
 #align Top.presheaf.stalk_pushforward.id TopCat.Presheaf.stalkPushforward.id
+-/
 
+#print TopCat.Presheaf.stalkPushforward.comp /-
 -- This proof is sadly not at all robust:
 -- having to use `erw` at all is a bad sign.
 @[simp]
@@ -203,7 +222,9 @@ theorem comp (ℱ : X.Presheaf C) (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) :
     colimit.ι_pre, colimit.ι_pre]
   rfl
 #align Top.presheaf.stalk_pushforward.comp TopCat.Presheaf.stalkPushforward.comp
+-/
 
+#print TopCat.Presheaf.stalkPushforward.stalkPushforward_iso_of_openEmbedding /-
 theorem stalkPushforward_iso_of_openEmbedding {f : X ⟶ Y} (hf : OpenEmbedding f) (F : X.Presheaf C)
     (x : X) : IsIso (F.stalkPushforward _ f x) :=
   by
@@ -231,18 +252,22 @@ theorem stalkPushforward_iso_of_openEmbedding {f : X ⟶ Y} (hf : OpenEmbedding
     refine' ((hom_of_le _).op : op (unop U) ⟶ _)
     exact Set.image_preimage_subset _ _
 #align Top.presheaf.stalk_pushforward.stalk_pushforward_iso_of_open_embedding TopCat.Presheaf.stalkPushforward.stalkPushforward_iso_of_openEmbedding
+-/
 
 end StalkPushforward
 
 section StalkPullback
 
+#print TopCat.Presheaf.stalkPullbackHom /-
 /-- The morphism `ℱ_{f x} ⟶ (f⁻¹ℱ)ₓ` that factors through `(f_*f⁻¹ℱ)_{f x}`. -/
 def stalkPullbackHom (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     F.stalk (f x) ⟶ (pullbackObj f F).stalk x :=
   (stalkFunctor _ (f x)).map ((pushforwardPullbackAdjunction C f).Unit.app F) ≫
     stalkPushforward _ _ _ x
 #align Top.presheaf.stalk_pullback_hom TopCat.Presheaf.stalkPullbackHom
+-/
 
+#print TopCat.Presheaf.germToPullbackStalk /-
 /-- The morphism `(f⁻¹ℱ)(U) ⟶ ℱ_{f(x)}` for some `U ∋ x`. -/
 def germToPullbackStalk (f : X ⟶ Y) (F : Y.Presheaf C) (U : Opens X) (x : U) :
     (pullbackObj f F).obj (op U) ⟶ F.stalk (f x) :=
@@ -252,6 +277,7 @@ def germToPullbackStalk (f : X ⟶ Y) (F : Y.Presheaf C) (U : Opens X) (x : U) :
         { app := fun V => F.germ ⟨f x, V.Hom.unop.le x.2⟩
           naturality' := fun _ _ i => by erw [category.comp_id]; exact F.germ_res i.left.unop _ } }
 #align Top.presheaf.germ_to_pullback_stalk TopCat.Presheaf.germToPullbackStalk
+-/
 
 #print TopCat.Presheaf.stalkPullbackInv /-
 /-- The morphism `(f⁻¹ℱ)ₓ ⟶ ℱ_{f(x)}`. -/
@@ -265,6 +291,7 @@ def stalkPullbackInv (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
 #align Top.presheaf.stalk_pullback_inv TopCat.Presheaf.stalkPullbackInv
 -/
 
+#print TopCat.Presheaf.stalkPullbackIso /-
 /-- The isomorphism `ℱ_{f(x)} ≅ (f⁻¹ℱ)ₓ`. -/
 def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     F.stalk (f x) ≅ (pullbackObj f F).stalk x
@@ -306,6 +333,7 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     delta costructured_arrow.mk
     congr
 #align Top.presheaf.stalk_pullback_iso TopCat.Presheaf.stalkPullbackIso
+-/
 
 end StalkPullback
 
@@ -331,44 +359,56 @@ noncomputable def stalkSpecializes (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
 #align Top.presheaf.stalk_specializes TopCat.Presheaf.stalkSpecializes
 -/
 
+#print TopCat.Presheaf.germ_stalkSpecializes /-
 @[simp, reassoc, elementwise]
 theorem germ_stalkSpecializes (F : X.Presheaf C) {U : Opens X} {y : U} {x : X} (h : x ⤳ y) :
     F.germ y ≫ F.stalkSpecializes h = F.germ (⟨x, h.mem_open U.IsOpen y.Prop⟩ : U) :=
   colimit.ι_desc _ _
 #align Top.presheaf.germ_stalk_specializes TopCat.Presheaf.germ_stalkSpecializes
+-/
 
+#print TopCat.Presheaf.germ_stalk_specializes' /-
 @[simp, reassoc, elementwise]
 theorem germ_stalk_specializes' (F : X.Presheaf C) {U : Opens X} {x y : X} (h : x ⤳ y)
     (hy : y ∈ U) : F.germ ⟨y, hy⟩ ≫ F.stalkSpecializes h = F.germ ⟨x, h.mem_open U.IsOpen hy⟩ :=
   colimit.ι_desc _ _
 #align Top.presheaf.germ_stalk_specializes' TopCat.Presheaf.germ_stalk_specializes'
+-/
 
+#print TopCat.Presheaf.stalkSpecializes_refl /-
 @[simp]
 theorem stalkSpecializes_refl {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
     (F : X.Presheaf C) (x : X) : F.stalkSpecializes (specializes_refl x) = 𝟙 _ :=
   F.stalk_hom_ext fun _ _ => by dsimp; simpa
 #align Top.presheaf.stalk_specializes_refl TopCat.Presheaf.stalkSpecializes_refl
+-/
 
+#print TopCat.Presheaf.stalkSpecializes_comp /-
 @[simp, reassoc, elementwise]
 theorem stalkSpecializes_comp {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
     (F : X.Presheaf C) {x y z : X} (h : x ⤳ y) (h' : y ⤳ z) :
     F.stalkSpecializes h' ≫ F.stalkSpecializes h = F.stalkSpecializes (h.trans h') :=
   F.stalk_hom_ext fun _ _ => by simp
 #align Top.presheaf.stalk_specializes_comp TopCat.Presheaf.stalkSpecializes_comp
+-/
 
+#print TopCat.Presheaf.stalkSpecializes_stalkFunctor_map /-
 @[simp, reassoc, elementwise]
 theorem stalkSpecializes_stalkFunctor_map {F G : X.Presheaf C} (f : F ⟶ G) {x y : X} (h : x ⤳ y) :
     F.stalkSpecializes h ≫ (stalkFunctor C x).map f =
       (stalkFunctor C y).map f ≫ G.stalkSpecializes h :=
   by ext; delta stalk_functor; simpa [stalk_specializes]
 #align Top.presheaf.stalk_specializes_stalk_functor_map TopCat.Presheaf.stalkSpecializes_stalkFunctor_map
+-/
 
+#print TopCat.Presheaf.stalkSpecializes_stalkPushforward /-
 @[simp, reassoc, elementwise]
 theorem stalkSpecializes_stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     (f _* F).stalkSpecializes (f.map_specializes h) ≫ F.stalkPushforward _ f x =
       F.stalkPushforward _ f y ≫ F.stalkSpecializes h :=
   by ext; delta stalk_pushforward; simpa [stalk_specializes]
 #align Top.presheaf.stalk_specializes_stalk_pushforward TopCat.Presheaf.stalkSpecializes_stalkPushforward
+-/
 
 #print TopCat.Presheaf.stalkCongr /-
 /-- The stalks are isomorphic on inseparable points -/
@@ -389,15 +429,18 @@ variable [ConcreteCategory.{v} C]
 
 attribute [local instance] concrete_category.has_coe_to_sort concrete_category.has_coe_to_fun
 
+#print TopCat.Presheaf.germ_ext /-
 @[ext]
 theorem germ_ext (F : X.Presheaf C) {U V : Opens X} {x : X} {hxU : x ∈ U} {hxV : x ∈ V}
     (W : Opens X) (hxW : x ∈ W) (iWU : W ⟶ U) (iWV : W ⟶ V) {sU : F.obj (op U)} {sV : F.obj (op V)}
     (ih : F.map iWU.op sU = F.map iWV.op sV) : F.germ ⟨x, hxU⟩ sU = F.germ ⟨x, hxV⟩ sV := by
   erw [← F.germ_res iWU ⟨x, hxW⟩, ← F.germ_res iWV ⟨x, hxW⟩, comp_apply, comp_apply, ih]
 #align Top.presheaf.germ_ext TopCat.Presheaf.germ_ext
+-/
 
 variable [PreservesFilteredColimits (forget C)]
 
+#print TopCat.Presheaf.germ_exist /-
 /--
 For presheaves valued in a concrete category whose forgetful functor preserves filtered colimits,
 every element of the stalk is the germ of a section.
@@ -414,7 +457,9 @@ theorem germ_exist (F : X.Presheaf C) (x : X) (t : stalk F x) :
   intro s e
   exact ⟨V, m, s, e⟩
 #align Top.presheaf.germ_exist TopCat.Presheaf.germ_exist
+-/
 
+#print TopCat.Presheaf.germ_eq /-
 theorem germ_eq (F : X.Presheaf C) {U V : Opens X} (x : X) (mU : x ∈ U) (mV : x ∈ V)
     (s : F.obj (op U)) (t : F.obj (op V)) (h : germ F ⟨x, mU⟩ s = germ F ⟨x, mV⟩ t) :
     ∃ (W : Opens X) (m : x ∈ W) (iU : W ⟶ U) (iV : W ⟶ V), F.map iU.op s = F.map iV.op t :=
@@ -425,7 +470,9 @@ theorem germ_eq (F : X.Presheaf C) {U V : Opens X} (x : X) (mU : x ∈ U) (mV :
       h
   exact ⟨(unop W).1, (unop W).2, iU.unop, iV.unop, e⟩
 #align Top.presheaf.germ_eq TopCat.Presheaf.germ_eq
+-/
 
+#print TopCat.Presheaf.stalkFunctor_map_injective_of_app_injective /-
 theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F ⟶ G)
     (h : ∀ U : Opens X, Function.Injective (f.app (op U))) (x : X) :
     Function.Injective ((stalkFunctor C x).map f) := fun s t hst =>
@@ -439,9 +486,11 @@ theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F
   convert congr_arg (F.germ ⟨x, hxW⟩) HEq
   exacts [(F.germ_res_apply iWU₁ ⟨x, hxW⟩ s).symm, (F.germ_res_apply iWU₂ ⟨x, hxW⟩ t).symm]
 #align Top.presheaf.stalk_functor_map_injective_of_app_injective TopCat.Presheaf.stalkFunctor_map_injective_of_app_injective
+-/
 
 variable [HasLimits C] [PreservesLimits (forget C)] [ReflectsIsomorphisms (forget C)]
 
+#print TopCat.Presheaf.section_ext /-
 /-- Let `F` be a sheaf valued in a concrete category, whose forgetful functor reflects isomorphisms,
 preserves limits and filtered colimits. Then two sections who agree on every stalk must be equal.
 -/
@@ -460,7 +509,9 @@ theorem section_ext (F : Sheaf C X) (U : Opens X) (s t : F.1.obj (op U))
   · intro x
     rw [HEq, Subsingleton.elim (i₁ x) (i₂ x)]
 #align Top.presheaf.section_ext TopCat.Presheaf.section_ext
+-/
 
+#print TopCat.Presheaf.app_injective_of_stalkFunctor_map_injective /-
 /-
 Note that the analogous statement for surjectivity is false: Surjectivity on stalks does not
 imply surjectivity of the components of a sheaf morphism. However it does imply that the morphism
@@ -472,7 +523,9 @@ theorem app_injective_of_stalkFunctor_map_injective {F : Sheaf C X} {G : Preshea
   section_ext F _ _ _ fun x =>
     h x <| by rw [stalk_functor_map_germ_apply, stalk_functor_map_germ_apply, hst]
 #align Top.presheaf.app_injective_of_stalk_functor_map_injective TopCat.Presheaf.app_injective_of_stalkFunctor_map_injective
+-/
 
+#print TopCat.Presheaf.app_injective_iff_stalkFunctor_map_injective /-
 theorem app_injective_iff_stalkFunctor_map_injective {F : Sheaf C X} {G : Presheaf C X}
     (f : F.1 ⟶ G) :
     (∀ x : X, Function.Injective ((stalkFunctor C x).map f)) ↔
@@ -480,7 +533,9 @@ theorem app_injective_iff_stalkFunctor_map_injective {F : Sheaf C X} {G : Preshe
   ⟨fun h U => app_injective_of_stalkFunctor_map_injective f U fun x => h x.1,
     stalkFunctor_map_injective_of_app_injective f⟩
 #align Top.presheaf.app_injective_iff_stalk_functor_map_injective TopCat.Presheaf.app_injective_iff_stalkFunctor_map_injective
+-/
 
+#print TopCat.Presheaf.stalkFunctor_preserves_mono /-
 instance stalkFunctor_preserves_mono (x : X) :
     Functor.PreservesMonomorphisms (Sheaf.forget C X ⋙ stalkFunctor C x) :=
   ⟨fun 𝓐 𝓑 f m =>
@@ -493,12 +548,16 @@ instance stalkFunctor_preserves_mono (x : X) :
               op c))
         x⟩
 #align Top.presheaf.stalk_functor_preserves_mono TopCat.Presheaf.stalkFunctor_preserves_mono
+-/
 
+#print TopCat.Presheaf.stalk_mono_of_mono /-
 theorem stalk_mono_of_mono {F G : Sheaf C X} (f : F ⟶ G) [Mono f] :
     ∀ x, Mono <| (stalkFunctor C x).map f.1 := fun x => by
   convert functor.map_mono (Sheaf.forget.{v} C X ⋙ stalk_functor C x) f
 #align Top.presheaf.stalk_mono_of_mono TopCat.Presheaf.stalk_mono_of_mono
+-/
 
+#print TopCat.Presheaf.mono_of_stalk_mono /-
 theorem mono_of_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) [∀ x, Mono <| (stalkFunctor C x).map f.1] :
     Mono f :=
   (Sheaf.Hom.mono_iff_presheaf_mono _ _ _).mpr <|
@@ -507,12 +566,16 @@ theorem mono_of_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) [∀ x, Mono <| (stal
         app_injective_of_stalkFunctor_map_injective f.1 U.unop fun ⟨x, hx⟩ =>
           (ConcreteCategory.mono_iff_injective_of_preservesPullback _).mp <| inferInstance
 #align Top.presheaf.mono_of_stalk_mono TopCat.Presheaf.mono_of_stalk_mono
+-/
 
+#print TopCat.Presheaf.mono_iff_stalk_mono /-
 theorem mono_iff_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) :
     Mono f ↔ ∀ x, Mono ((stalkFunctor C x).map f.1) :=
   ⟨by intro m; exact stalk_mono_of_mono _, by intro m; exact mono_of_stalk_mono _⟩
 #align Top.presheaf.mono_iff_stalk_mono TopCat.Presheaf.mono_iff_stalk_mono
+-/
 
+#print TopCat.Presheaf.app_surjective_of_injective_of_locally_surjective /-
 /-- For surjectivity, we are given an arbitrary section `t` and need to find a preimage for it.
 We claim that it suffices to find preimages *locally*. That is, for each `x : U` we construct
 a neighborhood `V ≤ U` and a section `s : F.obj (op V))` such that `f.app (op V) s` and `t`
@@ -551,7 +614,9 @@ theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f :
     simp_rw [← comp_apply, f.1.naturality, comp_apply, HEq, ← comp_apply, ← G.1.map_comp]
     rfl
 #align Top.presheaf.app_surjective_of_injective_of_locally_surjective TopCat.Presheaf.app_surjective_of_injective_of_locally_surjective
+-/
 
+#print TopCat.Presheaf.app_surjective_of_stalkFunctor_map_bijective /-
 theorem app_surjective_of_stalkFunctor_map_bijective {F G : Sheaf C X} (f : F ⟶ G) (U : Opens X)
     (h : ∀ x : U, Function.Bijective ((stalkFunctor C x.val).map f.1)) :
     Function.Surjective (f.1.app (op U)) :=
@@ -571,14 +636,18 @@ theorem app_surjective_of_stalkFunctor_map_bijective {F G : Sheaf C X} (f : F 
   use V₂, hxV₂, iV₂U, F.1.map iV₂V₁.op s₁
   rw [← comp_apply, f.1.naturality, comp_apply, HEq]
 #align Top.presheaf.app_surjective_of_stalk_functor_map_bijective TopCat.Presheaf.app_surjective_of_stalkFunctor_map_bijective
+-/
 
+#print TopCat.Presheaf.app_bijective_of_stalkFunctor_map_bijective /-
 theorem app_bijective_of_stalkFunctor_map_bijective {F G : Sheaf C X} (f : F ⟶ G) (U : Opens X)
     (h : ∀ x : U, Function.Bijective ((stalkFunctor C x.val).map f.1)) :
     Function.Bijective (f.1.app (op U)) :=
   ⟨app_injective_of_stalkFunctor_map_injective f.1 U fun x => (h x).1,
     app_surjective_of_stalkFunctor_map_bijective f U h⟩
 #align Top.presheaf.app_bijective_of_stalk_functor_map_bijective TopCat.Presheaf.app_bijective_of_stalkFunctor_map_bijective
+-/
 
+#print TopCat.Presheaf.app_isIso_of_stalkFunctor_map_iso /-
 theorem app_isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G) (U : Opens X)
     [∀ x : U, IsIso ((stalkFunctor C x.val).map f.1)] : IsIso (f.1.app (op U)) :=
   by
@@ -592,7 +661,9 @@ theorem app_isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G) (U : O
   apply (is_iso_iff_bijective _).mp
   exact functor.map_is_iso (forget C) ((stalk_functor C x.1).map f.1)
 #align Top.presheaf.app_is_iso_of_stalk_functor_map_iso TopCat.Presheaf.app_isIso_of_stalkFunctor_map_iso
+-/
 
+#print TopCat.Presheaf.isIso_of_stalkFunctor_map_iso /-
 -- Making this an instance would cause a loop in typeclass resolution with `functor.map_is_iso`
 /-- Let `F` and `G` be sheaves valued in a concrete category, whose forgetful functor reflects
 isomorphisms, preserves limits and filtered colimits. Then if the stalk maps of a morphism
@@ -610,7 +681,9 @@ theorem isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G)
   intro U; induction U using Opposite.rec'
   apply app_is_iso_of_stalk_functor_map_iso
 #align Top.presheaf.is_iso_of_stalk_functor_map_iso TopCat.Presheaf.isIso_of_stalkFunctor_map_iso
+-/
 
+#print TopCat.Presheaf.isIso_iff_stalkFunctor_map_iso /-
 /-- Let `F` and `G` be sheaves valued in a concrete category, whose forgetful functor reflects
 isomorphisms, preserves limits and filtered colimits. Then a morphism `f : F ⟶ G` is an
 isomorphism if and only if all of its stalk maps are isomorphisms.
@@ -624,17 +697,20 @@ theorem isIso_iff_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G) :
   · intro h
     exact is_iso_of_stalk_functor_map_iso f
 #align Top.presheaf.is_iso_iff_stalk_functor_map_iso TopCat.Presheaf.isIso_iff_stalkFunctor_map_iso
+-/
 
 end Concrete
 
 instance (F : X.Presheaf CommRingCat) {U : Opens X} (x : U) : Algebra (F.obj <| op U) (F.stalk x) :=
   (F.germ x).toAlgebra
 
+#print TopCat.Presheaf.stalk_open_algebraMap /-
 @[simp]
 theorem stalk_open_algebraMap {X : TopCat} (F : X.Presheaf CommRingCat) {U : Opens X} (x : U) :
     algebraMap (F.obj <| op U) (F.stalk x) = F.germ x :=
   rfl
 #align Top.presheaf.stalk_open_algebra_map TopCat.Presheaf.stalk_open_algebraMap
+-/
 
 end TopCat.Presheaf
 
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 topology.sheaves.stalks
-! leanprover-community/mathlib commit 61b5e2755ccb464b68d05a9acf891ae04992d09d
+! leanprover-community/mathlib commit 13361559d66b84f80b6d5a1c4a26aa5054766725
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -253,6 +253,7 @@ def germToPullbackStalk (f : X ⟶ Y) (F : Y.Presheaf C) (U : Opens X) (x : U) :
           naturality' := fun _ _ i => by erw [category.comp_id]; exact F.germ_res i.left.unop _ } }
 #align Top.presheaf.germ_to_pullback_stalk TopCat.Presheaf.germToPullbackStalk
 
+#print TopCat.Presheaf.stalkPullbackInv /-
 /-- The morphism `(f⁻¹ℱ)ₓ ⟶ ℱ_{f(x)}`. -/
 def stalkPullbackInv (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     (pullbackObj f F).stalk x ⟶ F.stalk (f x) :=
@@ -262,6 +263,7 @@ def stalkPullbackInv (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
         { app := fun U => F.germToPullbackStalk _ f (unop U).1 ⟨x, (unop U).2⟩
           naturality' := fun _ _ _ => by erw [colimit.pre_desc, category.comp_id]; congr } }
 #align Top.presheaf.stalk_pullback_inv TopCat.Presheaf.stalkPullbackInv
+-/
 
 /-- The isomorphism `ℱ_{f(x)} ≅ (f⁻¹ℱ)ₓ`. -/
 def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
@@ -451,7 +453,7 @@ theorem section_ext (F : Sheaf C X) (U : Opens X) (s t : F.1.obj (op U))
   choose V m i₁ i₂ heq using fun x : U => F.presheaf.germ_eq x.1 x.2 x.2 s t (h x)
   -- Since `F` is a sheaf, we can prove the equality locally, if we can show that these
   -- neighborhoods form a cover of `U`.
-  apply F.eq_of_locally_eq' V U i₁
+  apply TopCat.Sheaf.eq_of_locally_eq'.{u, v, v} F V U i₁
   · intro x hxU
     rw [opens.mem_supr]
     exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩
@@ -532,9 +534,9 @@ theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f :
     rw [opens.mem_supr]
     exact ⟨⟨x, hxU⟩, mV ⟨x, hxU⟩⟩
   -- Since `F` is a sheaf, we can glue all the local preimages together to get a global preimage.
-  obtain ⟨s, s_spec, -⟩ := F.exists_unique_gluing' V U iVU V_cover sf _
+  obtain ⟨s, s_spec, -⟩ := TopCat.Sheaf.existsUnique_gluing'.{u, v, v} F V U iVU V_cover sf _
   · use s
-    apply G.eq_of_locally_eq' V U iVU V_cover
+    apply TopCat.Sheaf.eq_of_locally_eq'.{u, v, v} G V U iVU V_cover
     intro x
     rw [← comp_apply, ← f.1.naturality, comp_apply, s_spec, HEq]
   · intro x y
Diff
@@ -208,7 +208,8 @@ theorem stalkPushforward_iso_of_openEmbedding {f : X ⟶ Y} (hf : OpenEmbedding
     (x : X) : IsIso (F.stalkPushforward _ f x) :=
   by
   haveI := functor.initial_of_adjunction (hf.is_open_map.adjunction_nhds x)
-  convert is_iso.of_iso
+  convert
+    is_iso.of_iso
       ((functor.final.colimit_iso (hf.is_open_map.functor_nhds x).op
               ((open_nhds.inclusion (f x)).op ⋙ f _* F) :
             _).symm ≪≫
Diff
@@ -270,8 +270,8 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
   inv := stalkPullbackInv _ _ _ _
   hom_inv_id' :=
     by
-    delta
-      stalk_pullback_hom stalk_pullback_inv stalk_functor presheaf.pullback stalk_pushforward germ_to_pullback_stalk germ
+    delta stalk_pullback_hom stalk_pullback_inv stalk_functor presheaf.pullback stalk_pushforward
+      germ_to_pullback_stalk germ
     ext j
     induction j using Opposite.rec'
     cases j
@@ -400,7 +400,7 @@ For presheaves valued in a concrete category whose forgetful functor preserves f
 every element of the stalk is the germ of a section.
 -/
 theorem germ_exist (F : X.Presheaf C) (x : X) (t : stalk F x) :
-    ∃ (U : Opens X)(m : x ∈ U)(s : F.obj (op U)), F.germ ⟨x, m⟩ s = t :=
+    ∃ (U : Opens X) (m : x ∈ U) (s : F.obj (op U)), F.germ ⟨x, m⟩ s = t :=
   by
   obtain ⟨U, s, e⟩ :=
     Types.jointly_surjective.{v, v} _ (is_colimit_of_preserves (forget C) (colimit.is_colimit _)) t
@@ -414,7 +414,7 @@ theorem germ_exist (F : X.Presheaf C) (x : X) (t : stalk F x) :
 
 theorem germ_eq (F : X.Presheaf C) {U V : Opens X} (x : X) (mU : x ∈ U) (mV : x ∈ V)
     (s : F.obj (op U)) (t : F.obj (op V)) (h : germ F ⟨x, mU⟩ s = germ F ⟨x, mV⟩ t) :
-    ∃ (W : Opens X)(m : x ∈ W)(iU : W ⟶ U)(iV : W ⟶ V), F.map iU.op s = F.map iV.op t :=
+    ∃ (W : Opens X) (m : x ∈ W) (iU : W ⟶ U) (iV : W ⟶ V), F.map iU.op s = F.map iV.op t :=
   by
   obtain ⟨W, iU, iV, e⟩ :=
     (Types.FilteredColimit.isColimit_eq_iff.{v, v} _
@@ -429,12 +429,12 @@ theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F
   by
   rcases germ_exist F x s with ⟨U₁, hxU₁, s, rfl⟩
   rcases germ_exist F x t with ⟨U₂, hxU₂, t, rfl⟩
-  simp only [stalk_functor_map_germ_apply _ ⟨x, _⟩] at hst
+  simp only [stalk_functor_map_germ_apply _ ⟨x, _⟩] at hst 
   obtain ⟨W, hxW, iWU₁, iWU₂, heq⟩ := G.germ_eq x hxU₁ hxU₂ _ _ hst
-  rw [← comp_apply, ← comp_apply, ← f.naturality, ← f.naturality, comp_apply, comp_apply] at heq
+  rw [← comp_apply, ← comp_apply, ← f.naturality, ← f.naturality, comp_apply, comp_apply] at heq 
   replace heq := h W HEq
   convert congr_arg (F.germ ⟨x, hxW⟩) HEq
-  exacts[(F.germ_res_apply iWU₁ ⟨x, hxW⟩ s).symm, (F.germ_res_apply iWU₂ ⟨x, hxW⟩ t).symm]
+  exacts [(F.germ_res_apply iWU₁ ⟨x, hxW⟩ s).symm, (F.germ_res_apply iWU₂ ⟨x, hxW⟩ t).symm]
 #align Top.presheaf.stalk_functor_map_injective_of_app_injective TopCat.Presheaf.stalkFunctor_map_injective_of_app_injective
 
 variable [HasLimits C] [PreservesLimits (forget C)] [ReflectsIsomorphisms (forget C)]
@@ -518,7 +518,7 @@ theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f :
     (U : Opens X) (hinj : ∀ x : U, Function.Injective ((stalkFunctor C x.1).map f.1))
     (hsurj :
       ∀ (t) (x : U),
-        ∃ (V : Opens X)(m : x.1 ∈ V)(iVU : V ⟶ U)(s : F.1.obj (op V)),
+        ∃ (V : Opens X) (m : x.1 ∈ V) (iVU : V ⟶ U) (s : F.1.obj (op V)),
           f.1.app (op V) s = G.1.map iVU.op t) :
     Function.Surjective (f.1.app (op U)) := by
   intro t
@@ -560,7 +560,7 @@ theorem app_surjective_of_stalkFunctor_map_bijective {F G : Sheaf C X} (f : F 
   -- ... and this preimage must come from some section `s₁` defined on some open neighborhood `V₁`
   obtain ⟨V₁, hxV₁, s₁, hs₁⟩ := F.presheaf.germ_exist x.1 s₀
   subst hs₁; rename' hs₀ => hs₁
-  erw [stalk_functor_map_germ_apply V₁ ⟨x.1, hxV₁⟩ f.1 s₁] at hs₁
+  erw [stalk_functor_map_germ_apply V₁ ⟨x.1, hxV₁⟩ f.1 s₁] at hs₁ 
   -- Now, the germ of `f.app (op V₁) s₁` equals the germ of `t`, hence they must coincide on
   -- some open neighborhood `V₂`.
   obtain ⟨V₂, hxV₂, iV₂V₁, iV₂U, heq⟩ := G.presheaf.germ_eq x.1 hxV₁ x.2 _ _ hs₁
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 topology.sheaves.stalks
-! leanprover-community/mathlib commit e2e38c005fc6f715502490da6cb0ec84df9ed228
+! leanprover-community/mathlib commit 61b5e2755ccb464b68d05a9acf891ae04992d09d
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -22,6 +22,9 @@ import Mathbin.CategoryTheory.Sites.Pushforward
 /-!
 # Stalks
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 For a presheaf `F` on a topological space `X`, valued in some category `C`, the *stalk* of `F`
 at the point `x : X` is defined as the colimit of the composition of the inclusion of categories
 `(nhds x)ᵒᵖ ⥤ (opens X)ᵒᵖ` and the functor `F : (opens X)ᵒᵖ ⥤ C`.
@@ -83,12 +86,14 @@ def stalkFunctor (x : X) : X.Presheaf C ⥤ C :=
 
 variable {C}
 
+#print TopCat.Presheaf.stalk /-
 /-- The stalk of a presheaf `F` at a point `x` is calculated as the colimit of the functor
 nbhds x ⥤ opens F.X ⥤ C
 -/
 def stalk (ℱ : X.Presheaf C) (x : X) : C :=
   (stalkFunctor C x).obj ℱ
 #align Top.presheaf.stalk TopCat.Presheaf.stalk
+-/
 
 -- -- colimit ((open_nhds.inclusion x).op ⋙ ℱ)
 @[simp]
@@ -305,6 +310,7 @@ section StalkSpecializes
 
 variable {C}
 
+#print TopCat.Presheaf.stalkSpecializes /-
 /-- If `x` specializes to `y`, then there is a natural map `F.stalk y ⟶ F.stalk x`. -/
 noncomputable def stalkSpecializes (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     F.stalk y ⟶ F.stalk x := by
@@ -320,6 +326,7 @@ noncomputable def stalkSpecializes (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     let V' : open_nhds x := ⟨_, (specializes_iff_forall_open.mp h _ (unop V).1.2 (unop V).2 : _)⟩
     exact colimit.w ((open_nhds.inclusion x).op ⋙ F) (show V' ⟶ U' from i.unop).op
 #align Top.presheaf.stalk_specializes TopCat.Presheaf.stalkSpecializes
+-/
 
 @[simp, reassoc, elementwise]
 theorem germ_stalkSpecializes (F : X.Presheaf C) {U : Opens X} {y : U} {x : X} (h : x ⤳ y) :
@@ -360,12 +367,14 @@ theorem stalkSpecializes_stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) {x y
   by ext; delta stalk_pushforward; simpa [stalk_specializes]
 #align Top.presheaf.stalk_specializes_stalk_pushforward TopCat.Presheaf.stalkSpecializes_stalkPushforward
 
+#print TopCat.Presheaf.stalkCongr /-
 /-- The stalks are isomorphic on inseparable points -/
 @[simps]
 def stalkCongr {X : TopCat} {C : Type _} [Category C] [HasColimits C] (F : X.Presheaf C) {x y : X}
     (e : Inseparable x y) : F.stalk x ≅ F.stalk y :=
   ⟨F.stalkSpecializes e.ge, F.stalkSpecializes e.le, by simp, by simp⟩
 #align Top.presheaf.stalk_congr TopCat.Presheaf.stalkCongr
+-/
 
 end StalkSpecializes
 
Diff
@@ -114,10 +114,7 @@ composition with the `germ` morphisms.
 -/
 theorem stalk_hom_ext (F : X.Presheaf C) {x} {Y : C} {f₁ f₂ : F.stalk x ⟶ Y}
     (ih : ∀ (U : Opens X) (hxU : x ∈ U), F.germ ⟨x, hxU⟩ ≫ f₁ = F.germ ⟨x, hxU⟩ ≫ f₂) : f₁ = f₂ :=
-  colimit.hom_ext fun U => by
-    induction U using Opposite.rec'
-    cases' U with U hxU
-    exact ih U hxU
+  colimit.hom_ext fun U => by induction U using Opposite.rec'; cases' U with U hxU; exact ih U hxU
 #align Top.presheaf.stalk_hom_ext TopCat.Presheaf.stalk_hom_ext
 
 @[simp, reassoc, elementwise]
@@ -217,9 +214,7 @@ theorem stalkPushforward_iso_of_openEmbedding {f : X ⟶ Y} (hf : OpenEmbedding
       refine' F.map_iso (eq_to_iso _)
       dsimp only [functor.op]
       exact congr_arg op (opens.ext <| Set.preimage_image_eq (unop U).1.1 hf.inj)
-    · intro U V i
-      erw [← F.map_comp, ← F.map_comp]
-      congr
+    · intro U V i; erw [← F.map_comp, ← F.map_comp]; congr
   · ext U
     rw [← iso.comp_inv_eq]
     erw [colimit.ι_map_assoc]
@@ -249,9 +244,7 @@ def germToPullbackStalk (f : X ⟶ Y) (F : Y.Presheaf C) (U : Opens X) (x : U) :
     { pt := F.stalk (f x)
       ι :=
         { app := fun V => F.germ ⟨f x, V.Hom.unop.le x.2⟩
-          naturality' := fun _ _ i => by
-            erw [category.comp_id]
-            exact F.germ_res i.left.unop _ } }
+          naturality' := fun _ _ i => by erw [category.comp_id]; exact F.germ_res i.left.unop _ } }
 #align Top.presheaf.germ_to_pullback_stalk TopCat.Presheaf.germToPullbackStalk
 
 /-- The morphism `(f⁻¹ℱ)ₓ ⟶ ℱ_{f(x)}`. -/
@@ -261,10 +254,7 @@ def stalkPullbackInv (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     { pt := F.stalk (f x)
       ι :=
         { app := fun U => F.germToPullbackStalk _ f (unop U).1 ⟨x, (unop U).2⟩
-          naturality' := fun _ _ _ =>
-            by
-            erw [colimit.pre_desc, category.comp_id]
-            congr } }
+          naturality' := fun _ _ _ => by erw [colimit.pre_desc, category.comp_id]; congr } }
 #align Top.presheaf.stalk_pullback_inv TopCat.Presheaf.stalkPullbackInv
 
 /-- The isomorphism `ℱ_{f(x)} ≅ (f⁻¹ℱ)ₓ`. -/
@@ -346,9 +336,7 @@ theorem germ_stalk_specializes' (F : X.Presheaf C) {U : Opens X} {x y : X} (h :
 @[simp]
 theorem stalkSpecializes_refl {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
     (F : X.Presheaf C) (x : X) : F.stalkSpecializes (specializes_refl x) = 𝟙 _ :=
-  F.stalk_hom_ext fun _ _ => by
-    dsimp
-    simpa
+  F.stalk_hom_ext fun _ _ => by dsimp; simpa
 #align Top.presheaf.stalk_specializes_refl TopCat.Presheaf.stalkSpecializes_refl
 
 @[simp, reassoc, elementwise]
@@ -362,20 +350,14 @@ theorem stalkSpecializes_comp {C : Type _} [Category C] [Limits.HasColimits C] {
 theorem stalkSpecializes_stalkFunctor_map {F G : X.Presheaf C} (f : F ⟶ G) {x y : X} (h : x ⤳ y) :
     F.stalkSpecializes h ≫ (stalkFunctor C x).map f =
       (stalkFunctor C y).map f ≫ G.stalkSpecializes h :=
-  by
-  ext
-  delta stalk_functor
-  simpa [stalk_specializes]
+  by ext; delta stalk_functor; simpa [stalk_specializes]
 #align Top.presheaf.stalk_specializes_stalk_functor_map TopCat.Presheaf.stalkSpecializes_stalkFunctor_map
 
 @[simp, reassoc, elementwise]
 theorem stalkSpecializes_stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     (f _* F).stalkSpecializes (f.map_specializes h) ≫ F.stalkPushforward _ f x =
       F.stalkPushforward _ f y ≫ F.stalkSpecializes h :=
-  by
-  ext
-  delta stalk_pushforward
-  simpa [stalk_specializes]
+  by ext; delta stalk_pushforward; simpa [stalk_specializes]
 #align Top.presheaf.stalk_specializes_stalk_pushforward TopCat.Presheaf.stalkSpecializes_stalkPushforward
 
 /-- The stalks are isomorphic on inseparable points -/
@@ -516,11 +498,7 @@ theorem mono_of_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) [∀ x, Mono <| (stal
 
 theorem mono_iff_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) :
     Mono f ↔ ∀ x, Mono ((stalkFunctor C x).map f.1) :=
-  ⟨by
-    intro m
-    exact stalk_mono_of_mono _, by
-    intro m
-    exact mono_of_stalk_mono _⟩
+  ⟨by intro m; exact stalk_mono_of_mono _, by intro m; exact mono_of_stalk_mono _⟩
 #align Top.presheaf.mono_iff_stalk_mono TopCat.Presheaf.mono_iff_stalk_mono
 
 /-- For surjectivity, we are given an arbitrary section `t` and need to find a preimage for it.
@@ -617,8 +595,7 @@ theorem isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G)
   -- We show that all components of `f` are isomorphisms.
   suffices ∀ U : (opens X)ᵒᵖ, is_iso (f.1.app U) by
     exact @nat_iso.is_iso_of_is_iso_app _ _ _ _ F.1 G.1 f.1 this
-  intro U
-  induction U using Opposite.rec'
+  intro U; induction U using Opposite.rec'
   apply app_is_iso_of_stalk_functor_map_iso
 #align Top.presheaf.is_iso_of_stalk_functor_map_iso TopCat.Presheaf.isIso_of_stalkFunctor_map_iso
 
@@ -630,8 +607,7 @@ theorem isIso_iff_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G) :
     IsIso f ↔ ∀ x : X, IsIso ((stalkFunctor C x).map f.1) :=
   by
   constructor
-  · intro h x
-    skip
+  · intro h x; skip
     exact @functor.map_is_iso _ _ _ _ _ _ (stalk_functor C x) f.1 ((sheaf.forget C X).map_isIso f)
   · intro h
     exact is_iso_of_stalk_functor_map_iso f
Diff
@@ -120,7 +120,7 @@ theorem stalk_hom_ext (F : X.Presheaf C) {x} {Y : C} {f₁ f₂ : F.stalk x ⟶
     exact ih U hxU
 #align Top.presheaf.stalk_hom_ext TopCat.Presheaf.stalk_hom_ext
 
-@[simp, reassoc.1, elementwise]
+@[simp, reassoc, elementwise]
 theorem stalkFunctor_map_germ {F G : X.Presheaf C} (U : Opens X) (x : U) (f : F ⟶ G) :
     germ F x ≫ (stalkFunctor C x.1).map f = f.app (op U) ≫ germ G x :=
   colimit.ι_map (whiskerLeft (OpenNhds.inclusion x.1).op f) (op ⟨U, x.2⟩)
@@ -140,7 +140,7 @@ def stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) (x : X) : (f _* F).stalk (
   exact colim.map (whisker_right (nat_trans.op (open_nhds.inclusion_map_iso f x).inv) F)
 #align Top.presheaf.stalk_pushforward TopCat.Presheaf.stalkPushforward
 
-@[simp, elementwise, reassoc.1]
+@[simp, elementwise, reassoc]
 theorem stalkPushforward_germ (f : X ⟶ Y) (F : X.Presheaf C) (U : Opens Y)
     (x : (Opens.map f).obj U) : (f _* F).germ ⟨f x, x.2⟩ ≫ F.stalkPushforward C f x = F.germ x :=
   by
@@ -331,13 +331,13 @@ noncomputable def stalkSpecializes (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     exact colimit.w ((open_nhds.inclusion x).op ⋙ F) (show V' ⟶ U' from i.unop).op
 #align Top.presheaf.stalk_specializes TopCat.Presheaf.stalkSpecializes
 
-@[simp, reassoc.1, elementwise]
+@[simp, reassoc, elementwise]
 theorem germ_stalkSpecializes (F : X.Presheaf C) {U : Opens X} {y : U} {x : X} (h : x ⤳ y) :
     F.germ y ≫ F.stalkSpecializes h = F.germ (⟨x, h.mem_open U.IsOpen y.Prop⟩ : U) :=
   colimit.ι_desc _ _
 #align Top.presheaf.germ_stalk_specializes TopCat.Presheaf.germ_stalkSpecializes
 
-@[simp, reassoc.1, elementwise]
+@[simp, reassoc, elementwise]
 theorem germ_stalk_specializes' (F : X.Presheaf C) {U : Opens X} {x y : X} (h : x ⤳ y)
     (hy : y ∈ U) : F.germ ⟨y, hy⟩ ≫ F.stalkSpecializes h = F.germ ⟨x, h.mem_open U.IsOpen hy⟩ :=
   colimit.ι_desc _ _
@@ -351,14 +351,14 @@ theorem stalkSpecializes_refl {C : Type _} [Category C] [Limits.HasColimits C] {
     simpa
 #align Top.presheaf.stalk_specializes_refl TopCat.Presheaf.stalkSpecializes_refl
 
-@[simp, reassoc.1, elementwise]
+@[simp, reassoc, elementwise]
 theorem stalkSpecializes_comp {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
     (F : X.Presheaf C) {x y z : X} (h : x ⤳ y) (h' : y ⤳ z) :
     F.stalkSpecializes h' ≫ F.stalkSpecializes h = F.stalkSpecializes (h.trans h') :=
   F.stalk_hom_ext fun _ _ => by simp
 #align Top.presheaf.stalk_specializes_comp TopCat.Presheaf.stalkSpecializes_comp
 
-@[simp, reassoc.1, elementwise]
+@[simp, reassoc, elementwise]
 theorem stalkSpecializes_stalkFunctor_map {F G : X.Presheaf C} (f : F ⟶ G) {x y : X} (h : x ⤳ y) :
     F.stalkSpecializes h ≫ (stalkFunctor C x).map f =
       (stalkFunctor C y).map f ≫ G.stalkSpecializes h :=
@@ -368,7 +368,7 @@ theorem stalkSpecializes_stalkFunctor_map {F G : X.Presheaf C} (f : F ⟶ G) {x
   simpa [stalk_specializes]
 #align Top.presheaf.stalk_specializes_stalk_functor_map TopCat.Presheaf.stalkSpecializes_stalkFunctor_map
 
-@[simp, reassoc.1, elementwise]
+@[simp, reassoc, elementwise]
 theorem stalkSpecializes_stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     (f _* F).stalkSpecializes (f.map_specializes h) ≫ F.stalkPushforward _ f x =
       F.stalkPushforward _ f y ≫ F.stalkSpecializes h :=
Diff
@@ -539,7 +539,7 @@ theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f :
   -- preimage under `f` on `V`.
   choose V mV iVU sf heq using hsurj t
   -- These neighborhoods clearly cover all of `U`.
-  have V_cover : U ≤ supᵢ V := by
+  have V_cover : U ≤ iSup V := by
     intro x hxU
     rw [opens.mem_supr]
     exact ⟨⟨x, hxU⟩, mV ⟨x, hxU⟩⟩
Diff
@@ -115,7 +115,7 @@ composition with the `germ` morphisms.
 theorem stalk_hom_ext (F : X.Presheaf C) {x} {Y : C} {f₁ f₂ : F.stalk x ⟶ Y}
     (ih : ∀ (U : Opens X) (hxU : x ∈ U), F.germ ⟨x, hxU⟩ ≫ f₁ = F.germ ⟨x, hxU⟩ ≫ f₂) : f₁ = f₂ :=
   colimit.hom_ext fun U => by
-    induction U using Opposite.rec
+    induction U using Opposite.rec'
     cases' U with U hxU
     exact ih U hxU
 #align Top.presheaf.stalk_hom_ext TopCat.Presheaf.stalk_hom_ext
@@ -192,7 +192,7 @@ theorem comp (ℱ : X.Presheaf C) (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) :
   by
   dsimp [stalk_pushforward, stalk_functor]
   ext U
-  induction U using Opposite.rec
+  induction U using Opposite.rec'
   rcases U with ⟨⟨_, _⟩, _⟩
   simp only [colimit.ι_map_assoc, colimit.ι_pre_assoc, whisker_right_app, category.assoc]
   dsimp
@@ -278,7 +278,7 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     delta
       stalk_pullback_hom stalk_pullback_inv stalk_functor presheaf.pullback stalk_pushforward germ_to_pullback_stalk germ
     ext j
-    induction j using Opposite.rec
+    induction j using Opposite.rec'
     cases j
     simp only [TopologicalSpace.OpenNhds.inclusionMapIso_inv, whisker_right_app, whisker_left_app,
       whiskering_left_obj_map, functor.comp_map, colimit.ι_map_assoc, nat_trans.op_id, Lan_obj_map,
@@ -289,7 +289,7 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     by
     delta stalk_pullback_hom stalk_pullback_inv stalk_functor presheaf.pullback stalk_pushforward
     ext (U j)
-    induction U using Opposite.rec
+    induction U using Opposite.rec'
     cases U; cases j; rcases j_right with ⟨⟨⟩⟩
     erw [colimit.map_desc, colimit.map_desc, colimit.ι_desc_assoc, colimit.ι_desc_assoc,
       colimit.ι_desc, category.comp_id]
@@ -618,7 +618,7 @@ theorem isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G)
   suffices ∀ U : (opens X)ᵒᵖ, is_iso (f.1.app U) by
     exact @nat_iso.is_iso_of_is_iso_app _ _ _ _ F.1 G.1 f.1 this
   intro U
-  induction U using Opposite.rec
+  induction U using Opposite.rec'
   apply app_is_iso_of_stalk_functor_map_iso
 #align Top.presheaf.is_iso_of_stalk_functor_map_iso TopCat.Presheaf.isIso_of_stalkFunctor_map_iso
 
Diff
@@ -206,8 +206,7 @@ theorem stalkPushforward_iso_of_openEmbedding {f : X ⟶ Y} (hf : OpenEmbedding
     (x : X) : IsIso (F.stalkPushforward _ f x) :=
   by
   haveI := functor.initial_of_adjunction (hf.is_open_map.adjunction_nhds x)
-  convert
-    is_iso.of_iso
+  convert is_iso.of_iso
       ((functor.final.colimit_iso (hf.is_open_map.functor_nhds x).op
               ((open_nhds.inclusion (f x)).op ⋙ f _* F) :
             _).symm ≪≫
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 topology.sheaves.stalks
-! leanprover-community/mathlib commit d39590fc8728fbf6743249802486f8c91ffe07bc
+! leanprover-community/mathlib commit e2e38c005fc6f715502490da6cb0ec84df9ed228
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,7 @@ import Mathbin.CategoryTheory.Limits.Preserves.Filtered
 import Mathbin.CategoryTheory.Limits.Final
 import Mathbin.Tactic.Elementwise
 import Mathbin.Algebra.Category.Ring.Colimits
+import Mathbin.CategoryTheory.Sites.Pushforward
 
 /-!
 # Stalks
Diff
@@ -493,7 +493,7 @@ instance stalkFunctor_preserves_mono (x : X) :
     ConcreteCategory.mono_of_injective _ <|
       (app_injective_iff_stalkFunctor_map_injective f.1).mpr
         (fun c =>
-          (@ConcreteCategory.mono_iff_injective_of_preserves_pullback _ _ (f.1.app (op c)) _).mp
+          (@ConcreteCategory.mono_iff_injective_of_preservesPullback _ _ (f.1.app (op c)) _).mp
             ((NatTrans.mono_iff_mono_app _ f.1).mp
                 (@CategoryTheory.presheaf_mono_of_mono _ _ _ _ _ _ _ _ _ _ _ m) <|
               op c))
@@ -509,9 +509,9 @@ theorem mono_of_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) [∀ x, Mono <| (stal
     Mono f :=
   (Sheaf.Hom.mono_iff_presheaf_mono _ _ _).mpr <|
     (NatTrans.mono_iff_mono_app _ _).mpr fun U =>
-      (ConcreteCategory.mono_iff_injective_of_preserves_pullback _).mpr <|
+      (ConcreteCategory.mono_iff_injective_of_preservesPullback _).mpr <|
         app_injective_of_stalkFunctor_map_injective f.1 U.unop fun ⟨x, hx⟩ =>
-          (ConcreteCategory.mono_iff_injective_of_preserves_pullback _).mp <| inferInstance
+          (ConcreteCategory.mono_iff_injective_of_preservesPullback _).mp <| inferInstance
 #align Top.presheaf.mono_of_stalk_mono TopCat.Presheaf.mono_of_stalk_mono
 
 theorem mono_iff_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) :
Diff
@@ -165,7 +165,7 @@ namespace StalkPushforward
 
 attribute [local tidy] tactic.op_induction'
 
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic tactic.op_induction' -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic tactic.op_induction' -/
 @[simp]
 theorem id (ℱ : X.Presheaf C) (x : X) :
     ℱ.stalkPushforward C (𝟙 X) x = (stalkFunctor C x).map (Pushforward.id ℱ).Hom :=
Diff
@@ -246,7 +246,7 @@ def stalkPullbackHom (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
 def germToPullbackStalk (f : X ⟶ Y) (F : Y.Presheaf C) (U : Opens X) (x : U) :
     (pullbackObj f F).obj (op U) ⟶ F.stalk (f x) :=
   colimit.desc (Lan.diagram (Opens.map f).op F (op U))
-    { x := F.stalk (f x)
+    { pt := F.stalk (f x)
       ι :=
         { app := fun V => F.germ ⟨f x, V.Hom.unop.le x.2⟩
           naturality' := fun _ _ i => by
@@ -258,7 +258,7 @@ def germToPullbackStalk (f : X ⟶ Y) (F : Y.Presheaf C) (U : Opens X) (x : U) :
 def stalkPullbackInv (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     (pullbackObj f F).stalk x ⟶ F.stalk (f x) :=
   colimit.desc ((OpenNhds.inclusion x).op ⋙ Presheaf.pullbackObj f F)
-    { x := F.stalk (f x)
+    { pt := F.stalk (f x)
       ι :=
         { app := fun U => F.germToPullbackStalk _ f (unop U).1 ⟨x, (unop U).2⟩
           naturality' := fun _ _ _ =>

Changes in mathlib4

mathlib3
mathlib4
chore: replace refine' that already have a ?_ (#12261)

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

Diff
@@ -140,7 +140,7 @@ stalk of `f _ * F` at `f x` and the stalk of `F` at `x`.
 def stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) (x : X) : (f _* F).stalk (f x) ⟶ F.stalk x := by
   -- This is a hack; Lean doesn't like to elaborate the term written directly.
   -- Porting note: The original proof was `trans; swap`, but `trans` does nothing.
-  refine' ?_ ≫ colimit.pre _ (OpenNhds.map f x).op
+  refine ?_ ≫ colimit.pre _ (OpenNhds.map f x).op
   exact colim.map (whiskerRight (NatTrans.op (OpenNhds.inclusionMapIso f x).inv) F)
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_pushforward TopCat.Presheaf.stalkPushforward
chore(CategoryTheory): move Full, Faithful, EssSurj, IsEquivalence and ReflectsIsomorphisms to the Functor namespace (#11985)

These notions on functors are now Functor.Full, Functor.Faithful, Functor.EssSurj, Functor.IsEquivalence, Functor.ReflectsIsomorphisms. Deprecated aliases are introduced for the previous names.

Diff
@@ -445,7 +445,7 @@ theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_functor_map_injective_of_app_injective TopCat.Presheaf.stalkFunctor_map_injective_of_app_injective
 
-variable [HasLimits C] [PreservesLimits (forget C)] [ReflectsIsomorphisms (forget C)]
+variable [HasLimits C] [PreservesLimits (forget C)] [(forget C).ReflectsIsomorphisms]
 
 /-- Let `F` be a sheaf valued in a concrete category, whose forgetful functor reflects isomorphisms,
 preserves limits and filtered colimits. Then two sections who agree on every stalk must be equal.
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -64,9 +64,7 @@ open TopologicalSpace
 open Opposite
 
 variable {C : Type u} [Category.{v} C]
-
 variable [HasColimits.{v} C]
-
 variable {X Y Z : TopCat.{v}}
 
 namespace TopCat.Presheaf
@@ -388,7 +386,6 @@ end stalkSpecializes
 section Concrete
 
 variable {C}
-
 variable [ConcreteCategory.{v} C]
 
 attribute [local instance] ConcreteCategory.hasCoeToSort
chore: classify todo porting notes (#11216)

Classifies by adding issue number #11215 to porting notes claiming "TODO".

Diff
@@ -395,7 +395,7 @@ attribute [local instance] ConcreteCategory.hasCoeToSort
 -- Porting note: The following does not seem to be needed.
 -- ConcreteCategory.hasCoeToFun
 
--- Porting note: Todo: @[ext] attribute only applies to structures or lemmas proving x = y
+-- Porting note (#11215): TODO: @[ext] attribute only applies to structures or lemmas proving x = y
 -- @[ext]
 theorem germ_ext (F : X.Presheaf C) {U V : Opens X} {x : X} {hxU : x ∈ U} {hxV : x ∈ V}
     (W : Opens X) (hxW : x ∈ W) (iWU : W ⟶ U) (iWV : W ⟶ V) {sU : F.obj (op U)} {sV : F.obj (op V)}
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
@@ -110,7 +110,7 @@ theorem germ_res (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) :
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ_res TopCat.Presheaf.germ_res
 
--- Porting note : `@[elementwise]` did not generate the best lemma when applied to `germ_res`
+-- Porting note: `@[elementwise]` did not generate the best lemma when applied to `germ_res`
 theorem germ_res_apply (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) [ConcreteCategory C]
     (s) : germ F x (F.map i.op s) = germ F (i x) s := by rw [← comp_apply, germ_res]
 set_option linter.uppercaseLean3 false in
refactor: replace some [@foo](https://github.com/foo) _ _ _ _ _ ... by named arguments (#8702)

Using Lean4's named arguments, we manage to remove a few hard-to-read explicit function calls [@foo](https://github.com/foo) _ _ _ _ _ ... which used to be necessary in Lean3.

Occasionally, this results in slightly longer code. The benefit of named arguments is readability, as well as to reduce the brittleness of the code when the argument order is changed.

Co-authored-by: Michael Rothgang <rothgami@math.hu-berlin.de>

Diff
@@ -493,13 +493,13 @@ set_option linter.uppercaseLean3 false in
 
 instance stalkFunctor_preserves_mono (x : X) :
     Functor.PreservesMonomorphisms (Sheaf.forget C X ⋙ stalkFunctor C x) :=
-  ⟨@fun _𝓐 _𝓑 f m =>
+  ⟨@fun _𝓐 _𝓑 f _ =>
     ConcreteCategory.mono_of_injective _ <|
       (app_injective_iff_stalkFunctor_map_injective f.1).mpr
         (fun c =>
           (@ConcreteCategory.mono_iff_injective_of_preservesPullback _ _ _ _ _ (f.1.app (op c))).mp
             ((NatTrans.mono_iff_mono_app _ f.1).mp
-                (@CategoryTheory.presheaf_mono_of_mono _ _ _ _ _ _ _ _ _ _ _ _ _ _ m) <|
+                (CategoryTheory.presheaf_mono_of_mono ..) <|
               op c))
         x⟩
 set_option linter.uppercaseLean3 false in
chore: space after (#8178)

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

Diff
@@ -112,7 +112,7 @@ set_option linter.uppercaseLean3 false in
 
 -- Porting note : `@[elementwise]` did not generate the best lemma when applied to `germ_res`
 theorem germ_res_apply (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) [ConcreteCategory C]
-    (s) : germ F x (F.map i.op s) = germ F (i x) s := by rw [←comp_apply, germ_res]
+    (s) : germ F x (F.map i.op s) = germ F (i x) s := by rw [← comp_apply, germ_res]
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ_res_apply TopCat.Presheaf.germ_res_apply
 
refactor(CategoryTheory/Sites): continuous functors (#8408)

This PR introduces the typeclass Functor.IsContinuous which says that the precomposition with a functor preserves the sheaf condition for Grothendieck topologies. It slightly refactors the previous main theorem about CoverPreserving and CompatiblePreserving functors: it now states that such functors are continuous. The pushforward functor for a continuous functor is defined under the Functor.IsContinuous assumption rather than the combination of both CoverPreserving and CompatiblePreserving. The property CoverLifting is renamed IsCocontinuous and it is made a class. The property IsCoverDense is also made a class.

Co-authored-by: Joël Riou <37772949+joelriou@users.noreply.github.com>

Diff
@@ -12,7 +12,7 @@ import Mathlib.CategoryTheory.Limits.Preserves.Filtered
 import Mathlib.CategoryTheory.Limits.Final
 import Mathlib.Tactic.CategoryTheory.Elementwise
 import Mathlib.Algebra.Category.Ring.Colimits
-import Mathlib.CategoryTheory.Sites.Pushforward
+import Mathlib.CategoryTheory.Sites.Pullback
 
 #align_import topology.sheaves.stalks from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
 
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
@@ -195,7 +195,6 @@ theorem comp (ℱ : X.Presheaf C) (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) :
   change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
   ext U
   rcases U with ⟨⟨_, _⟩, _⟩
-  simp only [colimit.ι_map_assoc, colimit.ι_pre_assoc, whiskerRight_app, Category.assoc]
   simp [stalkFunctor, stalkPushforward]
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_pushforward.comp TopCat.Presheaf.stalkPushforward.comp
@@ -364,7 +363,7 @@ theorem stalkSpecializes_stalkFunctor_map {F G : X.Presheaf C} (f : F ⟶ G) {x
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_specializes_stalk_functor_map TopCat.Presheaf.stalkSpecializes_stalkFunctor_map
 
-@[simp, reassoc, elementwise]
+@[reassoc, elementwise, simp, nolint simpNF] -- see std4#365 for the simpNF issue
 theorem stalkSpecializes_stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     (f _* F).stalkSpecializes (f.map_specializes h) ≫ F.stalkPushforward _ f x =
       F.stalkPushforward _ f y ≫ F.stalkSpecializes h := by
chore: exactly 4 spaces in theorems (#7328)

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

Diff
@@ -112,7 +112,7 @@ set_option linter.uppercaseLean3 false in
 
 -- Porting note : `@[elementwise]` did not generate the best lemma when applied to `germ_res`
 theorem germ_res_apply (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) [ConcreteCategory C]
-  (s) : germ F x (F.map i.op s) = germ F (i x) s := by rw [←comp_apply, germ_res]
+    (s) : germ F x (F.map i.op s) = germ F (i x) s := by rw [←comp_apply, germ_res]
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ_res_apply TopCat.Presheaf.germ_res_apply
 
chore: tidy various files (#7035)
Diff
@@ -332,11 +332,11 @@ set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ_stalk_specializes TopCat.Presheaf.germ_stalkSpecializes
 
 @[reassoc, elementwise nosimp]
-theorem germ_stalk_specializes' (F : X.Presheaf C) {U : Opens X} {x y : X} (h : x ⤳ y)
+theorem germ_stalkSpecializes' (F : X.Presheaf C) {U : Opens X} {x y : X} (h : x ⤳ y)
     (hy : y ∈ U) : F.germ ⟨y, hy⟩ ≫ F.stalkSpecializes h = F.germ ⟨x, h.mem_open U.isOpen hy⟩ :=
   colimit.ι_desc _ _
 set_option linter.uppercaseLean3 false in
-#align Top.presheaf.germ_stalk_specializes' TopCat.Presheaf.germ_stalk_specializes'
+#align Top.presheaf.germ_stalk_specializes' TopCat.Presheaf.germ_stalkSpecializes'
 
 @[simp]
 theorem stalkSpecializes_refl {C : Type*} [Category C] [Limits.HasColimits C] {X : TopCat}
@@ -463,7 +463,7 @@ theorem section_ext (F : Sheaf C X) (U : Opens X) (s t : F.1.obj (op U))
   -- neighborhoods form a cover of `U`.
   apply F.eq_of_locally_eq' V U i₁
   · intro x hxU
-    erw [Opens.mem_iSup]
+    simp only [Opens.coe_iSup, Set.mem_iUnion, SetLike.mem_coe]
     exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩
   · intro x
     rw [heq, Subsingleton.elim (i₁ x) (i₂ x)]
@@ -544,7 +544,7 @@ theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f :
   -- These neighborhoods clearly cover all of `U`.
   have V_cover : U ≤ iSup V := by
     intro x hxU
-    erw [Opens.mem_iSup]
+    simp only [Opens.coe_iSup, Set.mem_iUnion, SetLike.mem_coe]
     exact ⟨⟨x, hxU⟩, mV ⟨x, hxU⟩⟩
   suffices IsCompatible F.val V sf by
     -- Since `F` is a sheaf, we can glue all the local preimages together to get a global preimage.
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -339,7 +339,7 @@ set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ_stalk_specializes' TopCat.Presheaf.germ_stalk_specializes'
 
 @[simp]
-theorem stalkSpecializes_refl {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
+theorem stalkSpecializes_refl {C : Type*} [Category C] [Limits.HasColimits C] {X : TopCat}
     (F : X.Presheaf C) (x : X) : F.stalkSpecializes (specializes_refl x) = 𝟙 _ := by
   ext
   simp
@@ -347,7 +347,7 @@ set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_specializes_refl TopCat.Presheaf.stalkSpecializes_refl
 
 @[reassoc (attr := simp), elementwise (attr := simp)]
-theorem stalkSpecializes_comp {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
+theorem stalkSpecializes_comp {C : Type*} [Category C] [Limits.HasColimits C] {X : TopCat}
     (F : X.Presheaf C) {x y z : X} (h : x ⤳ y) (h' : y ⤳ z) :
     F.stalkSpecializes h' ≫ F.stalkSpecializes h = F.stalkSpecializes (h.trans h') := by
   ext
@@ -378,7 +378,7 @@ set_option linter.uppercaseLean3 false in
 
 /-- The stalks are isomorphic on inseparable points -/
 @[simps]
-def stalkCongr {X : TopCat} {C : Type _} [Category C] [HasColimits C] (F : X.Presheaf C) {x y : X}
+def stalkCongr {X : TopCat} {C : Type*} [Category C] [HasColimits C] (F : X.Presheaf C) {x y : X}
     (e : Inseparable x y) : F.stalk x ≅ F.stalk y :=
   ⟨F.stalkSpecializes e.ge, F.stalkSpecializes e.le, by simp, by simp⟩
 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) 2019 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 topology.sheaves.stalks
-! leanprover-community/mathlib commit 5dc6092d09e5e489106865241986f7f2ad28d4c8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Topology.Category.TopCat.OpenNhds
 import Mathlib.Topology.Sheaves.Presheaf
@@ -19,6 +14,8 @@ import Mathlib.Tactic.CategoryTheory.Elementwise
 import Mathlib.Algebra.Category.Ring.Colimits
 import Mathlib.CategoryTheory.Sites.Pushforward
 
+#align_import topology.sheaves.stalks from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
+
 /-!
 # Stalks
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

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

Diff
@@ -180,7 +180,7 @@ namespace stalkPushforward
 theorem id (ℱ : X.Presheaf C) (x : X) :
     ℱ.stalkPushforward C (𝟙 X) x = (stalkFunctor C x).map (Pushforward.id ℱ).hom := by
   -- Porting note: We need to this to help ext tactic.
-  change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+  change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
   ext1 j
   induction' j with j
   rcases j with ⟨⟨_, _⟩, _⟩
@@ -195,7 +195,7 @@ set_option linter.uppercaseLean3 false in
 theorem comp (ℱ : X.Presheaf C) (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) :
     ℱ.stalkPushforward C (f ≫ g) x =
       (f _* ℱ).stalkPushforward C g (f x) ≫ ℱ.stalkPushforward C f x := by
-  change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+  change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
   ext U
   rcases U with ⟨⟨_, _⟩, _⟩
   simp only [colimit.ι_map_assoc, colimit.ι_pre_assoc, whiskerRight_app, Category.assoc]
@@ -218,7 +218,7 @@ theorem stalkPushforward_iso_of_openEmbedding {f : X ⟶ Y} (hf : OpenEmbedding
       dsimp only [Functor.op]
       exact congr_arg op (Opens.ext <| Set.preimage_image_eq (unop U).1.1 hf.inj)
     · intro U V i; erw [← F.map_comp, ← F.map_comp]; congr 1
-  · change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+  · change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
     ext U
     rw [← Iso.comp_inv_eq]
     erw [colimit.ι_map_assoc]
@@ -274,7 +274,7 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     delta
       stalkPullbackHom stalkPullbackInv stalkFunctor Presheaf.pullback stalkPushforward
       germToPullbackStalk germ
-    change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+    change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
     ext j
     induction' j with j
     cases j
@@ -285,9 +285,9 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
     simp
   inv_hom_id := by
     delta stalkPullbackHom stalkPullbackInv stalkFunctor Presheaf.pullback stalkPushforward
-    change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+    change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
     ext ⟨U_obj, U_property⟩
-    change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+    change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
     ext ⟨j_left, ⟨⟨⟩⟩, j_hom⟩
     erw [colimit.map_desc, colimit.map_desc, colimit.ι_desc_assoc, colimit.ι_desc_assoc,
       colimit.ι_desc, Category.comp_id]
@@ -362,7 +362,7 @@ set_option linter.uppercaseLean3 false in
 theorem stalkSpecializes_stalkFunctor_map {F G : X.Presheaf C} (f : F ⟶ G) {x y : X} (h : x ⤳ y) :
     F.stalkSpecializes h ≫ (stalkFunctor C x).map f =
       (stalkFunctor C y).map f ≫ G.stalkSpecializes h := by
-  change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+  change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
   ext; delta stalkFunctor; simpa [stalkSpecializes] using by rfl
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_specializes_stalk_functor_map TopCat.Presheaf.stalkSpecializes_stalkFunctor_map
@@ -371,7 +371,7 @@ set_option linter.uppercaseLean3 false in
 theorem stalkSpecializes_stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     (f _* F).stalkSpecializes (f.map_specializes h) ≫ F.stalkPushforward _ f x =
       F.stalkPushforward _ f y ≫ F.stalkSpecializes h := by
-  change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
+  change (_ : colimit _ ⟶ _) = (_ : colimit _ ⟶ _)
   ext; delta stalkPushforward
   simp only [stalkSpecializes, colimit.ι_desc_assoc, colimit.ι_map_assoc, colimit.ι_pre,
     Category.assoc, colimit.pre_desc, colimit.ι_desc]
chore: update SHAs after #19153 was reverted (#5712)

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

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 topology.sheaves.stalks
-! leanprover-community/mathlib commit e2e38c005fc6f715502490da6cb0ec84df9ed228
+! leanprover-community/mathlib commit 5dc6092d09e5e489106865241986f7f2ad28d4c8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
feat: port AlgebraicGeometry.AffineScheme (#5394)

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Diff
@@ -644,7 +644,8 @@ set_option linter.uppercaseLean3 false in
 
 end Concrete
 
-instance (F : X.Presheaf CommRingCat) {U : Opens X} (x : U) : Algebra (F.obj <| op U) (F.stalk x) :=
+instance algebra_section_stalk (F : X.Presheaf CommRingCat) {U : Opens X} (x : U) :
+    Algebra (F.obj <| op U) (F.stalk x) :=
   (F.germ x).toAlgebra
 
 @[simp]
feat: more consistent use of ext, and updating porting notes. (#5242)

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

Diff
@@ -122,6 +122,7 @@ set_option linter.uppercaseLean3 false in
 /-- A morphism from the stalk of `F` at `x` to some object `Y` is completely determined by its
 composition with the `germ` morphisms.
 -/
+@[ext]
 theorem stalk_hom_ext (F : X.Presheaf C) {x} {Y : C} {f₁ f₂ : F.stalk x ⟶ Y}
     (ih : ∀ (U : Opens X) (hxU : x ∈ U), F.germ ⟨x, hxU⟩ ≫ f₁ = F.germ ⟨x, hxU⟩ ≫ f₂) : f₁ = f₂ :=
   colimit.hom_ext fun U => by
@@ -342,16 +343,18 @@ set_option linter.uppercaseLean3 false in
 
 @[simp]
 theorem stalkSpecializes_refl {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
-    (F : X.Presheaf C) (x : X) : F.stalkSpecializes (specializes_refl x) = 𝟙 _ :=
-  F.stalk_hom_ext fun _ _ => by dsimp; simp
+    (F : X.Presheaf C) (x : X) : F.stalkSpecializes (specializes_refl x) = 𝟙 _ := by
+  ext
+  simp
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_specializes_refl TopCat.Presheaf.stalkSpecializes_refl
 
 @[reassoc (attr := simp), elementwise (attr := simp)]
 theorem stalkSpecializes_comp {C : Type _} [Category C] [Limits.HasColimits C] {X : TopCat}
     (F : X.Presheaf C) {x y z : X} (h : x ⤳ y) (h' : y ⤳ z) :
-    F.stalkSpecializes h' ≫ F.stalkSpecializes h = F.stalkSpecializes (h.trans h') :=
-  F.stalk_hom_ext fun _ _ => by simp
+    F.stalkSpecializes h' ≫ F.stalkSpecializes h = F.stalkSpecializes (h.trans h') := by
+  ext
+  simp
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_specializes_comp TopCat.Presheaf.stalkSpecializes_comp
 
chore: clean up porting notes about op_induction (#5035)

Closes #4551.

Essentially op_induction is not necessary, now that Opposite.rec' is labelled with @[eliminator]. It would be nice if we could use this from inside aesop, see https://github.com/JLimperg/aesop/issues/59.

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

Diff
@@ -172,9 +172,8 @@ set_option linter.uppercaseLean3 false in
 -- (colim.map (whiskerRight (NatTrans.op (OpenNhds.inclusionMapIso f x).inv) ℱ) :
 --   colim.obj ((OpenNhds.inclusion (f x) ⋙ Opens.map f).op ⋙ ℱ) ⟶ _) ≫
 -- colimit.pre ((OpenNhds.inclusion x).op ⋙ ℱ) (OpenNhds.map f x).op
-namespace stalkPushforward
 
--- Porting note: TODO: attribute [local tidy] tactic.op_induction'
+namespace stalkPushforward
 
 @[simp]
 theorem id (ℱ : X.Presheaf C) (x : X) :
@@ -182,13 +181,10 @@ theorem id (ℱ : X.Presheaf C) (x : X) :
   -- Porting note: We need to this to help ext tactic.
   change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
   ext1 j
-  induction' j using Opposite.rec with j
-  -- Porting note: unsupported non-interactive tactic tactic.op_induction'
-  -- run_tac
-  --   tactic.op_induction'
+  induction' j with j
   rcases j with ⟨⟨_, _⟩, _⟩
   erw [colimit.ι_map_assoc]
-  simpa [stalkFunctor, stalkPushforward] using by rfl
+  simp [stalkFunctor, stalkPushforward]
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_pushforward.id TopCat.Presheaf.stalkPushforward.id
 
feat: change ConcreteCategory.hasCoeToFun to FunLike (#4693)
Diff
@@ -106,7 +106,6 @@ def germ (F : X.Presheaf C) {U : Opens X} (x : U) : F.obj (op U) ⟶ stalk F x :
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ TopCat.Presheaf.germ
 
-@[elementwise (attr := simp)]
 theorem germ_res (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) :
     F.map i.op ≫ germ F x = germ F (i x : V) :=
   let i' : (⟨U, x.2⟩ : OpenNhds x.1) ⟶ ⟨V, (i x : V).2⟩ := i
@@ -114,6 +113,12 @@ theorem germ_res (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) :
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ_res TopCat.Presheaf.germ_res
 
+-- Porting note : `@[elementwise]` did not generate the best lemma when applied to `germ_res`
+theorem germ_res_apply (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) [ConcreteCategory C]
+  (s) : germ F x (F.map i.op s) = germ F (i x) s := by rw [←comp_apply, germ_res]
+set_option linter.uppercaseLean3 false in
+#align Top.presheaf.germ_res_apply TopCat.Presheaf.germ_res_apply
+
 /-- A morphism from the stalk of `F` at `x` to some object `Y` is completely determined by its
 composition with the `germ` morphisms.
 -/
chore: formatting issues (#4947)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -412,7 +412,7 @@ For presheaves valued in a concrete category whose forgetful functor preserves f
 every element of the stalk is the germ of a section.
 -/
 theorem germ_exist (F : X.Presheaf C) (x : X) (t : (stalk.{v, u} F x : Type v)) :
-    ∃ (U : Opens X)(m : x ∈ U)(s : F.obj (op U)), F.germ ⟨x, m⟩ s = t := by
+    ∃ (U : Opens X) (m : x ∈ U) (s : F.obj (op U)), F.germ ⟨x, m⟩ s = t := by
   obtain ⟨U, s, e⟩ :=
     Types.jointly_surjective.{v, v} _ (isColimitOfPreserves (forget C) (colimit.isColimit _)) t
   revert s e
@@ -425,7 +425,7 @@ set_option linter.uppercaseLean3 false in
 
 theorem germ_eq (F : X.Presheaf C) {U V : Opens X} (x : X) (mU : x ∈ U) (mV : x ∈ V)
     (s : F.obj (op U)) (t : F.obj (op V)) (h : germ F ⟨x, mU⟩ s = germ F ⟨x, mV⟩ t) :
-    ∃ (W : Opens X)(_m : x ∈ W)(iU : W ⟶ U)(iV : W ⟶ V), F.map iU.op s = F.map iV.op t := by
+    ∃ (W : Opens X) (_m : x ∈ W) (iU : W ⟶ U) (iV : W ⟶ V), F.map iU.op s = F.map iV.op t := by
   obtain ⟨W, iU, iV, e⟩ :=
     (Types.FilteredColimit.isColimit_eq_iff.{v, v} _
           (isColimitOfPreserves _ (colimit.isColimit ((OpenNhds.inclusion x).op ⋙ F)))).mp h
chore: add space after exacts (#4945)

Too often tempted to change these during other PRs, so doing a mass edit here.

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

Diff
@@ -444,7 +444,7 @@ theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F
   rw [← comp_apply, ← comp_apply, ← f.naturality, ← f.naturality, comp_apply, comp_apply] at heq
   replace heq := h W heq
   convert congr_arg (F.germ ⟨x, hxW⟩) heq using 1
-  exacts[(F.germ_res_apply iWU₁ ⟨x, hxW⟩ s).symm, (F.germ_res_apply iWU₂ ⟨x, hxW⟩ t).symm]
+  exacts [(F.germ_res_apply iWU₁ ⟨x, hxW⟩ s).symm, (F.germ_res_apply iWU₂ ⟨x, hxW⟩ t).symm]
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_functor_map_injective_of_app_injective TopCat.Presheaf.stalkFunctor_map_injective_of_app_injective
 
refactor: fixes to material on sheaves and stalks (#4571)

Mostly this is installing the Opposite.rec' induction principle as the default @[eliminator], but also many other fixes and removing unnecessary steps from proofs.

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

Diff
@@ -195,7 +195,6 @@ theorem comp (ℱ : X.Presheaf C) (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) :
       (f _* ℱ).stalkPushforward C g (f x) ≫ ℱ.stalkPushforward C f x := by
   change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
   ext U
-  induction' U using Opposite.rec' with U
   rcases U with ⟨⟨_, _⟩, _⟩
   simp only [colimit.ι_map_assoc, colimit.ι_pre_assoc, whiskerRight_app, Category.assoc]
   simp [stalkFunctor, stalkPushforward]
@@ -275,7 +274,7 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
       germToPullbackStalk germ
     change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
     ext j
-    induction' j using Opposite.rec' with j
+    induction' j with j
     cases j
     simp only [TopologicalSpace.OpenNhds.inclusionMapIso_inv, whiskerRight_app, whiskerLeft_app,
       whiskeringLeft_obj_map, Functor.comp_map, colimit.ι_map_assoc, NatTrans.op_id, lan_obj_map,
@@ -285,11 +284,9 @@ def stalkPullbackIso (f : X ⟶ Y) (F : Y.Presheaf C) (x : X) :
   inv_hom_id := by
     delta stalkPullbackHom stalkPullbackInv stalkFunctor Presheaf.pullback stalkPushforward
     change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
-    ext U
+    ext ⟨U_obj, U_property⟩
     change (_ : colimit _ ⟶  _) = (_ : colimit _ ⟶  _)
-    ext j
-    induction' U using Opposite.rec' with U
-    cases' U with U_obj U_property; cases' j with j_left j_right j_hom; rcases j_right with ⟨⟨⟩⟩
+    ext ⟨j_left, ⟨⟨⟩⟩, j_hom⟩
     erw [colimit.map_desc, colimit.map_desc, colimit.ι_desc_assoc, colimit.ι_desc_assoc,
       colimit.ι_desc, Category.comp_id]
     simp only [Cocone.whisker_ι, colimit.cocone_ι, OpenNhds.inclusionMapIso_inv,
@@ -316,8 +313,7 @@ variable {C}
 noncomputable def stalkSpecializes (F : X.Presheaf C) {x y : X} (h : x ⤳ y) :
     F.stalk y ⟶ F.stalk x := by
   refine' colimit.desc _ ⟨_, fun U => _, _⟩
-  ·
-    exact
+  · exact
       colimit.ι ((OpenNhds.inclusion x).op ⋙ F)
         (op ⟨(unop U).1, (specializes_iff_forall_open.mp h _ (unop U).1.2 (unop U).2 : _)⟩)
   · intro U V i
@@ -420,9 +416,8 @@ theorem germ_exist (F : X.Presheaf C) (x : X) (t : (stalk.{v, u} F x : Type v))
   obtain ⟨U, s, e⟩ :=
     Types.jointly_surjective.{v, v} _ (isColimitOfPreserves (forget C) (colimit.isColimit _)) t
   revert s e
-  rw [show U = op (unop U) from rfl]
-  generalize unop U = V; clear U
-  cases' V with V m
+  induction U with | h U => ?_
+  cases' U with V m
   intro s e
   exact ⟨V, m, s, e⟩
 set_option linter.uppercaseLean3 false in
@@ -433,8 +428,7 @@ theorem germ_eq (F : X.Presheaf C) {U V : Opens X} (x : X) (mU : x ∈ U) (mV :
     ∃ (W : Opens X)(_m : x ∈ W)(iU : W ⟶ U)(iV : W ⟶ V), F.map iU.op s = F.map iV.op t := by
   obtain ⟨W, iU, iV, e⟩ :=
     (Types.FilteredColimit.isColimit_eq_iff.{v, v} _
-          (isColimitOfPreserves _ (colimit.isColimit ((OpenNhds.inclusion x).op ⋙ F)))).mp
-      h
+          (isColimitOfPreserves _ (colimit.isColimit ((OpenNhds.inclusion x).op ⋙ F)))).mp h
   exact ⟨(unop W).1, (unop W).2, iU.unop, iV.unop, e⟩
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.germ_eq TopCat.Presheaf.germ_eq
@@ -512,8 +506,8 @@ set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_functor_preserves_mono TopCat.Presheaf.stalkFunctor_preserves_mono
 
 theorem stalk_mono_of_mono {F G : Sheaf C X} (f : F ⟶ G) [Mono f] :
-    ∀ x, Mono <| (stalkFunctor C x).map f.1 := fun x => by
-  convert Functor.map_mono (Sheaf.forget.{v} C X ⋙ stalkFunctor C x) f
+    ∀ x, Mono <| (stalkFunctor C x).map f.1 :=
+  fun x => Functor.map_mono (Sheaf.forget.{v} C X ⋙ stalkFunctor C x) f
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.stalk_mono_of_mono TopCat.Presheaf.stalk_mono_of_mono
 
@@ -529,7 +523,7 @@ set_option linter.uppercaseLean3 false in
 
 theorem mono_iff_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) :
     Mono f ↔ ∀ x, Mono ((stalkFunctor C x).map f.1) :=
-  ⟨by intro m; exact stalk_mono_of_mono _, by intro m; exact mono_of_stalk_mono _⟩
+  ⟨fun _ => stalk_mono_of_mono _, fun _ => mono_of_stalk_mono _⟩
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.mono_iff_stalk_mono TopCat.Presheaf.mono_iff_stalk_mono
 
@@ -539,9 +533,7 @@ a neighborhood `V ≤ U` and a section `s : F.obj (op V))` such that `f.app (op
 agree on `V`. -/
 theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f : F ⟶ G)
     (U : Opens X) (hinj : ∀ x : U, Function.Injective ((stalkFunctor C x.1).map f.1))
-    (hsurj :
-      ∀ (t) (x : U),
-        ∃ (V : Opens X)(_m : x.1 ∈ V)(iVU : V ⟶ U)(s : F.1.obj (op V)),
+    (hsurj : ∀ (t) (x : U), ∃ (V : Opens X) (_ : x.1 ∈ V) (iVU : V ⟶ U) (s : F.1.obj (op V)),
           f.1.app (op V) s = G.1.map iVU.op t) :
     Function.Surjective (f.1.app (op U)) := by
   intro t
@@ -629,7 +621,7 @@ theorem isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G)
   -- We show that all components of `f` are isomorphisms.
   suffices ∀ U : (Opens X)ᵒᵖ, IsIso (f.1.app U) by
     exact @NatIso.isIso_of_isIso_app _ _ _ _ F.1 G.1 f.1 this
-  intro U; induction U using Opposite.rec'
+  intro U; induction U
   apply app_isIso_of_stalkFunctor_map_iso
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.is_iso_of_stalk_functor_map_iso TopCat.Presheaf.isIso_of_stalkFunctor_map_iso
@@ -639,12 +631,10 @@ isomorphisms, preserves limits and filtered colimits. Then a morphism `f : F ⟶
 isomorphism if and only if all of its stalk maps are isomorphisms.
 -/
 theorem isIso_iff_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G) :
-    IsIso f ↔ ∀ x : X, IsIso ((stalkFunctor C x).map f.1) := by
-  constructor
-  · intro h x; skip
-    exact @Functor.map_isIso _ _ _ _ _ _ (stalkFunctor C x) f.1 ((Sheaf.forget C X).map_isIso f)
-  · intro h
-    exact isIso_of_stalkFunctor_map_iso f
+    IsIso f ↔ ∀ x : X, IsIso ((stalkFunctor C x).map f.1) :=
+  ⟨fun _ x =>
+    @Functor.map_isIso _ _ _ _ _ _ (stalkFunctor C x) f.1 ((Sheaf.forget C X).map_isIso f),
+   fun _ => isIso_of_stalkFunctor_map_iso f⟩
 set_option linter.uppercaseLean3 false in
 #align Top.presheaf.is_iso_iff_stalk_functor_map_iso TopCat.Presheaf.isIso_iff_stalkFunctor_map_iso
 
chore: fix many typos (#4535)

Run codespell Mathlib and keep some suggestions.

Diff
@@ -561,7 +561,7 @@ theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f :
       intro x
       rw [← comp_apply, ← f.1.naturality, comp_apply, s_spec, heq]
   intro x y
-  -- What's left to show here is that the secions `sf` are compatible, i.e. they agree on
+  -- What's left to show here is that the sections `sf` are compatible, i.e. they agree on
   -- the intersections `V x ⊓ V y`. We prove this by showing that all germs are equal.
   apply section_ext
   intro z
chore: move category theory tactics to Tactic/CategoryTheory (#4461)
Diff
@@ -15,7 +15,7 @@ import Mathlib.CategoryTheory.Adjunction.Evaluation
 import Mathlib.CategoryTheory.Limits.Types
 import Mathlib.CategoryTheory.Limits.Preserves.Filtered
 import Mathlib.CategoryTheory.Limits.Final
-import Mathlib.Tactic.Elementwise
+import Mathlib.Tactic.CategoryTheory.Elementwise
 import Mathlib.Algebra.Category.Ring.Colimits
 import Mathlib.CategoryTheory.Sites.Pushforward
 
feat: port Topology.Sheaves.Stalks (#4449)

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

Dependencies 11 + 777

778 files ported (98.6%)
317412 lines ported (98.3%)
Show graph

The unported dependencies are