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
, CanonicallyOrderedMonoid
or SuccOrder
and subsequently be moved upstream to Data.Finset.LocallyFinite
.
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 := (_ : List.Nodup (List.range' a (b + 1 - a))) }
theorem
Nat.Ico_eq_range'
(a : ℕ)
(b : ℕ)
:
Finset.Ico a b = { val := ↑(List.range' a (b - a)), nodup := (_ : List.Nodup (List.range' a (b - a))) }
theorem
Nat.Ioc_eq_range'
(a : ℕ)
(b : ℕ)
:
Finset.Ioc a b = { val := ↑(List.range' (a + 1) (b - a)), nodup := (_ : List.Nodup (List.range' (a + 1) (b - a))) }
theorem
Nat.Ioo_eq_range'
(a : ℕ)
(b : ℕ)
:
Finset.Ioo a b = { val := ↑(List.range' (a + 1) (b - a - 1)), nodup := (_ : List.Nodup (List.range' (a + 1) (b - a - 1))) }
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 := (_ : List.Nodup (List.range' (min a b) (max a b + 1 - min a b))) }
@[simp]
theorem
Nat.Ico_succ_right_eq_insert_Ico
{a : ℕ}
{b : ℕ}
(h : a ≤ b)
:
Finset.Ico a (b + 1) = insert b (Finset.Ico a b)
theorem
Nat.Ico_insert_succ_left
{a : ℕ}
{b : ℕ}
(h : a < b)
:
insert a (Finset.Ico (Nat.succ a) b) = Finset.Ico a b
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.Ico_succ_left_eq_erase_Ico
{a : ℕ}
{b : ℕ}
:
Finset.Ico (Nat.succ a) b = Finset.erase (Finset.Ico a b) 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 : ℕ)
:
Finset.image (fun j => n - 1 - j) (Finset.range n) = Finset.range n
theorem
Finset.range_add_eq_union
(a : ℕ)
(b : ℕ)
:
Finset.range (a + b) = Finset.range a ∪ Finset.map (addLeftEmbedding a) (Finset.range b)
theorem
Nat.decreasing_induction_of_infinite
{P : ℕ → Prop}
(h : (n : ℕ) → P (n + 1) → P n)
(hP : Set.Infinite {x | P x})
(n : ℕ)
:
P n