Skip to content

feat: more precise characterizations of IsLUB s (sSup s) for s : Set (WithTop α) - #46150

Open
vihdzp wants to merge 6 commits into
leanprover-community:masterfrom
vihdzp:wtop
Open

vihdzp wants to merge 6 commits into
leanprover-community:masterfrom
vihdzp:wtop

Conversation

@vihdzp

@vihdzp vihdzp commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Used in the CGT repo.


@vihdzp vihdzp added the t-order Order theory label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

PR summary ce0422e367

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ isGLB_sInf_of_preimage
+ isLUB_sSup_of_preimage
+ nonempty_preimage_some_iff
+ preimage_some_eq_empty_iff
+ subset_range_some_iff

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

  • +10 new declarations
  • −0 removed declarations
+WithBot.isGLB_sInf_of_preimage
+WithBot.isLUB_sSup_of_preimage
+WithBot.nonempty_preimage_some_iff
+WithBot.preimage_some_eq_empty_iff
+WithBot.subset_range_some_iff
+WithTop.isGLB_sInf_of_preimage
+WithTop.isLUB_sSup_of_preimage
+WithTop.nonempty_preimage_some_iff
+WithTop.preimage_some_eq_empty_iff
+WithTop.subset_range_some_iff

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

Current commit ce0422e367
Reference commit 12f966a2d9

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.

Have you seen #40620 ? Could you coordinate with @SnirBroshi ?

@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 24, 2026
@YaelDillies YaelDillies self-assigned this Nov 24, 2026
@vihdzp

vihdzp commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

I don't think there's any overlap between PRs.

@SnirBroshi

SnirBroshi commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Hi! I haven't thought this through about this specific PR, but as I wrote here there are many predicates (like IsLUB here) which need these lemmas that cast from α to WithTop α, and I have been thinking for a while about whether we can generalize from WithTop.some to any RelEmbedding or InitialSeg or PrincipalSeg.

#44199 also has some translation lemmas btw, slightly similar to this PR.

Lots of things could use such translation lemmas, e.g. IsLUB / IsCofinal / BddAbove / IsLowerSet / IsCompactElement / IsAtom / IsCompl / Set.OrdConnected / Disjoint / IsSuccLimit, and if possible we shouldn't specialize to WithTop.coe as it'll mean lots more specific lemmas for all the other embeddings, e.g. ℕ → Ordinal / ℕ → Cardinal / ℕ → ENNReal / α → α ⊕ₗ β (Sum.inlₗ), etc.

Also sometimes we have lemmas for Set.image and for Set.preimage (and even Set.range), so perhaps we should prove them once for Set.MapsTo.

btw I think this isn't trivial, so it shouldn't block this upstreaming effort, just something to think about as we make all these translation lemma PRs

@vihdzp

vihdzp commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

I think the first step in your hypothetical refactor would be to move the definitions of InitialSeg/PrincipalSeg earlier in the import chain. Right now that entire file is specialized to results which are later useful for ordinals.

@vihdzp vihdzp removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 26, 2026
@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 27, 2026
@vihdzp vihdzp removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 27, 2026

@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

@YaelDillies YaelDillies removed their assignment Nov 28, 2026
@github-actions

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 28, 2026

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

maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. t-order Order theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants