Zulip Chat Archive

Stream: Is there code for X?

Topic: Even power of -1


Yaël Dillies (Apr 06 2022 at 10:40):

Do we really not have this? Maybe @Damiano Testa knows?

import algebra.parity

example {R : Type*} [ring R] {n : } (h : even n) : (-1 : R) ^ n = 1 := sorry

example {R : Type*} [ring R] {n : } (h : even n) (a : R) : (-a : R) ^ n = a ^n := sorry

Riccardo Brasca (Apr 06 2022 at 10:42):

docs#nat.neg_one_pow_of_even

Eric Rodriguez (Apr 06 2022 at 10:42):

docs#neg_one_pow_eq_pow_mod_two, docs#nat.neg_one_pow_eq_one_iff_even

Yaël Dillies (Apr 06 2022 at 10:42):

Ugh, that's a terrible name :sad:

Eric Wieser (Apr 06 2022 at 11:18):

The second name of the three, I assume?

Yaël Dillies (Apr 06 2022 at 11:27):

The first one. I was looking for even.neg_one_pow, even.neg_pow, ...

Eric Wieser (Apr 06 2022 at 12:09):

Good point, we don't usually put things about natural powers in the nat namespace

Eric Rodriguez (Apr 06 2022 at 13:04):

oh, I assumed it was about nat-powers! dear lord...

Yaël Dillies (Apr 06 2022 at 13:10):

Ah yes, -1 : nat :rolling_on_the_floor_laughing:

Yaël Dillies (Apr 06 2022 at 13:10):

I will issue a PR to fix the name today.

Eric Rodriguez (Apr 06 2022 at 13:13):

Yaël Dillies said:

Ah yes, -1 : nat :rolling_on_the_floor_laughing:

404: my brain cannot be located today :shock:

Yaël Dillies (Apr 09 2022 at 12:37):

#13268

Yaël Dillies (Apr 09 2022 at 12:38):

I'm cleaning up a few other things simultaneously. Maybe @Damiano Testa wants to have a look.

Stuart Presnell (Apr 09 2022 at 13:18):

We've transcended the boring debate over whether 0 should be included in the natural numbers, and moved on to whether -1 should be included :smile:

Eric Rodriguez (Apr 09 2022 at 13:35):

Yaël Dillies said:

#13268

literally above your post on Zulip is bors merging my generalisation of the typeclasses in that file, sorry about that!

Damiano Testa (Apr 09 2022 at 17:54):

Yaël, I left a review: I'm on mobile, so have not been able to experiment, but it all looks fine!

Regarding odd, especially in view of what its to_multiplicative version should be, I think that, if we really want to define it in general, it should be "not even". Having said this, I'm not sure that it is such a useful concept when it does not also mean 2*x+1 (or x+x+1 :wink: ), which I'm not sure how to multiplicativize.


Last updated: Dec 20 2023 at 11:08 UTC