Skip to content

refactor(Analysis): golf Mathlib/Analysis/Analytic/OfScalars#38513

Open
yuanyi-350 wants to merge 2 commits intoleanprover-community:masterfrom
yuanyi-350:A_10
Open

refactor(Analysis): golf Mathlib/Analysis/Analytic/OfScalars#38513
yuanyi-350 wants to merge 2 commits intoleanprover-community:masterfrom
yuanyi-350:A_10

Conversation

@yuanyi-350
Copy link
Copy Markdown
Collaborator

  • simplifies ofScalars_series_injective by evaluating the equality on the constant 1 tuple
  • rewrites ofScalars_add and ofScalars_smul with ext/simp, removing the transparency workaround

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 25, 2026
@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 25, 2026

Benchmark results for a548273 against 36a9746 are in. No significant results found. @yuanyi-350

  • build//instructions: -14.2G (-0.01%)

Small changes (2✅)

  • build/module/Mathlib.Tactic.Explode.Pretty//instructions: -397.9M (-12.84%)
  • build/module/Mathlib.Topology.Algebra.Module.StrongTopology//instructions: -366.7M (-6.78%)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 25, 2026

PR summary 36a97460d7

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.


Decrease in tech debt: (relative, absolute) = (2.00, 0.00)
Current number Change Type
6204 -2 backward.isDefEq.respectTransparency

Current commit 8b14f261d9
Reference commit 36a97460d7

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/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 25, 2026
@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

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

Results (seconds):

  • FormalMultilinearSeries.ofScalars_series_injective: 0.106365 -> 0.100783 (-5.2%)
  • FormalMultilinearSeries.ofScalars_add: 0.111418 -> 0.150578 (+35.1%)
  • FormalMultilinearSeries.ofScalars_smul: 0.078849 -> 0.093558 (+18.7%)

Overall:

  • ofScalars_series_injective is slightly faster.
  • ofScalars_add and ofScalars_smul regress, with the larger slowdown on ofScalars_add.

@yuanyi-350 yuanyi-350 added the tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip label Apr 25, 2026
Comment on lines +67 to +68
intro c c' h
funext n
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
intro c c' h
funext n
intro _ _ h
ext n

Comment on lines +89 to +90
ext n x
simp [ofScalars, add_smul]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ext n x
simp [ofScalars, add_smul]
ext; simp [ofScalars, add_smul]

Comment on lines +96 to +97
ext n y
simp [ofScalars, smul_smul]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ext n y
simp [ofScalars, smul_smul]
ext; simp [ofScalars, smul_smul]

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 t-analysis Analysis (normed *, calculus) tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants