Zulip Chat Archive
Stream: mathlib4
Topic: redefining `Inner` in `InnerProductSpace π π`
Jireh Loreaux (Dec 09 2024 at 18:56):
Currently, the definition of InnerProductSpace π π
is:
/-- A field `π` satisfying `RCLike` is itself a `π`-inner product space. -/
instance RCLike.innerProductSpace : InnerProductSpace π π where
inner x y := conj x * y
norm_sq_eq_inner x := by simp only [inner, conj_mul, β ofReal_pow, ofReal_re]
conj_symm x y := by simp only [mul_comm, map_mul, starRingEnd_self_apply]
add_left x y z := by simp only [add_mul, map_add]
smul_left x y z := by simp only [mul_assoc, smul_eq_mul, map_mul]
I would like to change the inner
field to:
inner x y := y * conj x
This is, of course, propositionally but not definitionally equal to the original. My reason for wanting this change is as follows. In Cβ-algebra theory, we like to consider an object called a (Hilbert) docs#CStarModule. These are essentially generalizations of InnerProductSpace
where the scalars are replaced by a Cβ-algebra. In the literature, we generally consider these as right A
-modules (where A
is the Cβ-algebra), which is why CStarModule
is currently set up with SMul Aα΅α΅α΅ E
. However, I realized that we will need both left and right Cβ-modules, which makes me want to just take a SMul A E
hypothesis instead.
Now, given any Cβ-algebra A
, there is a natural CStarModule A A
instance (with a left action) analogous to the InnerProductSpace π π
instance where the inner
field is defined as inner x y := y * star x
. Note that because the multiplication is non-commutative, we need inner
to be defined this way in order to get the appropriate behavior with the (pre-existing!) left action of A
on itself (i.e., we need βͺx, a β’ yβ« = a β’ βͺx, yβ«
for a x y : A
).
Herein lies the rub: β
is a Cβ-algebra, so it will inherit CStarModule β β
and InnerProductSpace β β
instances, which will result in a non-defeq diamond for Inner β β
.
Does anyone see any problem with this? @FrΓ©dΓ©ric Dupuis, @Heather Macbeth, @Jon Bannon
YaΓ«l Dillies (Dec 09 2024 at 19:09):
Oh, I really like the convention with the star
on the left because it corresponds to applying the dual map corresponding to x
to y
Jireh Loreaux (Dec 09 2024 at 21:16):
I think that's unaffected? Because that map uses innerSL
which, for this specific type, gets redefined.
Jireh Loreaux (Dec 10 2024 at 16:12):
Also @Anatole Dedecker
Jon Bannon (Dec 10 2024 at 16:30):
This is a source of controversy in some places because the OA community generally uses a * star b
(in Kadison-Ringrose, for example) but physics uses star a * b
, so if you have been raised on the former, calculations with the latter can be stumbly, on paper. I've come around to star a * b
for precisely the reason you mention, Jireh. In CStarModule
-land, everyone uses this convention for the CStarModule
valued inner products, which immediately puts it at odds with ordinary inner products in the trivial case where the C* algebra is the complex numbers.
Jireh Loreaux (Dec 10 2024 at 16:31):
Hold on, I don't think we're talking on the same wavelength.
Jireh Loreaux (Dec 10 2024 at 16:32):
I don't want to define βͺx, yβ« := x * star y
, I want to define it as βͺx, yβ« := y * star x
(as opposed the to current star x * y
). My version will still agree with that of current Mathlib propositionally (i.e., conjugate linear in the first variable).
Jireh Loreaux (Dec 10 2024 at 16:33):
Literally all I want to do is use the fact that multiplication in π
is commutative.
Jon Bannon (Dec 10 2024 at 16:35):
OK. So this isn't a change at all. Knee-jerk, I was taken back to several discussions with J. Martin Lindsay in which he vociferously argued for conjugate linearity in the first coordinate. The only problem I can see might be that some people prefer the opposite.
The physicists like conjugate linearity in the first variable (in opposition to the OA traditional approach), and since in the trivial A-A C* module we typically define $\langle a, b \rangle = a^{*}b$ for $a,b \in A$ and develop the whole theory around this, it seemed better to adopt that.
Sorry for the noise!
Jireh Loreaux (Dec 10 2024 at 16:36):
In Mathlib we've been conjugate linear in the first coordinate since ... forever? I think. But sure, that's a stance we've taken.
Jon Bannon (Dec 10 2024 at 16:40):
OK. No problem, then. I should probably have checked Mathlib before commenting...or carefully read your question.
Eric Wieser (Dec 10 2024 at 16:41):
Is it relevant that I was intending to eventually make InnerProductSpace K V
(or rather, its parent NormedSpace K V
) imply both a left- and right-action by K
?
Jireh Loreaux (Dec 10 2024 at 16:43):
:thinking: I think that's fine?
Jireh Loreaux (Dec 10 2024 at 16:44):
(deleted)
Jireh Loreaux (Dec 10 2024 at 16:44):
Oh, I guess it depends on what your definition of the right action is?
YaΓ«l Dillies (Dec 10 2024 at 16:47):
Jireh Loreaux said:
I don't want to define
βͺx, yβ« := x * star y
, I want to define it asβͺx, yβ« := y * star x
(as opposed the to currentstar x * y
).
I completely misread this! I am now unsaddened
Jon Bannon (Dec 10 2024 at 16:49):
(I'm glad you did too, @YaΓ«l Dillies ...I feel a tiny bit less silly, now. :rolling_on_the_floor_laughing: )
Eric Wieser (Dec 10 2024 at 17:19):
So just to check, we want
βͺx, a β’ yβ« = a β’ βͺx, yβ«
and not the more symmetric
βͺa β’> x, yβ« = a β’> βͺx, yβ«
βͺx, y <β’ aβ« = βͺx, yβ« <β’ a
Eric Wieser (Dec 10 2024 at 17:19):
(and am I right in saying we currently have the latter?)
Jireh Loreaux (Dec 10 2024 at 17:19):
No on both counts.
Jireh Loreaux (Dec 10 2024 at 17:21):
We want βͺx, a β’ yβ« = a β’ βͺx, yβ«
(and we have this) and we want βͺa β’ x, yβ« = βͺx, yβ« <β’ (star a)
.
Jireh Loreaux (Dec 10 2024 at 17:21):
(and we have these currently propositionally, but not defeq)
Eric Wieser (Dec 10 2024 at 17:22):
This is all moot without generalizing InnerProductSpace
to not need IsROrC
, right?
Jireh Loreaux (Dec 10 2024 at 17:22):
??
Eric Wieser (Dec 10 2024 at 17:22):
Ah nevermind, I now understand your diamond comment, sorry
Jireh Loreaux (Dec 10 2024 at 17:25):
When we have a CStarModule Aα΅α΅α΅ E
instance, then for x y : E
and a : A
, we'll get βͺx, y <β’ aβ« = βͺx, yβ« <β’ a
, which is what we normally do in Cβ-module theory (i.e., we default to right actions instead of left actions).
Jireh Loreaux (Dec 10 2024 at 17:32):
Eric Wieser said:
Is it relevant that I was intending to eventually make
InnerProductSpace K V
(or rather, its parentNormedSpace K V
) imply both a left- and right-action byK
?
I confused myself about this earlier. I think there is no issue here because the right-module action of a Cβ-algebra on itself gives us a CStarModule Aα΅α΅α΅ A
instance which leads to an Inner Aα΅α΅α΅ A
instance. So this doesn't conflict with anything in the case of A := β
because it's an Inner
instance over βα΅α΅α΅
not over β
.
Eric Wieser (Dec 10 2024 at 18:01):
Do you have any interest in one-sided CStarModule
s, or should they also imply compatible left and right actions?
Jireh Loreaux (Dec 10 2024 at 18:02):
No, they will only be one-sided in general.
Jireh Loreaux (Dec 10 2024 at 18:03):
But I'll need to, for example, consider Cβ-bimodules, where I have CStarModule A E
and CStarModule Bα΅α΅α΅ E
along with some compatibility conditions, hence I really do need left and right actions.
Anatole Dedecker (Dec 10 2024 at 22:46):
A bit late to the discussion, but I agree with Jireh on everything here. It's just a bit sad that βͺx, a β’ yβ« = a β’ βͺx, yβ«
looks less good than in the right module setting, but that's just a fact of life.
Anatole Dedecker (Dec 10 2024 at 22:53):
Eric Wieser said:
Is it relevant that I was intending to eventually make
InnerProductSpace K V
(or rather, its parentNormedSpace K V
) imply both a left- and right-action byK
?
I think we should be removing requirements from NormedSpace
(e.g allowing more base rings), not adding some. And indeed if we ever want to unify CStarModule
and InnerProductSpace
(which is not the most urgent thing, but could be nice) that could be annoying I think.
Eric Wieser (Dec 10 2024 at 23:01):
Anatole Dedecker said:
I think we should be removing requirements from
NormedSpace
(e.g allowing more base rings), not adding some.
We already have the fully-removed version, it's docs#BoundedSMul
Eric Wieser (Dec 10 2024 at 23:02):
I went through a spree last year of replacing lots of NormedSpace
s in theorems in mathlib with that typeclass, generalizing the ring appropriately
Anatole Dedecker (Dec 10 2024 at 23:06):
Eric Wieser said:
Anatole Dedecker said:
I think we should be removing requirements from
NormedSpace
(e.g allowing more base rings), not adding some.We already have the fully-removed version, it's docs#BoundedSMul
Ah yes, I always forget about this one, sorry. I don't remember, is there a reason not to replace NormedSpace
? But I guess this is another subject.
Jireh Loreaux (Dec 10 2024 at 23:06):
I suspect we never want to unify InnerProductSpace
and CStarModule
Anatole Dedecker (Dec 10 2024 at 23:08):
Is there an obvious reason I'm missing?
Jireh Loreaux (Dec 10 2024 at 23:10):
several:
- import hierarchy
- Can't include
\R
- Many theorems don't generalize so there isn't tons of duplication. And even the ones that do require high-powered results.
Jireh Loreaux (Dec 10 2024 at 23:12):
Even putting an instance on the product requires nontrivial CFC machinery.
Anatole Dedecker (Dec 10 2024 at 23:26):
I wasn't advocating for any nontrivial generalization, so I don't think the first two point are that bad (again, just for the definitions). I was mostly thinking of factorizing e.g Cauchy-Schwartz identity, but I was missing the sneaky docs#CStarAlgebra.conjugate_le_norm_smul in the proof.
Jireh Loreaux (Dec 11 2024 at 16:57):
Yeah, and note also that (at least for now), we don't allow pre-Cβ-modules, but we do allow for pre-inner product spaces.
But what I meant with β
is that the β
-module structure is baked in as a parameter to docs#CStarModule, so it's impossible to have CStarModule β β
. This may need to change at some point, but currently we do this because it would be a royal pain otherwise, as Lean will never be able to figure out whether it should choose β
or β
. (Indeed, while βͺx, yβ«_A
makes reference to A
, there is no mention of the actual scalar ring anywhere.)
Jireh Loreaux (Dec 13 2024 at 15:13):
Ugh... this is a super annoying change. If anyone wants to lend a hand, it's on branch#j-loreaux/InnerProductSpace-swap-mul.
Jireh Loreaux (Dec 13 2024 at 15:18):
I think the thing that is perhaps worst about it is that over β
it's really surprising (i.e., that βͺx, yβ«_β := y * x
definitionally for x y : β
). This comes up in the Fourier Transform stuff a bunch. I guess I'm not sure whether to change some of the definitions (so that they are innerSL.flip
, which preserves the order of multiplication, or to fix the proofs).
Likewise, when constructing an inner product on n β π
from a positive definite matrix M
, the definition was βͺx, yβ« := dotProduct (star x) (M *α΅₯ y)
, which is pretty natural, but I switched it to dotProduct (M *α΅₯ y) (star x)
so that when you take the inner product corresponding to the identity you will get the same inner product definitionally as the one on EuclideanSpace π n
.
Oliver Nash (Dec 14 2024 at 17:17):
I confess I haven't read this thread carefully but are you saying that we will lose the fact that the following proof is true by definition if we make this change?
import Mathlib
open scoped RealInnerProductSpace
example (x y : β) : βͺx, yβ« = x * y := rfl
Jireh Loreaux (Dec 14 2024 at 17:31):
Yes, it will be βͺx, yβ« = y * x := rfl
.
Jireh Loreaux (Mar 09 2025 at 13:54):
I finally got around to finishing this: #22715. Please feel free to comment.
@David Loeffler and @YaΓ«l Dillies in particular I would like your comments on changes in this PR to areas relevant to you.
David Loeffler (Mar 09 2025 at 15:50):
I think Jireh has done an excellent job of making the change in a way that's minimally invasive for the existing code β the vast majority the changes in Fourier theory, etc, seem to be just changing inner_apply
to inner_apply'
. So, if it makes life easier for C* algebra stuff, then I certainly have no objection.
Kim Morrison (Mar 10 2025 at 23:56):
There's a merge conflict now. Otherwise, sounds great!
Jireh Loreaux (Mar 13 2025 at 15:00):
conflict resolved.
George Granberry (Mar 14 2025 at 11:36):
Probably not related to the issue I'm having but you're probably familiar with this bit of code. I've been trying to use
rw [inner]
to use the lemma
β (w z : β), inner w z = ((starRingEnd β) w * z).re
but for whatever reason i'm always getting
Inner.inner.{u_4, u_5} {π : Type u_4} {E : Type u_5} [self : Inner π E] : E β E β π
Aaron Liu (Mar 14 2025 at 11:42):
George Granberry said:
Probably not related to the issue I'm having but you're probably familiar with this bit of code. I've been trying to use
rw [inner]
to use the lemma
β (w z : β), inner w z = ((starRingEnd β) w * z).re
but for whatever reason i'm always getting
Inner.inner.{u_4, u_5} {π : Type u_4} {E : Type u_5} [self : Inner π E] : E β E β π
That lemma is called docs#Complex.inner.
George Granberry (Mar 14 2025 at 11:51):
Ahhh, thanks so much @Aaron Liu !
Last updated: May 02 2025 at 03:31 UTC