Documentation

Mathlib.Order.Interval.Finset.Nat

Finite intervals of naturals #

This file proves that ℕ is a LocallyFiniteOrder and calculates the cardinality of its intervals as finsets and fintypes.

TODO #

Some lemmas can be generalized using OrderedGroup, CanonicallyOrderedMul or SuccOrder and subsequently be moved upstream to Order.Interval.Finset.

Equations
  • One or more equations did not get rendered due to their size.
theorem Nat.Icc_eq_range' (a b : ℕ) :
Finset.Icc a b = { val := ↑(List.range' a (b + 1 - a)), nodup := ⋯ }
theorem Nat.Ico_eq_range' (a b : ℕ) :
Finset.Ico a b = { val := ↑(List.range' a (b - a)), nodup := ⋯ }
theorem Nat.Ioc_eq_range' (a b : ℕ) :
Finset.Ioc a b = { val := ↑(List.range' (a + 1) (b - a)), nodup := ⋯ }
theorem Nat.Ioo_eq_range' (a b : ℕ) :
Finset.Ioo a b = { val := ↑(List.range' (a + 1) (b - a - 1)), nodup := ⋯ }
theorem Nat.uIcc_eq_range' (a b : ℕ) :
Finset.uIcc a b = { val := ↑(List.range' (min a b) (max a b + 1 - min a b)), nodup := ⋯ }
@[simp]
theorem Nat.card_Icc (a b : ℕ) :
(Finset.Icc a b).card = b + 1 - a
@[simp]
theorem Nat.card_Ico (a b : ℕ) :
(Finset.Ico a b).card = b - a
@[simp]
theorem Nat.card_Ioc (a b : ℕ) :
(Finset.Ioc a b).card = b - a
@[simp]
theorem Nat.card_Ioo (a b : ℕ) :
(Finset.Ioo a b).card = b - a - 1
@[simp]
theorem Nat.card_uIcc (a b : ℕ) :
(Finset.uIcc a b).card = (↑b - ↑a).natAbs + 1
@[simp]
theorem Nat.card_Iic (b : ℕ) :
(Finset.Iic b).card = b + 1
@[simp]
theorem Nat.card_Iio (b : ℕ) :
@[simp]
theorem Nat.Ico_succ_singleton (a : ℕ) :
Finset.Ico a (a + 1) = {a}
@[simp]
theorem Nat.Ico_pred_singleton {a : ℕ} (h : 0 < a) :
Finset.Ico (a - 1) a = {a - 1}
@[simp]
theorem Nat.Ioc_succ_singleton (b : ℕ) :
Finset.Ioc b (b + 1) = {b + 1}
theorem Nat.mem_Ioc_succ {a b : ℕ} :
a ∈ Finset.Ioc b (b + 1) ↔ a = b + 1
theorem Nat.mem_Ioc_succ' {b : ℕ} (a : ↥(Finset.Ioc b (b + 1))) :
a = ⟨b + 1, ⋯⟩
theorem Nat.image_sub_const_Ico {a b c : ℕ} (h : c ≤ a) :
Finset.image (fun (x : ℕ) => x - c) (Finset.Ico a b) = Finset.Ico (a - c) (b - c)
theorem Nat.Ico_image_const_sub_eq_Ico {a b c : ℕ} (hac : a ≤ c) :
Finset.image (fun (x : ℕ) => c - x) (Finset.Ico a b) = Finset.Ico (c + 1 - b) (c + 1 - a)
theorem Nat.mod_injOn_Ico (n a : ℕ) :
Set.InjOn (fun (x : ℕ) => x % a) ↑(Finset.Ico n (n + a))
theorem Nat.image_Ico_mod (n a : ℕ) :
Finset.image (fun (x : ℕ) => x % a) (Finset.Ico n (n + a)) = Finset.range a

Note that while this lemma cannot be easily generalized to a type class, it holds for ℤ as well. See Int.image_Ico_emod for the ℤ version.

theorem Nat.multiset_Ico_map_mod (n a : ℕ) :
Multiset.map (fun (x : ℕ) => x % a) (Multiset.Ico n (n + a)) = Multiset.range a
theorem Finset.range_image_pred_top_sub (n : ℕ) :
image (fun (j : ℕ) => n - 1 - j) (range n) = range n
theorem Nat.decreasing_induction_of_not_bddAbove {P : ℕ → Prop} (h : ∀ (n : ℕ), P (n + 1) → P n) (hP : ¬BddAbove {x : ℕ | P x}) (n : ℕ) :
P n
theorem Nat.strong_decreasing_induction {P : ℕ → Prop} (base : ∃ (n : ℕ), ∀ m > n, P m) (step : ∀ (n : ℕ), (∀ m > n, P m) → P n) (n : ℕ) :
P n
theorem Nat.decreasing_induction_of_infinite {P : ℕ → Prop} (h : ∀ (n : ℕ), P (n + 1) → P n) (hP : {x : ℕ | P x}.Infinite) (n : ℕ) :
P n
theorem Nat.cauchy_induction' {P : ℕ → Prop} (seed : ℕ) (h : ∀ (n : ℕ), P (n + 1) → P n) (hs : P seed) (hi : ∀ (x : ℕ), seed ≤ x → P x → ∃ (y : ℕ), x < y ∧ P y) (n : ℕ) :
P n
theorem Nat.cauchy_induction {P : ℕ → Prop} (h : ∀ (n : ℕ), P (n + 1) → P n) (seed : ℕ) (hs : P seed) (f : ℕ → ℕ) (hf : ∀ (x : ℕ), seed ≤ x → P x → x < f x ∧ P (f x)) (n : ℕ) :
P n
theorem Nat.cauchy_induction_mul {P : ℕ → Prop} (h : ∀ (n : ℕ), P (n + 1) → P n) (k seed : ℕ) (hk : 1 < k) (hs : P seed.succ) (hm : ∀ (x : ℕ), seed < x → P x → P (k * x)) (n : ℕ) :
P n
theorem Nat.cauchy_induction_two_mul {P : ℕ → Prop} (h : ∀ (n : ℕ), P (n + 1) → P n) (seed : ℕ) (hs : P seed.succ) (hm : ∀ (x : ℕ), seed < x → P x → P (2 * x)) (n : ℕ) :
P n
theorem Nat.pow_imp_self_of_one_lt {M : Type u_1} [Monoid M] (k : ℕ) (hk : 1 < k) (P : M → Prop) (hmul : ∀ (x y : M), P x → P (x * y) ∨ P (y * x)) (hpow : ∀ (x : M), P (x ^ k) → P x) (n : ℕ) (x : M) :
P (x ^ n) → P x