The areas / V04. Order and lattices
Mathlib.Order.Interval.Finset.Gaps
18 declarations. Mathlib docs · Source
Gaps of disjoint closed intervals
This file defines Finset.intervalGapsWithin that computes the complement of the union of a
collection of pairwise disjoint subintervals of [a, b].
If LinearOrder α, F is a finite subset of α × α such that for any (x, y) ∈ F,
a ≤ x ≤ y ≤ b and all such [x, y]'s are pairwise disjoint, h is a proof of #F = k,
i is in Fin (k + 1), we order F from left to right as
(x 0, y 0), ..., (x (k - 1), y (k - 1)), then F.intervalGapsWithin h a b i is
(a, b)if0 = i = k;(a, x 0)if0 = i < k;(y (i - 1), x i)if0 < i < k;(y (i - 1), b)if0 < i = k.
Technically, the definition F.intervalGapsWithin a b does not require F to be pairwise disjoint
or endpoints to be within [a, b] or even require that a ≤ b, but it makes the most sense if
they are actually satisfied. If they are actually satisfied, then we show that
Finset.intervalGapsWithin_mapsTo,Finset.intervalGapsWithin_injective,Finset.intervalGapsWithin_surjOn:(fun j ↦ ((F.intervalGapsWithin h a b j.castSucc).2, (F.intervalGapsWithin h a b j.succ).1))is a bijection betweenSet.Iio kandF.Finset.intervalGapsWithin_le_fst,Finset.intervalGapsWithin_snd_le,Finset.intervalGapsWithin_fst_le_snd:[(F.intervalGapsWithin h a b j).1, (F.intervalGapsWithin h a b j).2]is indeed a subinterval of[a, b]whenj < k.Finset.intervalGapsWithin_pairwiseDisjoint_Ioc: the half-closed intervals[(F.intervalGapsWithin h a b j).1, (F.intervalGapsWithin h a b j).2)are pairwise disjoint forj < k + 1.
theorem Finset.intervalGapsWithin.fst.congr_simp E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F F_1 : Finset (α × α)) (e_F : F = F_1) {k : ℕ} (h : F.card = k) (a a_1 : α),
a = a_1 →
∀ (i i_1 : Fin (k + 1)),
i = i_1 → Finset.intervalGapsWithin.fst F h a i = Finset.intervalGapsWithin.fst F_1 ⋯ a_1 i_1
theorem Finset.intervalGapsWithin.snd.congr_simp E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F F_1 : Finset (α × α)) (e_F : F = F_1) {k : ℕ} (h : F.card = k) (b b_1 : α),
b = b_1 →
∀ (i i_1 : Fin (k + 1)),
i = i_1 → Finset.intervalGapsWithin.snd F h b i = Finset.intervalGapsWithin.snd F_1 ⋯ b_1 i_1
theorem Finset.intervalGapsWithin.congr_simp E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F F_1 : Finset (α × α)) (e_F : F = F_1) {k : ℕ} (h : F.card = k) (a a_1 : α),
a = a_1 →
∀ (b b_1 : α),
b = b_1 → ∀ (i i_1 : Fin (k + 1)), i = i_1 → F.intervalGapsWithin h a b i = F_1.intervalGapsWithin ⋯ a_1 b_1 i_1
def Finset.intervalGapsWithin E1 #
{α : Type u_1} → [LinearOrder α] → (F : Finset (α × α)) → {k : ℕ} → F.card = k → α → α → Fin (k + 1) → α × α
We order F in the lexicographic order as (x 0, y 0), ..., (x (k - 1), y (k - 1)).
Then F.intervalGapsWithin h a b i is
(a, b)if0 = i = k;(a, x 0)if0 = i < k;(y (i - 1), x i)if0 < i < k;(y (i - 1), b)if0 < i = k.
def Finset.intervalGapsWithin.fst E1 #
{α : Type u_1} → [LinearOrder α] → (F : Finset (α × α)) → {k : ℕ} → F.card = k → α → Fin (k + 1) → α
The first coordinate of F.intervalGapsWithin h a b i is a if i = 0,
y (i - 1) otherwise.
def Finset.intervalGapsWithin.snd E1 #
{α : Type u_1} → [LinearOrder α] → (F : Finset (α × α)) → {k : ℕ} → F.card = k → α → Fin (k + 1) → α
The second coordinate of F.intervalGapsWithin h a b i is b if i = k,
x i otherwise.
theorem Finset.intervalGapsWithin_zero_fst E0 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α),
(F.intervalGapsWithin h a b 0).1 = a
theorem Finset.intervalGapsWithin_succ_fst_of_lt E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α) (j : ℕ) (hj : j < k),
(F.intervalGapsWithin h a b ↑j.succ).1 = ((F.orderEmbOfFin h) ⟨j, hj⟩).2
theorem Finset.intervalGapsWithin_fst_of_lt_lt E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α) (j : ℕ),
0 < j → ∀ (hj₂ : j - 1 < k), (F.intervalGapsWithin h a b ↑j).1 = ((F.orderEmbOfFin h) ⟨j - 1, hj₂⟩).2
theorem Finset.intervalGapsWithin_last_snd E0 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α),
(F.intervalGapsWithin h a b (Fin.last k)).2 = b
theorem Finset.intervalGapsWithin_snd_of_lt E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α) (j : ℕ) (hj : j < k),
(F.intervalGapsWithin h a b ↑j).2 = ((F.orderEmbOfFin h) ⟨j, hj⟩).1
theorem Finset.intervalGapsWithin_mapsTo E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α),
Set.MapsTo (fun j ↦ ((F.intervalGapsWithin h a b ↑j).2, (F.intervalGapsWithin h a b ↑j.succ).1)) (Set.Iio k) ↑F
theorem Finset.intervalGapsWithin_injOn E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α),
Set.InjOn (fun j ↦ ((F.intervalGapsWithin h a b ↑j).2, (F.intervalGapsWithin h a b ↑j.succ).1)) (Set.Iio k)
theorem Finset.intervalGapsWithin_surjOn E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (a b : α),
Set.SurjOn (fun j ↦ ((F.intervalGapsWithin h a b ↑j).2, (F.intervalGapsWithin h a b ↑j.succ).1)) (Set.Iio k) ↑F
theorem Finset.intervalGapsWithin_le_fst E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (j : ℕ) {a b : α},
(∀ ⦃z : α × α⦄, z ∈ F → a ≤ z.1 ∧ z.1 ≤ z.2 ∧ z.2 ≤ b) → a ≤ (F.intervalGapsWithin h a b ↑j).1
theorem Finset.intervalGapsWithin_snd_le E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (j : ℕ) {a b : α},
(∀ ⦃z : α × α⦄, z ∈ F → a ≤ z.1 ∧ z.1 ≤ z.2 ∧ z.2 ≤ b) → (F.intervalGapsWithin h a b ↑j).2 ≤ b
theorem Finset.intervalGapsWithin_fst_le_snd E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) (j : ℕ) {a b : α},
a ≤ b →
(∀ ⦃z : α × α⦄, z ∈ F → a ≤ z.1 ∧ z.1 ≤ z.2 ∧ z.2 ≤ b) →
((↑F).PairwiseDisjoint fun z ↦ Set.Icc z.1 z.2) →
(F.intervalGapsWithin h a b ↑j).1 ≤ (F.intervalGapsWithin h a b ↑j).2
theorem Finset.intervalGapsWithin_pairwiseDisjoint_Ioc E1 #
∀ {α : Type u_1} [inst : LinearOrder α] (F : Finset (α × α)) {k : ℕ} (h : F.card = k) {a b : α},
(∀ ⦃z : α × α⦄, z ∈ F → a ≤ z.1 ∧ z.1 ≤ z.2 ∧ z.2 ≤ b) →
(Set.Iio (k + 1)).PairwiseDisjoint fun j ↦
Set.Ioc (F.intervalGapsWithin h a b ↑j).1 (F.intervalGapsWithin h a b ↑j).2