Skip to content

[Merged by Bors] - chore: use @[to_dual] extensively in CompleteLattice - #35209

Closed
kim-em wants to merge 22 commits into
leanprover-community:masterfrom
kim-em:kim/to-dual-complete-lattice
Closed

kim-em wants to merge 22 commits into
leanprover-community:masterfrom
kim-em:kim/to-dual-complete-lattice

Conversation

@kim-em

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

Copy link
Copy Markdown
Contributor

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.

🤖 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 b16dd712b4

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

- Antitone.iInf
- Antitone.map_iSup_le
- Antitone.map_iSup₂_le
- Antitone.map_sSup_le
- Antitone.sInf
- Equiv.biInf_comp
- Equiv.iInf_comp
- Equiv.iInf_congr
- Function.Surjective.iInf_comp
- Function.Surjective.iInf_congr
- IsGLB.iInf_eq
- Monotone.iInf
- Monotone.iInf_comp_eq
- Monotone.map_iInf_le
- Monotone.map_iInf₂_le
- Monotone.map_sInf_le
- Monotone.sInf
- OrderIso.map_iInf
- OrderIso.map_iInf₂
- OrderIso.map_sInf
- OrderIso.map_sInf_eq_sInf_symm_preimage
- Pi.infSet
- Set.BijOn.iInf_comp
- Set.BijOn.iInf_congr
- biInf_congr
- biInf_congr'
- biInf_const
- biInf_ge_eq_iInf
- biInf_ge_eq_inf
- biInf_ge_eq_of_monotone
- biInf_gt_eq_iInf
- biInf_inf
- biInf_le
- biInf_le_eq_iInf
- biInf_le_eq_inf
- biInf_lt_eq_iInf
- biInf_lt_iff
- biInf_mono
- biInf_prod
- biInf_prod'
- biSup_ge_eq_of_antitone
- eq_singleton_top_of_sInf_eq_top_of_nonempty
- fst_iInf
- fst_sInf
- iInf_and
- iInf_and'
- iInf_apply
- iInf_comm
- iInf_congr
- iInf_const
- iInf_const_mono
- iInf_dite
- iInf_emptyset
- iInf_eq_bot
- iInf_eq_dif
- iInf_eq_if
- iInf_eq_of_forall_ge_of_forall_gt_exists_lt
- iInf_eq_top
- iInf_exists
- iInf_extend_top
- iInf_false
- iInf_iInf_eq_left
- iInf_iInf_eq_right
- iInf_image
- iInf_image2
- iInf_inf
- iInf_inf_eq
- iInf_insert
- iInf_ite
- iInf_le
- iInf_le_iInf_of_subset
- iInf_le_iInf₂
- iInf_le_of_le
- iInf_lt_iff
- iInf_lt_top
- iInf_mk
- iInf_mono
- iInf_mono'
- iInf_ne_top_subtype
- iInf_neg
- iInf_of_empty
- iInf_option
- iInf_option_elim
- iInf_or
- iInf_pair
- iInf_plift_down
- iInf_plift_up
- iInf_pos
- iInf_prod
- iInf_prod'
- iInf_psigma
- iInf_psigma'
- iInf_range
- iInf_range'
- iInf_sigma
- iInf_sigma'
- iInf_singleton
- iInf_split
- iInf_split_single
- iInf_subtype
- iInf_subtype'
- iInf_subtype''
- iInf_sum
- iInf_top
- iInf_true
- iInf_ulift
- iInf_union
- iInf_unique
- iInf_univ
- iInf₂_comm
- iInf₂_eq_bot
- iInf₂_eq_top
- iInf₂_le
- iInf₂_le_of_le
- iInf₂_mono
- iInf₂_mono'
- infSet
- inf_biInf
- inf_iInf
- instance (priority := 100) CoheytingAlgebra.toBoundedOrder [CoheytingAlgebra α] : BoundedOrder α
- isGLB_biInf
- isGLB_iInf
- le_iInf
- le_iInf_comp
- le_iInf_const
- le_iInf_iff
- le_iInf₂
- le_iInf₂_iff
- le_sInf_inter
- lt_iInf_iff
- sInf_apply
- sInf_apply_eq_sInf_image
- sInf_diff_singleton_top
- sInf_empty
- sInf_eq_bot
- sInf_eq_iInf
- sInf_eq_iInf'
- sInf_eq_of_forall_ge_of_forall_gt_exists_lt
- sInf_eq_top
- sInf_image
- sInf_image2
- sInf_insert
- sInf_le_sInf_of_isCoinitialFor
- sInf_le_sInf_of_subset_insert_top
- sInf_lt_iff
- sInf_pair
- sInf_prod
- sInf_range
- sInf_singleton
- sInf_union
- sInf_univ
- sInf_upperBounds_eq_sSup
- snd_iInf
- snd_sInf
- swap_iInf
- swap_sInf

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.


