topology.category.Profinite.cofiltered_limitMathlib.Topology.Category.Profinite.CofilteredLimit

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -6,8 +6,8 @@ Authors: Adam Topaz
 import Topology.Category.Profinite.Basic
 import Topology.LocallyConstant.Basic
 import Topology.DiscreteQuotient
-import Topology.Category.Top.Limits.Cofiltered
-import Topology.Category.Top.Limits.Konig
+import Topology.Category.TopCat.Limits.Cofiltered
+import Topology.Category.TopCat.Limits.Konig
 
 #align_import topology.category.Profinite.cofiltered_limit from "leanprover-community/mathlib"@"fd4551cfe4b7484b81c2c9ba3405edae27659676"
 
Diff
@@ -107,13 +107,13 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
       dsimp only [W] at hh ⊢
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w]
     · intro hx
-      simp_rw [Set.preimage_iUnion, Set.mem_iUnion] at hx 
+      simp_rw [Set.preimage_iUnion, Set.mem_iUnion] at hx
       obtain ⟨s, hs, hx⟩ := hx
       rw [h]
       refine' ⟨s.1, s.2, _⟩
       rw [(hV s).2]
-      dsimp only [W] at hx 
-      rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w] at hx 
+      dsimp only [W] at hx
+      rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w] at hx
 #align Profinite.exists_clopen_of_cofiltered Profinite.exists_isClopen_of_cofiltered
 -/
 
@@ -197,10 +197,10 @@ theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonemp
   · rw [h2.some_spec]
     exact h1
   · intro a b hh
-    apply_fun fun e => e a at hh 
-    dsimp [ι] at hh 
-    rw [if_pos rfl] at hh 
-    split_ifs at hh  with hh1 hh1
+    apply_fun fun e => e a at hh
+    dsimp [ι] at hh
+    rw [if_pos rfl] at hh
+    split_ifs at hh with hh1 hh1
     · exact hh1.symm
     · exact False.elim (bot_ne_top hh)
 #align Profinite.exists_locally_constant_finite_nonempty Profinite.exists_locallyConstant_finite_nonempty
@@ -239,7 +239,7 @@ theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
     obtain ⟨j, g', hj⟩ := exists_locally_constant_finite_nonempty _ hC f'
     refine' ⟨j, ⟨ff ∘ g', g'.is_locally_constant.comp _⟩, _⟩
     ext1 t
-    apply_fun fun e => e t at hj 
+    apply_fun fun e => e t at hj
     rw [LocallyConstant.coe_comap _ _ (C.π.app j).Continuous] at hj ⊢
     dsimp at hj ⊢
     rw [← hj]
Diff
@@ -57,7 +57,7 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
   rotate_left
   · intro i
     change TopologicalSpace.IsTopologicalBasis {W : Set (F.obj i) | IsClopen W}
-    apply isTopologicalBasis_clopen
+    apply isTopologicalBasis_isClopen
   · rintro i j f V (hV : IsClopen _)
     refine' ⟨hV.1.preimage _, hV.2.preimage _⟩ <;> continuity
   -- Using this, since `U` is open, we can write `U` as a union of clopen sets all of which
Diff
@@ -41,11 +41,11 @@ universe u
 variable {J : Type u} [SmallCategory J] [IsCofiltered J] {F : J ⥤ Profinite.{u}} (C : Cone F)
   (hC : IsLimit C)
 
-#print Profinite.exists_clopen_of_cofiltered /-
+#print Profinite.exists_isClopen_of_cofiltered /-
 /-- If `X` is a cofiltered limit of profinite sets, then any clopen subset of `X` arises from
 a clopen set in one of the terms in the limit.
 -/
-theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
+theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
     ∃ (j : J) (V : Set (F.obj j)) (hV : IsClopen V), U = C.π.app j ⁻¹' V :=
   by
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
@@ -114,7 +114,7 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
       rw [(hV s).2]
       dsimp only [W] at hx 
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w] at hx 
-#align Profinite.exists_clopen_of_cofiltered Profinite.exists_clopen_of_cofiltered
+#align Profinite.exists_clopen_of_cofiltered Profinite.exists_isClopen_of_cofiltered
 -/
 
 #print Profinite.exists_locallyConstant_fin_two /-
@@ -124,11 +124,11 @@ theorem exists_locallyConstant_fin_two (f : LocallyConstant C.pt (Fin 2)) :
   let U := f ⁻¹' {0}
   have hU : IsClopen U := f.is_locally_constant.is_clopen_fiber _
   obtain ⟨j, V, hV, h⟩ := exists_clopen_of_cofiltered C hC hU
-  use j, LocallyConstant.ofClopen hV
+  use j, LocallyConstant.ofIsClopen hV
   apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
   rw [LocallyConstant.coe_comap _ _ (C.π.app j).Continuous]
   conv_rhs => rw [Set.preimage_comp]
-  rw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
+  rw [LocallyConstant.ofIsClopen_fiber_zero hV, ← h]
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 -/
 
Diff
@@ -222,7 +222,7 @@ theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
         exact @Set.eq_empty_of_isEmpty _ hj _
       · ext x
         exact hj.elim' (C.π.app j x)
-    simp only [← not_nonempty_iff, ← not_forall]
+    simp only [← not_nonempty_iff, ← Classical.not_forall]
     intro h
     haveI : ∀ j : J, Nonempty ((F ⋙ Profinite.toTopCat).obj j) := h
     haveI : ∀ j : J, T2Space ((F ⋙ Profinite.toTopCat).obj j) := fun j =>
Diff
@@ -3,11 +3,11 @@ Copyright (c) 2021 Adam Topaz. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Adam Topaz
 -/
-import Mathbin.Topology.Category.Profinite.Basic
-import Mathbin.Topology.LocallyConstant.Basic
-import Mathbin.Topology.DiscreteQuotient
-import Mathbin.Topology.Category.Top.Limits.Cofiltered
-import Mathbin.Topology.Category.Top.Limits.Konig
+import Topology.Category.Profinite.Basic
+import Topology.LocallyConstant.Basic
+import Topology.DiscreteQuotient
+import Topology.Category.Top.Limits.Cofiltered
+import Topology.Category.Top.Limits.Konig
 
 #align_import topology.category.Profinite.cofiltered_limit from "leanprover-community/mathlib"@"fd4551cfe4b7484b81c2c9ba3405edae27659676"
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Adam Topaz. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Adam Topaz
-
-! This file was ported from Lean 3 source module topology.category.Profinite.cofiltered_limit
-! leanprover-community/mathlib commit fd4551cfe4b7484b81c2c9ba3405edae27659676
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Topology.Category.Profinite.Basic
 import Mathbin.Topology.LocallyConstant.Basic
@@ -14,6 +9,8 @@ import Mathbin.Topology.DiscreteQuotient
 import Mathbin.Topology.Category.Top.Limits.Cofiltered
 import Mathbin.Topology.Category.Top.Limits.Konig
 
+#align_import topology.category.Profinite.cofiltered_limit from "leanprover-community/mathlib"@"fd4551cfe4b7484b81c2c9ba3405edae27659676"
+
 /-!
 # Cofiltered limits of profinite sets.
 
Diff
@@ -44,8 +44,7 @@ universe u
 variable {J : Type u} [SmallCategory J] [IsCofiltered J] {F : J ⥤ Profinite.{u}} (C : Cone F)
   (hC : IsLimit C)
 
-include hC
-
+#print Profinite.exists_clopen_of_cofiltered /-
 /-- If `X` is a cofiltered limit of profinite sets, then any clopen subset of `X` arises from
 a clopen set in one of the terms in the limit.
 -/
@@ -119,7 +118,9 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
       dsimp only [W] at hx 
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w] at hx 
 #align Profinite.exists_clopen_of_cofiltered Profinite.exists_clopen_of_cofiltered
+-/
 
+#print Profinite.exists_locallyConstant_fin_two /-
 theorem exists_locallyConstant_fin_two (f : LocallyConstant C.pt (Fin 2)) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) :=
   by
@@ -132,7 +133,9 @@ theorem exists_locallyConstant_fin_two (f : LocallyConstant C.pt (Fin 2)) :
   conv_rhs => rw [Set.preimage_comp]
   rw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
+-/
 
+#print Profinite.exists_locallyConstant_finite_aux /-
 theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : LocallyConstant C.pt α) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
       (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) :=
@@ -172,7 +175,9 @@ theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : Locally
     rw [C.w]
   all_goals continuity
 #align Profinite.exists_locally_constant_finite_aux Profinite.exists_locallyConstant_finite_aux
+-/
 
+#print Profinite.exists_locallyConstant_finite_nonempty /-
 theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonempty α]
     (f : LocallyConstant C.pt α) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) :=
@@ -202,7 +207,9 @@ theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonemp
     · exact hh1.symm
     · exact False.elim (bot_ne_top hh)
 #align Profinite.exists_locally_constant_finite_nonempty Profinite.exists_locallyConstant_finite_nonempty
+-/
 
+#print Profinite.exists_locallyConstant /-
 /-- Any locally constant function from a cofiltered limit of profinite sets factors through
 one of the components. -/
 theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
@@ -241,6 +248,7 @@ theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
     rw [← hj]
     rfl
 #align Profinite.exists_locally_constant Profinite.exists_locallyConstant
+-/
 
 end Profinite
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Adam Topaz
 
 ! This file was ported from Lean 3 source module topology.category.Profinite.cofiltered_limit
-! leanprover-community/mathlib commit 178a32653e369dce2da68dc6b2694e385d484ef1
+! leanprover-community/mathlib commit fd4551cfe4b7484b81c2c9ba3405edae27659676
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,9 @@ import Mathbin.Topology.Category.Top.Limits.Konig
 /-!
 # Cofiltered limits of profinite sets.
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file contains some theorems about cofiltered limits of profinite sets.
 
 ## Main Results
Diff
@@ -53,11 +53,11 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
   -- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
   have hB :=
     TopCat.isTopologicalBasis_cofiltered_limit.{u} (F ⋙ Profinite.toTopCat)
-      (Profinite.to_Top.map_cone C) (is_limit_of_preserves _ hC) (fun j => { W | IsClopen W }) _
+      (Profinite.to_Top.map_cone C) (is_limit_of_preserves _ hC) (fun j => {W | IsClopen W}) _
       (fun i => isClopen_univ) (fun i U1 U2 hU1 hU2 => hU1.inter hU2) _
   rotate_left
   · intro i
-    change TopologicalSpace.IsTopologicalBasis { W : Set (F.obj i) | IsClopen W }
+    change TopologicalSpace.IsTopologicalBasis {W : Set (F.obj i) | IsClopen W}
     apply isTopologicalBasis_clopen
   · rintro i j f V (hV : IsClopen _)
     refine' ⟨hV.1.preimage _, hV.2.preimage _⟩ <;> continuity
@@ -192,10 +192,10 @@ theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonemp
   · rw [h2.some_spec]
     exact h1
   · intro a b hh
-    apply_fun fun e => e a  at hh 
+    apply_fun fun e => e a at hh 
     dsimp [ι] at hh 
     rw [if_pos rfl] at hh 
-    split_ifs  at hh  with hh1 hh1
+    split_ifs at hh  with hh1 hh1
     · exact hh1.symm
     · exact False.elim (bot_ne_top hh)
 #align Profinite.exists_locally_constant_finite_nonempty Profinite.exists_locallyConstant_finite_nonempty
@@ -232,7 +232,7 @@ theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
     obtain ⟨j, g', hj⟩ := exists_locally_constant_finite_nonempty _ hC f'
     refine' ⟨j, ⟨ff ∘ g', g'.is_locally_constant.comp _⟩, _⟩
     ext1 t
-    apply_fun fun e => e t  at hj 
+    apply_fun fun e => e t at hj 
     rw [LocallyConstant.coe_comap _ _ (C.π.app j).Continuous] at hj ⊢
     dsimp at hj ⊢
     rw [← hj]
Diff
@@ -47,7 +47,7 @@ include hC
 a clopen set in one of the terms in the limit.
 -/
 theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
-    ∃ (j : J)(V : Set (F.obj j))(hV : IsClopen V), U = C.π.app j ⁻¹' V :=
+    ∃ (j : J) (V : Set (F.obj j)) (hV : IsClopen V), U = C.π.app j ⁻¹' V :=
   by
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
   -- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
@@ -105,20 +105,20 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
       simp_rw [Set.preimage_iUnion, Set.mem_iUnion]
       obtain ⟨_, ⟨s, rfl⟩, _, ⟨hs, rfl⟩, hh⟩ := hG hx
       refine' ⟨s, hs, _⟩
-      dsimp only [W] at hh⊢
+      dsimp only [W] at hh ⊢
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w]
     · intro hx
-      simp_rw [Set.preimage_iUnion, Set.mem_iUnion] at hx
+      simp_rw [Set.preimage_iUnion, Set.mem_iUnion] at hx 
       obtain ⟨s, hs, hx⟩ := hx
       rw [h]
       refine' ⟨s.1, s.2, _⟩
       rw [(hV s).2]
-      dsimp only [W] at hx
-      rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w] at hx
+      dsimp only [W] at hx 
+      rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w] at hx 
 #align Profinite.exists_clopen_of_cofiltered Profinite.exists_clopen_of_cofiltered
 
 theorem exists_locallyConstant_fin_two (f : LocallyConstant C.pt (Fin 2)) :
-    ∃ (j : J)(g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) :=
+    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) :=
   by
   let U := f ⁻¹' {0}
   have hU : IsClopen U := f.is_locally_constant.is_clopen_fiber _
@@ -131,7 +131,7 @@ theorem exists_locallyConstant_fin_two (f : LocallyConstant C.pt (Fin 2)) :
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
 theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : LocallyConstant C.pt α) :
-    ∃ (j : J)(g : LocallyConstant (F.obj j) (α → Fin 2)),
+    ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
       (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) :=
   by
   cases nonempty_fintype α
@@ -172,7 +172,7 @@ theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : Locally
 
 theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonempty α]
     (f : LocallyConstant C.pt α) :
-    ∃ (j : J)(g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) :=
+    ∃ (j : J) (g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) :=
   by
   inhabit α
   obtain ⟨j, gg, h⟩ := exists_locally_constant_finite_aux _ hC f
@@ -192,10 +192,10 @@ theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonemp
   · rw [h2.some_spec]
     exact h1
   · intro a b hh
-    apply_fun fun e => e a  at hh
-    dsimp [ι] at hh
-    rw [if_pos rfl] at hh
-    split_ifs  at hh with hh1 hh1
+    apply_fun fun e => e a  at hh 
+    dsimp [ι] at hh 
+    rw [if_pos rfl] at hh 
+    split_ifs  at hh  with hh1 hh1
     · exact hh1.symm
     · exact False.elim (bot_ne_top hh)
 #align Profinite.exists_locally_constant_finite_nonempty Profinite.exists_locallyConstant_finite_nonempty
@@ -203,7 +203,7 @@ theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonemp
 /-- Any locally constant function from a cofiltered limit of profinite sets factors through
 one of the components. -/
 theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
-    ∃ (j : J)(g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) :=
+    ∃ (j : J) (g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) :=
   by
   let S := f.discrete_quotient
   let ff : S → α := f.lift
@@ -232,9 +232,9 @@ theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
     obtain ⟨j, g', hj⟩ := exists_locally_constant_finite_nonempty _ hC f'
     refine' ⟨j, ⟨ff ∘ g', g'.is_locally_constant.comp _⟩, _⟩
     ext1 t
-    apply_fun fun e => e t  at hj
-    rw [LocallyConstant.coe_comap _ _ (C.π.app j).Continuous] at hj⊢
-    dsimp at hj⊢
+    apply_fun fun e => e t  at hj 
+    rw [LocallyConstant.coe_comap _ _ (C.π.app j).Continuous] at hj ⊢
+    dsimp at hj ⊢
     rw [← hj]
     rfl
 #align Profinite.exists_locally_constant Profinite.exists_locallyConstant
Diff
@@ -30,7 +30,7 @@ This file contains some theorems about cofiltered limits of profinite sets.
 
 namespace Profinite
 
-open Classical
+open scoped Classical
 
 open CategoryTheory
 
Diff
@@ -149,14 +149,12 @@ theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : Locally
   let ggg := LocallyConstant.unflip gg
   refine' ⟨j0, ggg, _⟩
   have : f.map ι = LocallyConstant.unflip (f.map ι).flip := by simp
-  rw [this]
-  clear this
+  rw [this]; clear this
   have :
     LocallyConstant.comap (C.π.app j0) ggg =
       LocallyConstant.unflip (LocallyConstant.comap (C.π.app j0) ggg).flip :=
     by simp
-  rw [this]
-  clear this
+  rw [this]; clear this
   congr 1
   ext1 a
   change ff a = _
@@ -225,8 +223,7 @@ theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
     haveI : ∀ j : J, CompactSpace ((F ⋙ Profinite.toTopCat).obj j) := fun j =>
       (inferInstance : CompactSpace (F.obj j))
     have cond := TopCat.nonempty_limitCone_of_compact_t2_cofiltered_system (F ⋙ Profinite.toTopCat)
-    suffices : Nonempty C.X
-    exact IsEmpty.false (S.proj this.some)
+    suffices : Nonempty C.X; exact IsEmpty.false (S.proj this.some)
     let D := Profinite.to_Top.map_cone C
     have hD : is_limit D := is_limit_of_preserves Profinite.toTopCat hC
     have CD := (hD.cone_point_unique_up_to_iso (TopCat.limitConeIsLimit.{u} _)).inv
Diff
@@ -94,7 +94,7 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
   let W : S → Set (F.obj j0) := fun s => if hs : s ∈ G then F.map (f s hs) ⁻¹' V s else Set.univ
   -- Conclude, using the `j0` and the clopen set of `F.obj j0` obtained above.
   refine' ⟨j0, ⋃ (s : S) (hs : s ∈ G), W s, _, _⟩
-  · apply isClopen_bunionᵢ_finset
+  · apply isClopen_biUnion_finset
     intro s hs
     dsimp only [W]
     rw [dif_pos hs]
@@ -102,13 +102,13 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
   · ext x
     constructor
     · intro hx
-      simp_rw [Set.preimage_unionᵢ, Set.mem_unionᵢ]
+      simp_rw [Set.preimage_iUnion, Set.mem_iUnion]
       obtain ⟨_, ⟨s, rfl⟩, _, ⟨hs, rfl⟩, hh⟩ := hG hx
       refine' ⟨s, hs, _⟩
       dsimp only [W] at hh⊢
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w]
     · intro hx
-      simp_rw [Set.preimage_unionᵢ, Set.mem_unionᵢ] at hx
+      simp_rw [Set.preimage_iUnion, Set.mem_iUnion] at hx
       obtain ⟨s, hs, hx⟩ := hx
       rw [h]
       refine' ⟨s.1, s.2, _⟩
Diff
@@ -52,7 +52,7 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
   -- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
   have hB :=
-    TopCat.isTopologicalBasis_cofiltered_limit.{u} (F ⋙ Profinite.toTop)
+    TopCat.isTopologicalBasis_cofiltered_limit.{u} (F ⋙ Profinite.toTopCat)
       (Profinite.to_Top.map_cone C) (is_limit_of_preserves _ hC) (fun j => { W | IsClopen W }) _
       (fun i => isClopen_univ) (fun i U1 U2 hU1 hU2 => hU1.inter hU2) _
   rotate_left
@@ -219,16 +219,16 @@ theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
         exact hj.elim' (C.π.app j x)
     simp only [← not_nonempty_iff, ← not_forall]
     intro h
-    haveI : ∀ j : J, Nonempty ((F ⋙ Profinite.toTop).obj j) := h
-    haveI : ∀ j : J, T2Space ((F ⋙ Profinite.toTop).obj j) := fun j =>
+    haveI : ∀ j : J, Nonempty ((F ⋙ Profinite.toTopCat).obj j) := h
+    haveI : ∀ j : J, T2Space ((F ⋙ Profinite.toTopCat).obj j) := fun j =>
       (inferInstance : T2Space (F.obj j))
-    haveI : ∀ j : J, CompactSpace ((F ⋙ Profinite.toTop).obj j) := fun j =>
+    haveI : ∀ j : J, CompactSpace ((F ⋙ Profinite.toTopCat).obj j) := fun j =>
       (inferInstance : CompactSpace (F.obj j))
-    have cond := TopCat.nonempty_limitCone_of_compact_t2_cofiltered_system (F ⋙ Profinite.toTop)
+    have cond := TopCat.nonempty_limitCone_of_compact_t2_cofiltered_system (F ⋙ Profinite.toTopCat)
     suffices : Nonempty C.X
     exact IsEmpty.false (S.proj this.some)
     let D := Profinite.to_Top.map_cone C
-    have hD : is_limit D := is_limit_of_preserves Profinite.toTop hC
+    have hD : is_limit D := is_limit_of_preserves Profinite.toTopCat hC
     have CD := (hD.cone_point_unique_up_to_iso (TopCat.limitConeIsLimit.{u} _)).inv
     exact cond.map CD
   · let f' : LocallyConstant C.X S := ⟨S.proj, S.proj_is_locally_constant⟩
Diff
@@ -4,13 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Adam Topaz
 
 ! This file was ported from Lean 3 source module topology.category.Profinite.cofiltered_limit
-! leanprover-community/mathlib commit 829895f162a1f29d0133f4b3538f4cd1fb5bffd3
+! leanprover-community/mathlib commit 178a32653e369dce2da68dc6b2694e385d484ef1
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Topology.Category.Profinite.Basic
 import Mathbin.Topology.LocallyConstant.Basic
 import Mathbin.Topology.DiscreteQuotient
+import Mathbin.Topology.Category.Top.Limits.Cofiltered
+import Mathbin.Topology.Category.Top.Limits.Konig
 
 /-!
 # Cofiltered limits of profinite sets.
Diff
@@ -44,7 +44,7 @@ include hC
 /-- If `X` is a cofiltered limit of profinite sets, then any clopen subset of `X` arises from
 a clopen set in one of the terms in the limit.
 -/
-theorem exists_clopen_of_cofiltered {U : Set C.x} (hU : IsClopen U) :
+theorem exists_clopen_of_cofiltered {U : Set C.pt} (hU : IsClopen U) :
     ∃ (j : J)(V : Set (F.obj j))(hV : IsClopen V), U = C.π.app j ⁻¹' V :=
   by
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
@@ -115,7 +115,7 @@ theorem exists_clopen_of_cofiltered {U : Set C.x} (hU : IsClopen U) :
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, C.w] at hx
 #align Profinite.exists_clopen_of_cofiltered Profinite.exists_clopen_of_cofiltered
 
