Documentation

Mathlib.Algebra.Ring.Int.Parity

Basic parity lemmas for the ring ℤ #

See note [foundational algebra order theory].

Parity #

theorem Int.odd_iff {n : ℤ} :
Odd n ↔ n % 2 = 1
theorem Int.not_odd_iff {n : ℤ} :
¬Odd n ↔ n % 2 = 0
@[simp]
@[simp]
@[simp]
theorem Int.even_or_odd (n : ℤ) :
theorem Int.even_or_odd' (n : ℤ) :
∃ (k : ℤ), n = 2 * k ∨ n = 2 * k + 1
theorem Int.even_xor'_odd (n : ℤ) :
Xor' (Even n) (Odd n)
theorem Int.even_xor'_odd' (n : ℤ) :
∃ (k : ℤ), Xor' (n = 2 * k) (n = 2 * k + 1)
@[implicit_reducible]
Equations
theorem Int.even_add' {m n : ℤ} :
Even (m + n) ↔ (Odd m ↔ Odd n)
theorem Int.even_sub' {m n : ℤ} :
Even (m - n) ↔ (Odd m ↔ Odd n)
theorem Int.odd_mul {m n : ℤ} :
Odd (m * n) ↔ Odd m ∧ Odd n
theorem Int.Odd.of_mul_left {m n : ℤ} (h : Odd (m * n)) :
Odd m
theorem Int.Odd.of_mul_right {m n : ℤ} (h : Odd (m * n)) :
Odd n
theorem Int.odd_pow {m : ℤ} {n : ℕ} :
Odd (m ^ n) ↔ Odd m ∨ n = 0
theorem Int.odd_pow' {m : ℤ} {n : ℕ} (h : n ≠ 0) :
Odd (m ^ n) ↔ Odd m
theorem Int.odd_add {m n : ℤ} :
Odd (m + n) ↔ (Odd m ↔ Even n)
theorem Int.odd_add' {m n : ℤ} :
Odd (m + n) ↔ (Odd n ↔ Even m)
theorem Int.ne_of_odd_add {m n : ℤ} (h : Odd (m + n)) :
m ≠ n
theorem Int.odd_sub {m n : ℤ} :
Odd (m - n) ↔ (Odd m ↔ Even n)
theorem Int.odd_sub' {m n : ℤ} :
Odd (m - n) ↔ (Odd n ↔ Even m)
theorem Int.even_mul_succ_self (n : ℤ) :
Even (n * (n + 1))
theorem Int.even_mul_pred_self (n : ℤ) :
Even (n * (n - 1))
@[simp]
theorem Int.odd_coe_nat (n : ℕ) :
Odd ↑n ↔ Odd n
@[simp]
theorem Int.natAbs_even {n : ℤ} :
@[simp]
theorem Int.natAbs_odd {n : ℤ} :
theorem Even.natAbs {n : ℤ} :
Even n → Even n.natAbs

Alias of the reverse direction of Int.natAbs_even.

theorem Odd.natAbs {n : ℤ} :
Odd n → Odd n.natAbs

Alias of the reverse direction of Int.natAbs_odd.

theorem Int.four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
4 ∣ a + b ∨ 4 ∣ a - b
theorem Int.two_dvd_mul_add_one (k : ℤ) :
2 ∣ k * (k + 1)
theorem Int.two_mul_ediv_two_add_one_of_odd {n : ℤ} :
Odd n → 2 * (n / 2) + 1 = n
theorem Int.ediv_two_mul_two_add_one_of_odd {n : ℤ} :
Odd n → n / 2 * 2 + 1 = n
theorem Int.add_one_ediv_two_mul_two_of_odd {n : ℤ} :
Odd n → 1 + n / 2 * 2 = n
theorem Int.two_mul_ediv_two_of_odd {n : ℤ} (h : Odd n) :
2 * (n / 2) = n - 1
@[simp]
theorem Int.even_sign_iff {z : ℤ} :
Even z.sign ↔ z = 0
@[simp]
theorem Int.odd_sign_iff {z : ℤ} :
Odd z.sign ↔ z ≠ 0
theorem Int.natCast_pow_pred (b p : ℕ) (w : 0 < b) :
↑(b ^ p - 1) = ↑b ^ p - 1
theorem Int.coe_nat_two_pow_pred (p : ℕ) :
↑(2 ^ p - 1) = 2 ^ p - 1