Skip to content

[Merged by Bors] - refactor(Analysis): golf Mathlib/Analysis/Complex/Trigonometric#38274

Closed
yuanyi-350 wants to merge 2 commits intoleanprover-community:masterfrom
yuanyi-350:A_3
Closed

[Merged by Bors] - refactor(Analysis): golf Mathlib/Analysis/Complex/Trigonometric#38274
yuanyi-350 wants to merge 2 commits intoleanprover-community:masterfrom
yuanyi-350:A_3

Conversation

@yuanyi-350
Copy link
Copy Markdown
Collaborator

@yuanyi-350 yuanyi-350 commented Apr 20, 2026

  • rewrites cos_three_mul via cosh_three_mul and the cosh_mul_I conversion
  • shortens sin_three_mul using sin_add, double-angle identities, and grind

Extracted from #37968

Open in Gitpod

@yuanyi-350 yuanyi-350 added codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly labels Apr 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

PR summary c3e588b468

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

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

@github-actions github-actions Bot added the t-analysis Analysis (normed *, calculus) label Apr 20, 2026
@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

I ran a profiler comparison for the changed declarations in this PR.

Results (seconds):

  • Complex.cos_three_mul: 0.061700 -> 0.006364 (-89.7%)
  • Complex.sin_three_mul: 0.046297 -> 0.131374 (+183.8%)

Overall:

  • Complex.cos_three_mul is much faster.
  • Complex.sin_three_mul is slower, mainly from the new grind step.

Comment thread Mathlib/Analysis/Complex/Trigonometric.lean Outdated
@themathqueen themathqueen added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 20, 2026
Co-authored-by: Monica Omar <23701951+themathqueen@users.noreply.github.com>
@yuanyi-350 yuanyi-350 removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 21, 2026
Copy link
Copy Markdown
Collaborator

@themathqueen themathqueen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the profiler comparison comment so that reviewers can know that the second proof isn't that bad?

@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

yuanyi-350 commented Apr 21, 2026

I ran a profiler comparison for the changed declarations in this PR.

Results (seconds):

  • Complex.cos_three_mul: 0.070367 -> 0.015276 (-78.3%)
  • Complex.sin_three_mul: 0.043212 -> 0.030453 (-29.5%)

Overall:

  • Both changed declarations got faster.
  • Complex.cos_three_mul improved substantially.
  • Complex.sin_three_mul also improved, but by a smaller amount.

@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 21, 2026

Benchmark results for 292cd67 against c3e588b are in. No significant results found. @yuanyi-350

  • build//instructions: -5.4G (-0.00%)

Small changes (1✅)

  • build/module/Mathlib.Tactic.MinImports//instructions: -134.0M (-2.60%)

@themathqueen
Copy link
Copy Markdown
Collaborator

maintainer merge

(editing in maintainer merge into a comment from 2 hours ago doesn't work apparently)

@github-actions
Copy link
Copy Markdown

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

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Apr 21, 2026
@bryangingechen
Copy link
Copy Markdown
Contributor

Thanks!
bors r+

@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 Apr 21, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Apr 21, 2026
…8274)

- rewrites `cos_three_mul` via `cosh_three_mul` and the `cosh_mul_I` conversion
- shortens `sin_three_mul` using `sin_add`, double-angle identities, and `grind`
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors Bot commented Apr 21, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor(Analysis): golf Mathlib/Analysis/Complex/Trigonometric [Merged by Bors] - refactor(Analysis): golf Mathlib/Analysis/Complex/Trigonometric Apr 21, 2026
@mathlib-bors mathlib-bors Bot closed this Apr 21, 2026
@yuanyi-350 yuanyi-350 deleted the A_3 branch April 24, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly ready-to-merge This PR has been sent to bors. t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants