Repository navigation
Conversation
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]>
PR summary 14d98a46b3Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
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]>
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]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
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]>
f897e4b to
9e94c56
Compare
e6e8a7d to
452085b
Compare
dca52eb to
6a9bfbb
Compare
Co-Authored-By: Claude Opus 4.6 <[email protected]>
6a9bfbb to
cc6a238
Compare
Co-Authored-By: Claude Opus 4.6 <[email protected]>
cc6a238 to
7290fbd
Compare
|
This PR/issue depends on:
|
Co-Authored-By: Claude Opus 4.6 <[email protected]>
804106d to
da1a268
Compare
@[to_dual] generates a version with {f} (g) implicitness, but the
existing BddBelow.range_mono uses (f) {g} to match the convention
that the explicit argument is the "smaller" function.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
da1a268 to
f301c77
Compare
Co-Authored-By: Claude Opus 4.6 <[email protected]>
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]>
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]>
JovanGerb
left a comment
There was a problem hiding this comment.
A number of statements have had their proof modified for no reason.
Presumably the bot saw the word "dual" in the proof and felt the need to change the proof. Could you revert this, and tell your bot to never change any statements or proofs if the original statement and proof still work?
| theorem mem_upperBounds_image (Hf : AntitoneOn f t) (Hst : s ⊆ t) (Has : a ∈ lowerBounds s) : | ||
| a ∈ t → f a ∈ upperBounds (f '' s) := | ||
| Hf.dual_right.mem_lowerBounds_image Hst Has | ||
| @[to_dual] | ||
| theorem mem_upperBounds_image (Hf : AntitoneOn f t) (Hst : s ⊆ t) (Has : a ∈ lowerBounds s) | ||
| (Hat : a ∈ t) : f a ∈ upperBounds (f '' s) := | ||
| forall_mem_image.2 fun _ H => Hf Hat (Hst H) (Has H) |
There was a problem hiding this comment.
e.g. this one had its statement and proof modified
Revert unnecessary proof changes in the AntitoneOn and Antitone sections, restoring the original .dual_right delegation proofs while keeping the @[to_dual] annotations and docstrings. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Thanks for the review! I've restored the original |
JovanGerb
left a comment
There was a problem hiding this comment.
LGTM
The one use of to_dual existing is not needed.
Some declarations in the file were skipped in this PR because they depend on missing to_dual tags in Mathlib.Order.Monotone.Basic
maintainer merge
| lemma BddAbove.range_mono [Preorder β] {f : α → β} (g : α → β) (h : ∀ a, f a ≤ g a) | ||
| (hbdd : BddAbove (range g)) : BddAbove (range f) := by | ||
| obtain ⟨C, hC⟩ := hbdd | ||
| use C | ||
| rintro - ⟨x, rfl⟩ | ||
| exact (h x).trans (hC <| mem_range_self x) | ||
|
|
||
| -- The implicit/explicit parameter structure differs from `BddAbove.range_mono`. | ||
| -- The `to_dual` proof translation strategy doesn't care that the implicitness differs, | ||
| -- and `@[to_dual existing]` doesn't care about the discrepancy since `isDefEq` ignores binder info. | ||
| @[to_dual existing] | ||
| lemma BddBelow.range_mono [Preorder β] (f : α → β) {g : α → β} (h : ∀ a, f a ≤ g a) | ||
| (hbdd : BddBelow (range f)) : BddBelow (range g) := | ||
| BddAbove.range_mono (β := βᵒᵈ) f h hbdd |
There was a problem hiding this comment.
| lemma BddAbove.range_mono [Preorder β] {f : α → β} (g : α → β) (h : ∀ a, f a ≤ g a) | |
| (hbdd : BddAbove (range g)) : BddAbove (range f) := by | |
| obtain ⟨C, hC⟩ := hbdd | |
| use C | |
| rintro - ⟨x, rfl⟩ | |
| exact (h x).trans (hC <| mem_range_self x) | |
| -- The implicit/explicit parameter structure differs from `BddAbove.range_mono`. | |
| -- The `to_dual` proof translation strategy doesn't care that the implicitness differs, | |
| -- and `@[to_dual existing]` doesn't care about the discrepancy since `isDefEq` ignores binder info. | |
| @[to_dual existing] | |
| lemma BddBelow.range_mono [Preorder β] (f : α → β) {g : α → β} (h : ∀ a, f a ≤ g a) | |
| (hbdd : BddBelow (range f)) : BddBelow (range g) := | |
| BddAbove.range_mono (β := βᵒᵈ) f h hbdd | |
| @[to_dual (reorder := f g)] | |
| lemma BddAbove.range_mono [Preorder β] {f : α → β} (g : α → β) (h : ∀ a, f a ≤ g a) | |
| (hbdd : BddAbove (range g)) : BddAbove (range f) := by | |
| obtain ⟨C, hC⟩ := hbdd | |
| use C | |
| rintro - ⟨x, rfl⟩ | |
| exact (h x).trans (hC <| mem_range_self x) |
|
🚀 Pull request has been placed on the maintainer queue by JovanGerb. |
|
Thanks! |
|
✌️ kim-em can now approve this pull request. To approve and merge a pull request, simply reply with |
Per review feedback, use `reorder` on `BddAbove.range_mono` to auto-generate `BddBelow.range_mono` instead of manually writing it with `@[to_dual existing]`. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
bors merge |
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
|
Pull request successfully merged into master. Build succeeded: |
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
This PR adds
@[to_dual]annotations to primal theorems inMathlib.Order.Bounds.Image, auto-generating their dual counterparts and deleting the hand-written versions. CoversMonotoneOn,AntitoneOn,Monotone,Antitone,image2,IsCofinalFor,Prod, andPisections.Diff relative to #35208
🤖 Prepared with Claude Code