mathlib documentation

data.int.parity

Parity of integers #

This file contains theorems about the even and odd predicates on the integers.

Tags #

even, odd

@[simp]
theorem int.mod_two_ne_one {n : } :
¬n % 2 = 1 n % 2 = 0
theorem int.mod_two_ne_zero {n : } :
¬n % 2 = 0 n % 2 = 1
theorem int.even_iff {n : } :
even n n % 2 = 0
theorem int.odd_iff {n : } :
odd n n % 2 = 1
theorem int.not_even_iff {n : } :
¬even n n % 2 = 1
theorem int.not_odd_iff {n : } :
¬odd n n % 2 = 0
theorem int.even_iff_not_odd {n : } :
@[simp]
theorem int.odd_iff_not_even {n : } :
theorem int.is_compl_even_odd  :
is_compl {n : | even n} {n : | odd n}
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)
@[simp]
theorem int.two_dvd_ne_zero {n : } :
¬2 n n % 2 = 1
@[protected, instance]
Equations
@[protected, instance]
Equations
@[simp]
theorem int.not_even_one  :
theorem int.even_add {m n : } :
even (m + n) (even m even n)
theorem int.even_add' {m n : } :
even (m + n) (odd m odd n)
@[simp]
theorem int.not_even_bit1 (n : ) :
theorem int.two_not_dvd_two_mul_add_one (n : ) :
¬2 2 * n + 1
theorem int.even_sub {m n : } :
even (m - n) (even m even n)
theorem int.even_sub' {m n : } :
even (m - n) (odd m odd n)
theorem int.even_add_one {n : } :
even (n + 1) ¬even n
theorem int.even_mul {m n : } :
even (m * n) even m even 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.even_pow {m : } {n : } :
even (m ^ n) even m n 0
theorem int.even_pow' {m : } {n : } (h : n 0) :
even (m ^ n) even 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))
@[simp, norm_cast]
theorem int.even_coe_nat (n : ) :
@[simp, norm_cast]
theorem int.odd_coe_nat (n : ) :
@[simp]
theorem int.nat_abs_even {n : } :
@[simp]
theorem int.nat_abs_odd {n : } :
@[protected]
theorem even.nat_abs {n : } :
even neven n.nat_abs

Alias of nat_abs_even.

@[protected]
theorem odd.nat_abs {n : } :
odd nodd n.nat_abs

Alias of nat_abs_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_mul_div_two_of_even {n : } :
even n2 * (n / 2) = n
theorem int.div_two_mul_two_of_even {n : } :
even n(n / 2) * 2 = n
theorem int.two_mul_div_two_add_one_of_odd {n : } :
odd n2 * (n / 2) + 1 = n
theorem int.div_two_mul_two_add_one_of_odd {n : } :
odd n(n / 2) * 2 + 1 = n
theorem int.add_one_div_two_mul_two_of_odd {n : } :
odd n1 + (n / 2) * 2 = n
theorem int.two_mul_div_two_of_odd {n : } (h : odd n) :
2 * (n / 2) = n - 1