Zulip Chat Archive

Stream: general

Topic: simp-normal form for bundled hom conversion


Eric Wieser (Feb 16 2021 at 18:10):

Which of these should be the simp-normal forms for ring_equiv.to_ring_hom and ring_equiv.to_add_equiv?

Eric Wieser (Feb 16 2021 at 18:10):

\poll The simp-normal forms should be:

Eric Wieser (Feb 16 2021 at 18:12):

(deleted)

Eric Wieser (Feb 16 2021 at 18:13):

(deleted)

Bryan Gin-ge Chen (Feb 16 2021 at 18:13):

(deleted)

Eric Wieser (Feb 16 2021 at 18:13):

/poll The simp-normal forms should be:
(↑f : R →+* S) and (↑f : R ≃+ S)
f.to_ring_hom and f.to_add_equiv

Eric Wieser (Feb 16 2021 at 18:14):

This question is really about _all_ the simple bundled maps, as right now it's all over the place.

Kevin Buzzard (Feb 16 2021 at 18:14):

My choice is made purely for aesthetic reasons. What other reasons should come into play here?

Eric Wieser (Feb 16 2021 at 18:15):

If coercions are simp-normal, then sometimes you have to write (f : @a_really_nasty_type_that_doesnt_elaborate _ _ ≃+ S) instead of f.to_add_equiv

Eric Wieser (Feb 16 2021 at 18:17):

Essentially, the coercion will almost always look nicer in the goal view, but the to_* version will almost always be easier to write

Adam Topaz (Feb 16 2021 at 18:17):

Can you think of an exmaple where (f : _ ≃+ S) doesn't elaborate properly?

Eric Wieser (Feb 16 2021 at 18:17):

Sometimes S is also a mouthful

Adam Topaz (Feb 16 2021 at 18:17):

(f : _ ≃+ _)

Eric Wieser (Feb 16 2021 at 18:18):

That doesn't work for lots of cases

Eric Wieser (Feb 16 2021 at 18:18):

Try expressing docs#ring_equiv.to_ring_hom_comp_symm_to_ring_hom using that notation

Adam Topaz (Feb 16 2021 at 18:18):

I'm sure you're right, but I think we should have an example we can play around with

Adam Topaz (Feb 16 2021 at 18:19):

Ok, I'll try :)

Eric Wieser (Feb 16 2021 at 18:19):

lemma to_ring_hom_comp_symm_to_ring_hom {R S} [semiring R] [semiring S] (e : R ≃+* S) :
  (e : R →+* S).comp e.symm = ring_hom.id _ :=
by { ext, simp }

Adam Topaz (Feb 16 2021 at 18:22):

import data.equiv.ring

variables {R S : Type*} [semiring R] [semiring S]

theorem foo (e : R ≃+* S) : ((e.symm) : _ →+* _).comp (e : R →+* S) = ring_hom.id _ := sorry

Eric Wieser (Feb 16 2021 at 18:22):

Right, but you still had to pass R and S explicitly

Adam Topaz (Feb 16 2021 at 18:22):

true

Kevin Buzzard (Feb 16 2021 at 18:38):

But I think that passing explicit type ascriptions often makes code easier to read!

Floris van Doorn (Feb 16 2021 at 18:39):

My first impression would also be (f : R →+* S), but after the discussion I'm not so sure anymore...

Eric Wieser (Feb 16 2021 at 18:48):

Added a third option to the poll, we could do something like

abbreviation ring_equiv.to_«≃+» (f : M ≃+* N) := f.to_add_equiv

Scott Morrison (Feb 16 2021 at 23:52):

Too many scary brackets!

Eric Wieser (Feb 19 2021 at 09:20):

I've done some initial cleanups of lemmas about coercions in #6268. Once that's in, I'll try a follow-up PR to change the simp-normal form to what the consensus seems to be in this thread


Last updated: Dec 20 2023 at 11:08 UTC