-theorem exists_locallyConstant_fin_two (f : LocallyConstant C.x (Fin 2)) :
+theorem exists_locallyConstant_fin_two (f : LocallyConstant C.pt (Fin 2)) :
     ∃ (j : J)(g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) :=
   by
   let U := f ⁻¹' {0}
@@ -128,7 +128,7 @@ theorem exists_locallyConstant_fin_two (f : LocallyConstant C.x (Fin 2)) :
   rw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
-theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : LocallyConstant C.x α) :
+theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : LocallyConstant C.pt α) :
     ∃ (j : J)(g : LocallyConstant (F.obj j) (α → Fin 2)),
       (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) :=
   by
@@ -171,7 +171,7 @@ theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (f : Locally
 #align Profinite.exists_locally_constant_finite_aux Profinite.exists_locallyConstant_finite_aux
 
 theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonempty α]
-    (f : LocallyConstant C.x α) :
+    (f : LocallyConstant C.pt α) :
     ∃ (j : J)(g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) :=
   by
   inhabit α
@@ -202,7 +202,7 @@ theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonemp
 
 /-- Any locally constant function from a cofiltered limit of profinite sets factors through
 one of the components. -/
-theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.x α) :
+theorem exists_locallyConstant {α : Type _} (f : LocallyConstant C.pt α) :
     ∃ (j : J)(g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) :=
   by
   let S := f.discrete_quotient

Changes in mathlib4

mathlib3
mathlib4
refactor(Topology): take continuous argument in LocallyConstant.comap (#12136)

Changes the definition of LocallyConstant.comap so that it takes an argument of the form C(X, Y) instead of X → Y. There was no example of a non-continuous argument in mathlib, and this definition generally makes proofs easier.

Diff
@@ -117,11 +117,10 @@ theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.p
   obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
   use j, LocallyConstant.ofIsClopen hV
   apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
+  simp only [Fin.isValue, Functor.const_obj_obj, LocallyConstant.coe_comap, Set.preimage_comp,
+    LocallyConstant.ofIsClopen_fiber_zero]
   -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
-  conv_rhs => rw [Set.preimage_comp]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.ofIsClopen_fiber_zero hV, ← h]
+  erw [← h]
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
@@ -155,20 +154,8 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   rw [h]
   dsimp
   ext1 x
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
-  dsimp [ggg, LocallyConstant.flip, LocallyConstant.unflip]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
-  dsimp
-  rw [LocallyConstant.coe_comap _ _ _]
-  -- Porting note: `repeat' rw [LocallyConstant.coe_comap]` didn't work
-  -- so I did all three rewrites manually
-  · dsimp
-    congr! 1
-    change _ = (C.π.app j0 ≫ F.map (fs a)) x
-    rw [C.w]; rfl
-  · exact (F.map _).continuous
+  change _ = (g a) ((C.π.app j0 ≫ F.map (fs a)) x)
+  rw [C.w]; rfl
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_finite_aux Profinite.exists_locallyConstant_finite_aux
 
