Skip to content

chore(Order/ConditionallyCompleteLattice/Defs): deprecate ConditionallyCompleteLinearOrderBot - #45438

Open
astrainfinita wants to merge 72 commits into
leanprover-community:masterfrom
astrainfinita:cclob
Open

astrainfinita wants to merge 72 commits into
leanprover-community:masterfrom
astrainfinita:cclob

Conversation

@astrainfinita

@astrainfinita astrainfinita commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Now that ConditionallyCompleteLattice extends OrderSupSet, we no longer need a separate ConditionallyCompleteLinearOrderBot class to provide a proof of sSup ∅ = ⊥.


diff

…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.
…nces on `WithTop`

Adds `OrderSupSet (WithTop α)` and `OrderInfSet (WithTop α)` instances (and their `WithBot` duals), and cleans up the API for `sSup` and `sInf` on `WithTop`.
…nditionallyCompleteLinearOrderBot`"

This reverts commit 166d9c7.
…onditionallyCompleteLinearOrderBot`"

This reverts commit 00bcab2.
@astrainfinita astrainfinita added the t-order Order theory label Oct 28, 2026
@github-actions github-actions Bot added the tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

PR summary d9d32c4bed

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

+ OrderSupSet.chooseBot
+ OrderSupSet.chooseBot_sSup_empty_of_noBotOrder
+ OrderSupSet.chooseBot_sSup_of_not_exists
+ Set.OrdConnected.coe_sInf
+ Set.OrdConnected.coe_sSup
+ Set.OrdConnected.conditionallyCompleteLinearOrder
+ Set.OrdConnected.csInf_image_mem
+ Set.OrdConnected.csSup_image_mem
+ Set.OrdConnected.sInf_empty_of_noTopOrder
+ Set.OrdConnected.sSup_empty_of_noBotOrder
+ Subtype.isLUB_of_csSup_image_mem
+ WellFoundedLT.conditionallyCompleteLinearOrder
+ bddBelow_preimage_coe
+ coe_sInf'
+ exists_isLUB_cond
+ instOrderInfSet
+ instSupSet
+ instance (priority := 100) CompleteLinearOrder.toConditionallyCompleteLinearOrder {α : Type*}
+ instance : ConditionallyCompleteLinearOrder Cardinal
+ instance : ConditionallyCompleteLinearOrder Ordinal
+ instance : ConditionallyCompleteLinearOrder ℕ
+ instance : ConditionallyCompleteLinearOrder ℝ≥0
+ instance : NoBotOrder ℤ := ⟨fun x ↦ ⟨x - 1, (Int.sub_one_lt_of_le le_rfl).not_ge⟩⟩
+ instance : NoTopOrder ℤ := ⟨fun x ↦ ⟨x + 1, (Int.lt_add_one_of_le le_rfl).not_ge⟩⟩
+ isCompl_range_coe
+ isGLB_coe_iff
+ isGLB_top_iff
+ isLUB_coe_iff
+ isLUB_top_iff
+ lowerBounds_preimage_coe
+ sInf_eq_coe_iff
+ sInf_eq_top_iff
+ sSup_eq_coe_iff
+ sSup_eq_top_iff
++ instOrderSupSet
- WithTop.coe_sInf'
- instance (priority := 100) CompleteLinearOrder.toConditionallyCompleteLinearOrderBot {α : Type*}
- instance : ConditionallyCompleteLinearOrderBot Cardinal
- instance : ConditionallyCompleteLinearOrderBot Ordinal
- instance : ConditionallyCompleteLinearOrderBot ℕ
- instance : ConditionallyCompleteLinearOrderBot ℝ≥0
- instance [SupSet α] : SupSet (WithTop α)
- ordConnectedSubsetConditionallyCompleteLinearOrder
--++ 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 d9d32c4).

  • +62 new declarations
  • −13 removed declarations
+Cardinal.instConditionallyCompleteLinearOrder
-Cardinal.instConditionallyCompleteLinearOrderBot
+CompleteLinearOrder.toConditionallyCompleteLinearOrder
-CompleteLinearOrder.toConditionallyCompleteLinearOrderBot
+ConditionallyCompleteLattice.exists_isGLB_cond
+ConditionallyCompleteLattice.exists_isLUB_cond
-ConditionallyCompleteLattice.isGLB_csInf
-ConditionallyCompleteLattice.isLUB_csSup
-ConditionallyCompleteLattice.toInfSet
+ConditionallyCompleteLattice.toOrderInfSet
+ConditionallyCompleteLattice.toOrderSupSet
-ConditionallyCompleteLattice.toSupSet
-ConditionallyCompleteLinearOrderBot.csSup_empty
+ConditionallyCompleteLinearOrderBot.mk.inj
+ConditionallyCompleteLinearOrderBot.mk.injEq
+ConditionallyCompleteLinearOrderBot.mk.sizeOf_spec
+Int.instNoBotOrder
+Int.instNoTopOrder
+NNReal.instConditionallyCompleteLinearOrder
-NNReal.instConditionallyCompleteLinearOrderBot
+Nat.instConditionallyCompleteLinearOrder
-Nat.instConditionallyCompleteLinearOrderBot
+OrderInfSet.chooseTop
+OrderInfSet.chooseTop_sInf_empty_of_noTopOrder
+OrderInfSet.chooseTop_sInf_of_not_exists
+OrderInfSet.choose_sInf
+OrderSupSet.chooseBot
+OrderSupSet.chooseBot_sSup_empty_of_noBotOrder
+OrderSupSet.chooseBot_sSup_of_not_exists
+OrderSupSet.choose_sSup
+Ordinal.instConditionallyCompleteLinearOrder
-Ordinal.instConditionallyCompleteLinearOrderBot
+Seminorm.instOrderSupSet
+Set.OrdConnected.coe_sInf
+Set.OrdConnected.coe_sSup
+Set.OrdConnected.conditionallyCompleteLinearOrder
+Set.OrdConnected.csInf_image_mem
+Set.OrdConnected.csSup_image_mem
+Set.OrdConnected.sInf_empty_of_noTopOrder
+Set.OrdConnected.sSup_empty_of_noBotOrder
+Subtype.isGLB_of_csInf_image_mem
+Subtype.isLUB_of_csSup_image_mem
+WellFoundedLT.conditionallyCompleteLinearOrder
-WellFoundedLT.min.congr_simp
+WithBot.bddAbove_preimage_coe
+WithBot.instOrderInfSet
+WithBot.instOrderSupSet
+WithBot.isCompl_range_coe
+WithBot.isGLB_bot_iff
+WithBot.isGLB_coe_iff
+WithBot.isLUB_bot_iff
+WithBot.isLUB_coe_iff
+WithBot.sInf_eq_bot_iff
+WithBot.sInf_eq_coe_iff
+WithBot.sSup_eq_bot_iff
+WithBot.sSup_eq_coe_iff
+WithBot.upperBounds_preimage_coe
+WithTop.bddBelow_preimage_coe
+WithTop.instOrderInfSet
+WithTop.instOrderSupSet
+WithTop.isCompl_range_coe
+WithTop.isGLB_coe_iff
+WithTop.isGLB_top_iff
+WithTop.isLUB_coe_iff
+WithTop.isLUB_top_iff
+WithTop.lowerBounds_preimage_coe
+WithTop.sInf_eq_coe_iff
+WithTop.sInf_eq_top_iff
+WithTop.sSup_eq_coe_iff
+WithTop.sSup_eq_top_iff
+exists_isGLB_cond
+exists_isLUB_cond
-instConditionallyCompleteLinearOrderBotWithBotOfConditionallyCompleteLinearOrder
+instConditionallyCompleteLinearOrderWithBot
-ordConnectedSubsetConditionallyCompleteLinearOrder

Decrease in strong tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (strong)
4155 -1 backward.isDefEq.respectTransparency
Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
5127 1 exposed public sections

Current commit d9d32c4bed
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).

@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Oct 28, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@vihdzp

vihdzp commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Can you explain in the description what the motivation is? Specifically, thanks to the OrderSupSet typeclass, you can now use ConditionallyCompleteLinearOrder + WithBot instead.

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

Again, checked the diff and this LGTM. Glad to see this typeclass made redundant!

Comment thread Mathlib/Basic/NNReal/Defs.lean Resolved
Comment thread Mathlib/Basic/NNReal/Defs.lean Resolved
@SnirBroshi

Copy link
Copy Markdown
Collaborator

This also means it now has a dual, right? There are lots of lemmas we could now dualize!

@mathlib-merge-conflicts mathlib-merge-conflicts 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 30, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

mathlib-bors Bot pushed a commit that referenced this pull request Dec 2, 2026
Refactor `ConditionallyCompleteLattice` to extend `OrderSupSet` and `OrderInfSet` instead of `SupSet` and `InfSet`, and drop the now-redundant `csSup_empty` field from `ConditionallyCompleteLinearOrderBot`.

`OrderSupSet` implies `sSup ∅ = ⊥`, so we no longer need some nonemptiness assumptions.

Also add shortcut instances `NoBotOrder ℤ` and `NoTopOrder ℤ` for `ConditionallyCompleteLinearOrder ℤ`.

The cleanup of `ConditionallyCompleteLinearOrderBot` API is split into #45436 and #45438, and the typeclass itself will be deprecated in #45438.
TJHeeringa pushed a commit to TJHeeringa/mathlib4 that referenced this pull request Dec 2, 2026
…over-community#35674)

Refactor `ConditionallyCompleteLattice` to extend `OrderSupSet` and `OrderInfSet` instead of `SupSet` and `InfSet`, and drop the now-redundant `csSup_empty` field from `ConditionallyCompleteLinearOrderBot`.

`OrderSupSet` implies `sSup ∅ = ⊥`, so we no longer need some nonemptiness assumptions.

Also add shortcut instances `NoBotOrder ℤ` and `NoTopOrder ℤ` for `ConditionallyCompleteLinearOrder ℤ`.

The cleanup of `ConditionallyCompleteLinearOrderBot` API is split into leanprover-community#45436 and leanprover-community#45438, and the typeclass itself will be deprecated in leanprover-community#45438.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-order Order theory tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants