Experiment: use push/pull tactic for zpow rewrites#491
Draft
ldct wants to merge 3 commits intoteorth:mainfrom
Draft
Experiment: use push/pull tactic for zpow rewrites#491ldct wants to merge 3 commits intoteorth:mainfrom
ldct wants to merge 3 commits intoteorth:mainfrom
Conversation
Two replacements in Section_1_2_1.lean showing that pull works but isn't obviously better than rw for single-lemma applications. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace `rw [← zpow_sub₀ ...]`, `rw [← zpow_add₀ ...]` backward rewrite calls in Section_1_2_1.lean with `pull (disch := norm_num) _ ^ _; rfl` (or `congr 1; omega` where the exponents need arithmetic). Forward direction `rw [zpow_neg, zpow_natCast]` calls kept as-is since `push` left unsolved goals. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace `rw [← rpow_add ...]`, `rw [← rpow_neg ...]`, and `rw [← rpow_add_one ...]` backward rewrite calls in Section_6_7.lean and Appendix_B_2.lean with `pull (disch := positivity/norm_num) _ ^ _` calls. Cases involving `rpow_natCast + rpow_mul` (which mix nat pow and rpow) are left unchanged as `pull` cannot handle them. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Experiment replacing
rw [← zpow_sub₀ ...]withpull _ ^ _inSection_1_2_1.lean, using thepush/pulltactic from mathlib.Two replacements were made:
rw [← zpow_sub₀ (by norm_num : (2:ℝ) ≠ 0)]→pull (disch := norm_num) _ ^ _; rflFindings
For single-lemma rewrites, push/pull doesn't clearly win over
rw— same length, and the lemma name (zpow_sub₀) is more self-documenting than_ ^ _.Where push/pull would win (not demonstrated in this codebase):
push absreplacingrw [abs_mul, abs_neg, abs_div]push derivdoing product rule + chain rule recursivelypush absis easier to find than rememberingabs_mulpush Int.floorhandlesfloor_add_natCast,floor_add_intCast,floor_add_one,floor_add_ofNatuniformlyContext
This is part of a broader investigation into which mathlib lemmas benefit from
@[push]tagging. See companion PRs at ldct/mathlib4 for the tagging work.🤖 Generated with Claude Code