Skip to content
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

feat(FiberedCategory/HasFibers): define HasFibers class #13611

Open
wants to merge 238 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
649dd02
first commit
callesonne May 16, 2024
38082d9
fixing
callesonne May 16, 2024
335baba
new file
callesonne May 16, 2024
91ac434
linting fix
callesonne May 16, 2024
2df4544
documentation
callesonne May 16, 2024
f320f14
cleaning up
callesonne May 16, 2024
41b6091
typo
callesonne May 17, 2024
25ba2b9
renaming
callesonne May 17, 2024
dead993
documentation fix
callesonne May 17, 2024
518fce8
renaming
callesonne May 17, 2024
b21fd76
rearranging
callesonne May 17, 2024
3b0363f
make IsHomLift a class
callesonne May 17, 2024
7219334
squeeze simps
callesonne May 17, 2024
3bcb9d4
added automation
callesonne May 17, 2024
48efca6
added instances & golfing
callesonne May 17, 2024
cb943bf
naming conventions fix
callesonne May 17, 2024
21775a6
fix
callesonne May 17, 2024
0b5768b
make IsHomLift a class
callesonne May 17, 2024
878363e
squeeze simps
callesonne May 17, 2024
02eff36
added automation
callesonne May 17, 2024
e00f61e
added instances & golfing
callesonne May 17, 2024
7454f47
naming conventions fix
callesonne May 17, 2024
46a9267
make IsHomLift a class
callesonne May 17, 2024
9120723
naming conventions
callesonne May 17, 2024
819461b
make IsCartesian a class
callesonne May 17, 2024
5d0bc7e
use IsHomLift as a class better
callesonne May 18, 2024
0152d94
name changes
callesonne May 18, 2024
8d335de
linting fix
callesonne May 18, 2024
2908356
missing lemma
callesonne May 18, 2024
d7d1a5e
fixing
callesonne May 18, 2024
8d13d0c
removing bad simp lemmas
callesonne May 18, 2024
f894220
fixing
callesonne May 21, 2024
5c933e6
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 21, 2024
90b0ecd
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 21, 2024
9dbdef4
formatting
callesonne May 21, 2024
0efe900
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
f7d4f92
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
7080d9e
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
09fdc1d
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
e73649d
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
a3b3b90
IsHomLift using inductive type
callesonne May 23, 2024
7703af9
formatting
callesonne May 23, 2024
e3edb00
docstring fix
callesonne May 23, 2024
192af0b
name change
callesonne May 23, 2024
2dd3235
automatic lemma generation
callesonne May 23, 2024
f080e47
making code more uniform
callesonne May 24, 2024
4f36172
fix
callesonne May 17, 2024
aeead51
use IsHomLift as a class better
callesonne May 18, 2024
2601469
name changes
callesonne May 18, 2024
3d37111
linting fix
callesonne May 18, 2024
9ea4230
missing lemma
callesonne May 18, 2024
29ef1db
fixing
callesonne May 18, 2024
43260e8
removing bad simp lemmas
callesonne May 18, 2024
a5f0432
fixing
callesonne May 21, 2024
91e0e0c
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 21, 2024
0e9e00f
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 21, 2024
81722c9
formatting
callesonne May 21, 2024
5f6a5d8
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
4d4188d
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
ac49a26
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
a88f269
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
95e75fc
Update Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
callesonne May 23, 2024
31cf056
IsHomLift using inductive type
callesonne May 23, 2024
2245cd5
formatting
callesonne May 23, 2024
57715ba
docstring fix
callesonne May 23, 2024
aca192a
name change
callesonne May 23, 2024
e995f43
automatic lemma generation
callesonne May 23, 2024
c40dc83
making code more uniform
callesonne May 24, 2024
693b88f
adapting code to IsHomLift improvements
callesonne May 25, 2024
e15634d
first commit
callesonne May 27, 2024
f7de983
added IsCartesian and IsStronglyCartesian
callesonne May 28, 2024
2d696a4
IsFibered and IsPrefibered results
callesonne May 28, 2024
feef72b
fixing
callesonne May 28, 2024
bb3ee84
Update Mathlib/CategoryTheory/FiberedCategory/Fibered.lean
callesonne May 28, 2024
29e5cdf
Update Mathlib/CategoryTheory/FiberedCategory/Fibered.lean
callesonne May 28, 2024
9c4a330
comment fix
callesonne May 29, 2024
ae1dd9a
fixed file docstring
callesonne May 29, 2024
5549804
fixing
callesonne May 29, 2024
911cd98
linter fix
callesonne May 29, 2024
36d2fa4
fixing assumptions
callesonne May 29, 2024
e4379fc
cartesian arrows
callesonne May 29, 2024
fc08405
added file
callesonne May 29, 2024
971c6d6
fixing
callesonne May 29, 2024
b094a8d
added documentation
callesonne May 29, 2024
120af99
added TODO
callesonne May 29, 2024
49e890e
variable fix
callesonne May 30, 2024
9e310b8
fixing
callesonne May 30, 2024
8b5875b
documentation fix
callesonne May 30, 2024
3081126
moved variable
callesonne May 30, 2024
ea02d51
initial commit
callesonne May 30, 2024
974434f
error fix
callesonne May 30, 2024
831c559
fixing variables and comments
callesonne May 30, 2024
4765d7d
remove mk'
callesonne May 30, 2024
89340c1
more variable fix
callesonne May 30, 2024
0f0f672
cleaning up
callesonne May 31, 2024
a42b0ed
proof fix
callesonne May 31, 2024
0329dd4
remove todo
callesonne May 31, 2024
0cdb2b7
fixing assumptions
callesonne May 29, 2024
dac79b6
fixing
callesonne May 29, 2024
cff27d2
added TODO
callesonne May 29, 2024
d41988c
variable fix
callesonne May 30, 2024
efb2f8a
fixing
callesonne May 30, 2024
95a7cfe
documentation fix
callesonne May 30, 2024
67e32dc
moved variable
callesonne May 30, 2024
503c006
initial commit
callesonne May 30, 2024
decb8e8
error fix
callesonne May 30, 2024
d961448
fixing variables and comments
callesonne May 30, 2024
3892133
remove mk'
callesonne May 30, 2024
f097b62
more variable fix
callesonne May 30, 2024
8f7000f
cleaning up
callesonne May 31, 2024
bc53af9
proof fix
callesonne May 31, 2024
07853f1
remove todo
callesonne May 31, 2024
004499d
variable fix
callesonne May 31, 2024
69437a5
file docstring
callesonne May 31, 2024
076f635
added IsCartesian and IsStronglyCartesian
callesonne May 28, 2024
b132742
IsFibered and IsPrefibered results
callesonne May 28, 2024
31aa4aa
fixing
callesonne May 29, 2024
a584841
variable fix
callesonne May 30, 2024
e7e2095
initial commit
callesonne May 30, 2024
4046794
fixing variables and comments
callesonne May 30, 2024
a48b81a
cleaning up
callesonne May 31, 2024
59393e3
added IsCartesian and IsStronglyCartesian
callesonne May 28, 2024
bc25c06
IsFibered and IsPrefibered results
callesonne May 28, 2024
c5a2cc0
rebase onto prefibered branch
callesonne May 31, 2024
dc5f19e
completed messy rebase
callesonne Jun 1, 2024
4a4f348
fix
callesonne Jun 1, 2024
f21ee80
fix bad rebase again
callesonne Jun 1, 2024
45e68da
fixing proofs
callesonne Jun 1, 2024
d5977c1
added IsCartesian and IsStronglyCartesian
callesonne May 28, 2024
e8c7c4e
IsFibered and IsPrefibered results
callesonne May 28, 2024
b6bdd73
fixing
callesonne May 28, 2024
e79ccb0
Update Mathlib/CategoryTheory/FiberedCategory/Fibered.lean
callesonne May 28, 2024
35913b3
Update Mathlib/CategoryTheory/FiberedCategory/Fibered.lean
callesonne May 28, 2024
dcbd9c1
comment fix
callesonne May 29, 2024
e59a0ad
fixed file docstring
callesonne May 29, 2024
e304d48
fixing
callesonne May 29, 2024
65e05e2
linter fix
callesonne May 29, 2024
ad2dbe6
fixing assumptions
callesonne May 29, 2024
7454d1a
fixing
callesonne May 29, 2024
6ec80fb
added TODO
callesonne May 29, 2024
76dd45c
variable fix
callesonne May 30, 2024
b98bd37
fixing
callesonne May 30, 2024
e722e99
documentation fix
callesonne May 30, 2024
94ba627
moved variable
callesonne May 30, 2024
0146c8f
initial commit
callesonne May 30, 2024
044818f
error fix
callesonne May 30, 2024
a7411f0
fixing variables and comments
callesonne May 30, 2024
974d031
remove mk'
callesonne May 30, 2024
121da7b
more variable fix
callesonne May 30, 2024
f237bba
cleaning up
callesonne May 31, 2024
1f76bd2
proof fix
callesonne May 31, 2024
8c4c9cf
remove todo
callesonne May 31, 2024
a31707a
variable fix
callesonne May 31, 2024
8861bdf
file docstring
callesonne May 31, 2024
db08636
added IsCartesian and IsStronglyCartesian
callesonne May 28, 2024
f07f3ce
IsFibered and IsPrefibered results
callesonne May 28, 2024
e4544f2
fixing
callesonne May 29, 2024
9a849dc
variable fix
callesonne May 30, 2024
81166a7
initial commit
callesonne May 30, 2024
c599d45
fixing variables and comments
callesonne May 30, 2024
3ab1699
cleaning up
callesonne May 31, 2024
a3b6713
added IsCartesian and IsStronglyCartesian
callesonne May 28, 2024
aede73e
IsFibered and IsPrefibered results
callesonne May 28, 2024
7ed8a8f
rebase onto prefibered branch
callesonne May 31, 2024
c8e6562
completed messy rebase
callesonne Jun 1, 2024
8e41670
fix
callesonne Jun 1, 2024
3457d07
fix bad rebase again
callesonne Jun 1, 2024
68aa5dd
fixing proofs
callesonne Jun 1, 2024
df0d9af
error fixing
callesonne Jun 2, 2024
fc99b8d
Fixed all errors
callesonne Jun 2, 2024
6a11a7e
Fixing assumptions
callesonne Jun 3, 2024
6c47646
more fixing
callesonne Jun 3, 2024
52e90fe
fixing
callesonne Jun 6, 2024
8aab2e4
lots of progress
callesonne Jun 6, 2024
c71e0e4
more progress
callesonne Jun 6, 2024
74e9ef0
more fixing
callesonne Jun 6, 2024
8c7b996
Merge remote-tracking branch 'origin' into fiberedcategories_hasfibers
callesonne Jun 6, 2024
a869e8f
Merge remote-tracking branch 'origin' into fiberedcategories_stronglyโ€ฆ
callesonne Jun 6, 2024
ef90c41
Merge remote-tracking branch 'origin' into fiberedcategories_isfibered
callesonne Jun 6, 2024
639a88a
Merge branch 'fiberedcategories_isfibered' into fiberedcategories_hasโ€ฆ
callesonne Jun 6, 2024
a88e56d
fixed final sorry
callesonne Jun 6, 2024
549edc9
lint fix
callesonne Jun 6, 2024
77efc7d
lint fix
callesonne Jun 6, 2024
f506cca
lint fix 2
callesonne Jun 6, 2024
262588d
fixing
callesonne Jun 7, 2024
902016a
initial commit
callesonne Jun 7, 2024
4aa1559
golfing
callesonne Jun 7, 2024
3a3edbb
cleaning up
callesonne Jun 7, 2024
ed6b9ec
almost done
callesonne Jun 7, 2024
28adfeb
remove nat iso
callesonne Jun 7, 2024
822d4f9
comment fix
callesonne Jun 7, 2024
04459bc
proof fix
callesonne Jun 7, 2024
f2f11b4
reverted fix
callesonne Jun 7, 2024
115c123
added file
callesonne Jun 7, 2024
6c4465a
Merge branch 'fiberedcategory_fiber' into fiberedcategories_hasfibers
callesonne Jun 7, 2024
d807aec
add of_comp_iso
callesonne Jun 7, 2024
84e0b41
add homlift instances
callesonne Jun 7, 2024
23f71ec
cleaned up
callesonne Jun 7, 2024
7d04d3b
re-add natural isos
callesonne Jun 7, 2024
c11bd25
fixing
callesonne Jun 7, 2024
d597344
fixed docstring
callesonne Jun 7, 2024
2388b03
added file
callesonne Jun 7, 2024
a7760e9
linter fix
callesonne Jun 7, 2024
67d2daf
Merge branch 'master' into fiberedcategories_stronglycartesian
callesonne Jun 18, 2024
9b50fa7
Merge branch 'master' of https://github.com/leanprover-community/mathโ€ฆ
callesonne Jun 18, 2024
ffe7104
merge fix
callesonne Jun 18, 2024
5b48cf2
fix naming
callesonne Jun 18, 2024
4e514b2
comment fix
callesonne Jun 18, 2024
a9fab35
module docstring fix
callesonne Jun 18, 2024
66a246c
namespace fix
callesonne Jun 18, 2024
dc1efeb
fix hypothesis
callesonne Jun 18, 2024
4532388
Update Mathlib/CategoryTheory/FiberedCategory/Cartesian.lean
callesonne Jun 20, 2024
3cdcde2
fix suggestion + comments
callesonne Jun 20, 2024
386d13b
fix documentation and add reassoc
callesonne Jun 23, 2024
6e831c1
Merge branch 'master' into fiberedcategories_stronglycartesian
callesonne Jun 27, 2024
cdab458
Merge branch 'master' of https://github.com/leanprover-community/mathโ€ฆ
callesonne Jun 27, 2024
f0dcc6f
merge fix
callesonne Jun 27, 2024
fec249d
Merge branch 'fiberedcategories_isfibered' into fiberedcategories_hasโ€ฆ
callesonne Jun 27, 2024
86a998c
merge fix
callesonne Jun 27, 2024
cbffaa3
Update Mathlib/CategoryTheory/FiberedCategory/HasFibers.lean
callesonne Jun 27, 2024
7342a38
Merge branch 'master' of https://github.com/leanprover-community/mathโ€ฆ
callesonne Jul 19, 2024
c65124c
Merge branch 'master' of https://github.com/leanprover-community/mathโ€ฆ
callesonne Aug 2, 2024
e9bd4a4
merge fix
callesonne Aug 2, 2024
c12a811
Merge branch 'master' of https://github.com/leanprover-community/mathโ€ฆ
callesonne Aug 3, 2024
839a6df
Update Mathlib.lean
callesonne Aug 3, 2024
7415481
Merge branch 'fiberedcategories_isfibered' into fiberedcategory_fiber
callesonne Aug 3, 2024
60a0430
mk_all
callesonne Aug 3, 2024
3a7ef87
Merge branch 'fiberedcategory_fiber' of https://github.com/leanproverโ€ฆ
callesonne Aug 3, 2024
bc49ea4
Merge branch 'fiberedcategory_fiber' into fiberedcategories_hasfibers
callesonne Aug 3, 2024
e6a39d5
mk_all
callesonne Aug 3, 2024
9c82128
Merge branch 'fiberedcategories_hasfibers' of https://github.com/leanโ€ฆ
callesonne Aug 3, 2024
0383e48
Merge branch 'master' of https://github.com/leanprover-community/mathโ€ฆ
callesonne Oct 20, 2024
097cca7
progress
callesonne Oct 20, 2024
f3f54e3
fix errors
callesonne Oct 27, 2024
3e55b0a
fix final error
callesonne Oct 27, 2024
0aadff6
fix
callesonne Oct 27, 2024
895efbd
Apply suggestions from code review
callesonne Oct 29, 2024
222c5af
fix more of Joรซl's suggestion
callesonne Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,7 @@ import Mathlib.CategoryTheory.FiberedCategory.Cartesian
import Mathlib.CategoryTheory.FiberedCategory.Cocartesian
import Mathlib.CategoryTheory.FiberedCategory.Fiber
import Mathlib.CategoryTheory.FiberedCategory.Fibered
import Mathlib.CategoryTheory.FiberedCategory.HasFibers
import Mathlib.CategoryTheory.FiberedCategory.HomLift
import Mathlib.CategoryTheory.Filtered.Basic
import Mathlib.CategoryTheory.Filtered.Connected
Expand Down
24 changes: 12 additions & 12 deletions Mathlib/CategoryTheory/FiberedCategory/Cartesian.lean
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,18 @@ lemma map_self : IsCartesian.map p f ฯ† ฯ† = ๐Ÿ™ a := by
apply map_uniq
simp only [id_comp]

/-- The canonical isomorphism between the domains of two cartesian morphisms
instance of_comp_iso {b' : ๐’ณ} (ฯ†' : b โ‰… b') [IsHomLift p (๐Ÿ™ S) ฯ†'.hom] :
IsCartesian p f (ฯ† โ‰ซ ฯ†'.hom) where
universal_property := by
intro c ฯˆ hฯˆ
use IsCartesian.map p f ฯ† (ฯˆ โ‰ซ ฯ†'.inv)
refine โŸจโŸจinferInstance, by simp only [fac_assoc, assoc, Iso.inv_hom_id, comp_id]โŸฉ, ?_โŸฉ
rintro ฯ„ โŸจhฯ„โ‚, hฯ„โ‚‚โŸฉ
apply map_uniq
rw [Iso.eq_comp_inv]
simp only [assoc, hฯ„โ‚‚]

/-- The canonical isomorphism between the domains of two cartesian arrows
lying over the same object. -/
@[simps]
noncomputable def domainUniqueUpToIso {a' : ๐’ณ} (ฯ†' : a' โŸถ b) [IsCartesian p f ฯ†'] : a' โ‰… a where
Expand Down Expand Up @@ -152,17 +163,6 @@ instance of_iso_comp {a' : ๐’ณ} (ฯ†' : a' โ‰… a) [IsHomLift p (๐Ÿ™ R) ฯ†'.hom]
apply map_uniq
simp only [assoc, hฯ„โ‚‚]

/-- Postcomposing a cartesian morphism with an isomorphism lifting the identity is cartesian. -/
instance of_comp_iso {b' : ๐’ณ} (ฯ†' : b โ‰… b') [IsHomLift p (๐Ÿ™ S) ฯ†'.hom] :
IsCartesian p f (ฯ† โ‰ซ ฯ†'.hom) where
universal_property := by
intro c ฯˆ hฯˆ
use IsCartesian.map p f ฯ† (ฯˆ โ‰ซ ฯ†'.inv)
refine โŸจโŸจinferInstance, by simpโŸฉ, ?_โŸฉ
rintro ฯ„ โŸจhฯ„โ‚, hฯ„โ‚‚โŸฉ
apply map_uniq
simp only [Iso.eq_comp_inv, assoc, hฯ„โ‚‚]

end IsCartesian

namespace IsStronglyCartesian
Expand Down
247 changes: 247 additions & 0 deletions Mathlib/CategoryTheory/FiberedCategory/HasFibers.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
/-
Copyright (c) 2024 Calle Sรถnne. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Calle Sรถnne, Paul Lezeau
-/

import Mathlib.CategoryTheory.FiberedCategory.Fiber
import Mathlib.CategoryTheory.FiberedCategory.Fibered

/-!

# Fibers of functors

In this file we introduce a typeclass `HasFibers` for a functor `p : ๐’ณ โฅค ๐’ฎ`, consisting of:
- A collection of categories `Fib S` for every `S` in `๐’ฎ` (the fiber categories)
- Functors `ฮน : Fib S โฅค ๐’ณ` such that `ฮน โ‹™ p = const (Fib S) S
- The induced functor `Fib S โฅค Fiber p S` is an equivalence.

We also provide a default `HasFibers` instance, which uses the standard fibers `Fiber p S`
(see Fiber.lean). This makes it so that any result proven about `HasFibers` can be used for the
standard fibers as well.

The reason for introducing this typeclass is that in practice, when working with (pre)fibered
categories one often already has a collection of categories `Fib S` for every `S` that are
equivalent to the fibers `Fiber p S`. One would then like to use these categories `Fib S` directly,
instead of working through this equivalence of categories. By developing an API for the `HasFibers`
typeclass, this will be possible.

Here is an example of when this typeclass is useful. Suppose we have a presheaf of types
`F : ๐’ฎแต’แต– โฅค Type _`. The associated fibered category then has objects `(S, a)` where `S : ๐’ฎ` and `a`
is an element of `F(S)`. The fiber category `Fiber p S` is then equivalent to the discrete category
`Fib S` with objects `a` in `F(S)`. In this case, the `HasFibers` instance is given by the
categories `F(S)` and the functor `ฮน` sends `a : F(S)` to `(S, a)` in the fibered category.

## Main API
The following API is developed so that the fibers from a `HasFibers` instance can be used
analogously to the standard fibers.

- `mapPreimage ฯ†` is a lift of a morphism `ฯ† : (ฮน S).obj a โŸถ (ฮน S).obj b` in `๐’ณ`, which lies over
`๐Ÿ™ S`, to a morphism in the fiber over `S`.
- `objPreimage` gives an object in the fiber over `S` which is isomorphic to a given `a : ๐’ณ` that
satisfies `p(a) = S`. The isomorphism is given by `objObjPreimageIso`.
- `HasFibers.pullbackObj` is a version of `IsPreFibered.pullbackObj` which ensures that the object
lies in a given fiber. The corresponding cartesian morphism is given by `HasFibers.pullbackMap`.
- `HasFibers.inducedMap` is a version of `IsCartesian.inducedMap` which gives the corresponding
morphism in the fiber category.
- `fiber_factorization` is the statement that any morphism in `๐’ณ` can be factored as a morphism in
some fiber followed by a pullback.

-/

universe vโ‚ƒ uโ‚ƒ vโ‚‚ uโ‚‚ vโ‚ uโ‚

open CategoryTheory Functor Category IsCartesian IsHomLift Fiber

variable {๐’ฎ : Type uโ‚} {๐’ณ : Type uโ‚‚} [Category.{vโ‚} ๐’ฎ] [Category.{vโ‚‚} ๐’ณ]

/-- HasFibers is an extrinsic notion of fibers on a functor `p : ๐’ณ โฅค ๐’ฎ`. It is given by a
collection of categories `Fib S` for every `S : ๐’ฎ` (the fiber categories), each equiped with a
functors `ฮน : Fib S โฅค ๐’ณ` which map constantly to `S` on the base such that the induced functor
`Fib S โฅค Fiber p S` is an equivalence. -/
@[nolint checkUnivs]
class HasFibers (p : ๐’ณ โฅค ๐’ฎ) where
/-- The type of objects of the category `Fib S` for each `S`. -/
Fib (S : ๐’ฎ) : Type uโ‚ƒ
/-- `Fib S` is a category. -/
category (S : ๐’ฎ) : Category.{vโ‚ƒ} (Fib S) := by infer_instance
/-- The functor `ฮน : Fib S โฅค ๐’ณ`. -/
ฮน (S : ๐’ฎ) : (Fib S) โฅค ๐’ณ
/-- The composition with the functor `p` is *equal* to the constant functor mapping to `S`. -/
comp_const (S : ๐’ฎ) : (ฮน S) โ‹™ p = (const (Fib S)).obj S
/-- The induced functor from `Fib S` to the fiber of `๐’ณ โฅค ๐’ฎ` over `S` is an equivalence. -/
equiv (S : ๐’ฎ) : Functor.IsEquivalence (inducedFunctor (comp_const S))

namespace HasFibers

/-- The `HasFibers` on `p : ๐’ณ โฅค ๐’ฎ` given by the fibers of `p` -/
@[default_instance]
def canonical (p : ๐’ณ โฅค ๐’ฎ) : HasFibers p where
Fib := Fiber p
ฮน S := fiberInclusion
comp_const S := fiberInclusion_comp_eq_const
equiv S := by exact isEquivalence_of_iso (F := ๐Ÿญ (Fiber p S)) (Iso.refl _)

section

variable (p : ๐’ณ โฅค ๐’ฎ) [HasFibers p] (S : ๐’ฎ)

attribute [instance] category

/-- The induced functor from `Fib p S` to the standard fiber. -/
@[simps!]
def inducedFunctor : Fib p S โฅค Fiber p S :=
Fiber.inducedFunctor (comp_const S)

/-- The natural transformation `ฮน S โ‰… (inducedFunctor p S) โ‹™ (fiberInclusion p S)` -/
def inducedFunctor.NatIso : ฮน S โ‰… (inducedFunctor p S) โ‹™ fiberInclusion :=
Fiber.inducedFunctorCompIsoSelf (comp_const S)

lemma inducedFunctor_comp : ฮน S = (inducedFunctor p S) โ‹™ fiberInclusion :=
Fiber.inducedFunctor_comp (comp_const S)

instance : Functor.IsEquivalence (inducedFunctor p S) := equiv S

instance : Functor.Faithful (ฮน (p:=p) S) :=
Functor.Faithful.of_iso (inducedFunctor.NatIso p S).symm

end

section

variable {p : ๐’ณ โฅค ๐’ฎ} [HasFibers p]

@[simp]
lemma proj_eq {S : ๐’ฎ} (a : Fib p S) : p.obj ((ฮน S).obj a) = S := by
simp only [โ† comp_obj, comp_const, const_obj_obj]

/-- The morphism `R โŸถ S` in `๐’ฎ` obtained by projecting a morphism
`ฯ† : (ฮน R).obj a โŸถ (ฮน S).obj b`. -/
def proj_map {R S : ๐’ฎ} {a : Fib p R} {b : Fib p S}
(ฯ† : (ฮน R).obj a โŸถ (ฮน S).obj b) : R โŸถ S :=
eqToHom (proj_eq a).symm โ‰ซ (p.map ฯ†) โ‰ซ eqToHom (proj_eq b)

/-- For any homomorphism ฯ† in a fiber Fib S, its image under ฮน S lies over ๐Ÿ™ S -/
instance homLift {S : ๐’ฎ} {a b : Fib p S} (ฯ† : a โŸถ b) : IsHomLift p (๐Ÿ™ S) ((ฮน S).map ฯ†) := by
apply of_fac p _ _ (proj_eq a) (proj_eq b)
rw [โ† Functor.comp_map, Functor.congr_hom (comp_const S)]
simp

/-- A version of fullness of the functor `Fib S โฅค Fiber p S` that can be used inside the category
`๐’ณ`. -/
noncomputable def mapPreimage {S : ๐’ฎ} {a b : Fib p S} (ฯ† : (ฮน S).obj a โŸถ (ฮน S).obj b)
[IsHomLift p (๐Ÿ™ S) ฯ†] : a โŸถ b :=
(inducedFunctor _ S).preimage (homMk p S ฯ†)

@[simp]
lemma mapPreimage_eq {S : ๐’ฎ} {a b : Fib p S} (ฯ† : (ฮน S).obj a โŸถ (ฮน S).obj b)
[IsHomLift p (๐Ÿ™ S) ฯ†] : (ฮน S).map (mapPreimage ฯ†) = ฯ† := by
simp [mapPreimage, congr_hom (inducedFunctor_comp p S)]

/-- The lift of an isomorphism `ฮฆ : (ฮน S).obj a โ‰… (ฮน S).obj b` lying over `๐Ÿ™ S` to an isomorphism
in `Fib S`. -/
noncomputable def LiftIso {S : ๐’ฎ} {a b : Fib p S}
(ฮฆ : (ฮน S).obj a โ‰… (ฮน S).obj b) (hฮฆ : IsHomLift p (๐Ÿ™ S) ฮฆ.hom) : a โ‰… b := by
let a' : Fiber p S := (inducedFunctor p S).obj a
let b' : Fiber p S := (inducedFunctor p S).obj b
let ฮฆ' : a' โ‰… b' := {
hom := โŸจฮฆ.hom, hฮฆโŸฉ
inv := โŸจฮฆ.inv, inferInstanceโŸฉ
hom_inv_id := by
ext
simp [fiberInclusion.map_comp]
simp [fiberInclusion]
inv_hom_id := by
ext
simp [fiberInclusion.map_comp]
simp [fiberInclusion]
}
exact ((inducedFunctor p S).preimageIso ฮฆ')

/-- An object in `Fib p S` isomorphic in `๐’ณ` to a given object `a : ๐’ณ` such that `p(a) = S`. -/
noncomputable def objPreimage {S : ๐’ฎ} {a : ๐’ณ} (ha : p.obj a = S) : Fib p S :=
Functor.objPreimage (inducedFunctor p S) (Fiber.mk ha)

/-- Applying `ฮน S` to the preimage of `a : ๐’ณ` in `Fib p S` yields an object isomorphic to `a`. -/
noncomputable def objObjPreimageIso {S : ๐’ฎ} {a : ๐’ณ} (ha : p.obj a = S) :
(ฮน S).obj (objPreimage ha) โ‰… a :=
fiberInclusion.mapIso (Functor.objObjPreimageIso (inducedFunctor p S) (Fiber.mk ha))

instance objObjPreimageIso.IsHomLift {S : ๐’ฎ} {a : ๐’ณ} (ha : p.obj a = S) :
IsHomLift p (๐Ÿ™ S) (objObjPreimageIso ha).hom :=
(Functor.objObjPreimageIso (inducedFunctor p S) (Fiber.mk ha)).hom.2

section

variable [IsPreFibered p] {R S : ๐’ฎ} {a : ๐’ณ} (f : R โŸถ S) (ha : p.obj a = S)

/-- The domain, taken in `Fib p R`, of some cartesian morphism lifting a given
`f : R โŸถ S` in `๐’ฎ` -/
noncomputable def pullbackObj : Fib p R :=
objPreimage (domain_eq p f (IsPreFibered.pullbackMap ha f))

/-- A cartesian morphism lifting `f : R โŸถ S` with domain in the image of `Fib p R` -/
noncomputable def pullbackMap : (ฮน R).obj (pullbackObj f ha) โŸถ a :=
(objObjPreimageIso (domain_eq p f (IsPreFibered.pullbackMap ha f))).hom โ‰ซ
(IsPreFibered.pullbackMap ha f)

instance pullbackMap.isCartesian : IsCartesian p f (pullbackMap f ha) := by
conv in f => rw [โ† id_comp f]
simp only [id_comp, pullbackMap]
infer_instance

end

section

variable {R S : ๐’ฎ} {a : ๐’ณ} {b b' : Fib p R} (f : R โŸถ S) (ฯˆ : (ฮน R).obj b' โŸถ a)
[IsCartesian p f ฯˆ] (ฯ† : (ฮน R).obj b โŸถ a) [IsHomLift p f ฯ†]

/-- Given a fibered category p, b' b in Fib R, and a pullback ฯˆ : b โŸถ a in ๐’ณ, i.e.
```
b' b --ฯˆ--> a
| | |
v v v
R ====== R --f--> S
```
Then the induced map ฯ„ : b' โŸถ b can be lifted to the fiber over R -/
noncomputable def inducedMap : b โŸถ b' :=
mapPreimage (IsCartesian.map p f ฯˆ ฯ†)

lemma inducedMap_comp : (ฮน R).map (inducedMap f ฯˆ ฯ†) โ‰ซ ฯˆ = ฯ† := by
simp only [inducedMap, mapPreimage_eq, IsCartesian.fac]

end

section

variable [IsFibered p] {R S : ๐’ฎ} {a : ๐’ณ} {b : Fib p R}

/-- Given `a : ๐’ณ`, `b : Fib p R`, and a diagram
```
b --ฯ†--> a
- -
| |
v v
R --f--> S
```
It can be factorized as
```
b --ฯ„--> b'--ฯˆ--> a
- - -
| | |
v v v
R ====== R --f--> S
```
with `ฯˆ` cartesian over `f` and `ฯ„` a map in `Fib p R`. -/
lemma fiber_factorization (ha : p.obj a = S) {b : Fib p R} (f : R โŸถ S) (ฯ† : (ฮน R).obj b โŸถ a)
[IsHomLift p f ฯ†] : โˆƒ (b' : Fib p R) (ฯ„ : b โŸถ b') (ฯˆ : (ฮน R).obj b' โŸถ a),
IsStronglyCartesian p f ฯˆ โˆง (((ฮน R).map ฯ„) โ‰ซ ฯˆ = ฯ†) :=
let ฯˆ := pullbackMap f ha
โŸจpullbackObj f ha, inducedMap f ฯˆ ฯ†, ฯˆ, inferInstance, inducedMap_comp f ฯˆ ฯ†โŸฉ

end

end

end HasFibers
33 changes: 24 additions & 9 deletions Mathlib/CategoryTheory/FiberedCategory/HomLift.lean
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ instance comp {R S T : ๐’ฎ} {a b c : ๐’ณ} (f : R โŸถ S) (g : S โŸถ T) (ฯ† : a
apply CommSq.horiz_comp (commSq p f ฯ†) (commSq p g ฯˆ)

/-- If `ฯ† : a โŸถ b` and `ฯˆ : b โŸถ c` lift `๐Ÿ™ R`, then so does `ฯ† โ‰ซ ฯˆ` -/
instance lift_id_comp (R : ๐’ฎ) {a b c : ๐’ณ} (ฯ† : a โŸถ b) (ฯˆ : b โŸถ c)
instance comp_of_lift_id (R : ๐’ฎ) {a b c : ๐’ณ} (ฯ† : a โŸถ b) (ฯˆ : b โŸถ c)
[p.IsHomLift (๐Ÿ™ R) ฯ†] [p.IsHomLift (๐Ÿ™ R) ฯˆ] : p.IsHomLift (๐Ÿ™ R) (ฯ† โ‰ซ ฯˆ) :=
comp_id (๐Ÿ™ R) โ–ธ comp p (๐Ÿ™ R) (๐Ÿ™ R) ฯ† ฯˆ

Expand Down Expand Up @@ -164,22 +164,37 @@ lemma id_lift_eqToHom_codomain {p : ๐’ณ โฅค ๐’ฎ} {R S : ๐’ฎ} (hRS : R = S) {b
p.IsHomLift (eqToHom hRS) (๐Ÿ™ b) := by
subst hRS hb; simp

instance comp_eqToHom_lift {R S : ๐’ฎ} {a' a b : ๐’ณ} (f : R โŸถ S) (ฯ† : a โŸถ b) (h : a' = a)
[p.IsHomLift f ฯ†] : p.IsHomLift f (eqToHom h โ‰ซ ฯ†) := by

section

variable {R S : ๐’ฎ} {a b : ๐’ณ} (f : R โŸถ S) (ฯ† : a โŸถ b) [p.IsHomLift f ฯ†]

instance comp_id_lift : p.IsHomLift f (๐Ÿ™ a โ‰ซ ฯ†) := by
simp_all

instance id_comp_lift : p.IsHomLift f (ฯ† โ‰ซ ๐Ÿ™ b) := by
simp_all

instance lift_id_comp : p.IsHomLift (๐Ÿ™ R โ‰ซ f) ฯ† := by
simp_all

instance lift_comp_id : p.IsHomLift (f โ‰ซ ๐Ÿ™ S) ฯ† := by
simp_all

instance comp_eqToHom_lift {a' : ๐’ณ} (h : a' = a) : p.IsHomLift f (eqToHom h โ‰ซ ฯ†) := by
subst h; simp_all

instance eqToHom_comp_lift {R S : ๐’ฎ} {a b b' : ๐’ณ} (f : R โŸถ S) (ฯ† : a โŸถ b) (h : b = b')
[p.IsHomLift f ฯ†] : p.IsHomLift f (ฯ† โ‰ซ eqToHom h) := by
instance eqToHom_comp_lift {b' : ๐’ณ} (h : b = b') : p.IsHomLift f (ฯ† โ‰ซ eqToHom h) := by
subst h; simp_all

instance lift_eqToHom_comp {R' R S : ๐’ฎ} {a b : ๐’ณ} (f : R โŸถ S) (ฯ† : a โŸถ b) (h : R' = R)
[p.IsHomLift f ฯ†] : p.IsHomLift (eqToHom h โ‰ซ f) ฯ† := by
instance lift_eqToHom_comp {R' : ๐’ฎ} (h : R' = R) : p.IsHomLift (eqToHom h โ‰ซ f) ฯ† := by
subst h; simp_all

instance lift_comp_eqToHom {R S S' : ๐’ฎ} {a b : ๐’ณ} (f : R โŸถ S) (ฯ† : a โŸถ b) (h : S = S')
[p.IsHomLift f ฯ†] : p.IsHomLift (f โ‰ซ eqToHom h) ฯ† := by
instance lift_comp_eqToHom {S' : ๐’ฎ} (h : S = S') : p.IsHomLift (f โ‰ซ eqToHom h) ฯ† := by
subst h; simp_all

end

@[simp]
lemma comp_eqToHom_lift_iff {R S : ๐’ฎ} {a' a b : ๐’ณ} (f : R โŸถ S) (ฯ† : a โŸถ b) (h : a' = a) :
p.IsHomLift f (eqToHom h โ‰ซ ฯ†) โ†” p.IsHomLift f ฯ† where
Expand Down
Loading