Skip to content

[Merged by Bors] - refactor: weaken HasPullbacks to HasPullback in Over.Pullback - #29795

Closed
Jlh18 wants to merge 11 commits into
leanprover-community:masterfrom
Jlh18:OverPullback
Closed

Jlh18 wants to merge 11 commits into
leanprover-community:masterfrom
Jlh18:OverPullback

Conversation

@Jlh18

@Jlh18 Jlh18 commented Sep 19, 2025 •

Copy link
Copy Markdown
Collaborator

Add an abbreviation HasPullbackAlong f to mean that all maps into the codomain of f have pullbacks along f. As discussed in zulip #mathlib4 > Hom.HasPullback

The HasPullbacks instance on a category C for defining the pullback functor along a map f : X -> Y between their over categories can be weakened to just a HasPullbackAlong condition on f.

Dually, for HasPushout and undercategories.


Open in Gitpod

@github-actions github-actions Bot added new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! large-import Automatically added label for PRs with a significant increase in transitive imports t-category-theory Category theory labels Sep 19, 2025
@github-actions

github-actions Bot commented Sep 19, 2025 •

Copy link
Copy Markdown

PR summary 1f467e3c77

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.CategoryTheory.Comma.Over.Pullback 496 498 +2 (+0.40%)
Import changes for all files
Files Import difference
Mathlib.CategoryTheory.Comma.Over.Pullback 2

Declarations diff

+ HasPullbacksAlong
+ HasPushoutsAlong

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@chrisflav chrisflav left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! I think this is a good change, but we should check how this affects performance.

by pulling back a morphism along `f`. -/
@[simps! +simpRhs obj_left obj_hom map_left]
def pullback {X Y : C} (f : X ⟶ Y) : Over Y ⥤ Over X where
def pullback : Over Y ⥤ Over X where

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion this is a regression in readability. I would repeat the f argument (and the HasPullback assumption) in the signature.
Similarly below.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(In lemmas, relying on the section variables is fine.)


section HasBinaryProducts
variable [HasBinaryProducts C]
variable [HasBinaryProducts C] (X)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable implicitness change is unrelated to the rest of this PR if I understand correctly. I would suggest to do this in a separate PR, because this change probably needs some further discussion. For example, if we change explicitness here, we should probably also change Over.post.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just because X was explicit before, then became implicit due to my variable declaration at the top of the file. It is removed now

@chrisflav

Copy link
Copy Markdown
Member

!bench

@chrisflav chrisflav added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 19, 2025
@Jlh18

Jlh18 commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 19, 2025
Comment on lines +92 to +95
section

variable [HasPullbacks C]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making a section, I would just move the [HasPullbacks C] in the signature of the statement.

@chrisflav chrisflav added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 19, 2025
@leanprover-bot

Copy link
Copy Markdown

Here are the benchmark results for commit 2c45ee1.
There were no significant changes against commit 4f7d34e.

@github-actions

Copy link
Copy Markdown
File Instructions %
build +7.192⬝10⁹ (+0.00%)
Mathlib.CategoryTheory.Comma.Over.Pullback +6.148⬝10⁹ (+18.76%)
CI run Lakeprof report

@Jlh18

Jlh18 commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 19, 2025
@Jlh18
Jlh18 marked this pull request as draft September 19, 2025 20:27
@Jlh18
Jlh18 marked this pull request as ready for review September 20, 2025 02:13
@Jlh18
Jlh18 marked this pull request as draft September 22, 2025 14:44
@Jlh18

Jlh18 commented Sep 22, 2025

Copy link
Copy Markdown
Collaborator Author

I am now wondering if we should make a class

protected class Hom.HasPullback {X Y : C} (f : X ⟶ Y) : Prop where
  hasPullback {W} (g : W ⟶ Y) : HasPullback g f

to make these statements a little tidier?

@Jlh18
Jlh18 marked this pull request as ready for review September 22, 2025 15:28
@kckennylau

Copy link
Copy Markdown
Collaborator

Is there a context for this PR (and I suppose this new class)?

@Jlh18

Jlh18 commented Sep 29, 2025

Copy link
Copy Markdown
Collaborator Author

The category of manifolds also admits not all pullbacks but all pullbacks along submersions, so this seems like a useful definition for that too. One small nitpick though: shouldn't it be Hom.HasPullbacksAlong instead of Hom.HasPullbackAlong? It is all pullbacks along that morphism that you're talking about after all, not just one

I am happy to go with that convention. Changed it now

@peabrainiac peabrainiac left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment on one more thing I previously missed. Other than that this looks good to me though, thanks!

Comment on lines +511 to +512
/-- `HasPullbacksAlong f` represents a choice of pullback
for each morphism into the codomain of `f : X ⟶ Z`. -/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/-- `HasPullbacksAlong f` represents a choice of pullback
for each morphism into the codomain of `f : X ⟶ Z`. -/
/-- `HasPullbacksAlong f` states that all pullbacks of morphisms into `Y` along `f : X ⟶ Y` exist. -/

This is just a proposition, it doesn't actually carry any choices of pullbacks as data. Same thing for pushouts.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following the style of doc-strings for HasPullback and HasPullbacks. Should I change them too?

@peabrainiac peabrainiac Sep 29, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, those are outdated. They should definitely be updated at some point, but so should the docstrings for HasEqualizer, HasEqualizers, HasWideEqualizer, HasWideEqualizers, HasCoequalizer etc... maybe that is enough to warrant a separate PR. Let's just change the docstrings introduced in this PR for now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it - fixed now. Thanks a lot for the review!

mathlib-bors Bot pushed a commit that referenced this pull request Oct 3, 2025
…30145)

Update the docstrings of `HasPullbacks`, `HasEqualizers` etc. to reflect that those declarations are propositions and no longer carry any choices of limits as data. This came up in #29795.

Co-authored-by: Joël Riou <[email protected]>
mathlib-bors Bot pushed a commit that referenced this pull request Oct 3, 2025
…30145)

Update the docstrings of `HasPullbacks`, `HasEqualizers` etc. to reflect that those declarations are propositions and no longer carry any choices of limits as data. This came up in #29795.

Co-authored-by: Joël Riou <[email protected]>
@mathlib4-merge-conflict-bot mathlib4-merge-conflict-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 3, 2025
@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 3, 2025
mitchell-horner pushed a commit to mitchell-horner/mathlib4 that referenced this pull request Oct 6, 2025
…eanprover-community#30145)

Update the docstrings of `HasPullbacks`, `HasEqualizers` etc. to reflect that those declarations are propositions and no longer carry any choices of limits as data. This came up in leanprover-community#29795.

Co-authored-by: Joël Riou <[email protected]>
@joelriou

Copy link
Copy Markdown
Contributor

Thanks!

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Oct 10, 2025
mathlib-bors Bot pushed a commit that referenced this pull request Oct 10, 2025
Add an abbreviation `HasPullbackAlong f` to mean that all maps into the codomain of `f` have pullbacks along `f`. As discussed in zulip [#mathlib4 > Hom.HasPullback](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Hom.2EHasPullback/with/541055666)

The `HasPullbacks` instance on a category `C` for defining the pullback functor along a map `f : X -> Y` between their over categories can be weakened to just a `HasPullbackAlong` condition on `f`.

Dually, for `HasPushout` and undercategories.

Co-authored-by: jlh18 <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor: weaken HasPullbacks to HasPullback in Over.Pullback [Merged by Bors] - refactor: weaken HasPullbacks to HasPullback in Over.Pullback Oct 10, 2025
@mathlib-bors mathlib-bors Bot closed this Oct 10, 2025
mathlib-bors Bot pushed a commit that referenced this pull request Oct 10, 2025
…ts (#29812)

The `HasPullbacks` instance on a category `C` for defining the `baseChange` / pullback functor along a map `f : X -> Y` between their over categories can be weakened to just a `HasPullback` condition on `f`.

- [ ] depends on: #29795

Co-authored-by: jlh18 <[email protected]>
Jlh18 pushed a commit to Jlh18/mathlib4 that referenced this pull request Oct 14, 2025
…eanprover-community#30145)

Update the docstrings of `HasPullbacks`, `HasEqualizers` etc. to reflect that those declarations are propositions and no longer carry any choices of limits as data. This came up in leanprover-community#29795.

Co-authored-by: Joël Riou <[email protected]>
Jlh18 added a commit to Jlh18/mathlib4 that referenced this pull request Oct 14, 2025
…over-community#29795)

Add an abbreviation `HasPullbackAlong f` to mean that all maps into the codomain of `f` have pullbacks along `f`. As discussed in zulip [#mathlib4 > Hom.HasPullback](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Hom.2EHasPullback/with/541055666)

The `HasPullbacks` instance on a category `C` for defining the pullback functor along a map `f : X -> Y` between their over categories can be weakened to just a `HasPullbackAlong` condition on `f`.

Dually, for `HasPushout` and undercategories.

Co-authored-by: jlh18 <[email protected]>
mathlib-bors Bot pushed a commit that referenced this pull request Oct 15, 2025
…Adjuction (#29810)

This PR replaces the global assumption of `HasPullback T` with the weaker assumption that pullbacks exist along the morphism only. 

For the sake of readability I also moved the variable `(f : X -> Y)` into the statement of each theorem. As instructed in #29795 (comment)

- [ ] depends on: #29795
- [ ] depends on: #29812

Co-authored-by: jlh18 <[email protected]>
Jlh18 added a commit to Jlh18/mathlib4 that referenced this pull request Oct 24, 2025
…Adjuction (leanprover-community#29810)

This PR replaces the global assumption of `HasPullback T` with the weaker assumption that pullbacks exist along the morphism only. 

For the sake of readability I also moved the variable `(f : X -> Y)` into the statement of each theorem. As instructed in leanprover-community#29795 (comment)

- [ ] depends on: leanprover-community#29795
- [ ] depends on: leanprover-community#29812

Co-authored-by: jlh18 <[email protected]>
BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
…eanprover-community#30145)

Update the docstrings of `HasPullbacks`, `HasEqualizers` etc. to reflect that those declarations are propositions and no longer carry any choices of limits as data. This came up in leanprover-community#29795.

Co-authored-by: Joël Riou <[email protected]>
BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
…over-community#29795)

Add an abbreviation `HasPullbackAlong f` to mean that all maps into the codomain of `f` have pullbacks along `f`. As discussed in zulip [#mathlib4 > Hom.HasPullback](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Hom.2EHasPullback/with/541055666)

The `HasPullbacks` instance on a category `C` for defining the pullback functor along a map `f : X -> Y` between their over categories can be weakened to just a `HasPullbackAlong` condition on `f`.

Dually, for `HasPushout` and undercategories.

Co-authored-by: jlh18 <[email protected]>
BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
…ts (leanprover-community#29812)

The `HasPullbacks` instance on a category `C` for defining the `baseChange` / pullback functor along a map `f : X -> Y` between their over categories can be weakened to just a `HasPullback` condition on `f`.

- [ ] depends on: leanprover-community#29795

Co-authored-by: jlh18 <[email protected]>
BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
…Adjuction (leanprover-community#29810)

This PR replaces the global assumption of `HasPullback T` with the weaker assumption that pullbacks exist along the morphism only. 

For the sake of readability I also moved the variable `(f : X -> Y)` into the statement of each theorem. As instructed in leanprover-community#29795 (comment)

- [ ] depends on: leanprover-community#29795
- [ ] depends on: leanprover-community#29812

Co-authored-by: jlh18 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! ready-to-merge This PR has been sent to bors. t-category-theory Category theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants