-
Notifications
You must be signed in to change notification settings - Fork 936
feat(CategoryTheory/Sites): add the Grothendieck topology generated by a precoverage #32652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BGuillemet
wants to merge
10
commits into
leanprover-community:master
Choose a base branch
from
BGuillemet:coverage
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+236
−106
Open
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
667a959
add file PrecoverageToGrothendieck.lean
27fd792
fix breakages in Over.lean
fbd4f65
mk_all
fb9a2b9
corrections in PrecoverageToGrothendieck.lean
e2ce49e
Coverage.toGrothendieck as copy
d2894a8
add TODO
9e8579b
remove apply in Coverage.toGrothendieck
BGuillemet 970ef46
Saturate.pullback
BGuillemet 2c60bde
Update Mathlib/CategoryTheory/Sites/PrecoverageToGrothendieck.lean
BGuillemet 846fded
Update Mathlib/CategoryTheory/Sites/PrecoverageToGrothendieck.lean
BGuillemet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
Mathlib/CategoryTheory/Sites/PrecoverageToGrothendieck.lean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| /- | ||
| Copyright (c) 2025 Benoît Guillemet. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Benoît Guillemet | ||
chrisflav marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| -/ | ||
| module | ||
|
|
||
| public import Mathlib.CategoryTheory.Sites.Precoverage | ||
| public import Mathlib.CategoryTheory.Sites.Sheaf | ||
|
|
||
| /-! | ||
| # Grothendieck topology generated by a precoverage | ||
| For any category `C`, we define the Grothendieck topology generated by a precoverage `J` on `C`. | ||
| It is the smallest Grothendieck topology containing all the sieves generated by the covering | ||
| presieves of `J`. | ||
| The main definitions and theorems are: | ||
| - `Precoverage.toGrothendieck C`: A function which associates a Grothendieck topology to any | ||
| precoverage. | ||
BGuillemet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `Presieve.isSheaf_toGrothendieck_iff`: Given `J : Precoverage C` with associated Grothendieck | ||
| topology `K`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf | ||
| for all pullbacks of the presieves in `J`. | ||
| -/ | ||
chrisflav marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace CategoryTheory | ||
|
|
||
| variable {C : Type _} [Category C] | ||
|
|
||
| namespace Precoverage | ||
|
|
||
| variable {J : Precoverage C} | ||
|
|
||
| /-- | ||
| An auxiliary definition used to define the Grothendieck topology associated to a precoverage. | ||
| See `Precoverage.toGrothendieck`. | ||
| -/ | ||
| inductive Saturate (J : Precoverage C) : (X : C) → Sieve X → Prop where | ||
| | of (X : C) (S : Presieve X) (hS : S ∈ J X) : J.Saturate X (Sieve.generate S) | ||
| | top (X : C) : J.Saturate X ⊤ | ||
| | pullback (X : C) (S : Sieve X) : J.Saturate X S → ∀ {Y : C} (f : Y ⟶ X), | ||
| J.Saturate Y (S.pullback f) | ||
| | transitive (X : C) (S R : Sieve X) : J.Saturate X S → | ||
| (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, S f → J.Saturate Y (R.pullback f)) → J.Saturate X R | ||
|
|
||
| /-- | ||
| The Grothendieck topology associated to a precoverage `J`. | ||
| It is defined *inductively* as follows: | ||
| 1. If `S` is a covering presieve for `J`, then the sieve generated by `S` is a covering | ||
| sieve for the associated Grothendieck topology. | ||
| 2. The top sieves are in the associated Grothendieck topology. | ||
| 3. Add all sieves required by the pullback stability condition of a Grothendieck topology. | ||
| 4. Add all sieves required by the *local character* axiom of a Grothendieck topology. | ||
| -/ | ||
| def toGrothendieck (J : Precoverage C) : GrothendieckTopology C where | ||
| sieves := J.Saturate | ||
| top_mem' := .top | ||
| pullback_stable' _ _ _ _ hS := .pullback _ _ hS _ | ||
| transitive' _ _ hS _ hR := .transitive _ _ _ hS hR | ||
|
|
||
| lemma mem_toGrothendieck_iff {X : C} {S : Sieve X} : | ||
| S ∈ J.toGrothendieck X ↔ J.Saturate X S := .rfl | ||
|
|
||
| lemma generate_mem_toGrothendieck {X : C} {R : Presieve X} (hR : R ∈ J X) : | ||
BGuillemet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Sieve.generate R ∈ J.toGrothendieck X := | ||
| .of _ _ hR | ||
|
|
||
| /-- | ||
| An alternative characterization of the Grothendieck topology associated to a precoverage `J`: | ||
| it is the infimum of all Grothendieck topologies containing `Sieve.generate S` for all presieve | ||
BGuillemet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `S` in `J`. | ||
| -/ | ||
| lemma toGrothendieck_eq_sInf (J : Precoverage C) : | ||
| J.toGrothendieck = | ||
| sInf { K | ∀ ⦃X : C⦄ (S : Presieve X), S ∈ J X → Sieve.generate S ∈ K X } := by | ||
| refine le_antisymm ?_ ?_ | ||
| · rw [le_sInf_iff] | ||
| intro K hK _ _ hS | ||
| induction hS with | ||
| | of _ _ hS => exact hK _ hS | ||
| | top => exact K.top_mem _ | ||
| | pullback _ _ _ _ ih => exact K.pullback_stable _ ih | ||
| | transitive _ _ _ _ _ ih1 ih2 => exact K.transitive ih1 _ ih2 | ||
| · exact sInf_le (fun _ _ hS => .of _ _ hS) | ||
|
|
||
| /-- | ||
| The main theorem of this file: given a precoverage `J` on `C`, a `Type*`-valued presheaf on `C` is | ||
| a sheaf for the associated Grothendieck topology if and only if it is a sheaf for all pullback | ||
| sieves of presieves in `J`. | ||
| -/ | ||
| theorem isSheaf_toGrothendieck_iff (P : Cᵒᵖ ⥤ Type*) : | ||
| Presieve.IsSheaf J.toGrothendieck P ↔ | ||
| (∀ {X Y : C} {f : Y ⟶ X} (R : Presieve X), R ∈ J X → | ||
| Presieve.IsSheafFor P ((Sieve.generate R).pullback f).arrows) := by | ||
BGuillemet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| constructor | ||
| · refine fun H _ _ _ _ hR => H.isSheafFor _ _ ?_ | ||
| rw [Sieve.generate_sieve] | ||
| exact J.toGrothendieck.pullback_stable _ (Saturate.of _ _ hR) | ||
| · intro H X S hS | ||
| -- This is the key point of the proof: | ||
| -- We must generalize the induction in the correct way. | ||
| suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by | ||
| simpa using this (f := 𝟙 _) | ||
| induction hS with | ||
| | of X S hS => | ||
| exact fun _ _ => H S hS | ||
| | top => | ||
| simp [Presieve.isSheafFor_top_sieve P] | ||
| | pullback X S hS f ih => | ||
| intro Y f | ||
| rw [← S.pullback_comp] | ||
| exact ih (f ≫ _) | ||
| | transitive X R S hS h H1 H2 => | ||
| intro Y f | ||
| simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * | ||
| choose H1 H1' using H1 | ||
| choose H2 H2' using H2 | ||
| refine ⟨?_, fun x hx => ?_⟩ | ||
| · intro x t₁ t₂ h₁ h₂ | ||
| refine (H1 f).ext (fun Z g hg => ?_) | ||
| refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) | ||
| simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg | ||
| simp only [← types_comp_apply] | ||
| rw [← P.map_comp, ← op_comp, h₁, h₂] | ||
| simpa only [Sieve.pullback_apply, Category.assoc] using hgg | ||
| let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), | ||
| ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := | ||
| fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) | ||
| have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by | ||
| intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h | ||
| rw [hx] | ||
| rw [reassoc_of% h] | ||
BGuillemet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => | ||
| H2' hg (𝟙 _) (y g) (hy g) | ||
| let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg | ||
| have hq : q.Compatible := by | ||
| intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h | ||
| apply (H2 h₁ g₁).ext | ||
| intro ZZ gg hgg | ||
| simp only [← types_comp_apply] | ||
| rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] | ||
| · dsimp [y]; congr 1; simp only [Category.assoc, h] | ||
| · simpa [reassoc_of% h] using hgg | ||
| · simpa using hgg | ||
| obtain ⟨t, ht⟩ := H1' f q hq | ||
| refine ⟨t, fun Z g hg => ?_⟩ | ||
| refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) | ||
| rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] | ||
| on_goal 2 => simpa using hgg | ||
| refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) | ||
| rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] | ||
| on_goal 2 => simpa using hggg | ||
| refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) | ||
| rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] | ||
| apply hx | ||
| simp | ||
|
|
||
| end Precoverage | ||
|
|
||
| end CategoryTheory | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.