Skip to content

chore: use @[to_dual] in ConditionallyCompleteLattice - #35213

Closed
kim-em wants to merge 42 commits into
leanprover-community:masterfrom
kim-em:kim/to-dual-ccl-extended
Closed

kim-em wants to merge 42 commits into
leanprover-community:masterfrom
kim-em:kim/to-dual-ccl-extended

Conversation

@kim-em

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

Copy link
Copy Markdown
Contributor

This PR adds @[to_dual] annotations across all ConditionallyCompleteLattice files: Defs, Basic, Indexed, Finset, and Group. Auto-generates dual theorems and deletes hand-written versions. (Absorbs the former PR #35212.)

Diff relative to #35209

🤖 Prepared with Claude Code

kim-em and others added 3 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]>
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]>
@github-actions

github-actions Bot commented Feb 12, 2026 •

Copy link
Copy Markdown

PR summary 067172054b

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

- Antitone.le_map_sInf
- Antitone.map_iSup_le
- Antitone.map_iSup₂_le
- Equiv.biInf_comp
- Equiv.iInf_comp
- Equiv.iInf_congr
- Function.Surjective.iInf_comp
- Function.Surjective.iInf_congr
- IsGLB.iInf_eq
- Monotone.map_iInf_le
- Monotone.map_iInf₂_le
- Monotone.map_sInf_le
- OrderIso.map_iInf
- OrderIso.map_iInf₂
- OrderIso.map_sInf
- OrderIso.map_sInf_eq_sInf_symm_preimage
- Set.BijOn.iInf_comp
- Set.BijOn.iInf_congr
- biInf_congr
- biInf_congr'
- biInf_const
- biInf_ge_eq_iInf
- biInf_gt_eq_iInf
- biInf_inf
- biInf_le
- biInf_le_eq_iInf
- biInf_lt_eq_iInf
- biInf_lt_iff
- biInf_mono
- biInf_prod
- biInf_prod'
- eq_singleton_top_of_sInf_eq_top_of_nonempty
- iInf_and
- iInf_and'
- iInf_comm
- iInf_congr
- iInf_const
- iInf_dite
- iInf_emptyset
- 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_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_top
- iInf₂_le
- iInf₂_le_of_le
- iInf₂_mono
- iInf₂_mono'
- inf_biInf
- inf_iInf
- 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_diff_singleton_top
- sInf_eq_iInf
- sInf_eq_iInf'
- sInf_eq_of_forall_ge_of_forall_gt_exists_lt
- sInf_image
- sInf_image2
- sInf_insert
- sInf_le_sInf_of_isCoinitialFor
- sInf_le_sInf_of_subset_insert_top
- sInf_pair
- sInf_range
- sInf_union
- sInf_upperBounds_eq_sSup

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

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]>
@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 force-pushed the kim/to-dual-ccl-extended branch 5 times, most recently from a3056ce to 05f1371 Compare February 13, 2026 00:08
@kim-em
kim-em marked this pull request as ready for review February 13, 2026 00:10
@kim-em
kim-em force-pushed the kim/to-dual-ccl-extended branch 2 times, most recently from 1afd5fa to 24b87e0 Compare February 13, 2026 03:50
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-ccl-extended branch from 24b87e0 to 61bc773 Compare February 13, 2026 03:53
@kim-em
kim-em force-pushed the kim/to-dual-ccl-extended branch from 61bc773 to edb2da7 Compare February 13, 2026 04:19
kim-em and others added 10 commits February 14, 2026 10:07
When a dual lemma is deleted because it is now auto-generated by
@[to_dual], its original docstring is preserved via the
@[to_dual /-- ... -/] syntax.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
When a dual lemma is deleted because it is now auto-generated by
@[to_dual], its original docstring is preserved via the
@[to_dual /-- ... -/] syntax.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- 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]>
Preserve docstrings from csInf_eq_of_forall_ge_of_forall_gt_exists_lt,
csInf_lt_of_lt, csInf_eq_csInf_of_forall_exists_le, and
ciInf_eq_of_forall_ge_of_forall_gt_exists_lt via @[to_dual /-- ... -/].

Co-Authored-By: Claude Opus 4.6 <[email protected]>
# Conflicts:
#	Mathlib/Order/Bounds/Basic.lean
@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 16, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

Resolve merge conflicts with master's ConditionallyCompletePartialOrder
refactoring (PR leanprover-community#35047). The @[to_dual] annotations added by this branch
in CCL/Basic.lean, CCL/Indexed.lean, CCL/Finset.lean, and CCL/Group.lean
are incompatible with the new CCL→CCPO bridging instance, so these files
take master's versions. The @[to_dual] changes in CompleteLattice/Basic.lean
and all other files are preserved.

Conflicted files:
- Mathlib/Order/CompleteLattice/Basic.lean: kept branch's @[to_dual]
  additions and InfSet section removal; removed duplicate iInf_of_isEmpty
- Mathlib/Order/ConditionallyCompleteLattice/Basic.lean: took master's
  version (incompatible with @[to_dual] due to CCPO instance)
- Mathlib/Order/ConditionallyCompleteLattice/Indexed.lean: took master's
  version (same reason)

Also reverted to master for CCL/Finset.lean and CCL/Group.lean where
branch's @[to_dual existing] registrations conflict with the CCPO instance.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@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 17, 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 23, 2026
kim-em added 2 commits March 3, 2026 04:49
…ended

# Conflicts:
#	Mathlib/Order/Bounds/Image.lean
#	Mathlib/Order/CompleteLattice/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 Mar 4, 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 6, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@grunweg grunweg added the LLM-generated PRs with substantial input from LLMs - review accordingly label Mar 16, 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 Mar 20, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

@kim-em

kim-em commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing — the to_dual chain has rotted too far against master; reopen if revived.

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 merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants