Skip to content

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

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

[Merged by Bors] - refactor: weaken HasPullbacks to HasPullback in Over.Pullback#29795
Jlh18 wants to merge 11 commits intoleanprover-community:masterfrom
Jlh18:OverPullback

Conversation

@Jlh18
Copy link
Copy Markdown
Collaborator

@Jlh18 Jlh18 commented Sep 19, 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

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
Copy link
Copy Markdown

github-actions bot commented Sep 19, 2025

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).

Copy link
Copy Markdown
Member

@chrisflav chrisflav left a comment

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 A reviewer has asked the author a question or requested changes. label Sep 19, 2025
@Jlh18
Copy link
Copy Markdown
Collaborator Author

Jlh18 commented Sep 19, 2025

-awaiting-author

@github-actions github-actions bot removed the awaiting-author A reviewer has asked the author a question or requested changes. 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 A reviewer has asked the author a question or requested changes. label Sep 19, 2025
@leanprover-bot
Copy link
Copy Markdown
Collaborator

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
Copy link
Copy Markdown
Collaborator Author

Jlh18 commented Sep 19, 2025

-awaiting-author

@github-actions github-actions bot removed the awaiting-author A reviewer has asked the author a question or requested changes. 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
Copy link
Copy Markdown
Collaborator Author

Jlh18 commented Sep 22, 2025

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
Copy link
Copy Markdown
Collaborator Author

Jlh18 commented Sep 29, 2025

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

Copy link
Copy Markdown
Collaborator

@peabrainiac peabrainiac left a comment

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?

Copy link
Copy Markdown
Collaborator

@peabrainiac peabrainiac Sep 29, 2025

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 <37772949+joelriou@users.noreply.github.com>
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 <37772949+joelriou@users.noreply.github.com>
@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
Collaborator

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 <37772949+joelriou@users.noreply.github.com>
@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 <josephhua73@yahoo.com>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Oct 10, 2025

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 <josephhua73@yahoo.com>
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 <37772949+joelriou@users.noreply.github.com>
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 <josephhua73@yahoo.com>
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 <josephhua73@yahoo.com>
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 <josephhua73@yahoo.com>
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 <37772949+joelriou@users.noreply.github.com>
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 <josephhua73@yahoo.com>
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 <josephhua73@yahoo.com>
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 <josephhua73@yahoo.com>
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