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.OrderIsoNat

39 declarations and 1 deprecated aliases. Mathlib docs · Source

Relation embeddings from the naturals

This file allows translation from monotone functions ℕ → α to order embeddings ℕ ↪ α and defines the limit value of an eventually-constant sequence.

Main declarations

  • natLT/natGT: Make an order embedding Nat ↪ α from an increasing/decreasing function Nat → α.
  • Infinite.exists_strictMono_or_strictAnti: Every infinite linear order contains a strictly increasing or strictly decreasing sequence indexed by ℕ.
  • Finite.of_wellFoundedLT_wellFoundedGT: A linear order that is well-founded in both directions is finite.
  • monotonicSequenceLimit: The limit of an eventually-constant monotone sequence Nat →o α.
  • monotonicSequenceLimitIndex: The index of the first occurrence of monotonicSequenceLimit in the sequence.

theorem RelIso.ofSurjective.congr_simp E1 #

∀ {α : Type u_1} {β : Type u_2} {r : α → α → Prop} {s : β → β → Prop} (f f_1 : r ↪r s) (e_f : f = f_1)
  (H : Function.Surjective ⇑f), RelIso.ofSurjective f H = RelIso.ofSurjective f_1 ⋯

theorem RelEmbedding.natLT.congr_simp E1 #

∀ {α : Type u_1} {r : α → α → Prop} [inst : IsStrictOrder α r] (f f_1 : ℕ → α) (e_f : f = f_1)
  (H : ∀ (n : ℕ), r (f n) (f (n + 1))), RelEmbedding.natLT f H = RelEmbedding.natLT f_1 ⋯

theorem Infinite.natEmbedding.congr_simp E1 #

∀ (α : Type u_3) [inst : Infinite α], Infinite.natEmbedding α = Infinite.natEmbedding α

def RelEmbedding.natLT E3 #

{α : Type u_1} →
  {r : α → α → Prop} → [IsStrictOrder α r] → (f : ℕ → α) → (∀ (n : ℕ), r (f n) (f (n + 1))) → (fun x1 x2 ↦ x1 < x2) ↪r r

If f is a strictly r-increasing sequence, then this returns f as an order embedding.

theorem RelEmbedding.coe_natLT E0 #

∀ {α : Type u_1} {r : α → α → Prop} [inst : IsStrictOrder α r] {f : ℕ → α} {H : ∀ (n : ℕ), r (f n) (f (n + 1))},
  ⇑(RelEmbedding.natLT f H) = f

def RelEmbedding.natGT E3 #

{α : Type u_1} →
  {r : α → α → Prop} → [IsStrictOrder α r] → (f : ℕ → α) → (∀ (n : ℕ), r (f (n + 1)) (f n)) → (fun x1 x2 ↦ x1 > x2) ↪r r

If f is a strictly r-decreasing sequence, then this returns f as an order embedding.

theorem RelEmbedding.coe_natGT E0 #

∀ {α : Type u_1} {r : α → α → Prop} [inst : IsStrictOrder α r] {f : ℕ → α} {H : ∀ (n : ℕ), r (f (n + 1)) (f n)},
  ⇑(RelEmbedding.natGT f H) = f

theorem RelEmbedding.acc_iff_isEmpty_subtype_mem_range E1 #

∀ {α : Type u_1} {r : α → α → Prop} [IsStrictOrder α r] {x : α}, Acc r x ↔ IsEmpty { f // x ∈ Set.range ⇑f }

A value is accessible iff it isn't contained in any infinite decreasing sequence.

theorem RelEmbedding.not_acc E1 #

∀ {α : Type u_1} {r : α → α → Prop} [IsStrictOrder α r] (f : (fun x1 x2 ↦ x1 > x2) ↪r r) (k : ℕ), ¬Acc r (f k)

theorem RelEmbedding.wellFounded_iff_isEmpty E1 #

∀ {α : Type u_1} {r : α → α → Prop} [IsStrictOrder α r], WellFounded r ↔ IsEmpty ((fun x1 x2 ↦ x1 > x2) ↪r r)

A strict order relation is well-founded iff it doesn't have any infinite descending chain.

See wellFounded_iff_isEmpty_descending_chain for a version which works on any relation.

theorem RelEmbedding.not_wellFounded E1 #

∀ {α : Type u_1} {r : α → α → Prop} [IsStrictOrder α r] (f : (fun x1 x2 ↦ x1 > x2) ↪r r), ¬WellFounded r

theorem not_strictAnti_of_wellFoundedGT E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Preorder α] [WellFoundedGT α] [inst_2 : Preorder β] [Nonempty β] [NoMinOrder β]
  (f : β → α), ¬StrictAnti f

