Zulip Chat Archive

Stream: general

Topic: rw not working


Bernd Losert (Apr 17 2022 at 16:23):

For some reason, the rw here is not working. What am I missing?

import tactic
import data.set.pointwise

open set
open_locale pointwise

example {α : Type*} (s t : set α) [has_inv α] : nat :=
begin
  have hsub : has_inv.inv '' t  s, sorry,
  have hsub' : t⁻¹  s, by rw image_inv,
end

Yaël Dillies (Apr 17 2022 at 16:24):

Shouldn't it be rwa image_inv at hsub?

Bernd Losert (Apr 17 2022 at 16:25):

Let me try...

Bernd Losert (Apr 17 2022 at 16:26):

I changed it to:

  have hsub : has_inv.inv '' t  s, sorry,
  rwa image_inv at hsub,

but it still does not work.

Yaël Dillies (Apr 17 2022 at 16:27):

I meant

example {α : Type*} (s t : set α) [has_inv α] : nat :=
begin
  have hsub : has_inv.inv '' t  s, sorry,
  have hsub' : t⁻¹  s, by rwa image_inv at hsub,
end

Bernd Losert (Apr 17 2022 at 16:28):

That does not work either.

Yaël Dillies (Apr 17 2022 at 16:28):

Yeah because docs#set.image_inv requires has_involutive_inv α, not just has_inv α.

Bernd Losert (Apr 17 2022 at 16:32):

Ah, I see. The error was confusing me. I didn't realize that was the problem.

Bernd Losert (Apr 17 2022 at 16:33):

What's the difference between rw and rwa?

Yaël Dillies (Apr 17 2022 at 16:34):

rwa is rw + assumption

Bernd Losert (Apr 17 2022 at 16:35):

Interesting. Thanks.

Eric Wieser (Apr 17 2022 at 18:02):

This fails because docs#set.has_inv is surprisingly defined in terms of the preimage not the image

Eric Wieser (Apr 17 2022 at 18:03):

They're equivalent when inv is involutive, but when it's not this definition is kind of weird

Eric Wieser (Apr 17 2022 at 18:03):

There's another thread about this I made a few months ago

Yaël Dillies (Apr 17 2022 at 18:13):

Yes I agree. I believe it should be change to the image because it would make all the set.image2 API work with it.

Eric Wieser (Apr 17 2022 at 18:21):

We'd probably want to change docs#submonoid.has_inv as well to remain defeq Nevermind, it's already defined in terms of the set operator

Floris van Doorn (Apr 18 2022 at 10:55):

My experience is that the preimage is nicer to work with than image (has better properties - e.g. topologically; has nicer definitional behavior). Therefore I defined docs#set.has_inv in terms of preimage.


Last updated: Dec 20 2023 at 11:08 UTC