Zulip Chat Archive

Stream: mathlib4

Topic: linear map forgetting variables


Sébastien Gouëzel (Apr 09 2024 at 12:15):

Given a set s in a type ι, do we have in mathlib the linear map forgetting the coordinates not in s, i.e., ((i : ι) → E₁ i) →ₗ[𝕜] ((i : s) → E₁ i)? I looked for this and for a more general version, replacing the inclusion of s in univ with a general embedding, but I couldn't find it. It's one of these cases where I don't know a good tool to look for these constructions (and there are so many constructions in linear algebra!) (loogle and grep both failed me), so if you have tricks I'm all ears!

Floris van Doorn (Apr 09 2024 at 14:25):

My strategy is too look manually through Mathlib/LinearAlgebra/Pi.lean, but I don't find that there, so I think it's missing. It should be formulated as the non-equiv version of docs#LinearEquiv.piCongrLeft.

Adam Topaz (Apr 09 2024 at 14:29):

This should be restriction along the inclusion of s.

Adam Topaz (Apr 09 2024 at 14:31):

import Mathlib

example {X Y R : Type*} (f : X  Y) [Ring R] : (Y  R) →ₗ[R] (X  R) := LinearMap.funLeft
  R R f

found with exact? :tada:

Adam Topaz (Apr 09 2024 at 14:32):

oh but you want the dependent product. Does that work? (no :( )

Sébastien Gouëzel (Apr 09 2024 at 14:38):

Suppose I didn't want the dependent version (which I do). Can you explain how I could have guessed the name funLeft? Is that a standard name scheme in this corner of the library? (It's not even clear to me if fun means function -- because f is a function -- or functor -- since this is the canonical contravariant functor in this setting).

Adam Topaz (Apr 09 2024 at 14:39):

Well, here's the cleanest version I could come up with:

example {X R : Type*} {EX : X  Type*} [Ring R]
   [ x, AddCommGroup (EX x)]
   [ x, Module R (EX x)]
   (S : Set X)
   :
   ((x : X)  EX x) →ₗ[R] ((s : S)  EX s) := LinearMap.pi fun i => LinearMap.proj i.val

Adam Topaz (Apr 09 2024 at 14:39):

I mostly used exact?% and followed my nose.

Adam Topaz (Apr 09 2024 at 14:40):

It seems that this is just missing.

Adam Topaz (Apr 09 2024 at 14:40):

I also found funLeft with exact?%.

Adam Topaz (Apr 09 2024 at 14:41):

FWIW, I think funLeft is quite a bad name. I think it should have precompose or something like that in the name.

Adam Topaz (Apr 09 2024 at 14:43):

It's possible I don't work in the most efficient way, but I tend to prefer using tools in lean itself over going for loogle/moogle. I use loogle/moogle as a last resort.

Sébastien Gouëzel (Apr 09 2024 at 14:43):

Thanks!

Jireh Loreaux (Apr 09 2024 at 17:52):

We have these pre/post-composition defs all over the library, but the naming is absolutely awful (in terms of consistency). There's comp and comp' in some places (you get to guess which is which), or compLeft and compRight (again, you get to guess which is which).

I propose we come up with a standard naming scheme for these, and add it to #naming.

Jireh Loreaux (Apr 09 2024 at 17:53):

I think precomp and postcomp are clearer that compLeft and compRight, but maybe that's just my own bias showing.

Eric Wieser (Apr 09 2024 at 18:24):

Part of the problem is that you need to talk about compositions of Hom1s as a Hom2

Eric Wieser (Apr 09 2024 at 18:25):

Where here Hom1 is just a regular function, and Hom2 is a linear map

Eric Wieser (Apr 09 2024 at 18:25):

But we also definitely care about the cases where both are linear maps

Eric Wieser (Apr 09 2024 at 18:25):

And at least theoretically could care about the case where one is only an AddMonoidHom...

Jireh Loreaux (Apr 09 2024 at 18:28):

I don't think that's a problem? Or at least, it's a separate one? I'm talking about the distinction between docs#ContinuousMap.compStarAlgHom and docs#ContinuousMap.compStarAlgHom', for instance.

Anatole Dedecker (Apr 09 2024 at 18:52):

I think the point is there are a bunch of naming issues merging here x) I suggested some time ago that bundlings of the "same" function with different hom types could be named function.asSomeType, e.g docs#ContinuousLinearMap.compL could be ContinuousLinearMap.comp.asCLM or something like this.

Anatole Dedecker (Apr 09 2024 at 18:53):

But I agree this is not precisely the issue at play here.


Last updated: May 02 2025 at 03:31 UTC