Skip to content

refactor: golf only Function/SimpleFunc, Function/LpSeminorm/Basic#38107

Closed
yuanyi-350 wants to merge 5 commits intoleanprover-community:masterfrom
yuanyi-350:golf_77
Closed

refactor: golf only Function/SimpleFunc, Function/LpSeminorm/Basic#38107
yuanyi-350 wants to merge 5 commits intoleanprover-community:masterfrom
yuanyi-350:golf_77

Conversation

@yuanyi-350
Copy link
Copy Markdown
Collaborator

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

This PR selectively ports part of #38104.

Concretely, it does two things:

  • In Mathlib/MeasureTheory/Function/SimpleFunc.lean, it rewrites Measurable.add_simpleFunc and Measurable.simpleFunc_add to use SimpleFunc.measurable_bind instead of explicit inductions over simple functions together with manual piecewise/ support arguments.
  • In Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean, it shortens several eLpNorm/eLpNorm' monotonicity and bound proofs by deriving the nnnorm versions from the more general enorm versions, instead of reproving the same argument separately.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 16, 2026

PR summary 8e3c989104

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-measure-probability Measure theory / Probability theory label Apr 16, 2026
Copy link
Copy Markdown
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

A couple of minor comments. Can you comment on the performance aspects of this change?

Comment thread Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean Outdated
Comment thread Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean Outdated
Comment thread Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean Outdated
Comment thread Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean Outdated
Comment thread Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean Outdated
Comment thread Mathlib/MeasureTheory/Function/SimpleFunc.lean Outdated
Comment thread Mathlib/MeasureTheory/Function/SimpleFunc.lean Outdated
Comment thread Mathlib/MeasureTheory/Constructions/Polish/Basic.lean Outdated
@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 16, 2026
Comment thread Mathlib/MeasureTheory/Constructions/Polish/Basic.lean Outdated
@grunweg grunweg added the LLM-generated PRs with substantial input from LLMs - review accordingly label Apr 16, 2026
@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Apr 16, 2026

Echoing my comment made elsewhere, can you also update the PR description to be more helpful? Thanks!

@yuanyi-350 yuanyi-350 added the codex OpenAI Codex wrote (parts of) this PR. label Apr 16, 2026
yuanyi-350 and others added 4 commits April 16, 2026 20:40
Co-authored-by: Michael Rothgang <rothgang@math.uni-bonn.de>
Co-authored-by: Etienne Marion <66847262+EtienneC30@users.noreply.github.com>
@yuanyi-350 yuanyi-350 requested a review from grunweg April 18, 2026 08:37
@yuanyi-350 yuanyi-350 changed the title refactor: golf only Function/SimpleFunc, Function/LpSeminorm/Basic, Constructions/Polish/Basic refactor: golf only Function/SimpleFunc, Function/LpSeminorm/Basic Apr 18, 2026
@yuanyi-350 yuanyi-350 removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 18, 2026
@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

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

Results (seconds):

  • MeasureTheory.eLpNorm'_mono_nnnorm_ae: 0.159290 -> 0.056959 (-64.24%)
  • MeasureTheory.eLpNorm_mono_nnnorm_ae: 0.063250 -> 0.010056 (-84.10%)
  • MeasureTheory.eLpNorm_le_of_ae_nnnorm_bound: 0.218913 -> 0.082531 (-62.30%)
  • Measurable.add_simpleFunc: 0.183754 -> 0.024048 (-86.91%)
  • Measurable.simpleFunc_add: 0.165129 -> 0.019816 (-88.00%)

Overall:

  • All 5 changed declarations got faster.
  • No regressions showed up in the modified declarations I checked.

Caveat:

  • I measured each declaration by inserting local set_option trace.profiler true and taking the top-level declaration/proof timing emitted for that declaration.
  • The comparison uses the actual merge-base with upstream/master.

@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 19, 2026
@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Apr 19, 2026

Please follow the request made in the comments here and here. Thanks!

@yuanyi-350 yuanyi-350 closed this Apr 20, 2026
@yuanyi-350 yuanyi-350 deleted the golf_77 branch April 20, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly t-measure-probability Measure theory / Probability theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants