Skip to content

[Merged by Bors] - chore(Order/ConditionallyCompleteLattice): split off material on WithTop - #45402

Closed
astrainfinita wants to merge 5 commits into
leanprover-community:masterfrom
astrainfinita:ordersup_withtop_split
Closed

astrainfinita wants to merge 5 commits into
leanprover-community:masterfrom
astrainfinita:ordersup_withtop_split

Conversation

@astrainfinita

Copy link
Copy Markdown
Collaborator

This PR moves the material on sSup and sInf on WithTop α and WithBot α from Order/ConditionallyCompleteLattice/Basic and Order/ConditionallyCompleteLattice/Indexed to a new file Order/ConditionallyCompleteLattice/WithTop.

This material was scattered over five places in the two files, although the rest of these files does not depend on it.


…hTop`

This PR moves the material on `sSup` and `sInf` on `WithTop α` and `WithBot α` from `Order/ConditionallyCompleteLattice/Basic` and `Order/ConditionallyCompleteLattice/Indexed` to a new file `Order/ConditionallyCompleteLattice/WithTop`.

This material was scattered over five places in the two files, although the rest of these files does not depend on it.
@astrainfinita astrainfinita added the t-order Order theory label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

PR summary 2333caff1e

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 3323 files with changed transitive imports taking up over 154607 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)

--++ instance [ConditionallyCompleteLinearOrder α] :

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

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
5127 1 exposed public sections

Current commit 2333caff1e
Reference commit ee6c124192

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

@vihdzp vihdzp 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.

Looks good to me! Awaiting the future refactoring PRs.

@vihdzp
vihdzp requested a review from YaelDillies October 28, 2026 21:46
@YaelDillies

Copy link
Copy Markdown
Contributor

What refactoring PRs? Are you aware of #45250 ?

@astrainfinita

Copy link
Copy Markdown
Collaborator Author

We will clean up this API (#45406) and make ConditionallyCompleteLattice extend OrderSupSet (#35674). Finally, there's no need to use a more complicated definition (#45440).

Comment on lines +37 to +94
open scoped Classical in
@[to_dual]
noncomputable instance [SupSet α] : SupSet (WithTop α) :=
⟨fun S =>
if ⊤ ∈ S then ⊤ else if BddAbove ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α) then
↑(sSup ((fun (a : α) ↦ (a : WithTop α)) ⁻¹' S : Set α)) else ⊤⟩

open scoped Classical in
@[to_dual]
noncomputable instance instInfSet [InfSet α] : InfSet (WithTop α) :=
⟨fun S => if S ⊆ {⊤} ∨ ¬BddBelow S then ⊤ else ↑(sInf ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α))⟩

@[to_dual]
theorem sSup_eq [SupSet α] {s : Set (WithTop α)} (hs : ⊤ ∉ s)
(hs' : BddAbove ((↑) ⁻¹' s : Set α)) : sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
(ite_eq_right hs).trans <| ite_eq_left hs'

@[to_dual]
theorem sInf_eq [InfSet α] {s : Set (WithTop α)} (hs : ¬s ⊆ {⊤}) (h's : BddBelow s) :
sInf s = ↑(sInf ((↑) ⁻¹' s) : α) :=
ite_eq_right <| by simp [hs, h's]

@[to_dual (attr := simp)]
theorem sInf_empty [InfSet α] : sInf (∅ : Set (WithTop α)) = ⊤ :=
ite_eq_left <| by simp

@[to_dual (attr := simp)]
theorem sInf_singleton_top [InfSet α] : sInf ({⊤} : Set (WithTop α)) = ⊤ :=
ite_eq_left <| .inl subset_rfl

@[to_dual (attr := simp)]
theorem sSup_of_top_mem [SupSet α] {s : Set (WithTop α)} (h : ⊤ ∈ s) : sSup s = ⊤ :=
ite_eq_left h

@[to_dual]
theorem sSup_singleton_top [SupSet α] : sSup ({⊤} : Set (WithTop α)) = ⊤ := by
simp

@[to_dual]
theorem sSup_of_not_bddAbove [SupSet α] {s : Set (WithTop α)}
(h : ¬BddAbove ((↑) ⁻¹' s : Set α)) : sSup s = ⊤ := by
by_cases hmem : ⊤ ∈ s
· exact sSup_of_top_mem hmem
· exact ite_eq_right hmem |>.trans <| ite_eq_right h

@[to_dual (attr := simp)]
theorem sInf_of_not_bddBelow [InfSet α] {s : Set (WithTop α)} (h : ¬BddBelow s) :
sInf s = ⊤ :=
ite_eq_left <| .inr h

@[to_dual (attr := norm_cast)]
theorem coe_sSup' [SupSet α] {s : Set α} (hs : BddAbove s) :
↑(sSup s) = (sSup ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by
classical
change _ = ite _ _ _
rw [ite_eq_right, preimage_image_eq, ite_eq_left hs]
· exact Option.some_injective _
· rintro ⟨x, _, ⟨⟩⟩

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.

Can you split into SupSet and InfSet sections?

· rintro ⟨x, _, ⟨⟩⟩

@[to_dual]
theorem sSup_empty (α : Type*) [CompleteLattice α] : (sSup ∅ : WithTop α) = ⊥ := by

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.

This is misplaced

Comment on lines +27 to +29
section LE

namespace WithTop

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.

Why not

Suggested change
section LE
namespace WithTop
namespace WithTop
section LE

@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 30, 2026
@astrainfinita

Copy link
Copy Markdown
Collaborator Author

This PR only moves code, so I'd like to keep each section unchanged and do the cleanup in #45406. I think reordering the sections should be fine, though.

@astrainfinita astrainfinita removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 30, 2026
This reverts commit 991d83b.
@astrainfinita

Copy link
Copy Markdown
Collaborator Author

Actually, some of these aren't Preorder lemmas. I'll leave moving the Preorder lemmas to the next PR as well.

@YaelDillies YaelDillies 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.

Sure

maintainer merge

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

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

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Nov 2, 2026
@bryangingechen

Copy link
Copy Markdown
Contributor

Thanks!
bors r+

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Nov 3, 2026
@mathlib-triage mathlib-triage Bot removed the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Nov 3, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Nov 3, 2026
…hTop` (#45402)

This PR moves the material on `sSup` and `sInf` on `WithTop α` and `WithBot α` from `Order/ConditionallyCompleteLattice/Basic` and `Order/ConditionallyCompleteLattice/Indexed` to a new file `Order/ConditionallyCompleteLattice/WithTop`.

This material was scattered over five places in the two files, although the rest of these files does not depend on it.
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Nov 3, 2026
@mathlib-bors

mathlib-bors Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title chore(Order/ConditionallyCompleteLattice): split off material on WithTop [Merged by Bors] - chore(Order/ConditionallyCompleteLattice): split off material on WithTop Nov 3, 2026
@mathlib-bors mathlib-bors Bot closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. 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