Documentation

Mathlib.Algebra.Group.Nat

The natural numbers form a monoid #

This file contains the additive and multiplicative monoid instances on the natural numbers.

See note [foundational algebra order theory].

Instances #

Extra instances to short-circuit type class resolution #

These also prevent non-computable instances being used to construct these instances non-computably.

Equations
Equations
Equations

Miscellaneous lemmas #

@[simp]
theorem Nat.nsmul_eq_mul (m : ℕ) (n : ℕ) :
m • n = m * n
theorem Nat.toAdd_pow (a : Multiplicative ℕ) (b : ℕ) :
Multiplicative.toAdd (a ^ b) = Multiplicative.toAdd a * b
@[simp]
theorem Nat.ofAdd_mul (a : ℕ) (b : ℕ) :
Multiplicative.ofAdd (a * b) = Multiplicative.ofAdd a ^ b

Parity #

theorem Nat.even_iff {n : ℕ} :
Even n ↔ n % 2 = 0
Equations

IsSquare can be decided on ℕ by checking against the square root.

Equations
theorem Nat.not_even_iff {n : ℕ} :
¬Even n ↔ n % 2 = 1
@[simp]
theorem Nat.two_dvd_ne_zero {n : ℕ} :
¬2 ∣ n ↔ n % 2 = 1
@[simp]
theorem Nat.even_add {m : ℕ} {n : ℕ} :
Even (m + n) ↔ (Even m ↔ Even n)
theorem Nat.even_add_one {n : ℕ} :
Even (n + 1) ↔ ¬Even n
theorem Nat.succ_mod_two_eq_zero_iff {m : ℕ} :
(m + 1) % 2 = 0 ↔ m % 2 = 1
theorem Nat.succ_mod_two_eq_one_iff {m : ℕ} :
(m + 1) % 2 = 1 ↔ m % 2 = 0
theorem Nat.two_not_dvd_two_mul_sub_one {n : ℕ} :
0 < n → ¬2 ∣ 2 * n - 1
theorem Nat.even_sub {m : ℕ} {n : ℕ} (h : n ≤ m) :
Even (m - n) ↔ (Even m ↔ Even n)
theorem Nat.even_mul {m : ℕ} {n : ℕ} :
Even (m * n) ↔ Even m ∨ Even n
theorem Nat.even_pow {m : ℕ} {n : ℕ} :
Even (m ^ n) ↔ Even m ∧ n ≠ 0

If m and n are natural numbers, then the natural number m^n is even if and only if m is even and n is positive.

theorem Nat.even_pow' {m : ℕ} {n : ℕ} (h : n ≠ 0) :
Even (m ^ n) ↔ Even m
theorem Nat.even_mul_succ_self (n : ℕ) :
Even (n * (n + 1))
theorem Nat.even_mul_pred_self (n : ℕ) :
Even (n * (n - 1))
@[deprecated Nat.even_mul_pred_self]
theorem Nat.even_mul_self_pred (n : ℕ) :
Even (n * (n - 1))

Alias of Nat.even_mul_pred_self.

theorem Nat.two_mul_div_two_of_even {n : ℕ} :
Even n → 2 * (n / 2) = n
theorem Nat.div_two_mul_two_of_even {n : ℕ} :
Even n → n / 2 * 2 = n

Units #

theorem Nat.units_eq_one (u : ℕˣ) :
u = 1
@[simp]
theorem Nat.isUnit_iff {n : ℕ} :
IsUnit n ↔ n = 1
Equations