No changes to technical debt.

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

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]>
@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 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]>
@kim-em
kim-em force-pushed the kim/to-dual-complete-lattice branch from d08f72f to d36d616 Compare February 12, 2026 23:15
@kim-em
kim-em marked this pull request as ready for review February 12, 2026 23:43
@kim-em
kim-em force-pushed the kim/to-dual-complete-lattice branch from bbb9822 to 05f90ca Compare February 13, 2026 00:32
kim-em and others added 5 commits February 13, 2026 03:51
Add @[to_dual existing] to sInf_lt_iff and @[to_dual] to
lt_iSup_iff and lt_biSup_iff, auto-generating iInf_lt_iff and
biInf_lt_iff.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add ~100 @[to_dual] annotations to primal theorems in
Order.CompleteLattice.Basic and delete corresponding hand-written
dual theorems. The `@[to_dual]` attribute auto-generates the dual
versions by term-level translation.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@kim-em
kim-em force-pushed the kim/to-dual-complete-lattice branch from 05f90ca to 3ae29c0 Compare February 13, 2026 03:52
@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 13, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

Comment thread Mathlib/Order/Bounds/Basic.lean Resolved
Comment thread Mathlib/Order/CompleteLattice/Defs.lean Resolved
kim-em and others added 2 commits February 14, 2026 09:54
- Fix wrong docstrings on to_dual for iSup_and' and iSup_option_elim
  (should reference iInf versions, not iSup)
- Remove redundant comments (csInf_singleton, TODO(Jeremy), ciSup_const)
- Remove empty InfSet section
- Add explicit target name for Monotone.le_map_sSup → Monotone.map_sInf_le
- Use to_dual (dont_translate := ι) for biSup_{lt,le,gt,ge}_eq_iSup
- Add @[to_dual none] to IsLUB.exists_between{,'}
- Elaborate sInf_eq_bot TODO comment in Defs.lean

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions github-actions 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 14, 2026
Comment thread Mathlib/Order/Bounds/Basic.lean Resolved
Comment thread Mathlib/Order/CompleteLattice/Defs.lean Resolved
# Conflicts:
#	Mathlib/Order/Bounds/Basic.lean
@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 14, 2026
@JovanGerb JovanGerb added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Feb 21, 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 Mar 1, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

kim-em and others added 2 commits March 3, 2026 05:59
…e-lattice

# Conflicts:
#	Mathlib/Order/CompleteLattice/Basic.lean
- Use `@[to_dual none]` on `IsGLB.exists_between` and `IsGLB.exists_between'`
- Restore pre-existing comments removed in previous commit
- Rewrite `sInf_eq_bot` type to use `⊥ < b` instead of `b > ⊥`
- Update TODO comment on `biSup_le_eq_sup`

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@kim-em kim-em removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Mar 3, 2026
@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 Mar 4, 2026
@grunweg grunweg added the LLM-generated PRs with substantial input from LLMs - review accordingly label Mar 16, 2026
@bryangingechen bryangingechen assigned JovanGerb and unassigned dupuisf Mar 20, 2026
@github-actions github-actions 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 Mar 20, 2026
@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 Mar 20, 2026
@JovanGerb

Copy link
Copy Markdown
Contributor

I went through all the changes, and did some major cleanup

  • I had to tag some stuff around HeytingAlgebra and CoheytingAlgebra to make the instances be able to translate.
  • Everything is now tagged with to_dual (and no to_dual existing).
  • Antitone.le_map_sInf was deleted altogether - I put it back
  • Two declarations lost their doc-string - I put it back
  • I added inf₂/sup₂ to the name translation dictionary.

maintainer merge

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by JovanGerb.


issue_comment, wf_run

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Mar 20, 2026
@riccardobrasca

Copy link
Copy Markdown
Member

!radar

@leanprover-radar

leanprover-radar commented Mar 20, 2026 •

Copy link
Copy Markdown

Benchmark results for 4caf948 against b16dd71 are in. There are no significant changes. @riccardobrasca

  • 🟥 build//instructions: +2.8G (+0.00%)

Small changes (2✅, 1🟥)

  • ✅ build/module/Batteries.Data.String.AsciiCasing//instructions: -12.8M (-1.50%)
  • ✅ build/module/Mathlib.Order.CompleteLattice.Basic//instructions: -8.7G (-18.42%)
  • 🟥 build/module/Mathlib.Tactic.MkIffOfInductiveProp//instructions: +386.3M (+3.98%)

@riccardobrasca

Copy link
Copy Markdown
Member

Thanks!

bors merge

@mathlib-triage mathlib-triage Bot added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Mar 20, 2026
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]>
@mathlib-bors

mathlib-bors Bot commented Mar 20, 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] extensively in CompleteLattice [Merged by Bors] - chore: use @[to_dual] extensively in CompleteLattice Mar 20, 2026
@mathlib-bors mathlib-bors Bot closed this Mar 20, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM-generated PRs with substantial input from LLMs - review accordingly ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants