Skip to content

[Merged by Bors] - refactor(Order/Basic): move Pi & Prop orders to a new file#40658

Closed
SnirBroshi wants to merge 6 commits into
leanprover-community:masterfrom
SnirBroshi:chore/order/move-pi-and-prop-orders-earlier
Closed

[Merged by Bors] - refactor(Order/Basic): move Pi & Prop orders to a new file#40658
SnirBroshi wants to merge 6 commits into
leanprover-community:masterfrom
SnirBroshi:chore/order/move-pi-and-prop-orders-earlier

Conversation

@SnirBroshi

@SnirBroshi SnirBroshi commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Move the LE instances of Pi & Prop from Order/Basic.lean to a new Order/Defs/Prop.lean.
This lets Logic/Relation.lean import them so that it can use between relations.


Extracted from #30526

About the copyright of the new file:

Open in Gitpod

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

PR summary 7ab71b05d7

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
../mathlib-ci/scripts/pr_summary/import_trans_difference.sh all
There are 7441 files with changed transitive imports taking up over 331369 characters: this is too many to display!
You can run this locally from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci


Declarations diff (regex)

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 7ab71b0).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit 7ab71b05d7
Reference commit 9c27dca6e4

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/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).

@eric-wieser

Copy link
Copy Markdown
Member

Also reverts #34391

I think the reason for this PR still applies; we shouldn't ungeneralize the lemmas about the general definitions in core. This might mean having separate Sort and Type sections, or it might mean making an RFC to ungeneralize them upstream.

@eric-wieser

Copy link
Copy Markdown
Member

because Pi.hasLe doesn't support sorts, see this thread.

Please add the explanation in the commit message above the fold; GitHub discuseions are hard to find in large PRs

@SnirBroshi

SnirBroshi commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

Moved that sentence above the fold.

GitHub discussions are hard to find in large PRs

image

(link)
(edit: see also small Zulip remark)

@eric-wieser

Copy link
Copy Markdown
Member

Oh, I thought you had a reason to justify why it didn't support sorts

@joneugster joneugster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for the PR! This looks reasonable to me.

About the specialisation back from Sort to Type: My personal opinion in this instance is that this kind of generalisation is nice if it works out-of-the-box, but it might not be worth to deal with any complications just for the sake of generalisation. It seems to me that #34391 also has been created in this spirit, i.e. it has been generalised because it works without any issues, not because there was any real use case.

With that, I recommend

maintainer merge

Comment thread Mathlib/Order/Defs/Prop.lean Outdated
@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by joneugster.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jun 19, 2026
@eric-wieser

Copy link
Copy Markdown
Member

I'd like to hear from @b-mehta here before reverting his PR

@eric-wieser eric-wieser changed the title chore(Order/Basic): move Pi & Prop orders to a new file refactor(Order/Basic): move Pi & Prop orders to a new file and ungeneralize universes Jun 19, 2026
@eric-wieser eric-wieser requested a review from b-mehta June 19, 2026 14:25
@eric-wieser eric-wieser changed the title refactor(Order/Basic): move Pi & Prop orders to a new file and ungeneralize universes refactor(Order/Basic,LogicRelation): move Pi & Prop orders to a new file and ungeneralize universes Jun 19, 2026
@eric-wieser eric-wieser changed the title refactor(Order/Basic,LogicRelation): move Pi & Prop orders to a new file and ungeneralize universes refactor(Order/Basic,Logic/Relation): move Pi & Prop orders to a new file and ungeneralize universes in relation lemmas Jun 19, 2026
@eric-wieser

Copy link
Copy Markdown
Member

(the long PR title is perhaps good evidence that this PR is doing two unrelated things that would happen in separate PRs)

@eric-wieser eric-wieser assigned b-mehta and unassigned eric-wieser Jun 20, 2026
@b-mehta

b-mehta commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

I don't think the universe ungeneralisation is a good idea, and it's not clear to me that it's motivated. It looks like exactly one lemma doesn't work with the generalised universes, but that doesn't motivate making a whole series of true lemmas unusable. Can't we just change map_mono to take {α β : Type*} instead?

@SnirBroshi

Copy link
Copy Markdown
Collaborator Author

exactly one lemma

See #30526, it's the entire file, I changed just map_mono here as a proof-of-concept since it has a TODO comment.
But regardless, I prefer to postpone this discussion to #30526 if the move itself is good to go, so I reverted the changes to Logic/Relation.lean.

@SnirBroshi SnirBroshi changed the title refactor(Order/Basic,Logic/Relation): move Pi & Prop orders to a new file and ungeneralize universes in relation lemmas refactor(Order/Basic): move Pi & Prop orders to a new file Jun 21, 2026

@b-mehta b-mehta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, will wait for CI then merge

@SnirBroshi

Copy link
Copy Markdown
Collaborator Author

(btw my comment above reads a bit snarky to me but I'm not sure how to phrase it better, no snarky-ness intended)

Letting LE accept Sort will solve the universe issues, do you think core will be okay with such a change?

@eric-wieser

Copy link
Copy Markdown
Member

Letting LE accept Sort will solve the universe issues, do you think core will be okay with such a change?

I think the first half of this question is a good one for Zulip; in particular, this is needed for allow f ≤ g when f g : \forall x ≤ 3, Nat.

It sounds like the motivation is also that there are other core defs which already are generalized to Sort

@b-mehta

b-mehta commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Thanks!

bors merge

mathlib-bors Bot pushed a commit that referenced this pull request Jun 21, 2026
Move the `LE` instances of `Pi` & `Prop` from `Order/Basic.lean` to a new `Order/Defs/Prop.lean`.
This lets `Logic/Relation.lean` import them so that it can use `≤` between relations.
@mathlib-triage mathlib-triage Bot added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Jun 21, 2026
@mathlib-bors

mathlib-bors Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor(Order/Basic): move Pi & Prop orders to a new file [Merged by Bors] - refactor(Order/Basic): move Pi & Prop orders to a new file Jun 21, 2026
@mathlib-bors mathlib-bors Bot closed this Jun 21, 2026
bryangingechen pushed a commit to jcommelin/mathlib4 that referenced this pull request Jun 22, 2026
…rover-community#40658)

Move the `LE` instances of `Pi` & `Prop` from `Order/Basic.lean` to a new `Order/Defs/Prop.lean`.
This lets `Logic/Relation.lean` import them so that it can use `≤` between relations.
felixpernegger pushed a commit to felixpernegger/mathlib4 that referenced this pull request Jun 22, 2026
…rover-community#40658)

Move the `LE` instances of `Pi` & `Prop` from `Order/Basic.lean` to a new `Order/Defs/Prop.lean`.
This lets `Logic/Relation.lean` import them so that it can use `≤` between relations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-order Order theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants