Even and odd elements in rings #
This file defines odd elements and proves some general facts about even and odd elements of rings.
As opposed to Even, Odd does not have a multiplicative counterpart.
TODO #
Try to generalize Even lemmas further. For example, there are still a few lemmas whose Semiring
assumptions I (DT) am not convinced are necessary. If that turns out to be true, they could be moved
to Mathlib/Algebra/Group/Even.lean.
See also #
Mathlib/Algebra/Group/Even.lean for the definition of even elements.
@[simp]
theorem
Even.neg_one_pow
{α : Type u_2}
[Monoid α]
[HasDistribNeg α]
{n : ℕ}
(h : Even n)
:
(-1) ^ n = 1
@[simp]
theorem
Even.mul_left
{α : Type u_2}
[Add α]
[Mul α]
{a : α}
[LeftDistribClass α]
(ha : Even a)
(b : α)
:
Even (b * a)
@[simp]
theorem
Even.mul_right
{α : Type u_2}
[Add α]
[Mul α]
{a : α}
[RightDistribClass α]
(ha : Even a)
(b : α)
:
Even (a * b)
Alias of the forward direction of even_iff_two_dvd.
@[simp]
theorem
Even.pow_of_ne_zero
{α : Type u_2}
[Semiring α]
{a : α}
(ha : Even a)
{n : ℕ}
:
n ≠ 0 → Even (a ^ n)
Alias of the forward direction of odd_iff_exists_bit1.
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
Odd.pow_add_pow_eq_zero
{α : Type u_2}
[Semiring α]
{a b : α}
{n : ℕ}
[IsCancelAdd α]
(hn : Odd n)
(hab : a + b = 0)
:
a ^ n + b ^ n = 0
@[simp]
theorem
Odd.neg_one_pow
{α : Type u_2}
[Monoid α]
[HasDistribNeg α]
{n : ℕ}
(h : Odd n)
:
(-1) ^ n = -1
@[simp]
@[simp]
@[simp]
@[simp]
Alias of Nat.Odd.sub_odd.
theorem
Function.Involutive.iterate_two_mul
{α : Type u_4}
{f : α → α}
(hf : Involutive f)
(n : ℕ)
:
@[deprecated Function.Involutive.iterate_two_mul (since := "2025-10-28")]
Alias of Function.Involutive.iterate_two_mul.
theorem
Function.Involutive.iterate_two_mul_add_one
{α : Type u_4}
{f : α → α}
(hf : Involutive f)
(n : ℕ)
:
@[deprecated Function.Involutive.iterate_two_mul_add_one (since := "2025-10-28")]
theorem
Function.Involutive.iterate_even
{α : Type u_4}
{f : α → α}
{n : ℕ}
(hf : Involutive f)
(hn : Even n)
:
theorem
Function.Involutive.iterate_odd
{α : Type u_4}
{f : α → α}
{n : ℕ}
(hf : Involutive f)
(hn : Odd n)
:
theorem
Function.Involutive.iterate_eq_self
{α : Type u_4}
{f : α → α}
{n : ℕ}
(hf : Involutive f)
(hne : f ≠ id)
:
theorem
Function.Involutive.iterate_eq_id
{α : Type u_4}
{f : α → α}
{n : ℕ}
(hf : Involutive f)
(hne : f ≠ id)
:
theorem
neg_one_pow_eq_ite
{R : Type u_4}
[Monoid R]
[HasDistribNeg R]
{n : ℕ}
:
(-1) ^ n = if Even n then 1 else -1
theorem
neg_one_pow_congr
{R : Type u_4}
[Monoid R]
[HasDistribNeg R]
{m n : ℕ}
(h : Even m ↔ Even n)
:
(-1) ^ m = (-1) ^ n
theorem
neg_one_pow_eq_one_iff_even
{R : Type u_4}
[Monoid R]
[HasDistribNeg R]
{n : ℕ}
(h : -1 ≠ 1)
:
(-1) ^ n = 1 ↔ Even n
theorem
neg_one_pow_eq_neg_one_iff_odd
{R : Type u_4}
[Monoid R]
[HasDistribNeg R]
{n : ℕ}
(h : -1 ≠ 1)
:
(-1) ^ n = -1 ↔ Odd n
theorem
Even.neg_one_zpow
{α : Type u_2}
[DivisionMonoid α]
[HasDistribNeg α]
{n : ℤ}
(h : Even n)
:
(-1) ^ n = 1
theorem
neg_one_zpow_eq_ite
{α : Type u_2}
[DivisionMonoid α]
[HasDistribNeg α]
{n : ℤ}
:
(-1) ^ n = if Even n then 1 else -1
theorem
natCast_eq_zero_of_even_of_two_eq_zero
{R : Type u_4}
[AddMonoidWithOne R]
{n : ℕ}
(hn : Even n)
(h : 2 = 0)
:
↑n = 0
theorem
natCast_eq_one_of_odd_of_two_eq_zero
{R : Type u_4}
[AddMonoidWithOne R]
{n : ℕ}
(hn : Odd n)
(h : 2 = 0)
:
↑n = 1
theorem
natCast_eq_zero_or_one_of_two_eq_zero
{R : Type u_4}
[AddMonoidWithOne R]
(n : ℕ)
(h : 2 = 0)
:
↑n = 0 ∨ ↑n = 1