Zulip Chat Archive

Stream: Is there code for X?

Topic: module.prod


Alex Kontorovich (Jul 07 2022 at 14:40):

I see submodule.prod but not module.prod...?

Adam Topaz (Jul 07 2022 at 14:44):

the type-theoretic product should get a module instance for free

Yaël Dillies (Jul 07 2022 at 14:46):

docs#prod.module

Alex Kontorovich (Jul 07 2022 at 15:00):

How do I get this to work? I just want to define a vector space W=V×V' and a map from an endomorphism of V to one on W (which does nothing on V'). Help please? Thanks!

universe v

variables {V V' : Type v} [add_comm_group V] [add_comm_group V'] [module  V] [module  V']
  [finite_dimensional  V] [finite_dimensional  V']

def W := prod V V'

def first_component_injection :
 (module.End  V)  (module.End  W) :=
begin
  sorry
end

Alex Kontorovich (Jul 07 2022 at 15:01):

It doesn't accept module.End ℂ W...

Alex Kontorovich (Jul 07 2022 at 15:01):

I was hoping to be able to write def W := V.prod V' but that doesn't work...

Eric Wieser (Jul 07 2022 at 15:04):

If you make W @[reducible] then it will work

Eric Wieser (Jul 07 2022 at 15:04):

By using def you're saying "make a new thing called W which by default lean knows nothing about"

Eric Wieser (Jul 07 2022 at 15:05):

Of course, what you'll find next is that when you write W, lean won't be able to guess what V and V' are

Eric Wieser (Jul 07 2022 at 15:05):

Forcing you to write @W V V' _ _ _ _ _ _ instead...

Alex Kontorovich (Jul 07 2022 at 15:08):

Sorry can you explain further? What's the recommended way to define W?

Alex Kontorovich (Jul 07 2022 at 15:09):

This still gives an error:

@[reducible] def W := prod V V'

def first_component_injection :
 (module.End  V)  (module.End  W) :=
begin
  sorry
end

Eric Wieser (Jul 07 2022 at 15:09):

If V and V' are really variables and not some specific type, then I don't think you want to define W at all (because at best you'd have to write it W V V', and that's harder to read than V × V')

Eric Wieser (Jul 07 2022 at 15:10):

So

def first_component_injection :
  module.End  V  module.End  (V × V') :=
begin
  sorry
end

Alex Kontorovich (Jul 07 2022 at 15:11):

Thanks!

Eric Wieser (Jul 07 2022 at 15:12):

Your other options is:

def first_component_injection :
  let W := V × V' in (module.End  V  module.End  W) :=
begin
  sorry
end

which reads much more like the mathematics, but probably ends up being annoying later (I think mathlib almost never does this).

Yakov Pechersky (Jul 07 2022 at 15:38):

notation `W` := V × V'

is a nice way to get shorthand

Floris van Doorn (Jul 07 2022 at 23:53):

I think you need local notation W := V × V' if you refer to local variables.


Last updated: Dec 20 2023 at 11:08 UTC