Zulip Chat Archive

Stream: Is there code for X?

Topic: RingEquiv.ofHomInv and MonoidHom.toMulEquiv


Kim Morrison (Jan 30 2024 at 00:21):

We have both src#RingEquiv.ofHomInv and src#MonoidHom.toMulEquiv, seemingly inconsistently named. I was looking for the corresponding fact for linear equivalences, but couldn't find it.

  1. Where is the result for linear equivalences?
  2. Shall we add RingHom.toRingEquiv and/or MulEquiv.ofHomInv (if they don't already exist in hiding)?
  3. Shall we deprecate either of the existing functions in favour of anything added in 2?

Richard Copley (Jan 30 2024 at 00:32):

  1. docs#LinearEquiv.ofLeftInverse ? docs#LinearEquiv.ofInjective ?

Richard Copley (Jan 30 2024 at 00:35):

Richard Copley said:

  1. docs#LinearEquiv.ofLeftInverse ? docs#LinearEquiv.ofInjective ?

Nope. docs#LinearEquiv.ofLinear

Kim Morrison (Jan 30 2024 at 00:35):

Thanks, that's the one. What an interesting variety of names! :-)

Kim Morrison (Jan 30 2024 at 00:39):

To make matters more fun, LinearEquiv.ofLinear takes its 3rd and 4th arguments in the opposite order than RingHom.ofHomInv and MonoidHom.toMulEquiv.

Richard Copley (Jan 30 2024 at 00:43):

I seem to recall ofLinear being hard to find, and it's clear that I found it hard to remember. What say ofInverse for everything, with the arguments always in the same order? (I'd say "it has a left inverse" first, "it has a right inverse" second, so the same as RingHom.ofHomInv and MonoidHom.toMulEquiv and the opposite of LinearEquiv.ofInverse.)

Kim Morrison (Jan 30 2024 at 00:45):

How about:

  • XEquiv.ofInverse for each X
  • aliased as XHom.toXEquiv as well?

Yaël Dillies (Jan 30 2024 at 08:32):

I think the name should contain both XEquiv and XHom.

Eric Wieser (Jan 30 2024 at 20:43):

I don't think we need it in the XHom namespace now that dot constructor notation is a thing, though I guess alias is harmless enough

Eric Wieser (Jan 30 2024 at 20:43):

(does alias on definitions make the alias reducible? If not, then we should pretty much never use it)

Kim Morrison (Jan 30 2024 at 22:16):

Yaël Dillies said:

I think the name should contain both XEquiv and XHom.

So XEquiv.ofXHom or XEquiv.ofXHomInverse?

Yaël Dillies (Jan 30 2024 at 22:21):

I think the Inverse doesn't add anything. It might even hinder comprehension since the entire point of the constructor is that you are not providing an inverse!

Eric Wieser (Jan 30 2024 at 22:27):

I thought the entire point of the constructor was that you get to use nice ext lemmas to prove the maps compose to the identity

Eric Wieser (Jan 30 2024 at 22:27):

We're taking about XEquiv.ofXHom someXHom invXHom h1 h2, right?

Yaël Dillies (Jan 30 2024 at 22:28):

Ghu yes you're right and indeed the Inverse belongs there to disambiguate it from the other constructor I had in mind.

Eric Wieser (Jan 30 2024 at 22:35):

Which one were you thinking of?

Yaël Dillies (Jan 30 2024 at 22:45):

The one which takes in a bijective hom

Eric Wieser (Jan 30 2024 at 22:53):

That's ofBijective

Kim Morrison (Jan 30 2024 at 23:50):

Okay, XEquiv.ofXHomInverse!

Richard Copley (Jan 30 2024 at 23:55):

RingEquiv.ofRingHomInverse, MulEquiv.ofMonoidHomInverse, LinearEquiv.ofLinearMapInverse

  • One of these things is not like the others
  • That aside, does the XHom add anything?

Kim Morrison (Jan 31 2024 at 00:03):

I would be happy to drop the XHom.

Richard Copley (Jan 31 2024 at 00:14):

Oh. What I was getting at is that MonoidHom.toMulEquiv doesn't actually use map_one', and I assumed the below would go through. But it doesn't. It would be unfortunate to have MulEquiv.ofInverse that takes a MonoidHom and not a MulHom, so maybe that's an argument for keeping the XHom. Or just for keeping it when the Xs aren't the same in the XHom and XEquiv parts?

import Mathlib.Algebra.Group.Equiv.Basic

def MulEquiv.ofMulHomInverse {M N} [Mul M] [Mul N] (f : M →ₙ* N) (g : N →ₙ* M)
    (h₁ : g.comp f = MulHom.id _) (h₂ : f.comp g = MulHom.id _) : M ≃* N where
  toFun := f
  invFun := g
  left_inv := DFunLike.congr_fun h₁
  right_inv := DFunLike.congr_fun h₂
  map_mul' := f.map_mul

example {M N} [MulOneClass M] [MulOneClass N] (f : M →* N) (g : N →* M)
    (h₁ : g.comp f = MonoidHom.id _) (h₂ : f.comp g = MonoidHom.id _) : M ≃* N :=
  MulEquiv.ofMulHomInverse f.toMulHom g.toMulHom h₁ h₂
--                                        ~~
-- application type mismatch
--   MulEquiv.ofMulHomInverse (↑f) (↑g) h₁
-- argument
--   h₁
-- has type
--   MonoidHom.comp g f = MonoidHom.id M : Prop
-- but is expected to have type
--   MulHom.comp ↑g ↑f = MulHom.id M : Prop

Yaël Dillies (Jan 31 2024 at 07:23):

The point of the XHom is for you to discover the function when you type XHom in the docs


Last updated: May 02 2025 at 03:31 UTC