theorem not_strictAnti_of_wellFoundedLT E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Preorder α] [WellFoundedLT α] [inst_2 : Preorder β] [Nonempty β] [NoMaxOrder β]
  (f : β → α), ¬StrictAnti f

theorem not_strictMono_of_wellFoundedGT E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Preorder α] [WellFoundedGT α] [inst_2 : Preorder β] [Nonempty β] [NoMaxOrder β]
  (f : β → α), ¬StrictMono f

theorem not_strictMono_of_wellFoundedLT E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Preorder α] [WellFoundedLT α] [inst_2 : Preorder β] [Nonempty β] [NoMinOrder β]
  (f : β → α), ¬StrictMono f

def Nat.orderEmbeddingOfSet E1 #

(s : Set ℕ) → [Infinite ↑s] → [DecidablePred fun x ↦ x ∈ s] → ℕ ↪o ℕ

An order embedding from ℕ to itself with a specified range

def Nat.Subtype.orderIsoOfNat E1 #

(s : Set ℕ) → [Infinite ↑s] → ℕ ≃o ↑s

Nat.Subtype.ofNat as an order isomorphism between ℕ and an infinite subset. See also Nat.nth for a version where the subset may be finite.

theorem Nat.coe_orderEmbeddingOfSet E0 #

∀ {s : Set ℕ} [inst : Infinite ↑s] [inst_1 : DecidablePred fun x ↦ x ∈ s],
  ⇑(Nat.orderEmbeddingOfSet s) = Subtype.val ∘ Nat.Subtype.ofNat s

theorem Nat.orderEmbeddingOfSet_apply E0 #

∀ {s : Set ℕ} [inst : Infinite ↑s] [inst_1 : DecidablePred fun x ↦ x ∈ s] {n : ℕ},
  (Nat.orderEmbeddingOfSet s) n = ↑(Nat.Subtype.ofNat s n)

theorem Nat.Subtype.orderIsoOfNat_apply E0 #

∀ {s : Set ℕ} [inst : Infinite ↑s] [dP : DecidablePred fun x ↦ x ∈ s] {n : ℕ},
  (Nat.Subtype.orderIsoOfNat s) n = Nat.Subtype.ofNat s n

theorem Nat.orderEmbeddingOfSet_range E1 #

∀ (s : Set ℕ) [inst : Infinite ↑s] [inst_1 : DecidablePred fun x ↦ x ∈ s], Set.range ⇑(Nat.orderEmbeddingOfSet s) = s

theorem Nat.exists_subseq_of_forall_mem_union E1 #

∀ {α : Type u_1} {s t : Set α} (e : ℕ → α),
  (∀ (n : ℕ), e n ∈ s ∪ t) → ∃ g, (∀ (n : ℕ), e (g n) ∈ s) ∨ ∀ (n : ℕ), e (g n) ∈ t

theorem exists_increasing_or_nonincreasing_subseq' E1 #

∀ {α : Type u_1} (r : α → α → Prop) (f : ℕ → α),
  ∃ g, (∀ (n : ℕ), r (f (g n)) (f (g (n + 1)))) ∨ ∀ (m n : ℕ), m < n → ¬r (f (g m)) (f (g n))

theorem exists_increasing_or_nonincreasing_subseq E2 #

∀ {α : Type u_1} (r : α → α → Prop) [IsTrans α r] (f : ℕ → α),
  ∃ g, (∀ (m n : ℕ), m < n → r (f (g m)) (f (g n))) ∨ ∀ (m n : ℕ), m < n → ¬r (f (g m)) (f (g n))

This is the infinitary Erdős–Szekeres theorem, and an important lemma in the usual proof of Bolzano-Weierstrass for ℝ.

theorem Infinite.exists_strictMono_or_strictAnti E3 #

∀ (α : Type u_3) [inst : LinearOrder α] [Infinite α], ∃ f, StrictMono f ∨ StrictAnti f

Every infinite linear order contains either a strictly increasing or a strictly decreasing sequence indexed by ℕ.

theorem Finite.of_wellFoundedLT_of_wellFoundedGT E1 #

∀ (α : Type u_3) [inst : LinearOrder α] [WellFoundedLT α] [WellFoundedGT α], Finite α

A linear order that is well-founded in both directions is finite.

theorem IsChain.finite_of_wellFoundedLT_of_wellFoundedGT E1 #

∀ {α : Type u_1} [inst : Preorder α] [WellFoundedLT α] [WellFoundedGT α] {s : Set α},
  IsChain (fun x1 x2 ↦ x1 < x2) s → s.Finite

