doc(Tactic/Translate/ToDual): add deployment guide for @[to_dual]#35216
doc(Tactic/Translate/ToDual): add deployment guide for @[to_dual]#35216kim-em wants to merge 5 commits intoleanprover-community:masterfrom
Conversation
PR summary 3efa02168fImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match our commit style conventions. |
1c2f979 to
e9b67ed
Compare
Expand the module docstring in ToDual.lean with practical advice for deploying @[to_dual] to existing code: name agreement, attribute propagation, docstring syntax, declaration ordering, and known structural mismatches. Also add a note to the attribute docstring about (attr := ...) syntax ordering with docstrings. Add .claude/skills/to_dual/SKILL.md with detailed agent instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e9b67ed to
fc5d93c
Compare
|
As for the claude stuff, have we come to a consensus on whether this belongs on the Mathlib repo or on users' config files? I recall the last time something like this got brought up, the consensus was the latter. |
|
The claude file doesn't mention anything about When a theorem has hypotheses or parameters as explicit arguments that appear in a different order in the dual declaration, it is important to use the |
- Fix "swapping ≤/≥" → "reversing the order of inequalities" - Remove incorrect claims about directed/codirected, intervals, Heyting - Remove bot-oriented "Build and test" section - Add `to_dual none` mention for conjunct reordering - Show name positioning in syntax examples (attr, name, docstring order) - Remove .claude/skills/to_dual/SKILL.md (belongs in user config) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restore the SKILL.md that was incorrectly removed, and update it: - Remove incorrect claims about intervals and directed/codirected - Add to_dual_insert_cast documentation - Add to_dual self/existing/none and (reorder := ...) documentation - Add critical rule about only preserving existing docstrings - Fix syntax ordering (attr, name, docstring) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added in 2e25372. |
At this point, a repository without a |
|
Thanks, @vihdzp and @JovanGerb for your helpful and patient corrections! I hope this will be a good experiment in writing more detailed docs, eventually. I think I've addressed your comments above. |
JovanGerb
left a comment
There was a problem hiding this comment.
At this point, a repository without a .claude seems sort of mean. :-)
I honestly can't tell if this was written by Claude lol
Co-authored-by: Jovan Gerbscheid <56355248+JovanGerb@users.noreply.github.com>
Use the actual source code pattern instead of made-up `ofMapLEIff`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This had no labels, which usually leads to a wrong person to be assigned by the bot. Assigning @JovanGerb instead. |
JovanGerb
left a comment
There was a problem hiding this comment.
The added explanation in the ToDual module docstring seems reasonable. Though I don't know why we would have a separate documentation in the module docstring from the docstring on the to_dual attribute itself, it seems a bit inefficient like this.
I have more trouble with the .claude folder. If I understand it correctly, this adds a pay-walled feature to mathlib that users need to pay for if they want to use it. This seems undesirable to me. So you'd have to find another reviewer to approve this.
|
|
||
| `@[to_dual]` translates a declaration by: | ||
| 1. Dualizing the proof term (reversing the order of inequalities, swapping `⊔`/`⊓`, `⊤`/`⊥`, etc.) | ||
| 2. Guessing the dual declaration's name using `nameDict` below |
There was a problem hiding this comment.
| 2. Guessing the dual declaration's name using `nameDict` below | |
| 2. Guessing the dual declaration's name using `nameDict` and `abbreviationDict` below |
This PR expands the documentation for
@[to_dual]with practical advice for deploying it to existing code.Module docstring (
Mathlib/Tactic/Translate/ToDual.lean): adds a "Deploying@[to_dual]to existing code" section covering name agreement, attribute propagation, docstring syntax ordering, declaration order dependencies, and known structural mismatches (conjunct reordering, type class gaps, interval argument swapping).Attribute docstring: adds a note that
@[simp]is not auto-copied (must use(attr := simp)), and shows the correct ordering when combining(attr := ...)with docstrings.Agent skill (
.claude/skills/to_dual/SKILL.md): detailed step-by-step instructions for an AI agent deploying@[to_dual], including how to identify candidates, common patterns, and debugging.🤖 Prepared with Claude Code