The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V04. Order and lattices

Mathlib.Order.PiLex

52 declarations. Mathlib docs · Source

Lexicographic order on Pi types

This file defines the lexicographic and colexicographic orders for Pi types.

  • In the lexicographic order, a is less than b if a i = b i for all i up to some point k, and a k < b k.
  • In the colexicographic order, a is less than b if a i = b i for all i above some point k, and a k < b k.

Notation

  • Πₗ i, α i: Pi type equipped with the lexicographic order. Type synonym of Π i, α i.

See also

Related files are:

  • Data.Finset.Colex: Colexicographic order on finite sets.
  • Data.List.Lex: Lexicographic order on lists.
  • Order.Sigma: Lexicographic order on Σₗ i, α i.
  • Order.PSigma: Lexicographic order on Σₗ' i, α i.
  • Order.Prod.Lex.Basic: Lexicographic order on α × β.

def Pi.Lex E1 #

{ι : Type u_1} →
  {β : ι → Type u_2} → (ι → ι → Prop) → ({i : ι} → β i → β i → Prop) → ((i : ι) → β i) → ((i : ι) → β i) → Prop

The lexicographic relation on Π i : ι, β i, where ι is ordered by r, and each β i is ordered by s.

The < relation on Lex (∀ i, β i) is Pi.Lex (· < ·) (· < ·), while the < relation on Colex (∀ i, β i) is Pi.Lex (· > ·) (· < ·).

def Pi.«termΠₗ_,_» E1 #

Lean.ParserDescr

The notation Πₗ i, α i refers to a pi type equipped with the lexicographic order.

theorem Pi.lex_lt_of_lt_of_preorder E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : (i : ι) → Preorder (β i)] {r : ι → ι → Prop},
  WellFounded r → ∀ {x y : (i : ι) → β i}, x < y → ∃ i, (∀ (j : ι), r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i

theorem Pi.lex_lt_of_lt E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : (i : ι) → PartialOrder (β i)] {r : ι → ι → Prop},
  WellFounded r → ∀ {x y : (i : ι) → β i}, x < y → Pi.Lex r (fun {i} x1 x2 ↦ x1 < x2) x y

theorem Pi.lex_iff_of_unique E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Unique ι] [inst_1 : (i : ι) → LT (β i)] {r : ι → ι → Prop} [Std.Irrefl r]
  {x y : (i : ι) → β i}, Pi.Lex r (fun {i} x1 x2 ↦ x1 < x2) x y ↔ x default < y default

theorem Pi.trichotomous_lex E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} (r : ι → ι → Prop) (s : {i : ι} → β i → β i → Prop) [∀ (i : ι), Std.Trichotomous s]
  [wf : WellFounded r], Std.Trichotomous (Pi.Lex r s)

instance Pi.instLTLexForall E0 #

{ι : Type u_1} → {β : ι → Type u_2} → [LT ι] → [(a : ι) → LT (β a)] → LT (Lex ((i : ι) → β i))

instance Pi.instLTColexForall E0 #

{ι : Type u_1} → {β : ι → Type u_2} → [LT ι] → [(a : ι) → LT (β a)] → LT (Colex ((i : ι) → β i))

theorem Pi.toLex_apply E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} (x : (i : ι) → β i) (i : ι), toLex x i = x i

theorem Pi.ofLex_apply E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} (x : Lex ((i : ι) → β i)) (i : ι), ofLex x i = x i

theorem Pi.toColex_apply E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} (x : (i : ι) → β i) (i : ι), toColex x i = x i

theorem Pi.ofColex_apply E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} (x : Colex ((i : ι) → β i)) (i : ι), ofColex x i = x i

theorem Pi.Lex.lt_iff_of_unique E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Unique ι] [inst_1 : (i : ι) → LT (β i)] [inst_2 : Preorder ι]
  {x y : Lex ((i : ι) → β i)}, x < y ↔ x default < y default

theorem Pi.Colex.lt_iff_of_unique E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Unique ι] [inst_1 : (i : ι) → LT (β i)] [inst_2 : Preorder ι]
  {x y : Colex ((i : ι) → β i)}, x < y ↔ x default < y default

instance Pi.Lex.isStrictOrder E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [inst_1 : (a : ι) → PartialOrder (β a)],
  IsStrictOrder (Lex ((i : ι) → β i)) fun x1 x2 ↦ x1 < x2

instance Pi.Colex.isStrictOrder E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [inst_1 : (a : ι) → PartialOrder (β a)],
  IsStrictOrder (Colex ((i : ι) → β i)) fun x1 x2 ↦ x1 < x2

instance Pi.instPartialOrderLexForallOfLinearOrder E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} → [LinearOrder ι] → [(a : ι) → PartialOrder (β a)] → PartialOrder (Lex ((i : ι) → β i))

instance Pi.instPartialOrderColexForallOfLinearOrder E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} → [LinearOrder ι] → [(a : ι) → PartialOrder (β a)] → PartialOrder (Colex ((i : ι) → β i))

instance Pi.Lex.linearOrder E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] → [WellFoundedLT ι] → [(a : ι) → LinearOrder (β a)] → LinearOrder (Lex ((i : ι) → β i))

Lex (∀ i, α i) is a linear order if the original order has well-founded <.

instance Pi.Colex.linearOrder E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] → [WellFoundedGT ι] → [(a : ι) → LinearOrder (β a)] → LinearOrder (Colex ((i : ι) → β i))

Colex (∀ i, α i) is a linear order if the original order has well-founded >.

theorem Pi.lex_le_iff_of_unique E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Unique ι] [inst_1 : LinearOrder ι] [inst_2 : (i : ι) → PartialOrder (β i)]
  {x y : Lex ((i : ι) → β i)}, x ≤ y ↔ x default ≤ y default

theorem Pi.colex_le_iff_of_unique E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Unique ι] [inst_1 : LinearOrder ι] [inst_2 : (i : ι) → PartialOrder (β i)]
  {x y : Colex ((i : ι) → β i)}, x ≤ y ↔ x default ≤ y default

theorem Pi.toLex_monotone E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedLT ι],
  Monotone ⇑toLex

theorem Pi.toLex_strictMono E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedLT ι],
  StrictMono ⇑toLex

theorem Pi.lt_toLex_update_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedLT ι], toLex x < toLex (Function.update x i a) ↔ x i < a

theorem Pi.toLex_update_lt_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedLT ι], toLex (Function.update x i a) < toLex x ↔ a < x i

theorem Pi.le_toLex_update_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedLT ι], toLex x ≤ toLex (Function.update x i a) ↔ x i ≤ a

theorem Pi.toLex_update_le_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedLT ι], toLex (Function.update x i a) ≤ toLex x ↔ a ≤ x i

theorem Pi.toColex_monotone E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedGT ι],
  Monotone ⇑toColex

theorem Pi.toColex_strictMono E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedGT ι],
  StrictMono ⇑toColex

theorem Pi.lt_toColex_update_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedGT ι], toColex x < toColex (Function.update x i a) ↔ x i < a

theorem Pi.toColex_update_lt_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedGT ι], toColex (Function.update x i a) < toColex x ↔ a < x i

theorem Pi.le_toColex_update_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedGT ι], toColex x ≤ toColex (Function.update x i a) ↔ x i ≤ a

theorem Pi.toColex_update_le_self_iff E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x : (i : ι) → β i} {i : ι} {a : β i}
  [inst_1 : (i : ι) → PartialOrder (β i)] [WellFoundedGT ι], toColex (Function.update x i a) ≤ toColex x ↔ a ≤ x i

theorem Pi.apply_le_of_toLex E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x y : (i : ι) → β i} {i : ι}
  [inst_1 : (i : ι) → LinearOrder (β i)], toLex x ≤ toLex y → (∀ j < i, x j = y j) → x i ≤ y i

theorem Pi.apply_le_of_toColex E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] {x y : (i : ι) → β i} {i : ι}
  [inst_1 : (i : ι) → LinearOrder (β i)], toColex x ≤ toColex y → (∀ j > i, x j = y j) → x i ≤ y i

instance Pi.instOrderBotLexForallOfWellFoundedLT E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] →
      [WellFoundedLT ι] →
        [inst_2 : (a : ι) → PartialOrder (β a)] → [(a : ι) → OrderBot (β a)] → OrderBot (Lex ((a : ι) → β a))

instance Pi.instOrderBotColexForallOfWellFoundedGT E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] →
      [WellFoundedGT ι] →
        [inst_2 : (a : ι) → PartialOrder (β a)] → [(a : ι) → OrderBot (β a)] → OrderBot (Colex ((a : ι) → β a))