theorem wellFoundedGT_iff_monotone_chain_condition' E1 #

∀ {α : Type u_1} [inst : Preorder α], WellFoundedGT α ↔ ∀ (a : ℕ →o α), ∃ n, ∀ (m : ℕ), n ≤ m → ¬a n < a m

The monotone chain condition: a preorder is co-well-founded iff every increasing sequence contains two non-increasing indices.

See wellFoundedGT_iff_monotone_chain_condition for a stronger version on partial orders.

theorem WellFoundedGT.monotone_chain_condition' E1 #

∀ {α : Type u_1} [inst : Preorder α] [h : WellFoundedGT α] (a : ℕ →o α), ∃ n, ∀ (m : ℕ), n ≤ m → ¬a n < a m

theorem wellFoundedGT_iff_monotone_chain_condition E1 #

∀ {α : Type u_1} [inst : PartialOrder α], WellFoundedGT α ↔ ∀ (a : ℕ →o α), ∃ n, ∀ (m : ℕ), n ≤ m → a n = a m

A stronger version of the monotone chain condition for partial orders.

See wellFoundedGT_iff_monotone_chain_condition' for a version on preorders.

theorem WellFoundedGT.monotone_chain_condition E1 #

∀ {α : Type u_1} [inst : PartialOrder α] [h : WellFoundedGT α] (a : ℕ →o α), ∃ n, ∀ (m : ℕ), n ≤ m → a n = a m

theorem WellFoundedLT.antitone_chain_condition E1 #

∀ {α : Type u_1} [inst : PartialOrder α] [WellFoundedLT α] {f : ℕ → α}, Antitone f → ∃ n, ∀ (m : ℕ), n ≤ m → f n = f m

The antitone chain condition: an antitone sequence in a partially-ordered type with well-founded < is eventually constant.

This is the dual of WellFoundedGT.monotone_chain_condition. It is provided for convenience, since it unbundles the antitone property from the order homomorphism.

def monotonicSequenceLimitIndex E3 #

{α : Type u_1} → [inst : Preorder α] → (ℕ →o α) → ℕ

Given an eventually-constant monotone sequence a₀ ≤ a₁ ≤ a₂ ≤ ... in a partially-ordered type, monotonicSequenceLimitIndex a is the least natural number n for which aₙ reaches the constant value. For sequences that are not eventually constant, monotonicSequenceLimitIndex a is defined, but is a junk value.

def monotonicSequenceLimit E3 #

{α : Type u_1} → [inst : Preorder α] → (ℕ →o α) → α

The constant value of an eventually-constant monotone sequence a₀ ≤ a₁ ≤ a₂ ≤ ... in a partially-ordered type.

theorem le_monotonicSequenceLimit E1 #

∀ {α : Type u_1} [inst : PartialOrder α] [WellFoundedGT α] (a : ℕ →o α) (m : ℕ), a m ≤ monotonicSequenceLimit a

theorem WellFoundedGT.iSup_eq_monotonicSequenceLimit E1 #

∀ {α : Type u_1} [inst : CompleteLattice α] [WellFoundedGT α] (a : ℕ →o α), iSup ⇑a = monotonicSequenceLimit a

theorem WellFoundedGT.ciSup_eq_monotonicSequenceLimit E1 #

∀ {α : Type u_1} [inst : ConditionallyCompleteLattice α] [WellFoundedGT α] (a : ℕ →o α),
  BddAbove (Set.range ⇑a) → iSup ⇑a = monotonicSequenceLimit a

theorem exists_covBy_seq_of_wellFoundedLT_wellFoundedGT E1 #

∀ (α : Type u_3) [inst : Preorder α] [Nonempty α] [wfl : WellFoundedLT α] [wfg : WellFoundedGT α],
  ∃ a, IsMin (a 0) ∧ ∃ n, IsMax (a n) ∧ ∀ i < n, a i ⋖ a (i + 1)

theorem exists_covBy_seq_of_wellFoundedLT_wellFoundedGT_of_le E1 #

∀ {α : Type u_3} [inst : PartialOrder α] [wfl : WellFoundedLT α] [wfg : WellFoundedGT α] {x y : α},
  x ≤ y → ∃ a, a 0 = x ∧ ∃ n, a n = y ∧ ∀ i < n, a i ⋖ a (i + 1)

Deprecated aliases

NameNew nameSince
Finite.of_wellFoundedLT_wellFoundedGTFinite.of_wellFoundedLT_of_wellFoundedGT2026-08-11