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.card = 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.
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.
Equations
- F.intervalGapsWithin h a b i = (Finset.intervalGapsWithin.fst F h a i, Finset.intervalGapsWithin.snd F h b i)
Instances For
The first coordinate of F.intervalGapsWithin h a b i is a if i = 0,
y (i - 1) otherwise.
Equations
- Finset.intervalGapsWithin.fst F h a i = if hi : i = 0 then a else ((F.orderEmbOfFin h) (i.pred hi)).2
Instances For
The second coordinate of F.intervalGapsWithin h a b i is b if i = k,
x i otherwise.
Equations
- Finset.intervalGapsWithin.snd F h b i = if hi : i = Fin.last k then b else ((F.orderEmbOfFin h) (i.castPred hi)).1