instance Pi.instOrderTopLexForallOfWellFoundedLT E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] →
      [WellFoundedLT ι] →
        [inst_2 : (a : ι) → PartialOrder (β a)] → [(a : ι) → OrderTop (β a)] → OrderTop (Lex ((a : ι) → β a))

instance Pi.instOrderTopColexForallOfWellFoundedGT E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] →
      [WellFoundedGT ι] →
        [inst_2 : (a : ι) → PartialOrder (β a)] → [(a : ι) → OrderTop (β a)] → OrderTop (Colex ((a : ι) → β a))

instance Pi.instBoundedOrderLexForallOfWellFoundedLT E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] →
      [WellFoundedLT ι] →
        [inst_2 : (a : ι) → PartialOrder (β a)] → [(a : ι) → BoundedOrder (β a)] → BoundedOrder (Lex ((a : ι) → β a))

instance Pi.instBoundedOrderColexForallOfWellFoundedGT E0 #

{ι : Type u_1} →
  {β : ι → Type u_2} →
    [inst : LinearOrder ι] →
      [WellFoundedGT ι] →
        [inst_2 : (a : ι) → PartialOrder (β a)] → [(a : ι) → BoundedOrder (β a)] → BoundedOrder (Colex ((a : ι) → β a))

instance Pi.instDenselyOrderedLexForall E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Preorder ι] [inst_1 : (i : ι) → LT (β i)] [∀ (i : ι), DenselyOrdered (β i)],
  DenselyOrdered (Lex ((i : ι) → β i))

instance Pi.instDenselyOrderedColexForall E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Preorder ι] [inst_1 : (i : ι) → LT (β i)] [∀ (i : ι), DenselyOrdered (β i)],
  DenselyOrdered (Colex ((i : ι) → β i))

theorem Pi.Lex.noMaxOrder' E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Preorder ι] [inst_1 : (i : ι) → LT (β i)] (i : ι) [NoMaxOrder (β i)],
  NoMaxOrder (Lex ((i : ι) → β i))

theorem Pi.Colex.noMaxOrder' E1 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : Preorder ι] [inst_1 : (i : ι) → LT (β i)] (i : ι) [NoMaxOrder (β i)],
  NoMaxOrder (Colex ((i : ι) → β i))

instance Pi.instNoMaxOrderLexForallOfWellFoundedLTOfNonempty E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [WellFoundedLT ι] [Nonempty ι]
  [inst_3 : (i : ι) → PartialOrder (β i)] [∀ (i : ι), NoMaxOrder (β i)], NoMaxOrder (Lex ((i : ι) → β i))

instance Pi.instNoMaxOrderColexForallOfWellFoundedGTOfNonempty E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [WellFoundedGT ι] [Nonempty ι]
  [inst_3 : (i : ι) → PartialOrder (β i)] [∀ (i : ι), NoMaxOrder (β i)], NoMaxOrder (Colex ((i : ι) → β i))

instance Pi.instNoMinOrderLexForallOfWellFoundedLTOfNonempty E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [WellFoundedLT ι] [Nonempty ι]
  [inst_3 : (i : ι) → PartialOrder (β i)] [∀ (i : ι), NoMinOrder (β i)], NoMinOrder (Lex ((i : ι) → β i))

instance Pi.instNoMinOrderColexForallOfWellFoundedGTOfNonempty E0 #

∀ {ι : Type u_1} {β : ι → Type u_2} [inst : LinearOrder ι] [WellFoundedGT ι] [Nonempty ι]
  [inst_3 : (i : ι) → PartialOrder (β i)] [∀ (i : ι), NoMinOrder (β i)], NoMinOrder (Colex ((i : ι) → β i))

theorem Pi.lex_desc E1 #

∀ {ι : Type u_1} {α : Type u_3} [inst : Preorder ι] [inst_1 : DecidableEq ι] [inst_2 : LT α] {f : ι → α} {i j : ι},
  i ≤ j → f j < f i → toLex (f ∘ ⇑(Equiv.swap i j)) < toLex f

If we swap two strictly decreasing values in a function, then the result is lexicographically smaller than the original function.

theorem Pi.colex_asc E1 #

∀ {ι : Type u_1} {α : Type u_3} [inst : Preorder ι] [inst_1 : DecidableEq ι] [inst_2 : LT α] {f : ι → α} {i j : ι},
  i ≤ j → f i < f j → toColex (f ∘ ⇑(Equiv.swap i j)) < toColex f

If we swap two strictly increasing values in a function, then the result is colexicographically smaller than the original function.