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

39 declarations. Mathlib docs · Source

Comparability and incomparability relations

Two values in a preorder are said to be comparable (SymmRel) whenever a ≤ b or b ≤ a. We define both the comparability and incomparability relations.

In a linear order, SymmGen (· ≤ ·) a b is always true, and IncompRel (· ≤ ·) a b is always false.

Implementation notes

Although comparability and incomparability are negations of each other, both relations are convenient in different contexts, and as such, it's useful to keep them distinct. To move from one to the other, use not_symmGen_iff and not_incompRel_iff_symmGen.

Main declarations

  • CompRel: The comparability relation. CompRel r a b means that a and b is related in either direction by r. This is deprecated in favor of Relation.SymmGen, with naming chosen for consistency with Relation.TransGen in core and other definitions in Mathlib.Logic.Relation.
  • IncompRel: The incomparability relation. IncompRel r a b means that a and b are related in neither direction by r.

Todo

These definitions should be linked to IsChain and IsAntichain.

Comparability

Incomparability relation

def Relation.linearOrderOfSymmGen E1 #

{α : Type u_1} →
  [inst : PartialOrder α] →
    [decLE : DecidableLE α] →
      [decLT : DecidableLT α] →
        [decEq : DecidableEq α] → (∀ (a b : α), Relation.SymmGen (fun x1 x2 ↦ x1 ≤ x2) a b) → LinearOrder α

A partial order where any two elements are comparable is a linear order.

def IncompRel E3 #

{α : Type u_1} → (α → α → Prop) → α → α → Prop

The incomparability relation IncompRel r a b means ¬ r a b and ¬ r b a.

theorem antisymmRel_compl E0 #

∀ {α : Type u_1} (r : α → α → Prop), AntisymmRel rᶜ = IncompRel r

theorem antisymmRel_compl_apply E0 #

∀ {α : Type u_1} {a b : α} (r : α → α → Prop), AntisymmRel rᶜ a b ↔ IncompRel r a b

theorem incompRel_compl E0 #

∀ {α : Type u_1} (r : α → α → Prop), IncompRel rᶜ = AntisymmRel r

theorem incompRel_compl_apply E0 #

∀ {α : Type u_1} {a b : α} (r : α → α → Prop), IncompRel rᶜ a b ↔ AntisymmRel r a b

theorem incompRel_swap E1 #

∀ {α : Type u_1} (r : α → α → Prop), IncompRel (Function.swap r) = IncompRel r

theorem incompRel_swap_apply E0 #

∀ {α : Type u_1} {a b : α} (r : α → α → Prop), IncompRel (Function.swap r) a b ↔ IncompRel r a b

theorem IncompRel.refl E0 #

∀ {α : Type u_1} (r : α → α → Prop) [Std.Irrefl r] (a : α), IncompRel r a a

theorem IncompRel.rfl E1 #

∀ {α : Type u_1} {r : α → α → Prop} [Std.Irrefl r] {a : α}, IncompRel r a a

instance instReflIncompRelOfIrrefl E0 #

∀ {α : Type u_1} {r : α → α → Prop} [Std.Irrefl r], Std.Refl (IncompRel r)

theorem IncompRel.symm E1 #

∀ {α : Type u_1} {a b : α} {r : α → α → Prop}, IncompRel r a b → IncompRel r b a

instance instSymmIncompRel E0 #

∀ {α : Type u_1} {r : α → α → Prop}, Std.Symm (IncompRel r)

theorem incompRel_comm E1 #

∀ {α : Type u_1} {r : α → α → Prop} {a b : α}, IncompRel r a b ↔ IncompRel r b a

instance IncompRel.decidableRel E0 #

{α : Type u_1} → {r : α → α → Prop} → [DecidableRel r] → DecidableRel (IncompRel r)

theorem IncompRel.not_antisymmRel E1 #

∀ {α : Type u_1} {a b : α} {r : α → α → Prop}, IncompRel r a b → ¬AntisymmRel r a b

theorem AntisymmRel.not_incompRel E1 #

∀ {α : Type u_1} {a b : α} {r : α → α → Prop}, AntisymmRel r a b → ¬IncompRel r a b

theorem not_symmGen_iff E0 #

∀ {α : Type u_1} {a b : α} {r : α → α → Prop}, ¬Relation.SymmGen r a b ↔ IncompRel r a b

theorem not_incompRel_iff_symmGen E1 #

∀ {α : Type u_1} {a b : α} {r : α → α → Prop}, ¬IncompRel r a b ↔ Relation.SymmGen r a b

theorem not_incompRel_of_total E0 #

∀ {α : Type u_1} {r : α → α → Prop} [Std.Total r] (a b : α), ¬IncompRel r a b

theorem IncompRel.ne E1 #

∀ {α : Type u_1} {r : α → α → Prop} [Std.Refl r] {a b : α}, IncompRel r a b → a ≠ b

theorem IncompRel.not_le E1 #

∀ {α : Type u_1} {a b : α} [inst : LE α], IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b → ¬a ≤ b

theorem IncompRel.not_ge E1 #

∀ {α : Type u_1} {a b : α} [inst : LE α], IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b → ¬b ≤ a

theorem LE.le.not_incompRel E1 #

∀ {α : Type u_1} {a b : α} [inst : LE α], a ≤ b → ¬IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b

theorem IncompRel.not_lt E1 #

∀ {α : Type u_1} {a b : α} [inst : Preorder α], IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b → ¬a < b

theorem IncompRel.not_gt E1 #

∀ {α : Type u_1} {a b : α} [inst : Preorder α], IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b → ¬b < a

theorem LT.lt.not_incompRel E1 #

∀ {α : Type u_1} {a b : α} [inst : Preorder α], a < b → ¬IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b

theorem not_le_iff_lt_or_incompRel E1 #

∀ {α : Type u_1} {a b : α} [inst : Preorder α], ¬b ≤ a ↔ a < b ∨ IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b

theorem lt_or_antisymmRel_or_gt_or_incompRel E1 #

∀ {α : Type u_1} [inst : Preorder α] (a b : α),
  a < b ∨ AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) a b ∨ b < a ∨ IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b

Exactly one of the following is true.

theorem incompRel_of_incompRel_of_antisymmRel E1 #

∀ {α : Type u_1} {a b c : α} [inst : Preorder α],
  IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b → AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) b c → IncompRel (fun x1 x2 ↦ x1 ≤ x2) a c

theorem IncompRel.trans_antisymmRel E1 #

∀ {α : Type u_1} {a b c : α} [inst : Preorder α],
  IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b → AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) b c → IncompRel (fun x1 x2 ↦ x1 ≤ x2) a c

Alias of incompRel_of_incompRel_of_antisymmRel.

instance instTransIncompRelLeAntisymmRel E0 #

{α : Type u_1} →
  [inst : Preorder α] →
    Trans (IncompRel fun x1 x2 ↦ x1 ≤ x2) (AntisymmRel fun x1 x2 ↦ x1 ≤ x2) (IncompRel fun x1 x2 ↦ x1 ≤ x2)

theorem incompRel_of_antisymmRel_of_incompRel E1 #

∀ {α : Type u_1} {a b c : α} [inst : Preorder α],
  AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) a b → IncompRel (fun x1 x2 ↦ x1 ≤ x2) b c → IncompRel (fun x1 x2 ↦ x1 ≤ x2) a c

theorem AntisymmRel.trans_incompRel E1 #

∀ {α : Type u_1} {a b c : α} [inst : Preorder α],
  AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) a b → IncompRel (fun x1 x2 ↦ x1 ≤ x2) b c → IncompRel (fun x1 x2 ↦ x1 ≤ x2) a c

Alias of incompRel_of_antisymmRel_of_incompRel.

instance instTransAntisymmRelLeIncompRel E0 #

{α : Type u_1} →
  [inst : Preorder α] →
    Trans (AntisymmRel fun x1 x2 ↦ x1 ≤ x2) (IncompRel fun x1 x2 ↦ x1 ≤ x2) (IncompRel fun x1 x2 ↦ x1 ≤ x2)

theorem AntisymmRel.incompRel_congr E1 #

∀ {α : Type u_1} {a b c d : α} [inst : Preorder α],
  AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) a b →
    AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) c d → (IncompRel (fun x1 x2 ↦ x1 ≤ x2) a c ↔ IncompRel (fun x1 x2 ↦ x1 ≤ x2) b d)

theorem AntisymmRel.incompRel_congr_left E1 #

∀ {α : Type u_1} {a b c : α} [inst : Preorder α],
  AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) a b → (IncompRel (fun x1 x2 ↦ x1 ≤ x2) a c ↔ IncompRel (fun x1 x2 ↦ x1 ≤ x2) b c)

theorem AntisymmRel.incompRel_congr_right E1 #

∀ {α : Type u_1} {a b c : α} [inst : Preorder α],
  AntisymmRel (fun x1 x2 ↦ x1 ≤ x2) b c → (IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b ↔ IncompRel (fun x1 x2 ↦ x1 ≤ x2) a c)

theorem lt_or_eq_or_gt_or_incompRel E1 #

∀ {α : Type u_1} [inst : PartialOrder α] (a b : α), a < b ∨ a = b ∨ b < a ∨ IncompRel (fun x1 x2 ↦ x1 ≤ x2) a b

Exactly one of the following is true.