Skip to content

feat: all sets in a co-well-order are closed under suprema - #45611

Open
vihdzp wants to merge 4 commits into
leanprover-community:masterfrom
vihdzp:inaccwf
Open

vihdzp wants to merge 4 commits into
leanprover-community:masterfrom
vihdzp:inaccwf

Conversation

@vihdzp

@vihdzp vihdzp commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

PR summary 4a6d8f7295

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Order.Bounds.Basic 335 339 +4 (+1.19%)
Import changes for all files
Files Import difference
4 files Mathlib.Algebra.Order.GroupWithZero.Bounds Mathlib.Order.Interval.Set.Fin Mathlib.Order.Interval.Set.OrderEmbedding Mathlib.Order.Interval.Set.UnorderedInterval
1
Mathlib.Order.Bounds.Image Mathlib.Order.ScottContinuity 3
8 files Mathlib.Algebra.Order.Group.Bounds Mathlib.Data.Nat.Prime.Infinite Mathlib.Order.Bounds.Basic Mathlib.Order.CompleteLattice.Defs Mathlib.Order.ConditionallyCompletePartialOrder.Basic Mathlib.Order.LatticeIntervals Mathlib.Order.Monotone.Odd Mathlib.Order.Monotone.Union
4

Declarations diff (regex)

+ DirSupClosed.of_wellFoundedGT
+ DirSupClosedOn.of_wellFoundedGT
+ DirSupInacc.of_wellFoundedGT
+ DirSupInaccOn.of_wellFoundedGT
+ IsGLB.isLeast_of_wellFoundedLT
+ IsGLB.mem_of_wellFoundedLT
+ IsGLB.min_eq
+ WellFoundedLT.isLeast_min

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 -- stale, waiting for the new build)

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

  • +8 new declarations
  • −0 removed declarations
+DirSupClosed.of_wellFoundedGT
+DirSupClosedOn.of_wellFoundedGT
+DirSupInacc.of_wellFoundedGT
+DirSupInaccOn.of_wellFoundedGT
+IsGLB.mem_of_nonempty
+IsGLB.min_eq
+IsLUB.max_eq
+IsLUB.mem_of_nonempty

No changes to strong technical debt.
No changes to weak technical debt.

Current commit 4a6d8f7295
Reference commit a495318fed

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

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

Thanks! 🚀

maintainer merge

@github-actions

github-actions Bot commented Nov 6, 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 6, 2026

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

You might be interested in SnirBroshi#97 :)

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'm pretty sure these are true for any PartialOrder, not just for LinearOrders

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.

Do you have a proof? I'm having a hard time figuring it out. (Does every nonempty directed set in a WellFoundedGT order have a maximum? Do we have that somewhere?)

@SnirBroshi SnirBroshi Nov 8, 2026 •

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.

theorem DirSupClosed.of_notMem_imp_isCompactElement {α : Type*} [PartialOrder α] {s : Set α}
    (h : ∀ a ∉ s, IsCompactElement a) : DirSupClosed s := by
  intro d hsub hne hdir a hlub
  by_contra hmem
  have ⟨b, hmem', hle⟩ := h a hmem d a hne hdir hlub le_rfl
  cases hle.antisymm <| hlub.left hmem'
  exact hmem <| hsub hmem'

theorem DirSupInacc.of_mem_imp_isCompactElement {α : Type*} [PartialOrder α] {s : Set α}
    (h : ∀ a ∈ s, IsCompactElement a) : DirSupInacc s :=
  .of_compl <| .of_notMem_imp_isCompactElement <| by simpa

example {α : Type*} [PartialOrder α] [WellFoundedGT α] (s : Set α) : DirSupClosed s :=
  .of_notMem_imp_isCompactElement fun a _ ↦ .of_wellFoundedGT a

example {α : Type*} [PartialOrder α] [WellFoundedGT α] (s : Set α) : DirSupInacc s :=
  .of_mem_imp_isCompactElement fun a _ ↦ .of_wellFoundedGT a

Does every nonempty directed set in a WellFoundedGT order have a maximum? Do we have that somewhere?

Yes, no. You could combine DirectedOn.maximal_iff_isGreatest with WellFoundedGT.exists_maximal or WellFounded.maximal_wellFounded_lt_max to get it.

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.

Well, it seems we want to use IsCompactElement to prove things about DirSupClosed and also the other way around. Perhaps we should move the former to the DirSupClosed.lean file when we redefine it?

@vihdzp vihdzp added awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Nov 8, 2026
Comment thread Mathlib/Order/Bounds/Basic.lean Resolved
Comment thread Mathlib/Order/Bounds/Basic.lean Resolved

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

awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. t-order Order theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants