Documentation

Mathlib.Combinatorics.Colex

Colexigraphic order #

We define the colex order for finite sets, and give a couple of important lemmas and properties relating to it.

The colex ordering likes to avoid large values: If the biggest element of t is bigger than all elements of s, then s < t.

In the special case of , it can be thought of as the "binary" ordering. That is, order s based on is2i. It's defined here on Finset α for any linear order α.

In the context of the Kruskal-Katona theorem, we are interested in how colex behaves for sets of a fixed size. For example, for size 3, the colex order on ℕ starts 012, 013, 023, 123, 014, 024, 124, 034, 134, 234, ...

Main statements #

See also #

Related files are:

TODO #

References #

Tags #

colex, colexicographic, binary

theorem Finset.Colex.ext {α : Type u_3} (x : Finset.Colex α) (y : Finset.Colex α) (ofColex : x.ofColex = y.ofColex) :
x = y
theorem Finset.Colex.ext_iff {α : Type u_3} (x : Finset.Colex α) (y : Finset.Colex α) :
x = y x.ofColex = y.ofColex
structure Finset.Colex (α : Type u_3) :
Type u_3

Type synonym of Finset α equipped with the colexicographic order rather than the inclusion order.

Instances For
Equations
  • Finset.instInhabitedColex = { default := { ofColex := } }
@[simp]
theorem Finset.toColex_ofColex {α : Type u_1} (s : Finset.Colex α) :
{ ofColex := s.ofColex } = s
theorem Finset.ofColex_toColex {α : Type u_1} (s : Finset α) :
{ ofColex := s }.ofColex = s
theorem Finset.toColex_inj {α : Type u_1} {s : Finset α} {t : Finset α} :
{ ofColex := s } = { ofColex := t } s = t
@[simp]
theorem Finset.ofColex_inj {α : Type u_1} {s : Finset.Colex α} {t : Finset.Colex α} :
s.ofColex = t.ofColex s = t
theorem Finset.toColex_ne_toColex {α : Type u_1} {s : Finset α} {t : Finset α} :
{ ofColex := s } { ofColex := t } s t
theorem Finset.ofColex_ne_ofColex {α : Type u_1} {s : Finset.Colex α} {t : Finset.Colex α} :
s.ofColex t.ofColex s t
theorem Finset.toColex_injective {α : Type u_1} :
Function.Injective Finset.Colex.toColex
theorem Finset.ofColex_injective {α : Type u_1} :
Function.Injective Finset.Colex.ofColex
instance Finset.Colex.instLE {α : Type u_1} [PartialOrder α] :
Equations
  • Finset.Colex.instLE = { le := fun (s t : Finset.Colex α) => ∀ ⦃a : α⦄, a s.ofColexat.ofColex∃ b ∈ t.ofColex, bs.ofColex a b }
Equations
theorem Finset.Colex.le_def {α : Type u_1} [PartialOrder α] {s : Finset.Colex α} {t : Finset.Colex α} :
s t ∀ ⦃a : α⦄, a s.ofColexat.ofColex∃ b ∈ t.ofColex, bs.ofColex a b
theorem Finset.Colex.toColex_le_toColex {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} :
{ ofColex := s } { ofColex := t } ∀ ⦃a : α⦄, a sat∃ b ∈ t, bs a b
theorem Finset.Colex.toColex_lt_toColex {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} :
{ ofColex := s } < { ofColex := t } s t ∀ ⦃a : α⦄, a sat∃ b ∈ t, bs a b
theorem Finset.Colex.toColex_mono {α : Type u_1} [PartialOrder α] :
Monotone Finset.Colex.toColex

If s ⊆ t, then s ≤ t in the colex order. Note the converse does not hold, as inclusion does not form a linear order.

theorem Finset.Colex.toColex_strictMono {α : Type u_1} [PartialOrder α] :
StrictMono Finset.Colex.toColex

If s ⊂ t, then s < t in the colex order. Note the converse does not hold, as inclusion does not form a linear order.

theorem Finset.Colex.toColex_le_toColex_of_subset {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} (h : s t) :
{ ofColex := s } { ofColex := t }

If s ⊆ t, then s ≤ t in the colex order. Note the converse does not hold, as inclusion does not form a linear order.

theorem Finset.Colex.toColex_lt_toColex_of_ssubset {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} (h : s t) :
{ ofColex := s } < { ofColex := t }

If s ⊂ t, then s < t in the colex order. Note the converse does not hold, as inclusion does not form a linear order.

Equations
@[simp]
theorem Finset.Colex.toColex_empty {α : Type u_1} [PartialOrder α] :
{ ofColex := } =
@[simp]
theorem Finset.Colex.ofColex_bot {α : Type u_1} [PartialOrder α] :
.ofColex =
theorem Finset.Colex.forall_le_mono {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} {a : α} (hst : { ofColex := s } { ofColex := t }) (ht : bt, b a) (b : α) :
b sb a

If s ≤ t in colex, and all elements in t are small, then all elements in s are small.

theorem Finset.Colex.forall_lt_mono {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} {a : α} (hst : { ofColex := s } { ofColex := t }) (ht : bt, b < a) (b : α) :
b sb < a

If s ≤ t in colex, and all elements in t are small, then all elements in s are small.

theorem Finset.Colex.toColex_le_singleton {α : Type u_1} [PartialOrder α] {s : Finset α} {a : α} :
{ ofColex := s } { ofColex := {a} } bs, b a (a sb = a)

s ≤ {a} in colex iff all elements of s are strictly less than a, except possibly a in which case s = {a}.

theorem Finset.Colex.toColex_lt_singleton {α : Type u_1} [PartialOrder α] {s : Finset α} {a : α} :
{ ofColex := s } < { ofColex := {a} } bs, b < a

s < {a} in colex iff all elements of s are strictly less than a.

theorem Finset.Colex.singleton_le_toColex {α : Type u_1} [PartialOrder α] {s : Finset α} {a : α} :
{ ofColex := {a} } { ofColex := s } ∃ x ∈ s, a x

{a} ≤ s in colex iff s contains an element greated than or equal to a.

theorem Finset.Colex.singleton_le_singleton {α : Type u_1} [PartialOrder α] {a : α} {b : α} :
{ ofColex := {a} } { ofColex := {b} } a b

Colex is an extension of the base order.

theorem Finset.Colex.singleton_lt_singleton {α : Type u_1} [PartialOrder α] {a : α} {b : α} :
{ ofColex := {a} } < { ofColex := {b} } a < b

Colex is an extension of the base order.

instance Finset.Colex.instDecidableLE {α : Type u_1} [PartialOrder α] [DecidableEq α] [DecidableRel fun (x x_1 : α) => x x_1] :
DecidableRel fun (x x_1 : Finset.Colex α) => x x_1
Equations
instance Finset.Colex.instDecidableLT {α : Type u_1} [PartialOrder α] [DecidableEq α] [DecidableRel fun (x x_1 : α) => x x_1] :
DecidableRel fun (x x_1 : Finset.Colex α) => x < x_1
Equations
  • Finset.Colex.instDecidableLT = decidableLTOfDecidableLE
theorem Finset.Colex.le_iff_sdiff_subset_lowerClosure {α : Type u_1} [PartialOrder α] {s : Finset.Colex α} {t : Finset.Colex α} :
s t s.ofColex \ t.ofColex (lowerClosure (t.ofColex \ s.ofColex))
theorem Finset.Colex.toColex_sdiff_le_toColex_sdiff {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} {u : Finset α} [DecidableEq α] (hus : u s) (hut : u t) :
{ ofColex := s \ u } { ofColex := t \ u } { ofColex := s } { ofColex := t }

The colexigraphic order is insensitive to removing the same elements from both sets.

theorem Finset.Colex.toColex_sdiff_lt_toColex_sdiff {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} {u : Finset α} [DecidableEq α] (hus : u s) (hut : u t) :
{ ofColex := s \ u } < { ofColex := t \ u } { ofColex := s } < { ofColex := t }

The colexigraphic order is insensitive to removing the same elements from both sets.

@[simp]
theorem Finset.Colex.toColex_sdiff_le_toColex_sdiff' {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} [DecidableEq α] :
{ ofColex := s \ t } { ofColex := t \ s } { ofColex := s } { ofColex := t }
@[simp]
theorem Finset.Colex.toColex_sdiff_lt_toColex_sdiff' {α : Type u_1} [PartialOrder α] {s : Finset α} {t : Finset α} [DecidableEq α] :
{ ofColex := s \ t } < { ofColex := t \ s } { ofColex := s } < { ofColex := t }
Equations
  • Finset.Colex.instLinearOrder = LinearOrder.mk Finset.Colex.instDecidableLE decidableEqOfDecidableLE Finset.Colex.instDecidableLT
theorem Finset.Colex.toColex_lt_toColex_iff_exists_forall_lt {α : Type u_1} [LinearOrder α] {s : Finset α} {t : Finset α} :
{ ofColex := s } < { ofColex := t } ∃ a ∈ t, as bs, btb < a
theorem Finset.Colex.lt_iff_exists_forall_lt {α : Type u_1} [LinearOrder α] {s : Finset.Colex α} {t : Finset.Colex α} :
s < t ∃ a ∈ t.ofColex, as.ofColex bs.ofColex, bt.ofColexb < a
theorem Finset.Colex.toColex_le_toColex_iff_max'_mem {α : Type u_1} [LinearOrder α] {s : Finset α} {t : Finset α} :
{ ofColex := s } { ofColex := t } ∀ (hst : s t), Finset.max' (symmDiff s t) t
theorem Finset.Colex.le_iff_max'_mem {α : Type u_1} [LinearOrder α] {s : Finset.Colex α} {t : Finset.Colex α} :
s t ∀ (h : s t), Finset.max' (symmDiff s.ofColex t.ofColex) t.ofColex
theorem Finset.Colex.toColex_lt_toColex_iff_max'_mem {α : Type u_1} [LinearOrder α] {s : Finset α} {t : Finset α} :
{ ofColex := s } < { ofColex := t } ∃ (hst : s t), Finset.max' (symmDiff s t) t
theorem Finset.Colex.lt_iff_max'_mem {α : Type u_1} [LinearOrder α] {s : Finset.Colex α} {t : Finset.Colex α} :
s < t ∃ (h : s t), Finset.max' (symmDiff s.ofColex t.ofColex) t.ofColex
theorem Finset.Colex.toColex_image_le_toColex_image {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] {f : αβ} {s : Finset α} {t : Finset α} (hf : StrictMono f) :
{ ofColex := Finset.image f s } { ofColex := Finset.image f t } { ofColex := s } { ofColex := t }