@@ -181,13 +168,13 @@ theorem exists_locallyConstant_finite_nonempty {α : Type*} [Finite α] [Nonempt
   let σ : (α → Fin 2) → α := fun f => if h : ∃ a : α, ι a = f then h.choose else default
   refine' ⟨j, gg.map σ, _⟩
   ext x
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+  simp only [Functor.const_obj_obj, LocallyConstant.coe_comap, LocallyConstant.map_apply,
+    Function.comp_apply]
   dsimp [σ]
   have h1 : ι (f x) = gg (C.π.app j x) := by
     change f.map (fun a b => if a = b then (0 : Fin 2) else 1) x = _
     -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+    erw [h]
     rfl
   have h2 : ∃ a : α, ι a = gg (C.π.app j x) := ⟨f x, h1⟩
   -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
@@ -240,8 +227,6 @@ theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstan
     refine' ⟨j, ⟨ff ∘ g', g'.isLocallyConstant.comp _⟩, _⟩
     ext1 t
     apply_fun fun e => e t at hj
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
     dsimp at hj ⊢
     rw [← hj]
     rfl
chore: move Mathlib to v4.7.0-rc1 (#11162)

This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0 branch as we update to intermediate nightlies.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>

Diff
@@ -90,18 +90,18 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsCl
   refine' ⟨j0, ⋃ (s : S) (_ : s ∈ G), W s, _, _⟩
   · apply isClopen_biUnion_finset
     intro s hs
-    dsimp
+    dsimp [W]
     rw [dif_pos hs]
     exact ⟨(hV s).1.1.preimage (F.map _).continuous, (hV s).1.2.preimage (F.map _).continuous⟩
   · ext x
     constructor
     · intro hx
-      simp_rw [Set.preimage_iUnion, Set.mem_iUnion]
+      simp_rw [W, Set.preimage_iUnion, Set.mem_iUnion]
       obtain ⟨_, ⟨s, rfl⟩, _, ⟨hs, rfl⟩, hh⟩ := hG hx
       refine' ⟨s, hs, _⟩
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, ← Functor.map_comp, C.w]
     · intro hx
-      simp_rw [Set.preimage_iUnion, Set.mem_iUnion] at hx
+      simp_rw [W, Set.preimage_iUnion, Set.mem_iUnion] at hx
       obtain ⟨s, hs, hx⟩ := hx
       rw [h]
       refine' ⟨s.1, s.2, _⟩
@@ -157,7 +157,7 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   ext1 x
   -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
   erw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
-  dsimp [LocallyConstant.flip, LocallyConstant.unflip]
+  dsimp [ggg, LocallyConstant.flip, LocallyConstant.unflip]
   -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
   erw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
   dsimp
@@ -183,7 +183,7 @@ theorem exists_locallyConstant_finite_nonempty {α : Type*} [Finite α] [Nonempt
   ext x
   -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
   erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
-  dsimp
+  dsimp [σ]
   have h1 : ι (f x) = gg (C.π.app j x) := by
     change f.map (fun a b => if a = b then (0 : Fin 2) else 1) x = _
     -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
@@ -197,7 +197,7 @@ theorem exists_locallyConstant_finite_nonempty {α : Type*} [Finite α] [Nonempt
     exact h1
   · intro a b hh
     have hhh := congr_fun hh a
-    dsimp at hhh
+    dsimp [ι] at hhh
     rw [if_pos rfl] at hhh
     split_ifs at hhh with hh1
     · exact hh1.symm
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

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

This follows on from #6964.

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

Diff
@@ -65,11 +65,11 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsCl
 
   -- Since `U` is also closed, hence compact, it is covered by finitely many of the
   -- clopens constructed in the previous step.
-  have hUo : ∀ (i : ↑S), IsOpen ((fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i)
-  · intro s
+  have hUo : ∀ (i : ↑S), IsOpen ((fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i) := by
+    intro s
     exact (hV s).1.2.preimage (C.π.app (j s)).continuous
-  have hsU : U ⊆ ⋃ (i : ↑S), (fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i
-  · dsimp only
+  have hsU : U ⊆ ⋃ (i : ↑S), (fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i := by
+    dsimp only
     rw [h]
     rintro x ⟨T, hT, hx⟩
     refine' ⟨_, ⟨⟨T, hT⟩, rfl⟩, _⟩
@@ -215,8 +215,8 @@ theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstan
   · suffices ∃ j, IsEmpty (F.obj j) by
       refine' this.imp fun j hj => _
       refine' ⟨⟨hj.elim, fun A => _⟩, _⟩
-      · suffices : (fun a ↦ IsEmpty.elim hj a) ⁻¹' A = ∅
-        · rw [this]
+      · suffices (fun a ↦ IsEmpty.elim hj a) ⁻¹' A = ∅ by
+          rw [this]
           exact isOpen_empty
         exact @Set.eq_empty_of_isEmpty _ hj _
       · ext x
@@ -230,7 +230,7 @@ theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstan
       (inferInstance : CompactSpace (F.obj j))
     have cond := TopCat.nonempty_limitCone_of_compact_t2_cofiltered_system.{u}
       (F ⋙ Profinite.toTopCat)
-    suffices : Nonempty C.pt; exact IsEmpty.false (S.proj this.some)
+    suffices Nonempty C.pt from IsEmpty.false (S.proj this.some)
     let D := Profinite.toTopCat.mapCone C
     have hD : IsLimit D := isLimitOfPreserves Profinite.toTopCat hC
     have CD := (hD.conePointUniqueUpToIso (TopCat.limitConeIsLimit.{v, max u v} _)).inv
chore: remove useless include porting note (#10516)

This one was added by myself and not removed in #10503.

Diff
@@ -36,9 +36,6 @@ universe u v
 
 variable {J : Type v} [SmallCategory J] [IsCofiltered J] {F : J ⥤ ProfiniteMax.{u, v}} (C : Cone F)
 
--- include hC
--- Porting note: I just add `(hC : IsLimit C)` explicitly as a hypothesis to all the theorems
-
 /-- If `X` is a cofiltered limit of profinite sets, then any clopen subset of `X` arises from
 a clopen set in one of the terms in the limit.
 -/
feat(CategoryTheory): PreservesLimits instances for adjoint functors (#9990)

This PR adds PreservesColimits/PreservesLimits instances for adjoint functors.

Co-authored-by: Markus Himmel <markus@himmel-villmar.de>

Diff
@@ -36,11 +36,6 @@ universe u v
 
 variable {J : Type v} [SmallCategory J] [IsCofiltered J] {F : J ⥤ ProfiniteMax.{u, v}} (C : Cone F)
 
-noncomputable
-instance preserves_smaller_limits_toTopCat :
-    PreservesLimitsOfSize.{v, v} (toTopCat : ProfiniteMax.{v, u} ⥤ TopCatMax.{v, u}) :=
-  Limits.preservesLimitsOfSizeShrink.{v, max u v, v, max u v} _
-
 -- include hC
 -- Porting note: I just add `(hC : IsLimit C)` explicitly as a hypothesis to all the theorems
 
@@ -49,7 +44,6 @@ a clopen set in one of the terms in the limit.
 -/
 theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClopen U) :
     ∃ (j : J) (V : Set (F.obj j)), IsClopen V ∧ U = C.π.app j ⁻¹' V := by
-  have := preserves_smaller_limits_toTopCat.{u, v}
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
   -- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
   have hB := TopCat.isTopologicalBasis_cofiltered_limit.{u, v} (F ⋙ Profinite.toTopCat)
@@ -218,7 +212,6 @@ set_option linter.uppercaseLean3 false in
 one of the components. -/
 theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstant C.pt α) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) := by
-  have := preserves_smaller_limits_toTopCat.{u, v}
   let S := f.discreteQuotient
   let ff : S → α := f.lift
   cases isEmpty_or_nonempty S
refactor(Topology/Clopen): order of open and closed (#9957)

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

Diff
@@ -65,7 +65,7 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsCl
     -- Porting note: `<;> continuity` fails
   -- Using this, since `U` is open, we can write `U` as a union of clopen sets all of which
   -- are preimages of clopens from the factors in the limit.
-  obtain ⟨S, hS, h⟩ := hB.open_eq_sUnion hU.1
+  obtain ⟨S, hS, h⟩ := hB.open_eq_sUnion hU.2
   clear hB
   let j : S → J := fun s => (hS s.2).choose
   let V : ∀ s : S, Set (F.obj (j s)) := fun s => (hS s.2).choose_spec.choose
@@ -76,7 +76,7 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsCl
   -- clopens constructed in the previous step.
   have hUo : ∀ (i : ↑S), IsOpen ((fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i)
   · intro s
-    exact (hV s).1.1.preimage (C.π.app (j s)).continuous
+    exact (hV s).1.2.preimage (C.π.app (j s)).continuous
   have hsU : U ⊆ ⋃ (i : ↑S), (fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i
   · dsimp only
     rw [h]
@@ -84,7 +84,7 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsCl
     refine' ⟨_, ⟨⟨T, hT⟩, rfl⟩, _⟩
     dsimp only [forget_map_eq_coe]
     rwa [← (hV ⟨T, hT⟩).2]
-  have := hU.2.isCompact.elim_finite_subcover (fun s : S => C.π.app (j s) ⁻¹' V s) hUo hsU
+  have := hU.1.isCompact.elim_finite_subcover (fun s : S => C.π.app (j s) ⁻¹' V s) hUo hsU
   -- Porting note: same remark as after `hB`
   -- We thus obtain a finite set `G : Finset J` and a clopen set of `F.obj j` for each
   -- `j ∈ G` such that `U` is the union of the preimages of these clopen sets.
chore(*): use ∃ x ∈ s, _ instead of ∃ (x) (_ : x ∈ s), _ (#9184)

Search for [∀∃].*(_ and manually replace some occurrences with more readable versions. In case of , the new expressions are defeq to the old ones. In case of , they differ by exists_prop.

In some rare cases, golf proofs that needed fixing.

Diff
@@ -48,7 +48,7 @@ instance preserves_smaller_limits_toTopCat :
 a clopen set in one of the terms in the limit.
 -/
 theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClopen U) :
-    ∃ (j : J) (V : Set (F.obj j)) (_ : IsClopen V), U = C.π.app j ⁻¹' V := by
+    ∃ (j : J) (V : Set (F.obj j)), IsClopen V ∧ U = C.π.app j ⁻¹' V := by
   have := preserves_smaller_limits_toTopCat.{u, v}
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
   -- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
@@ -93,8 +93,7 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsCl
   -- Pulling back all of the sets from the previous step to `F.obj j0` and taking a union,
   -- we obtain a clopen set in `F.obj j0` which works.
   obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists (G.image j)
-  let f : ∀ (s : S) (_ : s ∈ G), j0 ⟶ j s := fun s hs =>
-    (hj0 (Finset.mem_image.mpr ⟨s, hs, rfl⟩)).some
+  let f : ∀ s ∈ G, j0 ⟶ j s := fun s hs => (hj0 (Finset.mem_image.mpr ⟨s, hs, rfl⟩)).some
   let W : S → Set (F.obj j0) := fun s => if hs : s ∈ G then F.map (f s hs) ⁻¹' V s else Set.univ
   -- Conclude, using the `j0` and the clopen set of `F.obj j0` obtained above.
   refine' ⟨j0, ⋃ (s : S) (_ : s ∈ G), W s, _, _⟩
chore: rename lemmas containing "of_open" to match the naming convention (#8229)

Mostly, this means replacing "of_open" by "of_isOpen". A few lemmas names were misleading and are corrected differently. Zulip discussion.

Diff
@@ -58,7 +58,7 @@ theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsCl
   rotate_left
   · intro i
     change TopologicalSpace.IsTopologicalBasis {W : Set (F.obj i) | IsClopen W}
-    apply isTopologicalBasis_clopen
+    apply isTopologicalBasis_isClopen
   · rintro i j f V (hV : IsClopen _)
     exact ⟨hV.1.preimage ((F ⋙ toTopCat).map f).continuous,
       hV.2.preimage ((F ⋙ toTopCat).map f).continuous⟩
chore: rename most lemmas involving clopen to isClopen (#8720)

This PR renames the field Clopens.clopen' -> Clopens.isClopen', and the lemmas

  • preimage_closed_of_closed -> ContinuousOn.preimage_isClosed_of_isClosed

as well as: ClopenUpperSet.clopen -> ClopenUpperSet.isClopen connectedComponent_eq_iInter_clopen -> connectedComponent_eq_iInter_isClopen connectedComponent_subset_iInter_clopen -> connectedComponent_subset_iInter_isClopen continuous_boolIndicator_iff_clopen -> continuous_boolIndicator_iff_isClopen continuousOn_boolIndicator_iff_clopen -> continuousOn_boolIndicator_iff_isClopen DiscreteQuotient.ofClopen -> DiscreteQuotient.ofIsClopen disjoint_or_subset_of_clopen -> disjoint_or_subset_of_isClopen exists_clopen_{lower,upper}of_not_le -> exists_isClopen{lower,upper}_of_not_le exists_clopen_of_cofiltered -> exists_isClopen_of_cofiltered exists_clopen_of_totally_separated -> exists_isClopen_of_totally_separated exists_clopen_upper_or_lower_of_ne -> exists_isClopen_upper_or_lower_of_ne IsPreconnected.subset_clopen -> IsPreconnected.subset_isClopen isTotallyDisconnected_of_clopen_set -> isTotallyDisconnected_of_isClopen_set LocallyConstant.ofClopen_fiber_one -> LocallyConstant.ofIsClopen_fiber_one LocallyConstant.ofClopen_fiber_zero -> LocallyConstant.ofIsClopen_fiber_zero LocallyConstant.ofClopen -> LocallyConstant.ofIsClopen preimage_clopen_of_clopen -> preimage_isClopen_of_isClopen TopologicalSpace.Clopens.clopen -> TopologicalSpace.Clopens.isClopen

Diff
@@ -18,7 +18,7 @@ This file contains some theorems about cofiltered limits of profinite sets.
 
 ## Main Results
 
-- `exists_clopen_of_cofiltered` shows that any clopen set in a cofiltered limit of profinite
+- `exists_isClopen_of_cofiltered` shows that any clopen set in a cofiltered limit of profinite
   sets is the pullback of a clopen set from one of the factors in the limit.
 - `exists_locally_constant` shows that any locally constant function from a cofiltered limit
   of profinite sets factors through one of the components.
@@ -47,7 +47,7 @@ instance preserves_smaller_limits_toTopCat :
 /-- If `X` is a cofiltered limit of profinite sets, then any clopen subset of `X` arises from
 a clopen set in one of the terms in the limit.
 -/
-theorem exists_clopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClopen U) :
+theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClopen U) :
     ∃ (j : J) (V : Set (F.obj j)) (_ : IsClopen V), U = C.π.app j ⁻¹' V := by
   have := preserves_smaller_limits_toTopCat.{u, v}
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
@@ -118,20 +118,20 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClop
       rw [(hV s).2]
       rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, ← Functor.map_comp, C.w] at hx
 set_option linter.uppercaseLean3 false in
-#align Profinite.exists_clopen_of_cofiltered Profinite.exists_clopen_of_cofiltered
+#align Profinite.exists_clopen_of_cofiltered Profinite.exists_isClopen_of_cofiltered
 
 theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
   let U := f ⁻¹' {0}
   have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
-  obtain ⟨j, V, hV, h⟩ := exists_clopen_of_cofiltered C hC hU
-  use j, LocallyConstant.ofClopen hV
+  obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
+  use j, LocallyConstant.ofIsClopen hV
   apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
   -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
   erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   conv_rhs => rw [Set.preimage_comp]
   -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
+  erw [LocallyConstant.ofIsClopen_fiber_zero hV, ← h]
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
chore(Profinite): allow more universe flexibility in Profinite/CofilteredLimit (#8613)

We allow the indexing category for the cofiltered limit in the result Profinite.exists_locallyConstant to live in a smaller universe than our profinite sets.

Diff
@@ -24,7 +24,6 @@ This file contains some theorems about cofiltered limits of profinite sets.
   of profinite sets factors through one of the components.
 -/
 
-
 namespace Profinite
 
 open scoped Classical
@@ -33,9 +32,14 @@ open CategoryTheory
 
 open CategoryTheory.Limits
 
-universe u
+universe u v
+
+variable {J : Type v} [SmallCategory J] [IsCofiltered J] {F : J ⥤ ProfiniteMax.{u, v}} (C : Cone F)
 
-variable {J : Type u} [SmallCategory J] [IsCofiltered J] {F : J ⥤ Profinite.{u}} (C : Cone F)
+noncomputable
+instance preserves_smaller_limits_toTopCat :
+    PreservesLimitsOfSize.{v, v} (toTopCat : ProfiniteMax.{v, u} ⥤ TopCatMax.{v, u}) :=
+  Limits.preservesLimitsOfSizeShrink.{v, max u v, v, max u v} _
 
 -- include hC
 -- Porting note: I just add `(hC : IsLimit C)` explicitly as a hypothesis to all the theorems
@@ -45,9 +49,10 @@ a clopen set in one of the terms in the limit.
 -/
 theorem exists_clopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClopen U) :
     ∃ (j : J) (V : Set (F.obj j)) (_ : IsClopen V), U = C.π.app j ⁻¹' V := by
+  have := preserves_smaller_limits_toTopCat.{u, v}
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
   -- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
-  have hB := TopCat.isTopologicalBasis_cofiltered_limit.{u, u} (F ⋙ Profinite.toTopCat)
+  have hB := TopCat.isTopologicalBasis_cofiltered_limit.{u, v} (F ⋙ Profinite.toTopCat)
       (Profinite.toTopCat.mapCone C) (isLimitOfPreserves _ hC) (fun j => {W | IsClopen W}) ?_
       (fun i => isClopen_univ) (fun i U1 U2 hU1 hU2 => hU1.inter hU2) ?_
   rotate_left
@@ -214,6 +219,7 @@ set_option linter.uppercaseLean3 false in
 one of the components. -/
 theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstant C.pt α) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) := by
+  have := preserves_smaller_limits_toTopCat.{u, v}
   let S := f.discreteQuotient
   let ff : S → α := f.lift
   cases isEmpty_or_nonempty S
@@ -238,7 +244,7 @@ theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstan
     suffices : Nonempty C.pt; exact IsEmpty.false (S.proj this.some)
     let D := Profinite.toTopCat.mapCone C
     have hD : IsLimit D := isLimitOfPreserves Profinite.toTopCat hC
-    have CD := (hD.conePointUniqueUpToIso (TopCat.limitConeIsLimit.{u, u} _)).inv
+    have CD := (hD.conePointUniqueUpToIso (TopCat.limitConeIsLimit.{v, max u v} _)).inv
     exact cond.map CD
   · let f' : LocallyConstant C.pt S := ⟨S.proj, S.proj_isLocallyConstant⟩
     obtain ⟨j, g', hj⟩ := exists_locallyConstant_finite_nonempty _ hC f'
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -122,9 +122,11 @@ theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.p
   obtain ⟨j, V, hV, h⟩ := exists_clopen_of_cofiltered C hC hU
   use j, LocallyConstant.ofClopen hV
   apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
-  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   conv_rhs => rw [Set.preimage_comp]
-  rw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
@@ -158,9 +160,11 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   rw [h]
   dsimp
   ext1 x
-  rw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
   dsimp [LocallyConstant.flip, LocallyConstant.unflip]
-  rw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
   dsimp
   rw [LocallyConstant.coe_comap _ _ _]
   -- Porting note: `repeat' rw [LocallyConstant.coe_comap]` didn't work
@@ -168,7 +172,7 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   · dsimp
     congr! 1
     change _ = (C.π.app j0 ≫ F.map (fs a)) x
-    rw [C.w]
+    rw [C.w]; rfl
   · exact (F.map _).continuous
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_finite_aux Profinite.exists_locallyConstant_finite_aux
@@ -182,14 +186,17 @@ theorem exists_locallyConstant_finite_nonempty {α : Type*} [Finite α] [Nonempt
   let σ : (α → Fin 2) → α := fun f => if h : ∃ a : α, ι a = f then h.choose else default
   refine' ⟨j, gg.map σ, _⟩
   ext x
-  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   dsimp
   have h1 : ι (f x) = gg (C.π.app j x) := by
     change f.map (fun a b => if a = b then (0 : Fin 2) else 1) x = _
-    rw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
     rfl
   have h2 : ∃ a : α, ι a = gg (C.π.app j x) := ⟨f x, h1⟩
-  rw [dif_pos h2]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [dif_pos h2]
   apply_fun ι
   · rw [h2.choose_spec]
     exact h1
@@ -238,7 +245,8 @@ theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstan
     refine' ⟨j, ⟨ff ∘ g', g'.isLocallyConstant.comp _⟩, _⟩
     ext1 t
     apply_fun fun e => e t at hj
-    rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
     dsimp at hj ⊢
     rw [← hj]
     rfl
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -122,11 +122,9 @@ theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.p
   obtain ⟨j, V, hV, h⟩ := exists_clopen_of_cofiltered C hC hU
   use j, LocallyConstant.ofClopen hV
   apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   conv_rhs => rw [Set.preimage_comp]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
+  rw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
@@ -160,11 +158,9 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   rw [h]
   dsimp
   ext1 x
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
   dsimp [LocallyConstant.flip, LocallyConstant.unflip]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
   dsimp
   rw [LocallyConstant.coe_comap _ _ _]
   -- Porting note: `repeat' rw [LocallyConstant.coe_comap]` didn't work
@@ -172,7 +168,7 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   · dsimp
     congr! 1
     change _ = (C.π.app j0 ≫ F.map (fs a)) x
-    rw [C.w]; rfl
+    rw [C.w]
   · exact (F.map _).continuous
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_finite_aux Profinite.exists_locallyConstant_finite_aux
@@ -186,17 +182,14 @@ theorem exists_locallyConstant_finite_nonempty {α : Type*} [Finite α] [Nonempt
   let σ : (α → Fin 2) → α := fun f => if h : ∃ a : α, ι a = f then h.choose else default
   refine' ⟨j, gg.map σ, _⟩
   ext x
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   dsimp
   have h1 : ι (f x) = gg (C.π.app j x) := by
     change f.map (fun a b => if a = b then (0 : Fin 2) else 1) x = _
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+    rw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
     rfl
   have h2 : ∃ a : α, ι a = gg (C.π.app j x) := ⟨f x, h1⟩
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [dif_pos h2]
+  rw [dif_pos h2]
   apply_fun ι
   · rw [h2.choose_spec]
     exact h1
@@ -245,8 +238,7 @@ theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstan
     refine' ⟨j, ⟨ff ∘ g', g'.isLocallyConstant.comp _⟩, _⟩
     ext1 t
     apply_fun fun e => e t at hj
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
+    rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
     dsimp at hj ⊢
     rw [← hj]
     rfl
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

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

Diff
@@ -122,9 +122,11 @@ theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.p
   obtain ⟨j, V, hV, h⟩ := exists_clopen_of_cofiltered C hC hU
   use j, LocallyConstant.ofClopen hV
   apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
-  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   conv_rhs => rw [Set.preimage_comp]
-  rw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
@@ -158,9 +160,11 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   rw [h]
   dsimp
   ext1 x
-  rw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
   dsimp [LocallyConstant.flip, LocallyConstant.unflip]
-  rw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
   dsimp
   rw [LocallyConstant.coe_comap _ _ _]
   -- Porting note: `repeat' rw [LocallyConstant.coe_comap]` didn't work
@@ -168,7 +172,7 @@ theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit
   · dsimp
     congr! 1
     change _ = (C.π.app j0 ≫ F.map (fs a)) x
-    rw [C.w]
+    rw [C.w]; rfl
   · exact (F.map _).continuous
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_finite_aux Profinite.exists_locallyConstant_finite_aux
@@ -182,14 +186,17 @@ theorem exists_locallyConstant_finite_nonempty {α : Type*} [Finite α] [Nonempt
   let σ : (α → Fin 2) → α := fun f => if h : ∃ a : α, ι a = f then h.choose else default
   refine' ⟨j, gg.map σ, _⟩
   ext x
-  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   dsimp
   have h1 : ι (f x) = gg (C.π.app j x) := by
     change f.map (fun a b => if a = b then (0 : Fin 2) else 1) x = _
-    rw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
     rfl
   have h2 : ∃ a : α, ι a = gg (C.π.app j x) := ⟨f x, h1⟩
-  rw [dif_pos h2]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [dif_pos h2]
   apply_fun ι
   · rw [h2.choose_spec]
     exact h1
@@ -238,7 +245,8 @@ theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstan
     refine' ⟨j, ⟨ff ∘ g', g'.isLocallyConstant.comp _⟩, _⟩
     ext1 t
     apply_fun fun e => e t at hj
-    rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
     dsimp at hj ⊢
     rw [← hj]
     rfl
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
@@ -128,7 +128,7 @@ theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.p
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_fin_two Profinite.exists_locallyConstant_fin_two
 
-theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (hC : IsLimit C)
+theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
     (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
       (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
   cases nonempty_fintype α
@@ -173,7 +173,7 @@ theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (hC : IsLimi
 set_option linter.uppercaseLean3 false in
 #align Profinite.exists_locally_constant_finite_aux Profinite.exists_locallyConstant_finite_aux
 
-theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonempty α]
+theorem exists_locallyConstant_finite_nonempty {α : Type*} [Finite α] [Nonempty α]
     (hC : IsLimit C) (f : LocallyConstant C.pt α) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) := by
   inhabit α
@@ -205,7 +205,7 @@ set_option linter.uppercaseLean3 false in
 
 /-- Any locally constant function from a cofiltered limit of profinite sets factors through
 one of the components. -/
-theorem exists_locallyConstant {α : Type _} (hC : IsLimit C) (f : LocallyConstant C.pt α) :
+theorem exists_locallyConstant {α : Type*} (hC : IsLimit C) (f : LocallyConstant C.pt α) :
     ∃ (j : J) (g : LocallyConstant (F.obj j) α), f = g.comap (C.π.app _) := by
   let S := f.discreteQuotient
   let ff : S → α := f.lift
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

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

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Adam Topaz. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Adam Topaz
-
-! This file was ported from Lean 3 source module topology.category.Profinite.cofiltered_limit
-! leanprover-community/mathlib commit 178a32653e369dce2da68dc6b2694e385d484ef1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Topology.Category.Profinite.Basic
 import Mathlib.Topology.LocallyConstant.Basic
@@ -14,6 +9,8 @@ import Mathlib.Topology.DiscreteQuotient
 import Mathlib.Topology.Category.TopCat.Limits.Cofiltered
 import Mathlib.Topology.Category.TopCat.Limits.Konig
 
+#align_import topology.category.Profinite.cofiltered_limit from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1"
+
 /-!
 # Cofiltered limits of profinite sets.
 
fix: re-port topology.category.top.limits.konig (#4985)

This was caught up in a simultaneous split and port, and wasn't quite done correctly as a result

Co-authored-by: Kevin Buzzard <k.buzzard@imperial.ac.uk> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -229,7 +229,7 @@ theorem exists_locallyConstant {α : Type _} (hC : IsLimit C) (f : LocallyConsta
       (inferInstance : T2Space (F.obj j))
     haveI : ∀ j : J, CompactSpace ((F ⋙ Profinite.toTopCat).obj j) := fun j =>
       (inferInstance : CompactSpace (F.obj j))
-    have cond := TopCat.nonempty_limitCone_of_compact_t2_cofiltered_system.{u, u}
+    have cond := TopCat.nonempty_limitCone_of_compact_t2_cofiltered_system.{u}
       (F ⋙ Profinite.toTopCat)
     suffices : Nonempty C.pt; exact IsEmpty.false (S.proj this.some)
     let D := Profinite.toTopCat.mapCone C
chore: tidy various files (#5482)
Diff
@@ -38,8 +38,6 @@ open CategoryTheory.Limits
 
 universe u
 
-set_option autoImplicit false -- **TODO** delete this later
-
 variable {J : Type u} [SmallCategory J] [IsCofiltered J] {F : J ⥤ Profinite.{u}} (C : Cone F)
 
 -- include hC
@@ -86,7 +84,7 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClop
     rwa [← (hV ⟨T, hT⟩).2]
   have := hU.2.isCompact.elim_finite_subcover (fun s : S => C.π.app (j s) ⁻¹' V s) hUo hsU
   -- Porting note: same remark as after `hB`
-  -- We thus obtain a finite set `G : finset J` and a clopen set of `F.obj j` for each
+  -- We thus obtain a finite set `G : Finset J` and a clopen set of `F.obj j` for each
   -- `j ∈ G` such that `U` is the union of the preimages of these clopen sets.
   obtain ⟨G, hG⟩ := this
   -- Since `J` is cofiltered, we can find a single `j0` dominating all the `j ∈ G`.
chore: resolve a porting note in Profinite/CofilteredLimit (#5168)

To create new goals from have you need to use ?_, rather than _.

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

Diff
@@ -52,22 +52,17 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClop
     ∃ (j : J) (V : Set (F.obj j)) (_ : IsClopen V), U = C.π.app j ⁻¹' V := by
   -- First, we have the topological basis of the cofiltered limit obtained by pulling back
   -- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
-  have hT : ∀ (j : J), TopologicalSpace.IsTopologicalBasis
-      ((fun j ↦ {W : Set (F.obj j)| IsClopen W}) j)
+  have hB := TopCat.isTopologicalBasis_cofiltered_limit.{u, u} (F ⋙ Profinite.toTopCat)
+      (Profinite.toTopCat.mapCone C) (isLimitOfPreserves _ hC) (fun j => {W | IsClopen W}) ?_
+      (fun i => isClopen_univ) (fun i U1 U2 hU1 hU2 => hU1.inter hU2) ?_
+  rotate_left
   · intro i
     change TopologicalSpace.IsTopologicalBasis {W : Set (F.obj i) | IsClopen W}
     apply isTopologicalBasis_clopen
-  have compat : ∀ (i j : J) (f : i ⟶ j) (V : Set ↑((F ⋙ toTopCat).obj j)),
-      V ∈ (fun j ↦ {W | IsClopen W}) j → (forget TopCat).map ((F ⋙ toTopCat).map f) ⁻¹' V ∈
-      (fun j ↦ {W | IsClopen W}) i
   · rintro i j f V (hV : IsClopen _)
     exact ⟨hV.1.preimage ((F ⋙ toTopCat).map f).continuous,
       hV.2.preimage ((F ⋙ toTopCat).map f).continuous⟩
     -- Porting note: `<;> continuity` fails
-  have hB := TopCat.isTopologicalBasis_cofiltered_limit.{u, u} (F ⋙ Profinite.toTopCat)
-      (Profinite.toTopCat.mapCone C) (isLimitOfPreserves _ hC) (fun j => {W | IsClopen W}) hT
-      (fun i => isClopen_univ) (fun i U1 U2 hU1 hU2 => hU1.inter hU2) compat
-  -- Porting note: before, `hT` and `compat` were blank and created new goals proved afterwards.
   -- Using this, since `U` is open, we can write `U` as a union of clopen sets all of which
   -- are preimages of clopens from the factors in the limit.
   obtain ⟨S, hS, h⟩ := hB.open_eq_sUnion hU.1
feat: change ConcreteCategory.hasCoeToFun to FunLike (#4693)
Diff
@@ -87,7 +87,7 @@ theorem exists_clopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClop
     rw [h]
     rintro x ⟨T, hT, hx⟩
     refine' ⟨_, ⟨⟨T, hT⟩, rfl⟩, _⟩
-    dsimp only
+    dsimp only [forget_map_eq_coe]
     rwa [← (hV ⟨T, hT⟩).2]
   have := hU.2.isCompact.elim_finite_subcover (fun s : S => C.π.app (j s) ⁻¹' V s) hUo hsU
   -- Porting note: same remark as after `hB`
@@ -132,7 +132,7 @@ theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.p
   obtain ⟨j, V, hV, h⟩ := exists_clopen_of_cofiltered C hC hU
   use j, LocallyConstant.ofClopen hV
   apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
-  rw [LocallyConstant.coe_comap ((forget Profinite).map _) _ (C.π.app j).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   conv_rhs => rw [Set.preimage_comp]
   rw [LocallyConstant.ofClopen_fiber_zero hV, ← h]
 set_option linter.uppercaseLean3 false in
@@ -168,11 +168,11 @@ theorem exists_locallyConstant_finite_aux {α : Type _} [Finite α] (hC : IsLimi
   rw [h]
   dsimp
   ext1 x
-  rw [LocallyConstant.coe_comap ((forget Profinite).map _) _ (C.π.app (j a)).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app (j a)).continuous]
   dsimp [LocallyConstant.flip, LocallyConstant.unflip]
-  rw [LocallyConstant.coe_comap ((forget Profinite).map _) _ (C.π.app j0).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app j0).continuous]
   dsimp
-  rw [LocallyConstant.coe_comap ((forget Profinite).map _) _ _]
+  rw [LocallyConstant.coe_comap _ _ _]
   -- Porting note: `repeat' rw [LocallyConstant.coe_comap]` didn't work
   -- so I did all three rewrites manually
   · dsimp
@@ -192,11 +192,11 @@ theorem exists_locallyConstant_finite_nonempty {α : Type _} [Finite α] [Nonemp
   let σ : (α → Fin 2) → α := fun f => if h : ∃ a : α, ι a = f then h.choose else default
   refine' ⟨j, gg.map σ, _⟩
   ext x
-  rw [LocallyConstant.coe_comap ((forget Profinite).map _) _ (C.π.app j).continuous]
+  rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
   dsimp
   have h1 : ι (f x) = gg (C.π.app j x) := by
     change f.map (fun a b => if a = b then (0 : Fin 2) else 1) x = _
-    rw [h, LocallyConstant.coe_comap ((forget Profinite).map _) _ (C.π.app j).continuous]
+    rw [h, LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
     rfl
   have h2 : ∃ a : α, ι a = gg (C.π.app j x) := ⟨f x, h1⟩
   rw [dif_pos h2]
@@ -248,7 +248,7 @@ theorem exists_locallyConstant {α : Type _} (hC : IsLimit C) (f : LocallyConsta
     refine' ⟨j, ⟨ff ∘ g', g'.isLocallyConstant.comp _⟩, _⟩
     ext1 t
     apply_fun fun e => e t at hj
-    rw [LocallyConstant.coe_comap ((forget Profinite).map _) _ (C.π.app j).continuous] at hj ⊢
+    rw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous] at hj ⊢
     dsimp at hj ⊢
     rw [← hj]
     rfl
feat: port Topology.Category.Profinite.CofilteredLimit (#4889)

Dependencies 10 + 746

747 files ported (98.7%)
310642 lines ported (98.3%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file