Zulip Chat Archive

Stream: Is there code for X?

Topic: two module instance over ℤ


Edison Xie (Mar 08 2025 at 17:18):

Do we have a solution to this? Or more specifically, for a isomorphism between cohomology group, how do I get the AddEquiv version of that without causing error like below?

theorem eq_inst (M : ModuleCat ): M.isModule = @AddCommGroup.toIntModule M M.isAddCommGroup := sorry

Kevin Buzzard (Mar 08 2025 at 17:50):

docs#ModuleCat.isModule

Kevin Buzzard (Mar 08 2025 at 17:54):

If you just want a proof then take everything apart; there's only one way Z can act on an additive group. Are you sure you want this though? What's the application?

Eric Wieser (Mar 08 2025 at 19:17):

I don't think it is possible to make this defeq

Eric Wieser (Mar 08 2025 at 19:17):

Subsingleton.elim _ _ should prove the theorem though

Edward van de Meent (Mar 08 2025 at 19:50):

a quick glance suggests there is no Subsingleton instance here, though...

Edward van de Meent (Mar 08 2025 at 19:50):

this should do it

instance (M : Type*) [AddCommGroup M] : Subsingleton (Module  M) where
  allEq inst1 inst2 := by
    ext z m
    rw [int_smul_eq_zsmul inst1,int_smul_eq_zsmul]

Edward van de Meent (Mar 08 2025 at 19:52):

see also:

theorem eq_inst (M : ModuleCat ) :
    M.isModule = @AddCommGroup.toIntModule M M.isAddCommGroup := by
  ext z m
  rw [int_smul_eq_zsmul M.isModule]
  rfl

Aaron Liu (Mar 08 2025 at 19:52):

Should that be AddCommMonoid M, or is that not a useful generalization?

Edward van de Meent (Mar 08 2025 at 19:53):

i don't think so? i believe the whole point is that you get -1 • x = -x

Edward van de Meent (Mar 08 2025 at 19:53):

so you need additive inverses

Aaron Liu (Mar 08 2025 at 19:54):

Then you need to derive AddCommGroup M if you don't have it already

Aaron Liu (Mar 08 2025 at 19:55):

from docs#Module.addCommMonoidToAddCommGroup

Edward van de Meent (Mar 08 2025 at 19:55):

:hmm:

Edward van de Meent (Mar 08 2025 at 19:56):

it does seem unidiomatic, but i guess it might work?

Edward van de Meent (Mar 08 2025 at 19:57):

as in, the extra cases where this would apply are unidiomatic, but it's fair to make it work then nonetheless

Aaron Liu (Mar 08 2025 at 19:57):

Also, you might not have any actual Module ℤ M instance yet, for example when using docs#Quotient.recOnSubsingleton or similar

Edward van de Meent (Mar 08 2025 at 19:59):

instance (M : Type*) [AddCommMonoid M] : Subsingleton (Module  M) where
  allEq inst1 inst2 := by
    let _ := Module.addCommMonoidToAddCommGroup  (M := M)
    ext z m
    rw [int_smul_eq_zsmul inst1,int_smul_eq_zsmul]

Edison Xie (Mar 08 2025 at 21:04):

Kevin Buzzard said:

If you just want a proof then take everything apart; there's only one way Z can act on an additive group. Are you sure you want this though? What's the application?

I'm trying to convert groupCohomology.isoH2 into an AddEquiv

Edison Xie (Mar 08 2025 at 21:04):

Thanks everyone!

Kevin Buzzard (Mar 08 2025 at 21:04):

docs#groupCohomology.isoH2

Kevin Buzzard (Mar 08 2025 at 21:05):

Convert it into an AlgEquiv instead

Edison Xie (Mar 08 2025 at 21:09):

Kevin Buzzard said:

Convert it into an AlgEquiv instead

Ah but it's an equivalence in ModuleCat?

Kevin Buzzard (Mar 08 2025 at 21:12):

Yes so hopefully there will be something in mathlib saying that this is the same thing as an algEquiv

Eric Wieser (Mar 08 2025 at 22:49):

Edward van de Meent said:

a quick glance suggests there is no Subsingleton instance here, though...

docs#AddCommGroup.uniqueIntModule

Kevin Buzzard (Mar 08 2025 at 23:03):

So the Unique isn't an instance for AddCommGroup and the docstring makes it clear why, but is there any argument against making the Subsingleton instance for AddCommMonoid? Part of me wonders whether it will lead typeclass inference on a merry dance but I think it won't because I'm guessing R = Int will be quick to fail.

Eric Wieser (Mar 09 2025 at 00:11):

I guess let's try it and see


Last updated: May 02 2025 at 03:31 UTC