Strictly monotone functions preserve the colex ordering.

theorem Finset.Colex.toColex_image_lt_toColex_image {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] {f : αβ} {s : Finset α} {t : Finset α} (hf : StrictMono f) :
{ ofColex := Finset.image f s } < { ofColex := Finset.image f t } { ofColex := s } < { ofColex := t }

Strictly monotone functions preserve the colex ordering.

theorem Finset.Colex.toColex_image_ofColex_strictMono {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] {f : αβ} (hf : StrictMono f) :
StrictMono fun (s : Finset.Colex α) => { ofColex := Finset.image f s.ofColex }

Initial segments #

def Finset.Colex.IsInitSeg {α : Type u_1} [LinearOrder α] (𝒜 : Finset (Finset α)) (r : ) :

𝒜 is an initial segment of the colexigraphic order on sets of r, and that if t is below s in colex where t has size r and s is in 𝒜, then t is also in 𝒜. In effect, 𝒜 is downwards closed with respect to colex among sets of size r.

Equations
theorem Finset.Colex.IsInitSeg.total {α : Type u_1} [LinearOrder α] {𝒜₁ : Finset (Finset α)} {𝒜₂ : Finset (Finset α)} {r : } (h₁ : Finset.Colex.IsInitSeg 𝒜₁ r) (h₂ : Finset.Colex.IsInitSeg 𝒜₂ r) :
𝒜₁ 𝒜₂ 𝒜₂ 𝒜₁

Initial segments are nested in some way. In particular, if they're the same size they're equal.

def Finset.Colex.initSeg {α : Type u_1} [LinearOrder α] [Fintype α] (s : Finset α) :

The initial segment of the colexicographic order on sets with s.card elements and ending at s.

Equations
@[simp]
theorem Finset.Colex.mem_initSeg {α : Type u_1} [LinearOrder α] {s : Finset α} {t : Finset α} [Fintype α] :
t Finset.Colex.initSeg s s.card = t.card { ofColex := t } { ofColex := s }
@[simp]
theorem Finset.Colex.initSeg_nonempty {α : Type u_1} [LinearOrder α] {s : Finset α} [Fintype α] :
theorem Finset.Colex.IsInitSeg.exists_initSeg {α : Type u_1} [LinearOrder α] {𝒜 : Finset (Finset α)} {r : } [Fintype α] (h𝒜 : Finset.Colex.IsInitSeg 𝒜 r) (h𝒜₀ : 𝒜.Nonempty) :
∃ (s : Finset α), s.card = r 𝒜 = Finset.Colex.initSeg s
theorem Finset.Colex.isInitSeg_iff_exists_initSeg {α : Type u_1} [LinearOrder α] {𝒜 : Finset (Finset α)} {r : } [Fintype α] :
Finset.Colex.IsInitSeg 𝒜 r 𝒜.Nonempty ∃ (s : Finset α), s.card = r 𝒜 = Finset.Colex.initSeg s

Being a nonempty initial segment of colex is equivalent to being an initSeg.

Colex on #

The colexicographic order agrees with the order induced by interpreting a set of naturals as a n-ary expansion.

theorem Finset.geomSum_ofColex_strictMono {n : } (hn : 2 n) :
StrictMono fun (s : Finset.Colex ) => Finset.sum s.ofColex fun (k : ) => n ^ k
theorem Finset.geomSum_le_geomSum_iff_toColex_le_toColex {s : Finset } {t : Finset } {n : } (hn : 2 n) :
((Finset.sum s fun (k : ) => n ^ k) Finset.sum t fun (k : ) => n ^ k) { ofColex := s } { ofColex := t }

For finsets of naturals of naturals, the colexicographic order is equivalent to the order induced by the n-ary expansion.

theorem Finset.geomSum_lt_geomSum_iff_toColex_lt_toColex {s : Finset } {t : Finset } {n : } (hn : 2 n) :
((Finset.sum s fun (i : ) => n ^ i) < Finset.sum t fun (i : ) => n ^ i) { ofColex := s } < { ofColex := t }

For finsets of naturals of naturals, the colexicographic order is equivalent to the order induced by the n-ary expansion.