Zulip Chat Archive

Stream: maths

Topic: module maps induced by ring homs


Apurva Nakade (Sep 07 2023 at 16:06):

What is a good way to define a map between modules induced by ring homomorphisms? Here's an mwe:

import Mathlib.Algebra.Module.Submodule.Basic

variable {R : Type*} [Ring R]
variable {S : Type*} [Ring S]

variable {E : Type*} [AddCommGroup E] [Module S E]
variable {F : Type*} [AddCommGroup F] [Module S F]

variable (φ : R →+* S)

-- instance : Module R E := Module.compHom E φ
#check Module.compHom E φ -- typechecks!

-- instance : Module R F := Module.compHom F φ
#check Module.compHom F φ -- typechecks!

example (f : E →ₗ[S] F) : E →ₗ[R] F := by sorry

Thanks,

Apurva Nakade (Sep 07 2023 at 16:07):

The case I'm interested is when φ is an inclusion of subrings.

Apurva Nakade (Sep 07 2023 at 16:08):

(Also, VSCode parses \phi as \varphi and \varphi as \phi lol)

Alex J. Best (Sep 07 2023 at 16:16):

Does docs#LinearMap.restrictScalars work?

Apurva Nakade (Sep 07 2023 at 17:16):

This is exactly what I want! Thanks!!

I'm having issues with inducing the second module structure though. This line gives an error even though it typechecks:

-- instance : Module R E := Module.compHom E φ
#check Module.compHom E φ -- typechecks!

The error is:

cannot find synthesization order for instance @instModuleToSemiringToAddCommMonoid with type
  {R : Type u_1} 
    [inst : Ring R] 
      {S : Type u_2} 
        [inst_1 : Ring S]  {E : Type u_3}  [inst_2 : AddCommGroup E]  [inst_3 : Module S E]  (R →+* S)  Module R E
all remaining arguments have metavariables:
  Ring ?S
  @Module ?S E Ring.toSemiring AddCommGroup.toAddCommMonoid

Kevin Buzzard (Sep 07 2023 at 17:20):

What's a #mwe for the error?

Apurva Nakade (Sep 07 2023 at 17:23):

The same as above:

import Mathlib.Algebra.Module.Submodule.Basic

variable {R : Type*} [Ring R]
variable {S : Type*} [Ring S]

variable {E : Type*} [AddCommGroup E] [Module S E]
variable {F : Type*} [AddCommGroup F] [Module S F]

variable (φ : R →+* S)

-- instance : Module R E := Module.compHom E φ
#check Module.compHom E φ -- typechecks!

Kevin Buzzard (Sep 07 2023 at 17:32):

The instance doesn't really make sense. ϕ\phi is just a variable. What if I have two ring homomorphisms RSR\to S? So the system is complaining that the instance is not mathematically meaningful.

Kevin Buzzard (Sep 07 2023 at 17:34):

Mathematically if you want to say "there is one and only one canonical map from R to S, and I want to fix that one" then you can use [Algebra R S] and then you can make E into an R-module with [Module R E] [IsScalarTower R S E]

Apurva Nakade (Sep 07 2023 at 17:36):

I see, thanks! I will try this out.

Kevin Buzzard (Sep 07 2023 at 17:41):

I think I have a more precise explanation of the error. variable (φ : R →+* S) doesn't mean "let ϕ\phi be a ring homomorphism from RR to SS". It rather means "do nothing, but if a user ever mentions ϕ\phi then just put "for all ϕ:RS\phi:R\to S in front of what they're writing". So what Module.compHom E \phi unfolds to is "for all rings R and S, and for all S-modules E, and for all ring homs phi:R->S, here's an R-module structure on E". Now if you make this an instance, then when the typeclass inference system sees Module R E it can figure out what to choose for R and E, but now it has no clue what to let S be, so it gives up.

Apurva Nakade (Sep 07 2023 at 17:43):

I see. So I need a better way to create the _specific_ ring hom I'm interested in.

Kevin Buzzard (Sep 07 2023 at 17:44):

If you have a specific ring hom in mind which won't change then Algebra R S is the way to go.

Apurva Nakade (Sep 07 2023 at 17:44):

Yes, it's just an inclusion of rings.

Apurva Nakade (Sep 07 2023 at 17:44):

Great, I'll switch to using [Algebra R S]


Last updated: Dec 20 2023 at 11:08 UTC