Skip to content

refactor: redefine eLpNorm at p = 0 - #39311

Draft
felixpernegger wants to merge 35 commits into
leanprover-community:masterfrom
felixpernegger:lpnonmeasurable
Draft

felixpernegger wants to merge 35 commits into
leanprover-community:masterfrom
felixpernegger:lpnonmeasurable

Conversation

@felixpernegger

@felixpernegger felixpernegger commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

For Zulip discussion see https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/eLpNorm.20junk.20value/with/576356442. In partuclar this change is suggestion 2 in #mathlib4 > eLpNorm junk value @ 💬

This redefined MeasureTheory.eLpNorm at p = 0. Previously it was always 0 but now it is the measure of the support of the function (technical detail: In order to avoid having to add additional arguments to eLpNorm, we define it as the measure of the support of the norm of the function, but this is almost always the same)

The motivation for this comes from the counting measure, in particular this then unifies with https://leanprover-community.github.io/mathlib4_docs/Mathlib/Analysis/Normed/Lp/lpSpace.html#Mem%E2%84%93p. In any case, it is "closer" to the actual mathematical definition

Unfortunately, since eLpNorm is widely used, the diff is very large and a lot of theorems break (i.e. now require p != 0). Oftentimes p != 0 is still not required (sometimes with nontrivial arguments), I tried to avoid adding extra hypothesis whenever I could but I almost certainly missed some.

There now may also be places where we dont need p != 0 as a hypothesis anymore (i.e. for [Memℓp](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Analysis/Normed/Lp/lpSpace.html#Mem%E2%84%93p)), but this is not included in this PR.


Open in Gitpod

@github-actions github-actions Bot added merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-measure-probability Measure theory / Probability theory labels May 13, 2026
@felixpernegger

Copy link
Copy Markdown
Contributor Author

-t-measure-probability

@github-actions github-actions Bot removed t-measure-probability Measure theory / Probability theory merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels May 13, 2026
@github-actions

github-actions Bot commented May 13, 2026 •

Copy link
Copy Markdown

PR summary 4783221ee1

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.MeasureTheory.Function.LpSpace.Basic 1994 1996 +2 (+0.10%)
Mathlib.MeasureTheory.Function.LpSpace.ContinuousFunctions 2009 2011 +2 (+0.10%)
Import changes for all files
Files Import difference
Mathlib.MeasureTheory.Function.LpSpace.Basic Mathlib.MeasureTheory.Function.LpSpace.ContinuousFunctions 2

Declarations diff (regex)

+ IsFiniteMeasure.memLp_exponent_zero
+ _root_.ENNReal.ne_zero_of_ge_one
+ _root_.Function.support_enorm
+ _root_.Function.support_enorm'
+ _root_.support_congr_of_ae_eq
+ aestronglyMeasurable_of_memLp_zero
+ eLpNorm_exponent_zero_mono_of_ae_zero
+ eLpNorm_exponent_zero_smul_le_left
+ eLpNorm_exponent_zero_smul_le_right
+ eLpNorm_zero_le_of_ae_le
+ eLpNorm_zero_piecewise
+ eLpNorm_zero_piecewise_le
+ measure_support_mono
+ measure_support_mono'
+ memLp_zero_iff_aestronglyMeasurable_and_volume_support_lt_top
+ stronglyMeasurable_rpow
+ toLp_exponent_zero
+ volume_support_le_of_ae_le
+ volume_support_lt_top_of_memLp_zero
+ zero_of_zero_left
+ zero_of_zero_right
+--+ memLp
- lpNorm_exponent_zero
- memLp_zero
- memLp_zero_iff_aestronglyMeasurable
-++- memLp_exp_mul
-+-+ toLp
--++ norm_compLp_le

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 4783221).

  • +22 new declarations
  • −3 removed declarations
+ENNReal.HolderTriple.zero_of_zero_left
+ENNReal.HolderTriple.zero_of_zero_right
+ENNReal.ne_zero_of_ge_one
+Function.support_enorm
+Function.support_enorm'
+MeasureTheory.IsFiniteMeasure.memLp_exponent_zero
-MeasureTheory.SimpleFunc.memLp_zero
+MeasureTheory.aestronglyMeasurable_of_memLp_zero
+MeasureTheory.eLpNorm_exponent_zero_mono_of_ae_zero
+MeasureTheory.eLpNorm_exponent_zero_smul_le_left
+MeasureTheory.eLpNorm_exponent_zero_smul_le_right
+MeasureTheory.eLpNorm_zero_le_of_ae_le
+MeasureTheory.eLpNorm_zero_piecewise
+MeasureTheory.eLpNorm_zero_piecewise_le
-MeasureTheory.lpNorm_exponent_zero
+MeasureTheory.measure_support_mono
+MeasureTheory.measure_support_mono'
-MeasureTheory.memLp_zero_iff_aestronglyMeasurable
+MeasureTheory.memLp_zero_iff_aestronglyMeasurable_and_volume_support_lt_top
+MeasureTheory.stronglyMeasurable_rpow
+MeasureTheory.volume_support_le_of_ae_le
+MeasureTheory.volume_support_lt_top_of_memLp_zero
+SchwartzMap.mkCLMtoNormedSpace.congr_simp
+SchwartzMap.toLp_exponent_zero
+support_congr_of_ae_eq

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 4783221ee1
Reference commit be883716af

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

@sgouezel sgouezel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for doing this, this is very much appreciated!

I haven't gone through the whole PR yet, but for now I have two main comments:

  • In distributions, you should use junk values for toLp, to avoid having a proof argument to carry around, which is sometimes cumbersome
  • You should construct some API for the L^0 norm, to discharge proofs instead of redoing the same kind of things all the time. Notably, you need a lemma saying that, if for almost every x, g x =0 -> f x = 0, then the L^0 norm of f is bounded by that of g.

Also, don't hesitate to use the filter_upwards tactic more, it is very handy.

@sgouezel sgouezel added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label May 14, 2026
@github-actions github-actions Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 14, 2026
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 14, 2026
Co-authored-by: Felix Pernegger <[email protected]>
@felixpernegger

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label May 22, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 23, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 31, 2026
@github-actions github-actions Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 1, 2026
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 1, 2026
Comment thread Mathlib/Analysis/Fourier/LpSpace.lean Resolved
Comment thread Mathlib/Analysis/Fourier/LpSpace.lean Resolved
@sgouezel

sgouezel commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

I am afraid there is going to be an issue with this PR. As we discussed in Zulip (see for instance my message at #mathlib4 > eLpNorm junk value @ 💬), the endgoal of the refactor could be the following:

  • one function eLpHmgNorm, the homogeneous L^p norm, which correspond to the current eLpNorm (except that it would be infinite for non aestronglyMeasurable functions) and satisfies eLpHmgNorm (c • f) p μ = ‖c‖₊ • eLpHmgNorm f p μ.
  • another function eLpNorm which would be homogeneous only for p ≥ 1, but would be a seminorm for all p. This is the one that would be used to put the normed structure on L^p, to make sure we have a distance, a topology and everything.

What your refactor is doing is changing some part of the current eLpNorm, to replace its behavior at p = 0 by the new one. However, I am afraid it will make part of the refactor harder, because some theorems will hold for all values of p for eLpHmgNorm, and to get these we will need to undo what you're doing in the PR.

A tentative plan to get the refactor done while not doing everything at once could be:
(1) modify the current definition of eLpNorm to also require that the functions are aestronglyMeasurable (and assign enorm = \infty otherwise)
(2) create a new definition eLpHmgNorm, which is just the same as eLpNorm, and duplicate most statements from eLpNorm to eLpHmgNorm (I know duplicating is bad, but here I don't see what else we could do)
(3) modify the definition of eLpNorm to make it no-homogeneous, by changing the behavior at p=0 and at 0<p<1. Adjust the assumptions accordingly in the statements.
Note that (3) could be split into: (3'): change at p=0; (3'') change at 0<p<1

As you can see, your PR would be perfect for (3'), but I'm not sure the library is ready for it now, because we haven't implemented (1) or (2).

Note that this is just a tentative plan, and I'm not sure of anything here. So definitely worth discussing, here on the PR or maybe preferably on Zulip.

@felixpernegger

Copy link
Copy Markdown
Contributor Author

I am afraid there is going to be an issue with this PR. As we discussed in Zulip (see for instance my message at #mathlib4 > eLpNorm junk value @ 💬), the endgoal of the refactor could be the following:

* one function `eLpHmgNorm`, the homogeneous L^p norm, which correspond to the current `eLpNorm` (except that it would be infinite for non aestronglyMeasurable functions) and satisfies `eLpHmgNorm (c • f) p μ = ‖c‖₊ • eLpHmgNorm f p μ`.

* another function `eLpNorm` which would be homogeneous only for `p ≥ 1`, but would be a seminorm for all `p`. This is the one that would be used to put the normed structure on `L^p`, to make sure we have a distance, a topology and everything.

What your refactor is doing is changing some part of the current eLpNorm, to replace its behavior at p = 0 by the new one. However, I am afraid it will make part of the refactor harder, because some theorems will hold for all values of p for eLpHmgNorm, and to get these we will need to undo what you're doing in the PR.

A tentative plan to get the refactor done while not doing everything at once could be: (1) modify the current definition of eLpNorm to also require that the functions are aestronglyMeasurable (and assign enorm = \infty otherwise) (2) create a new definition eLpHmgNorm, which is just the same as eLpNorm, and duplicate most statements from eLpNorm to eLpHmgNorm (I know duplicating is bad, but here I don't see what else we could do) (3) modify the definition of eLpNorm to make it no-homogeneous, by changing the behavior at p=0 and at 0<p<1. Adjust the assumptions accordingly in the statements. Note that (3) could be split into: (3'): change at p=0; (3'') change at 0<p<1

As you can see, your PR would be perfect for (3'), but I'm not sure the library is ready for it now, because we haven't implemented (1) or (2).

Note that this is just a tentative plan, and I'm not sure of anything here. So definitely worth discussing, here on the PR or maybe preferably on Zulip.

Alright, this is quite unfortunate. In any case; hopefully we can at least use this for some p=0 proofs (or lemmas which do not hold for p = 0) :/

@felixpernegger

Copy link
Copy Markdown
Contributor Author

awaiting-zulip

@github-actions github-actions Bot added the awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there label Jun 5, 2026
@felixpernegger
felixpernegger temporarily deployed to cache-upload-forks June 5, 2026 13:13 — with GitHub Actions Inactive
@felixpernegger
felixpernegger temporarily deployed to cache-upload-forks June 5, 2026 13:30 — with GitHub Actions Inactive
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 19, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@YaelDillies YaelDillies added the t-measure-probability Measure theory / Probability theory label Jul 4, 2026
@felixpernegger
felixpernegger marked this pull request as draft July 10, 2026 12:29
@mathlib-bors

mathlib-bors Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This pull request is now in draft mode. No active bors state needed cleanup.

While this PR remains draft, bors will ignore commands on this PR. Mark it ready for review before using commands like bors r+ or bors try.

This branch was previously deployed

1 inactive deployment
cache-upload-forks — 4783221e Deployed Jun 5, 2026 by felixpernegger via ci (fork) / Upload to cache #303126
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-measure-probability Measure theory / Probability theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants