Skip to content

[Merged by Bors] - chore: use @[to_dual] in Bounds.Basic - #35208

Closed
kim-em wants to merge 8 commits into
leanprover-community:masterfrom
kim-em:kim/to-dual-bounds-basic
Closed

kim-em wants to merge 8 commits into
leanprover-community:masterfrom
kim-em:kim/to-dual-bounds-basic

Conversation

@kim-em

@kim-em kim-em commented Feb 12, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds @[to_dual] name dictionary entries for atom/coatom and lfp/gfp, and uses @[to_dual] to auto-generate dual theorems in Order.Bounds.Basic, deleting the hand-written versions.

27 @[to_dual] annotations total, deleting 27 hand-written duals.

Remaining pairs not converted:

  • bddAbove_insert/bddBelow_insert — needs directed/codirected dictionary entry, which causes problems elsewhere
  • IsLUB.exists_between/IsGLB.exists_between — @[to_dual] swaps the And conjuncts
  • Bounded interval theorems (Icc, Ico, etc.) — arguments swap under duality
  • DenselyOrdered interval theorems — dual proofs need simpa [Ioo_toDual]
  • isGreatest_himp/isLeast_sdiff — needs himp/sdiff dictionary entry

🤖 Prepared with Claude Code

kim-em and others added 2 commits February 12, 2026 21:53
This enables @[to_dual] to automatically translate between
atom/coatom and lfp/gfp theorem names, preparing for expanded
@[to_dual] coverage in subsequent commits.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add @[to_dual] to IsLUB.insert, isLUB_pair, IsLeast.unique,
IsLeast.isLeast_iff_eq, and IsLUB.unique, auto-generating
their duals instead of maintaining hand-written copies.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions

github-actions Bot commented Feb 12, 2026 •

Copy link
Copy Markdown

PR summary 3efa02168f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

- BddBelow.insert
- IsGLB.insert
- IsGLB.nonempty
- IsGLB.prod
- IsGLB.unique
- IsGreatest.isGreatest_iff_eq
- IsGreatest.unique
- IsLeast.insert
- NoBotOrder.lowerBounds_univ
- OrderBot.bddBelow
- OrderBot.lowerBounds_univ
- bddAbove_iff_subset_Iic
- bddBelow_empty
- bddBelow_insert
- isGLB_lt_iff
- isGLB_pair
- isGLB_univ
- isGLB_upperBounds
- isLUB_empty
- isLUB_empty_iff
- isLeast_pair
- isLeast_univ
- isLeast_univ_iff
- lowerBounds_empty
- lowerBounds_insert
- lowerBounds_prod
- lt_isGLB_iff
- nonempty_of_not_bddBelow
- not_bddBelow_univ

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

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

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


No changes to technical debt.

You can run this locally as

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

Add @[to_dual] to 15 more theorems in Order.Bounds.Basic,
auto-generating their duals instead of maintaining hand-written copies.

Covers univ, empty set, bounds, and lt_iff sections.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@bryangingechen bryangingechen 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!
bors r+

mathlib-bors Bot pushed a commit that referenced this pull request Feb 12, 2026
This PR adds `@[to_dual]` name dictionary entries for atom/coatom and lfp/gfp, and uses `@[to_dual]` to auto-generate dual theorems in `Order.Bounds.Basic`, deleting the hand-written versions.

Covers insert/pair/unique theorems (5), plus univ (6), empty set (6), lower/upper bounds (1), and lt_iff theorems (2) — 20 `@[to_dual]` annotations total, deleting 20 hand-written duals.

🤖 Prepared with Claude Code
@mathlib-triage mathlib-triage Bot added the ready-to-merge This PR has been sent to bors. label Feb 12, 2026
@kim-em
kim-em marked this pull request as draft February 12, 2026 22:58
kim-em and others added 4 commits February 12, 2026 23:00
Add @[to_dual] to 7 more theorems: bddBelow_iff_subset_Ici,
IsGreatest.insert, upperBounds_insert, OrderTop.bddAbove,
isGreatest_pair, upperBounds_prod, and IsLUB.prod.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
These don't enable any new @[to_dual] annotations in Bounds.Basic
(the Heyting pairs have type class issues), but prepare the dictionary
for use elsewhere.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@bryangingechen

