Skip to content

chore: generalize ConditionallyCompleteLinearOrderBot lemmas - #45436

Open
astrainfinita wants to merge 67 commits into
leanprover-community:masterfrom
astrainfinita:condc_orderbot
Open

astrainfinita wants to merge 67 commits into
leanprover-community:masterfrom
astrainfinita:condc_orderbot

Conversation

@astrainfinita

@astrainfinita astrainfinita commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

# Conflicts:
#	Mathlib/Algebra/Order/Nonneg/Lattice.lean
#	Mathlib/Basic/NNReal/Defs.lean
#	Mathlib/Order/CompleteLatticeIntervals.lean
…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`.
@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 00bcab2bb5

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
+ bddBelow_preimage_coe
+ coe_sInf'
+ exists_isLUB_cond
+ instOrderInfSet
+ instSupSet
+ 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 [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 00bcab2).

  • +52 new declarations
  • −7 removed declarations
+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
+Int.instNoBotOrder
+Int.instNoTopOrder
+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
+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.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
-ordConnectedSubsetConditionallyCompleteLinearOrder

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 00bcab2bb5
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
@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
@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.
@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Dec 2, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

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

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.

1 participant