Zulip Chat Archive
Stream: PhysLean
Topic: Normed dual of Schwarz space
Kenny Lau (Jul 12 2025 at 14:37):
@Joseph Tooby-Smith I thought it might be a good idea to make this a separate thread. What are the things I should keep in mind?
Kenny Lau (Jul 12 2025 at 14:40):
For example, the question I would have is, how much stuff do we currently have? and which folder should I put it in?
Kenny Lau (Jul 12 2025 at 14:41):
maybe I should make a separate folder for it, PhysLean/Mathematics/Schwarz/Basic.lean
Kenny Lau (Jul 12 2025 at 14:44):
to document more of my thoughts, I had an idea to enlarge the test functions to continuous piecewise differentiable but ultimately thought it's a bad idea.
Kenny Lau (Jul 12 2025 at 14:45):
I think I'll keep the test function to the Schwarz space, and then I'll make some API to account for the piecewise functions
Joseph Tooby-Smith (Jul 12 2025 at 14:56):
The only thing currently in PhysLean regarding Schwarz maps is the stuff I was doing last week regarding Quantum mechanics which can be found in the Operators and HilbertSpace folders of this directory.
I would even be tempted to put this in the SpaceAndTime directory in a folder like e.g. SpaceAndTime.Distributions., but I think the mathematics folder is also good.
Here are somethings I would like to see:
- Notation that makes the type of distributions look like a function type e.g.
ℝ →d ℂ - API and notation around derivatives so we can use them like we use derivatives of functions.
- API that makes it as easy as possible to treat functions as distributions. This means: Defining distributions from functions, take the derivative of distributions which are actually functions, proving equality of two distributions which are actually functions, etc.
- Important distributions pre-defined as such, e.g. dirac delta, the Heaviside step functions, the inverse potential . These should have good API, for example their derivatives etc.
Kenny Lau (Jul 12 2025 at 15:00):
also another question is, do we want R -> C or R -> R? or R -> R^k?
Kenny Lau (Jul 12 2025 at 15:15):
it seems like in quantum you would want (R -> C) -> C but in variational calculus you would want (R -> R^2) -> R?
Kenny Lau (Jul 12 2025 at 15:16):
or i can allow both
Kenny Lau (Jul 12 2025 at 15:19):
I want to make the decision to only use Type 0 lol
Kenny Lau (Jul 12 2025 at 15:20):
@Joseph Tooby-Smith do you actually use universes? I see that you type universe v u in the beginning of your files but I don't know if you really use them
Joseph Tooby-Smith (Jul 12 2025 at 15:24):
So as physicists we are mainly interested in functions from space (or spacetime) to Euclidean space or the product of R’s etc. So if it can be done to cover all these cases I think this would be good - if indeed possible.
Kenny Lau (Jul 12 2025 at 15:25):
yes but i'm saying in quantum you want C
Joseph Tooby-Smith (Jul 12 2025 at 15:26):
Regarding universes, nope! I’m not sure of anywhere in physlean where universes come in. If they can be avoided here the better I think
Joseph Tooby-Smith (Jul 12 2025 at 15:27):
Yeah sorry, Euclidean spaces over the reals or complex numbers and also factors of C and C^2 etc. (Sorry for the bad formatting - on my phone)
Kenny Lau (Jul 12 2025 at 15:28):
Joseph Tooby-Smith said:
Regarding universes, nope! I’m not sure of anywhere in physlean where universes come in. If they can be avoided here the better I think
https://github.com/search?q=repo%3AHEPLean%2FPhysLean%20universe&type=code
Kenny Lau (Jul 12 2025 at 15:30):
now i'm thinking you might actually want (R -> R/C^k) -> R/C^k!
Kenny Lau (Jul 12 2025 at 15:31):
@Joseph Tooby-Smith what should the output be?
Kenny Lau (Jul 12 2025 at 15:31):
for example, where does dirac delta make sense?
Kenny Lau (Jul 12 2025 at 15:32):
if i start with a function f:R->R^3 defined by f(t) = (sin(t), cos(t), t), and ask you what is (δ*f)(0)?
Kenny Lau (Jul 12 2025 at 15:32):
then you would say (0, 1, 0) right
Joseph Tooby-Smith (Jul 12 2025 at 15:36):
I think the output should be R or C still. In particular a function R->R^k defines a distribution (R->R^k)->R through integration over the inner product
Kenny Lau (Jul 12 2025 at 15:36):
ok but what about my example?
Kenny Lau (Jul 12 2025 at 15:39):
oh you take the inner product first
Joseph Tooby-Smith (Jul 12 2025 at 15:40):
I think (though could be wrong) that you have a direction associated with the delta function
Kenny Lau (Jul 12 2025 at 15:41):
wiki seems to think that it outputs R^n
Joseph Tooby-Smith (Jul 12 2025 at 15:41):
Kenny Lau said:
Joseph Tooby-Smith said:
Regarding universes, nope! I’m not sure of anywhere in physlean where universes come in. If they can be avoided here the better I think
https://github.com/search?q=repo%3AHEPLean%2FPhysLean%20universe&type=code
I can’t open this right now (as I’m not signed into GitHub on my phone) but I’m going to guess that those universes can be trivially removed
Kenny Lau (Jul 12 2025 at 15:41):
but this could just be a different convention
Joseph Tooby-Smith (Jul 12 2025 at 15:42):
could you share the wiki page?
Kenny Lau (Jul 12 2025 at 15:42):
https://en.wikipedia.org/wiki/Dirac_delta_function#Generalizations
Kenny Lau (Jul 12 2025 at 15:42):
Kenny Lau (Jul 12 2025 at 15:43):
oh wait, this is different
Kenny Lau (Jul 12 2025 at 15:43):
this is the dirac delta R^n -> R, sorry for the confusion
Joseph Tooby-Smith (Jul 12 2025 at 15:44):
Yeah! I think f here is a function from R^k->R
Joseph Tooby-Smith (Jul 12 2025 at 16:18):
Kenny Lau said:
Joseph Tooby-Smith said:
Regarding universes, nope! I’m not sure of anywhere in physlean where universes come in. If they can be avoided here the better I think
https://github.com/search?q=repo%3AHEPLean%2FPhysLean%20universe&type=code
Back at a computer, and made a PR removing all universes in PhysLean - none were doing anything.
Kenny Lau (Jul 12 2025 at 17:29):
@Joseph Tooby-Smith I've made a PR to define distributions and dirac delta function. I've provided a custom constructor that a physicist should be able to understand (try it yourself!).
Kenny Lau (Jul 12 2025 at 17:34):
https://github.com/HEPLean/PhysLean/pull/644
Kenny Lau (Jul 12 2025 at 17:34):
cc @ZhiKai Pong
Kenny Lau (Jul 12 2025 at 17:50):
@Joseph Tooby-Smith do you know why the CI is building all the files even though I haven't touched anything?
Joseph Tooby-Smith (Jul 12 2025 at 17:52):
This always happens for PhysLean - I think it is basically down to the fact we don't have a cache like Mathlib does. I would like to set one up at some point, but am not entirely sure how - and think it relies on server space somewhere.
Joseph Tooby-Smith (Jul 12 2025 at 17:53):
BTW you can run the linters locally using (which is quicker then relying on GitHub):
lake exe lint_all
./scripts/lint-style.sh
Kenny Lau (Jul 12 2025 at 18:15):
@Joseph Tooby-Smith i've updated the file
ZhiKai Pong (Jul 12 2025 at 18:43):
what does docs#SchwartzMap.delta do or is it something else entirely?
Kenny Lau (Jul 12 2025 at 18:46):
aha, lol
Kenny Lau (Jul 12 2025 at 18:46):
nice find!
Kenny Lau (Jul 12 2025 at 18:47):
so one difference is that it doesn't output a scalar
Kenny Lau (Jul 12 2025 at 18:53):
https://en.wikipedia.org/wiki/Distribution_(mathematics)
Kenny Lau (Jul 12 2025 at 18:53):
here's an interesting thing
Kenny Lau (Jul 12 2025 at 18:54):
wiki seems to imply that distributions are actually (U -> R) -> R or (U -> C) -> C
Kenny Lau (Jul 12 2025 at 18:54):
wiki wants to make the domain high dimensional rather than the target
Kenny Lau (Jul 12 2025 at 19:04):
what if we just allow (R -> E) -> F because we might need them eventually
Kenny Lau (Jul 12 2025 at 19:08):
on that note why don't we generalise the R too :rofl:
Joseph Tooby-Smith (Jul 12 2025 at 19:11):
Yeah I think R really should be generalized, since in general this represents space or spacetime, not necessarily in 1-dimension. I'm still confused why you want to generalize F though?
Joseph Tooby-Smith (Jul 12 2025 at 19:16):
Maybe my real concern is the following: If you generalize F, I worry that defining e.g. the derivative etc. will become difficult. But maybe it can be done.
Joseph Tooby-Smith (Jul 12 2025 at 19:20):
Let me add to my list above of things I would like to see:
- A constructor of a distribution based on a function
ℝ → ℂsatisfying conditions which can be solved withfun_prop.
Kenny Lau (Jul 12 2025 at 19:26):
Joseph Tooby-Smith said:
Yeah I think R really should be generalized, since in general this represents space or spacetime, not necessarily in 1-dimension. I'm still confused why you want to generalize F though?
i think you're right, we don't need to generalise F; i just thought we might need to because the dirac delta in the library is S(E,F) ->[L] F
Kenny Lau (Jul 12 2025 at 19:27):
but if we stick to R/C then we can still define our own dirac by composing it with a linear function
Joseph Tooby-Smith (Jul 12 2025 at 19:29):
Ok, I'm happy either way, so I am happy for you to make a call on this. I think at some point it will become clear which one is needed anyway :).
Kenny Lau (Jul 12 2025 at 19:35):
@Joseph Tooby-Smith I think a good enough criterion for f to become a distribution is that int_a^b |f(x)| dx should (exist and) be bounded for every a<b? but this would also mean that your 1/r^2 might not work... how do you make sense of 1/r^2?
Kenny Lau (Jul 12 2025 at 19:45):
every continuous function should be able to be interpreted as a distribution
Kenny Lau (Jul 12 2025 at 19:45):
i'll do that in the next PR
Kenny Lau (Jul 12 2025 at 19:54):
actually i hope you don't mind me asking again, i'm not really familiar with these things; do you have an example where we want the test functions (that's the R->E part) to have high dimensional output value?
Kenny Lau (Jul 12 2025 at 19:54):
i actually don't understand why S(R, R) ->L R and S(R, C) ->L C aren't enough...
Kenny Lau (Jul 12 2025 at 19:54):
i thought about the var cal case but actually in that case the test functions are still one dimensional
Joseph Tooby-Smith (Jul 12 2025 at 20:24):
Kenny Lau said:
Joseph Tooby-Smith I think a good enough criterion for f to become a distribution is that int_a^b |f(x)| dx should (exist and) be bounded for every a<b? but this would also mean that your 1/r^2 might not work... how do you make sense of 1/r^2?
Huh - this is worrying. I want to really make sense of the equation given here:
I thought, and what people say, is that this is in terms of distributions. This equation comes up in Maxwell's equations for a point particle, and actually gives an example of why S(R, R) ->L R and S(R, C) ->L C aren't enough.
Joseph Tooby-Smith (Jul 12 2025 at 20:31):
Also the 1/r^2 should be thought of as being in 3d, which may salvage things (r) is the distance from the orgin.
Kenny Lau (Jul 12 2025 at 20:32):
@Joseph Tooby-Smith Thanks for the example.
- This is an interesting example indeed. From the proof given in the most upvoted answer, I'll take the definition to be "the limit of the distributions defined by 1/(r^2+a^2) as a->0". If you want a more intrinsic definition maybe principal values will be the answer?
- The test functions (φ) are actually R^3 -> R, so that's actually not an example I'm looking for. I understand that the first R in my (S(R, R/C) -> R/C) should be generalised, but I'm talking about the first "R/C" in my expression.
Joseph Tooby-Smith (Jul 12 2025 at 20:35):
c.f. 2, yes, sorry you are right. I am interested in the function before taking the divergence, and I want to interpret this as a distribution, which I think would correspond to .
Joseph Tooby-Smith (Jul 12 2025 at 20:36):
I want to interpret this as a distribution, because I want to make sense of the divergence of it, and ending up with a Dirac delta function.
Joseph Tooby-Smith (Jul 12 2025 at 20:38):
If you want a more intrinsic definition maybe principal values will be the answer?
I was thinking that, but I don't think it's actually needed, since I think e.g. the norm of is locally integrable in , namely since the volume measure is , the 's cancel out.
Kenny Lau (Jul 12 2025 at 20:38):
I'm wondering if it's possible to make sense of your f : R^3 -> "R^3" without actually modifying the space of test functions S(R^3, R)
Joseph Tooby-Smith (Jul 12 2025 at 20:39):
(From the
Joseph Tooby-Smith said:
If you want a more intrinsic definition maybe principal values will be the answer?
I was thinking that, but I don't think it's actually needed, since I think e.g. the norm of is locally integrable in , namely since the volume measure is , the 's cancel out.
(From the physics point of view this is actually precisely why the appears in electromagnetism)
Joseph Tooby-Smith (Jul 12 2025 at 20:41):
Kenny Lau said:
I'm wondering if it's possible to make sense of your f : R^3 -> "R^3" without actually modifying the space of test functions S(R^3, R)
I guess the question is how would you treat f : R^3 -> R^3 as a distribution in this sense, what would your integral be?
Kenny Lau (Jul 12 2025 at 20:42):
from a mathematical point of view there's actually nothing "extra" added on by going from a "scalar field" to a "vector field": the behaviour of (f1, f2, f3) is determined by f1, f2, and f3, i think
Kenny Lau (Jul 12 2025 at 20:43):
generalising the codomain is quite different from generalising the domain
Kenny Lau (Jul 12 2025 at 20:44):
i'm actually also a bit confused about the statement that it's integrable because the 1D version 1/x^2 seems to not be integrable? am I missing something here?
Kenny Lau (Jul 12 2025 at 20:46):
oh the 1d version isn't 1/x^2 it's sgn(x)/x^2 right
Joseph Tooby-Smith (Jul 12 2025 at 20:50):
Kenny Lau said:
oh the 1d version isn't 1/x^2 it's sgn(x)/x^2 right
The 2d version is , and the 1d version is . This is explained (for physicists) here:
https://physics.stackexchange.com/questions/629299/does-the-electric-field-in-1d-exist-in-nature
This has a very bizarre physical consequence: A point particle in 1d produces a constant electric field in all of space. (the same way that in 3d an infinite plane of charges produces a constant electric field).
Kenny Lau (Jul 12 2025 at 20:51):
sorry, by 1d version i just meant the naive way of just looking at the x-axis
Kenny Lau (Jul 12 2025 at 20:52):
and then for sgn(x)/x^2 you still need to kinda of "take some limit" -- whether you do it explicitly via sgn(x)/(x^2+a^2), or implicitly by considering "principal value" or taking the complement of (-ε, ε) and letting ε -> 0
Joseph Tooby-Smith (Jul 12 2025 at 20:54):
I agree that the value along the -axis is sgn(x)/x^2, but I don't see why you are trying to integrate along the x-axis, which is of measure zero in 3d.
Kenny Lau (Jul 12 2025 at 20:55):
ah I just wanted to do an "easier" version but maybe this is not the right thing to do
Kenny Lau (Jul 12 2025 at 20:55):
maybe 3d domain is really different from 1d domain
Joseph Tooby-Smith (Jul 12 2025 at 20:58):
Yeah I think it is - I don't think you can just restrict to a 1d line. (which I agree is rather odd intuitively)
Kenny Lau (Jul 13 2025 at 12:24):
@Joseph Tooby-Smith btw im now leaning towards making a function f: R^n -> R^k into a distribution by taking test function η: R^n -> R (!) and outputting int η x • f x dx (in R^k!); I thought I would ask for your opinion on this.
Kenny Lau (Jul 13 2025 at 12:29):
I’m 80% convinced that this is the best approach
Kenny Lau (Jul 13 2025 at 12:52):
update: 90%
Joseph Tooby-Smith (Jul 13 2025 at 12:56):
Ok this makes sense, I think it will make it easier to eg define the divergence as well
Tomas Skrivan (Jul 13 2025 at 18:17):
(deleted)
Tomas Skrivan (Jul 13 2025 at 18:19):
(deleted)
Joseph Tooby-Smith (Jul 16 2025 at 13:49):
Concerning showing is a distribution in 3d, I think what one may need is the generalization of docs#integral_comp_polarCoord_symm to one dimension higher, or something similar. This is related to @ZhiKai Pong 's (as yet unanswered :() post on spherical coordinates: #Is there code for X? > Spherical coordinates . Maybe it is worth developing such an API.
Kenny Lau (Jul 16 2025 at 14:00):
I recall we have something like a "spherical haar measure"
Kenny Lau (Jul 16 2025 at 14:01):
Kenny Lau (Jul 16 2025 at 14:02):
this thing
Joseph Tooby-Smith (Jul 16 2025 at 14:05):
Ah! Nice! Ok, and there is docs#MeasureTheory.integral_fun_norm_addHaar ! Looks very close to what we would want (just over a compact domain not the whole space).
Kenny Lau (Jul 16 2025 at 14:06):
just set the function to 0 outside the compact domain
Joseph Tooby-Smith (Jul 16 2025 at 14:06):
Yep!
Joseph Tooby-Smith (Jul 16 2025 at 14:08):
Honestly I spent a good hour earlier searching loogle for things like
MeasureTheory.integral, "norm"
so don't know how I missed this, maybe I didn't quite use the right words :).
Joseph Tooby-Smith (Jul 17 2025 at 07:11):
Some other distributions which appear in physics:
- A generalization of a dirac delta function to a line e.g. for the
x-axis such that in 3d
Physically this appears when studying e.g. lines of charges, or a the magnetic field around a wire.
- A generalization of a dirac delta function to a plane (and in general any co-dimension
nsurface, e.g. the surface of a ball). - The function which takes a value 'a' inside a ball of radius 'r' and is zero outside. Used e.g. in gravity.
Joseph Tooby-Smith (Jul 18 2025 at 15:36):
Here is the definition of the function in 3d as a distribution, I'm sure this could very much be neatened up etc.
Code
Joseph Tooby-Smith (Jul 18 2025 at 18:07):
I was thinking maybe it would be good to define e.g. the following notation:
scoped notation "¹/r²" => invSq (EuclideanSpace ℝ (Fin 3))
or similar.
(edit: removed part of message which was incorrect).
Joseph Tooby-Smith (Jul 21 2025 at 10:38):
I have a construction of a distribution from a function bounded by in this PR. This is only for EuclideanSpace ℝ (Fin 3), but I'm sure everything should generalize nicely.
I'm not sure if this is something you're still aiming for @Kenny Lau , but if so, I suspect anything you produce here will be better then what I have - in which case this PR can be ignored or overwritten at a later date :).
Kenny Lau (Jul 21 2025 at 10:55):
@Joseph Tooby-Smith there might be a bit of time before my next PR, sorry
ZhiKai Pong (Oct 31 2025 at 15:50):
#PR reviews > Tempered distributions
@Moritz Doll (sorry for pinging) has a series of PRs on tempered distributions which I believe is closely related to what's been done here (e.g. Distribution) and we may want to update our version to match the mathlib version once it stabilizes. (I'm not so confident with the relevant maths yet)
ZhiKai Pong (Oct 31 2025 at 15:51):
on a related note there's also #30329 on generalised distributions
Joseph Tooby-Smith (Oct 31 2025 at 15:58):
Agreed! I wonder if it is possible to set up a Zulip bot that would ping a message when PRs are merged with Mathlib, and/or when a PR becomes a part of a tagged version of Mathlib. I think this would be very helpful in keeping track of these things when they actually get merged, so we can act on them then.
Daniel Morrison (Oct 31 2025 at 23:31):
I do know there's a Zulip topic #rss > Recent Commits to mathlib4:master which posts new merged PRs and includes a link to the PR so it seems like you could tell a bot to watch that topic and message you when certain PRs are mentioned. On the Github side I believe there's a way to link your PR to other ones and a bot there will comment changes. No idea how either of these work though
Moritz Doll (Dec 16 2025 at 00:40):
The definition of tempered distributions has now been merged (sorry forgot to mention it here), there is very little of actual useful objects (there are PRs for embeddings, multiplication and derivatives), just the Fourier transform. Fourier multiplier and convolution are work in progress
Joseph Tooby-Smith (Dec 16 2025 at 05:06):
Great @Moritz Doll - many thanks for postiing here ! We have some stuff specific for PhysLean around distributions in places over PhysLean e.g.
So when we next merge with Mathlib we need to remove our definition of a distribution and update all the lemmas around it.
What do you mean by 'multiplication'? Multiplication of a distribution with what?
Moritz Doll (Dec 16 2025 at 05:12):
Multiplication with a function of temperate growth (i.e., all derivatives are polynomially bounded)
ZhiKai Pong (Dec 24 2025 at 12:35):
I'm a bit out of the loop on mathlib versions, are we ready to start this refactor or will it be in the next update?
Joseph Tooby-Smith (Dec 24 2025 at 13:42):
I think we are ready to refactor now with our current update.
ZhiKai Pong (Dec 24 2025 at 13:46):
I'll give it a go over Christmas (also to give myself a reason to learn the API). I'll probably come up with a lot of questions and will ask here.
ZhiKai Pong (Dec 28 2025 at 14:57):
so there is
docs#Distribution (defined as abbrev Distribution := 𝓓^{n}(Ω, ℝ) →L_c[ℝ] F)
and
docs#TemperedDistribution (defined as 𝓢(E, ℂ) →Lₚₜ[ℂ] F)
currently in Mathlib.
I don't really understand the difference in terms of topology etc., from what I gathered we should use the second one.
if my understanding is correct, should we just use the mathlib notation (i.e. 𝓢'(E, F) for TemperedDistribution E F) instead of the current E →d[𝕜] F?
Joseph Tooby-Smith (Dec 28 2025 at 15:17):
Yeah - I think we want the second one. I think the “pt” is related to the topology of the whole space, which I don’t think we use so shouldn’t affect anything.
I personally would be in favour of keeping the ‘E →d[𝕜] F’ notation, since to me it echos that this is like a function, which is how a physicist thinks about them. But happy to hear arguments against
ZhiKai Pong (Dec 28 2025 at 15:33):
my concern would be that if we are to use the mathlib API the notation mismatch might be confusing
Alfredo Moreira-Rosa (Dec 28 2025 at 15:47):
Not sure it's the right place to share this video, but here is a nice use of schwartz space functions for non standard Traces detection in particle colliders :
https://www.youtube.com/watch?v=DRS7TbjVTNQ
ZhiKai Pong (Dec 28 2025 at 18:52):
Also mathlib define this for complex ℂ: abbrev TemperedDistribution := 𝓢(E, ℂ) →Lₚₜ[ℂ] F whereas the PhysLean definition has [RCLike 𝕜]. Just want to check that we do indeed want the ability to write real-valued distributions before pinging Moritz to ask about implementation details
Joseph Tooby-Smith (Dec 28 2025 at 20:53):
Yeah, we are going to explicitly need it for the reals as well as the complex numbers. In electromagnetism, I think we only use it over the reals. I guess this is one advantage of the current notation - the field is explicit.
Moritz Doll (Dec 28 2025 at 21:29):
The reason to bake in the complex numbers is that the main motivation for Schwartz functions (and tempered distributions) is the Fourier transform and that is only defined if the codomain is a complex vector space. So even when you solve a PDE that is purely real like the wave equation, you might want to work over the complex numbers.
ZhiKai Pong (Dec 28 2025 at 21:35):
Thank you Moritz for explaining.
I'm thinking about the following: Maybe we keep the PhysLean version for physical distributions (point charges, current densities etc.), then cast towards the Mathlib version when we need to do Fourier transforms?
ZhiKai Pong (Dec 28 2025 at 21:38):
The refactor will then be to match analogous API (lemma and proofs where possible) to the Mathlib (complex) version counterpart, but keeping both versions, @Joseph Tooby-Smith do you think this is a good idea
ZhiKai Pong (Dec 28 2025 at 23:25):
I'm getting myself confused, should physical distributions (charges, currents) be docs#Distribution instead? the tempered part only comes in when we care about Fourier transforms etc.? but I also don't see any connection between docs#Distribution and docs#TemperedDistribution in mathlib, not sure if this is due to both parts being very new or I'm completely misunderstanding things.
ZhiKai Pong (Dec 28 2025 at 23:28):
if I'm not mistaken docs#TestFunction is ultimately the samething as IsTestFunction used in variational calculus, so it seems to me that we can refactor everything in mathlib API (not sure how challenging this will be)
ZhiKai Pong (Dec 29 2025 at 00:01):
sorry if this is a bit incoherent, it's late here and I'm quite confused about all of these, just summarizing my thoughts here:
- For physical distributions, the object we want is
𝓢(E, 𝕜) →L[𝕜] Fwhich is defined over both real and complex whereas the mathlib docs#TemperedDistribution is only defined over the complex.
-
1.1 docs#Distribution requires compact support which is not necessarily the case for physical distributions so it is irrelevant here (is this correct?)
-
1.2 Do we want to duplicate the mathlib API for multiplication and derivatives etc.?
- @Joseph Tooby-Smith in PhysLean, is distributions and variational calculus currently "orthogonal" in the sense that they can be dealt with separately?
- 2.1 a separate refactor of IsTestFunction should be done?
- Mathematically,
is it correct to say that tempered and has compact support are independent properties, and the mathlib definitions of docs#Distribution and docs#TemeperedDistribution only conincide when the object has both?
is it correct that compactly supported implies temperedness, so docs#TemeperedDistribution is strictly more general than docs#Distribution ?
Joseph Tooby-Smith (Dec 29 2025 at 01:19):
In response to your points:
-
Yes we want
𝓢(E, 𝕜) →L[𝕜] F.
1.1 Yes, docs#Distribution is defined on compactly supported functions whilst docs#TemeperedDistribution is defined on all Schwartz maps. Every compactly supported function is a Schwartz map, so every docs#TemeperedDistribution is also defined on all compactly supported functions, and thus is a docs#Distribution. (as your last comment indicates).
1.2 We currently have derivatives for distributions, but not multiplication. I think it would be worth reproducing this. -
Yes, distributions and variational calculus are currently orthogonal. In fact, I think they might have to stay this way, since I do not know of anyway to even define a Lagrangian for distributions (instead of functions).
2.1. I think a refactoring for IsTestFunction should be done.
ZhiKai Pong (Feb 11 2026 at 15:44):
@Moritz Doll May I ask why does mathlib use docs#LineDeriv for SchwartzMap and TemperedDistribution instead of docs#fderiv ?
I'm trying to understand the difference between the mathlib inplementation and https://physlean.com/docs/PhysLean/Mathematics/Distribution/Basic.html#Distribution.fderivD, especially on the usage of docs#SchwarzMap.fderivCLM
I'm guessing it makes some Fourier stuff easier, but I have never used LineDeriv before so not really sure what's the difference, and if there's a way to convert between the two
Moritz Doll (Feb 11 2026 at 22:20):
I think it is way more convenient in distribution theory to deal with maps with equal domain and codomain. If you use docs#fderiv directly (and we have docs#SchwartzMap.fderivCLM), then the definition for distributions becomes lengthy because you have to rearrange the evaluation map. This is exactly why the definition of fderivD is so tedious. However the definition for the directional derivative is just one line, docs#TemperedDistribution.instLineDeriv.
Note that lineDerivOp is mainly for the notation (and then there are algebraic type-classes on top), so it all looks very nice (and consistent).
For the Fourier transform on Schwartz functions, we proved docs#SchwartzMap.fderivCLM_fourier_eq first and then deduced the variants for the line derivative, whereas for tempered distributions it follows for the line derivatives directly from duality, so no fderivCLM needed.
ZhiKai Pong (Feb 12 2026 at 01:14):
Many thanks @Moritz Doll for typing this out. I've tried playing around with it a bit but am still kind of lost (could very well be my knowledge of distributions isn't good enough), I'm wondering would it be possible to demonstrate something like derivative of the heaviside step function (not even sure how to write this as a distribution) equals Dirac delta or is this actually much more completed than I think.
(@Joseph Tooby-Smith I thought you had something along these lines for 1D point charge, is it still somewhere in PhysLean or am I misremembering?)
Moritz Doll (Feb 12 2026 at 01:42):
There is a bit of stuff missing, but nothing too major:
import Mathlib.Analysis.Distribution.TemperedDistribution
open SchwartzMap MeasureTheory
open scoped LineDeriv
noncomputable section
def heaviside : 𝓢'(ℝ, ℂ) where
toFun f := ∫ x in Set.Ioi 0, f x
map_add' := sorry
map_smul' := sorry
cont := sorry
@[simp]
theorem heaviside_apply (f : 𝓢(ℝ, ℂ)) : heaviside f = ∫ x in Set.Ioi 0, f x := rfl
@[simp]
theorem lineDerivOp_eq_deriv (f : 𝓢(ℝ, ℂ)) (x : ℝ) : ∂_{(1 : ℝ)} f x = deriv f x := rfl
theorem linederiv_heaviside : ∂_{(1 : ℝ)} heaviside = TemperedDistribution.delta (0 : ℝ) := by
ext f
simp only [TemperedDistribution.lineDerivOp_apply_apply, heaviside_apply, SchwartzMap.neg_apply,
lineDerivOp_eq_deriv, TemperedDistribution.delta_apply]
rw [MeasureTheory.integral_Ioi_of_hasDerivAt_of_tendsto (f := -f) (m := 0)]
· simp
· fun_prop
· intro x hx
exact (f.hasDerivAt x).neg
· refine Integrable.integrableOn ?_
apply (-derivCLM ℝ ℂ f).integrable
· sorry
obviously not mathlib level code. The last sorry is obviously true and follows from the statement about cocompact filters in mathlib.
ZhiKai Pong (Feb 12 2026 at 01:52):
Thanks! I'll try to work through this later
Joseph Tooby-Smith (Feb 12 2026 at 05:43):
@ZhiKai Pong This was for the point particle in 1 dimension, but I replaced the heaviside step function with (x-r)/||x-r||, as this was more general, and carried over to higher dimensions.
The corresponding derivatives are calculated in this file:
https://github.com/lean-phys-community/PhysLean/blob/master/PhysLean/SpaceAndTime/Space/Norm.lean
Maybe the thing to do here is relate fderiv of our distributions to linederiv, if possible.
ZhiKai Pong (Feb 12 2026 at 09:21):
Yea I'm planning to refactor the relevant PhysLean parts to follow Mathlib more closely, I'm still experimenting to see how everything fits together, especially since we want to be able to do stuff with 𝓢(E, 𝕜) →L[𝕜] F, maybe we just duplicate the whole docs#TemperedDistribution API but I'll think about it
ZhiKai Pong (Feb 12 2026 at 09:27):
I can see this being a source of confusion (it already is quite confusing) I'm thinking maybe some sort of namespace structuring might be helpful but we should probably be more careful about this and think this through
Joseph Tooby-Smith (Feb 13 2026 at 14:45):
In PhysLean we have the condition IsDistBounded which is different from HasTemperateGrowth (in particular it deals with non-smooth functions such as , which often appear in physics).
We have things like the following
distOfFunction (fun x : Space d.succ => ‖x‖ ^ (- d.succ : ℤ) • basis.repr x) (by fun_prop)
Here the by fun_prop is a proof of a IsDistBounded lemma. I am wondering if we can define a macro, so we can make this look much more like a function. I'm thinking of something like:
⸨‖x‖ ^ (- d.succ : ℤ) • basis.repr x⸩ᵈ
to represent the above, where the x is automatically inferred and the fun_prop is automatically proved.
Joseph Tooby-Smith (Feb 16 2026 at 17:08):
In addition to the above, maybe some sort of equality =d which takes a distribution on the left and a function on the right, and is true when the distribution corresponds to the integration of the function.
Joseph Tooby-Smith (Feb 19 2026 at 14:35):
I have put an implementation of the ⸨‖x‖ ^ (- d.succ : ℤ) • basis.repr x⸩ᵈ style notation in PhysLean#953, along with some other simplifying definitions around distributions.
Last updated: Feb 28 2026 at 14:05 UTC