Copy link
Copy Markdown
Contributor

bors r-

@mathlib-triage mathlib-triage Bot removed the ready-to-merge This PR has been sent to bors. label Feb 12, 2026
@mathlib-bors

mathlib-bors Bot commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Build failed:

@kim-em
kim-em marked this pull request as ready for review February 12, 2026 23:26
let ⟨c, hcs, hbc, hca⟩ := h.exists_between hb
⟨c, hcs, hbc, hca.lt_of_ne fun hac => h' <| hac ▸ hcs⟩

-- These are not `@[to_dual]` because the `And` conjuncts would be in the wrong order.

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.

We can leave this for a later PR, but I think what we have been doing in cases like this is just to use to_dual to add those versions of the statements; then we won't be blocked on later declarations. We could even use to_dual none to make the translated versions have non-user-facing names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! to_dual none is a great trick for unblocking downstream declarations. I'll look into this for a follow-up.

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.

Yes, to_dual none is the correct fix here.

Comment thread Mathlib/Order/Bounds/Basic.lean Resolved
@kim-em
kim-em force-pushed the kim/to-dual-bounds-basic branch from afd8e55 to 50f7448 Compare February 13, 2026 00:32
Comment thread Mathlib/Order/Bounds/Basic.lean Resolved
@bryangingechen

Copy link
Copy Markdown
Contributor

Thanks!
bors r+

@mathlib-triage mathlib-triage Bot added the ready-to-merge This PR has been sent to bors. label Feb 13, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Feb 13, 2026
This PR adds `@[to_dual]` name dictionary entries for atom/coatom and lfp/gfp, and uses `@[to_dual]` to auto-generate dual theorems in `Order.Bounds.Basic`, deleting the hand-written versions.

27 `@[to_dual]` annotations total, deleting 27 hand-written duals.

Remaining pairs not converted:
- `bddAbove_insert`/`bddBelow_insert` — needs `directed`/`codirected` dictionary entry, which causes problems elsewhere
- `IsLUB.exists_between`/`IsGLB.exists_between` — `@[to_dual]` swaps the `And` conjuncts
- Bounded interval theorems (`Icc`, `Ico`, etc.) — arguments swap under duality
- DenselyOrdered interval theorems — dual proofs need `simpa [Ioo_toDual]`
- `isGreatest_himp`/`isLeast_sdiff` — needs `himp`/`sdiff` dictionary entry

🤖 Prepared with Claude Code
@mathlib-bors

mathlib-bors Bot commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title chore: use @[to_dual] in Bounds.Basic [Merged by Bors] - chore: use @[to_dual] in Bounds.Basic Feb 13, 2026
@mathlib-bors mathlib-bors Bot closed this Feb 13, 2026
rao107 pushed a commit to rao107/mathlib4 that referenced this pull request Feb 18, 2026
This PR adds `@[to_dual]` name dictionary entries for atom/coatom and lfp/gfp, and uses `@[to_dual]` to auto-generate dual theorems in `Order.Bounds.Basic`, deleting the hand-written versions.

27 `@[to_dual]` annotations total, deleting 27 hand-written duals.

Remaining pairs not converted:
- `bddAbove_insert`/`bddBelow_insert` — needs `directed`/`codirected` dictionary entry, which causes problems elsewhere
- `IsLUB.exists_between`/`IsGLB.exists_between` — `@[to_dual]` swaps the `And` conjuncts
- Bounded interval theorems (`Icc`, `Ico`, etc.) — arguments swap under duality
- DenselyOrdered interval theorems — dual proofs need `simpa [Ioo_toDual]`
- `isGreatest_himp`/`isLeast_sdiff` — needs `himp`/`sdiff` dictionary entry

🤖 Prepared with Claude Code
mathlib-bors Bot pushed a commit that referenced this pull request Feb 22, 2026
This PR adds `@[to_dual]` annotations to primal theorems in `Mathlib.Order.Bounds.Image`, auto-generating their dual counterparts and deleting the hand-written versions. Covers `MonotoneOn`, `AntitoneOn`, `Monotone`, `Antitone`, `image2`, `IsCofinalFor`, `Prod`, and `Pi` sections.

[Diff relative to #35208](kim-em/mathlib4@kim/to-dual-bounds-basic...kim/to-dual-bounds-image)

- [x] depends on: #35208

🤖 Prepared with Claude Code
Maldooor pushed a commit to Maldooor/mathlib4 that referenced this pull request Feb 25, 2026
This PR adds `@[to_dual]` name dictionary entries for atom/coatom and lfp/gfp, and uses `@[to_dual]` to auto-generate dual theorems in `Order.Bounds.Basic`, deleting the hand-written versions.

27 `@[to_dual]` annotations total, deleting 27 hand-written duals.

Remaining pairs not converted:
- `bddAbove_insert`/`bddBelow_insert` — needs `directed`/`codirected` dictionary entry, which causes problems elsewhere
- `IsLUB.exists_between`/`IsGLB.exists_between` — `@[to_dual]` swaps the `And` conjuncts
- Bounded interval theorems (`Icc`, `Ico`, etc.) — arguments swap under duality
- DenselyOrdered interval theorems — dual proofs need `simpa [Ioo_toDual]`
- `isGreatest_himp`/`isLeast_sdiff` — needs `himp`/`sdiff` dictionary entry

🤖 Prepared with Claude Code
pfaffelh pushed a commit to pfaffelh/mathlib4 that referenced this pull request Mar 2, 2026
This PR adds `@[to_dual]` name dictionary entries for atom/coatom and lfp/gfp, and uses `@[to_dual]` to auto-generate dual theorems in `Order.Bounds.Basic`, deleting the hand-written versions.

27 `@[to_dual]` annotations total, deleting 27 hand-written duals.

Remaining pairs not converted:
- `bddAbove_insert`/`bddBelow_insert` — needs `directed`/`codirected` dictionary entry, which causes problems elsewhere
- `IsLUB.exists_between`/`IsGLB.exists_between` — `@[to_dual]` swaps the `And` conjuncts
- Bounded interval theorems (`Icc`, `Ico`, etc.) — arguments swap under duality
- DenselyOrdered interval theorems — dual proofs need `simpa [Ioo_toDual]`
- `isGreatest_himp`/`isLeast_sdiff` — needs `himp`/`sdiff` dictionary entry

🤖 Prepared with Claude Code
pfaffelh pushed a commit to pfaffelh/mathlib4 that referenced this pull request Mar 2, 2026
This PR adds `@[to_dual]` annotations to primal theorems in `Mathlib.Order.Bounds.Image`, auto-generating their dual counterparts and deleting the hand-written versions. Covers `MonotoneOn`, `AntitoneOn`, `Monotone`, `Antitone`, `image2`, `IsCofinalFor`, `Prod`, and `Pi` sections.

[Diff relative to leanprover-community#35208](kim-em/mathlib4@kim/to-dual-bounds-basic...kim/to-dual-bounds-image)

- [x] depends on: leanprover-community#35208

🤖 Prepared with Claude Code
mathlib-bors Bot pushed a commit that referenced this pull request Mar 20, 2026
This PR adds `@[to_dual]` annotations extensively in `CompleteLattice/Defs.lean` and `CompleteLattice/Basic.lean`, auto-generating many dual theorems and deleting the hand-written versions.

- [x] depends on: #35208

🤖 Prepared with Claude Code

Co-authored-by: Jovan Gerbscheid <[email protected]>
justus-springer pushed a commit to justus-springer/mathlib4 that referenced this pull request Mar 28, 2026
…unity#35209)

This PR adds `@[to_dual]` annotations extensively in `CompleteLattice/Defs.lean` and `CompleteLattice/Basic.lean`, auto-generating many dual theorems and deleting the hand-written versions.

- [x] depends on: leanprover-community#35208

🤖 Prepared with Claude Code

Co-authored-by: Jovan Gerbscheid <[email protected]>
mathlib-bors Bot pushed a commit that referenced this pull request Aug 10, 2026
This PR adds some `to_dual` tags that weren't added in #35208
attilavjda pushed a commit to attilavjda/mathlib4 that referenced this pull request Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants