Zulip Chat Archive

Stream: general

Topic: ring_aut coerce to function


Kenny Lau (Apr 29 2020 at 10:28):

import data.equiv.ring
#check λ (α : Type*) [ring α] (g : ring_aut α) (x : α), g x
/-
function expected at
  g
term has type
  α ≃+* α
-/

Kenny Lau (Apr 29 2020 at 10:28):

what's the canonical workaround?

Chris Hughes (Apr 29 2020 at 10:30):

g.to_equiv

Kevin Buzzard (Apr 29 2020 at 10:31):

For some reason they decided that a coercion to a function was not a good idea?

Kenny Lau (Apr 29 2020 at 10:31):

well that wouldn't be structually equivalent

Kevin Buzzard (Apr 29 2020 at 10:31):

Why not?

Kenny Lau (Apr 29 2020 at 10:31):

I've found that this works:

(@has_coe_to_fun.coe (α +* α) _ g : α  α) x

Kenny Lau (Apr 29 2020 at 10:31):

Kevin Buzzard said:

Why not?

because it doesn't use has_coe_to_fun.coe

Kevin Buzzard (Apr 29 2020 at 10:32):

Oh so there _is_ a coercion to fun?

Kenny Lau (Apr 29 2020 at 10:32):

yeah

Kevin Buzzard (Apr 29 2020 at 11:05):

So just coercing g to \a -> \a directly doesn't work?

Kevin Buzzard (Apr 29 2020 at 11:06):

Is this something to do with coe_t or has_lift or whatever? I've never understood the details of that stuff

Kevin Buzzard (Apr 29 2020 at 11:06):

Can you fix it with \u= ?

Kenny Lau (Apr 29 2020 at 11:08):

I don't think I can.

Reid Barton (Apr 29 2020 at 11:22):

No, there isn't a coercion to fun. (I don't know why not.) An instance for a defeq type is not an instance for the original type.

Kenny Lau (Apr 29 2020 at 11:22):

There is a coercion to fun though. It's called ring_equiv.has_coe_to_fun

Reid Barton (Apr 29 2020 at 11:24):

Okay, but it's not an instance for ring_aut.

Chris Hughes (Apr 29 2020 at 11:25):

Should we make ring_aut reducible? That method worked okay for perm

Kenny Lau (Apr 29 2020 at 11:25):

oh, that's the reason

Kenny Lau (Apr 29 2020 at 11:31):

so g.to_equiv is the canonical way?

Chris Hughes (Apr 29 2020 at 11:32):

I think there isn't a canonical way right now. But making ring_aut reducible fixes it.

Chris Hughes (Apr 29 2020 at 11:34):

#2563

Kevin Buzzard (Apr 29 2020 at 11:38):

Thanks


Last updated: Dec 20 2023 at 11:08 UTC