Skip to content

[Merged by Bors] - chore: use IsLUB IsGLB in CompleteLattice - #35328

Closed
astrainfinita wants to merge 15 commits into
leanprover-community:masterfrom
astrainfinita:use_islub
Closed

astrainfinita wants to merge 15 commits into
leanprover-community:masterfrom
astrainfinita:use_islub

Conversation

@astrainfinita

Copy link
Copy Markdown
Collaborator

@astrainfinita astrainfinita changed the title Use islub chore: use IsLUB IsGLB in CompleteLattice ConditionallyCompleteLattice Feb 15, 2026
@github-actions

github-actions Bot commented Feb 15, 2026 •

Copy link
Copy Markdown

PR summary 95b694b853

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Order.CompleteLattice.Basic 235 236 +1 (+0.43%)
Mathlib.Order.CompleteLattice.Lemmas 238 239 +1 (+0.42%)
Import changes for all files
Files Import difference
24 files Mathlib.Algebra.Order.Quantale Mathlib.CategoryTheory.ObjectProperty.CompleteLattice Mathlib.Combinatorics.Graph.Basic Mathlib.Combinatorics.SimpleGraph.Walk Mathlib.Data.Finite.Vector Mathlib.Data.Fintype.Vector Mathlib.Data.List.Sym Mathlib.Data.Multiset.Sym Mathlib.Data.Setoid.Basic Mathlib.Data.Sym.Basic Mathlib.Data.Sym.Sym2.Order Mathlib.Data.Sym.Sym2 Mathlib.GroupTheory.Congruence.BigOperators Mathlib.GroupTheory.Congruence.Defs Mathlib.GroupTheory.Congruence.Hom Mathlib.GroupTheory.Congruence.Opposite Mathlib.Order.CompleteLattice.Basic Mathlib.Order.CompleteLattice.Group Mathlib.Order.CompleteLattice.Lemmas Mathlib.Order.GameAdd Mathlib.Order.Lattice.Congruence Mathlib.RingTheory.Congruence.BigOperators Mathlib.RingTheory.Congruence.Defs Mathlib.Topology.Defs.Filter
1

Declarations diff

+ UniformSpace.isGLB_sInf
+ instPartialOrder
+ instance : IsConcreteLE (AbstractSimplicialComplex ι) (Finset ι)
+ instance : IsConcreteLE (PreAbstractSimplicialComplex ι) (Finset ι)
+ sInf_apply_eq_sInf_image
+ sSup_apply_eq_sSup_image
++ isLUB_sSup
+++ isGLB_sInf
+-- le_sSup
+-- sSup_le
- le_sInf
- sInf_le

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


Increase in tech debt: (relative, absolute) = (0.71, 0.02)
Current number Change Type
466 -2 porting notes
50 1 dsimp +instances

Current commit a6eac0ddbc
Reference commit 95b694b853

You can run this locally as

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

@github-actions

github-actions Bot commented Feb 15, 2026 •

Copy link
Copy Markdown

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@astrainfinita astrainfinita added the t-order Order theory label Feb 15, 2026
@astrainfinita astrainfinita mentioned this pull request Feb 15, 2026
1 of 4 tasks
@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 Feb 15, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@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 Feb 18, 2026
@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 Feb 18, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@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 Feb 23, 2026

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

I like this very much! It makes the definition much more transparent and allows us to use existing API on IsLUB/IsGLB better.

I've left a bunch of stylistic suggestions, most of them are safely ignored.

Comment thread Mathlib/Algebra/Tropical/Lattice.lean Resolved
exact ⟨_, h, F.map f h'⟩ }
le_sSup _ _ _ _ _ := by aesop
sSup_le _ _ _ _ _ := by aesop
isLUB_sSup _ := ⟨fun _ _ _ _ ↦ by aesop, fun _ _ _ ↦ by aesop⟩

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.

Can you merge this into a single aesop call? Same below.

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.

aesop doesn't know to unfold the definition.

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.

I tried to add a few aesop lemmas to unfold the definitions, but we want to unfold Set.subset_def (which is not a safe rule in general, since we want to reason on the level of subsets, not on the level of elements). So I think doing everything in one aesop is a bit too much work right now.

le_sInf _ G' hG' :=
⟨Set.subset_iInter₂ fun _ hH => (hG' _ hH).1, fun _ _ hab =>
⟨fun _ hH => (hG' _ hH).2 hab, G'.adj_sub hab⟩⟩
isLUB_sSup _ :=

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.

a) Would it be any nicer to put this proof in a single by block?
b) Is the porting note still relevant?

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.

Replacing Set.subset_iUnion₂ with Set.subset_biUnion_of_mem avoids by apply.

Comment thread Mathlib/Data/Set/BooleanAlgebra.lean Resolved
/-- `a ≤ sInf s` for all `a ∈ lowerBounds s`. -/
le_csInf : ∀ s a, Set.Nonempty s → a ∈ lowerBounds s → a ≤ sInf s
/-- Every nonempty subset which is bounded above has a least upper bound. -/
isLUB_csSup : ∀ s : Set α, s.Nonempty → BddAbove s → IsLUB s (sSup s)

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.

Is it any easier to split this into a separate PR? i.e. this PR would just do this change for CompleteLattice, the successive PR would do it on ConditionallyCompleteLattice, etc.

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.

Comment thread Mathlib/Order/Interval/Basic.lean Resolved
@astrainfinita astrainfinita changed the title chore: use IsLUB IsGLB in CompleteLattice ConditionallyCompleteLattice chore: use IsLUB IsGLB in CompleteLattice Feb 25, 2026

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

Most of these changes are quite good, but there are some regressions where the proof becomes quite deeply nested: I would like to see changes like

-  isGLB_sInf _ := ⟨sInf_le _, le_sInf _⟩
+  (isGLB_sInf _).mem := sInf_le _
+  (isGLB_sInf _).lower := le_sInf _

(After changing IsGLB into a structure with the correct fields.)

But the syntax I suggest above doesn't exist (for writing fields after function arrows). So I think the current version is good enough, it definitely overall improves Mathlib!

bors d+

exact ⟨_, h, F.map f h'⟩ }
le_sSup _ _ _ _ _ := by aesop
sSup_le _ _ _ _ _ := by aesop
isLUB_sSup _ := ⟨fun _ _ _ _ ↦ by aesop, fun _ _ _ ↦ by aesop⟩

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.

I tried to add a few aesop lemmas to unfold the definitions, but we want to unfold Set.subset_def (which is not a safe rule in general, since we want to reason on the level of subsets, not on the level of elements). So I think doing everything in one aesop is a bit too much work right now.

@mathlib-bors

mathlib-bors Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

✌️ astrainfinita can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@mathlib-triage mathlib-triage Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Mar 12, 2026
@astrainfinita

Copy link
Copy Markdown
Collaborator Author

bors r+

mathlib-bors Bot pushed a commit that referenced this pull request Mar 12, 2026
@mathlib-bors

mathlib-bors Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title chore: use IsLUB IsGLB in CompleteLattice [Merged by Bors] - chore: use IsLUB IsGLB in CompleteLattice Mar 12, 2026
@mathlib-bors mathlib-bors Bot closed this Mar 12, 2026
mjsottile added a commit to mjsottile/analysis that referenced this pull request Jun 17, 2026
leanprover-community/mathlib4#35328

- Add noncomputable to instances due to dependence on noncomputable definitions like `instZeroEReal`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-order Order theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants