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 / V03. Sets, finite structures and big operators

Mathlib.Data.Fintype.Order

49 declarations. Mathlib docs · Source

Order structures on finite types

This file provides order instances on fintypes.

Computable instances

On a Fintype, we can construct

  • an OrderBot from SemilatticeInf.
  • an OrderTop from SemilatticeSup.
  • a BoundedOrder from Lattice.

Those are marked as def to avoid issues with defeq.

Completion instances

Those instances are noncomputable because the definitions of sSup and sInf use Set.toFinset and set membership is undecidable in general.

On a Fintype, we can promote:

  • a Lattice to a CompleteLattice.
  • a DistribLattice to a CompleteDistribLattice.
  • a LinearOrder to a CompleteLinearOrder.
  • a BooleanAlgebra to a CompleteAtomicBooleanAlgebra.

Those are marked as def to avoid typeclass loops.

Concrete instances

We provide a few instances for concrete types:

  • Fin.completeLinearOrder
  • Bool.completeLinearOrder
  • Bool.completeBooleanAlgebra

Concrete instances

Directed Orders

Suprema and infima over finite types

We state simplified versions of le_ciSup_if_le and ciSup_mono when the indexing type is finite. This avoids having to explicitly use Finite.bddAbove_range.

Similarly for ciInf.

abbrev Fintype.toOrderBot E1 #

(α : Type u_1) → [Fintype α] → [Nonempty α] → [inst : SemilatticeInf α] → OrderBot α

Constructs the ⊥ of a finite nonempty SemilatticeInf.

abbrev Fintype.toOrderTop E1 #

(α : Type u_1) → [Fintype α] → [Nonempty α] → [inst : SemilatticeSup α] → OrderTop α

Constructs the ⊤ of a finite nonempty SemilatticeSup

abbrev Fintype.toBoundedOrder E1 #

(α : Type u_1) → [Fintype α] → [Nonempty α] → [inst : Lattice α] → BoundedOrder α

Constructs the ⊤ and ⊥ of a finite nonempty Lattice.

abbrev Fintype.toCompleteLattice E1 #

(α : Type u_1) → [Fintype α] → [inst : Lattice α] → [BoundedOrder α] → CompleteLattice α

A finite bounded lattice is complete.

abbrev Fintype.toCompleteDistribLatticeMinimalAxioms E1 #

∀ (α : Type u_1) [inst : Fintype α] [inst_1 : DistribLattice α] [inst_2 : BoundedOrder α],
  CompleteDistribLattice.MinimalAxioms α

A finite bounded distributive lattice is completely distributive.

abbrev Fintype.toCompleteDistribLattice E1 #

(α : Type u_1) → [Fintype α] → [inst : DistribLattice α] → [BoundedOrder α] → CompleteDistribLattice α

A finite bounded distributive lattice is completely distributive.

abbrev Fintype.toCompleteLinearOrder E1 #

(α : Type u_1) → [Fintype α] → [inst : LinearOrder α] → [BoundedOrder α] → CompleteLinearOrder α

A finite bounded linear order is complete.

If the α is already a BiheytingAlgebra, then prefer to construct this instance manually using Fintype.toCompleteLattice instead, to avoid creating a diamond with LinearOrder.toBiheytingAlgebra.

abbrev Fintype.toCompleteBooleanAlgebra E1 #

(α : Type u_1) → [Fintype α] → [BooleanAlgebra α] → CompleteBooleanAlgebra α

A finite Boolean algebra is complete.

abbrev Fintype.toCompleteAtomicBooleanAlgebra E1 #

(α : Type u_1) → [Fintype α] → [BooleanAlgebra α] → CompleteAtomicBooleanAlgebra α

A finite Boolean algebra is complete and atomic.

abbrev Fintype.toCompleteLatticeOfNonempty E1 #

(α : Type u_1) → [Fintype α] → [Nonempty α] → [Lattice α] → CompleteLattice α

A nonempty finite lattice is complete. If the lattice is already a BoundedOrder, then use Fintype.toCompleteLattice instead, as this gives definitional equality for ⊥ and ⊤.

abbrev Fintype.toCompleteLinearOrderOfNonempty E1 #

(α : Type u_1) → [Fintype α] → [Nonempty α] → [LinearOrder α] → CompleteLinearOrder α

A nonempty finite linear order is complete. If the linear order is already a BoundedOrder, then use Fintype.toCompleteLinearOrder instead, as this gives definitional equality for ⊥ and ⊤.

instance Fin.completeLinearOrder E0 #

{n : ℕ} → [NeZero n] → CompleteLinearOrder (Fin n)

instance Bool.completeBooleanAlgebra E0 #

CompleteBooleanAlgebra Bool

instance Bool.completeLinearOrder E0 #

CompleteLinearOrder Bool

instance Bool.completeAtomicBooleanAlgebra E0 #

CompleteAtomicBooleanAlgebra Bool

theorem Directed.finite_set_le E1 #

∀ {α : Type u_2} {r : α → α → Prop} [IsTrans α r] {γ : Type u_3} [Nonempty γ] {f : γ → α},
  Directed r f → ∀ {s : Set γ}, s.Finite → ∃ z, ∀ i ∈ s, r (f i) (f z)

theorem Directed.finite_le E1 #

∀ {α : Type u_2} {r : α → α → Prop} [IsTrans α r] {ι : Sort u_4} {κ : Sort u_5} [Nonempty ι] [Finite κ] {f : ι → α},
  Directed r f → ∀ (g : κ → ι), ∃ z, ∀ (i : κ), r (f (g i)) (f z)

theorem Finite.exists_le E1 #

∀ {ι : Sort u_1} {α : Type u_2} [Finite ι] [Nonempty α] [inst : Preorder α] [IsDirectedOrder α] (f : ι → α),
  ∃ M, ∀ (i : ι), f i ≤ M

theorem Finite.exists_ge E1 #

∀ {ι : Sort u_1} {α : Type u_2} [Finite ι] [Nonempty α] [inst : Preorder α] [IsCodirectedOrder α] (f : ι → α),
  ∃ M, ∀ (i : ι), M ≤ f i

theorem Set.Finite.exists_le E1 #

∀ {α : Type u_2} [Nonempty α] [inst : Preorder α] [IsDirectedOrder α] {s : Set α}, s.Finite → ∃ M, ∀ i ∈ s, i ≤ M

theorem Set.Finite.exists_ge E1 #

∀ {α : Type u_2} [Nonempty α] [inst : Preorder α] [IsCodirectedOrder α] {s : Set α}, s.Finite → ∃ M, ∀ i ∈ s, M ≤ i

theorem Finite.bddAbove_range E0 #

∀ {ι : Sort u_1} {α : Type u_2} [Finite ι] [Nonempty α] [inst : Preorder α] [IsDirectedOrder α] (f : ι → α),
  BddAbove (Set.range f)

theorem Finite.bddBelow_range E0 #

∀ {ι : Sort u_1} {α : Type u_2} [Finite ι] [Nonempty α] [inst : Preorder α] [IsCodirectedOrder α] (f : ι → α),
  BddBelow (Set.range f)

theorem le_iSup_iff_of_directed E1 #

∀ {ι : Sort u_1} {α : Type u_2} [inst : CompleteLattice α] {a : α} {f : ι → α} [Nonempty ι] [Finite ι],
  Directed (fun x1 x2 ↦ x1 ≤ x2) f → (a ≤ ⨆ i, f i ↔ ∃ i, a ≤ f i)

theorem le_sSup_iff_of_directedOn E1 #

∀ {α : Type u_2} [inst : CompleteLattice α] {s : Set α} {a : α},
  s.Nonempty → s.Finite → DirectedOn (fun x1 x2 ↦ x1 ≤ x2) s → (a ≤ sSup s ↔ ∃ b ∈ s, a ≤ b)

theorem Set.subset_iUnion_iff_of_directed E1 #

∀ {ι : Sort u_1} {α : Type u_2} {s : Set α} {f : ι → Set α} [Nonempty ι] [Finite ι],
  Directed (fun x1 x2 ↦ x1 ⊆ x2) f → (s ⊆ ⋃ i, f i ↔ ∃ i, s ⊆ f i)

theorem Set.subset_sUnion_iff_of_directed E1 #

∀ {α : Type u_2} {S : Set (Set α)} {s : Set α},
  S.Nonempty → S.Finite → DirectedOn (fun x1 x2 ↦ x1 ⊆ x2) S → (s ⊆ sSup S ↔ ∃ t ∈ S, s ⊆ t)

theorem Finite.le_ciSup_of_le E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] {a : α} {f : ι → α} (c : ι),
  a ≤ f c → a ≤ iSup f

theorem Finite.ciInf_le_of_le E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] {a : α} {f : ι → α} (c : ι),
  f c ≤ a → iInf f ≤ a

theorem Finite.ciSup_mono E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] {f g : ι → α},
  (∀ (x : ι), f x ≤ g x) → iSup f ≤ iSup g

theorem Finite.ciInf_mono E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] {f g : ι → α},
  (∀ (x : ι), f x ≤ g x) → iInf f ≤ iInf g

theorem Finite.le_ciSup E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] (f : ι → α) (i : ι), f i ≤ ⨆ j, f j

theorem Finite.ciInf_le E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] (f : ι → α) (i : ι), ⨅ j, f j ≤ f i

theorem Finite.ciSup_sup E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] [Nonempty ι] {f : ι → α} {a : α},
  (⨆ i, f i) ⊔ a = ⨆ i, f i ⊔ a

theorem Finite.ciInf_inf E1 #

∀ {α : Type u_1} {ι : Type u_2} [Finite ι] [inst : ConditionallyCompleteLattice α] [Nonempty ι] {f : ι → α} {a : α},
  (⨅ i, f i) ⊓ a = ⨅ i, f i ⊓ a

theorem Finite.ciSup_prod E1 #

∀ {α : Type u_1} {ι : Type u_2} {ι' : Type u_3} [Finite ι] [Finite ι'] [inst : ConditionallyCompleteLattice α]
  (f : ι × ι' → α), ⨆ a, f a = ⨆ i, ⨆ i', f (i, i')

theorem Finite.ciInf_prod E1 #

∀ {α : Type u_1} {ι : Type u_2} {ι' : Type u_3} [Finite ι] [Finite ι'] [inst : ConditionallyCompleteLattice α]
  (f : ι × ι' → α), ⨅ a, f a = ⨅ i, ⨅ i', f (i, i')

theorem Finite.map_iSup_of_monotoneOn E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] {s : Set α} {f : ι → α} {g : α → β},
  MonotoneOn g s → (∀ (i : ι), f i ∈ s) → g (⨆ i, f i) = ⨆ i, g (f i)

theorem Finite.map_iInf_of_monotoneOn E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] {s : Set α} {f : ι → α} {g : α → β},
  MonotoneOn g s → (∀ (i : ι), f i ∈ s) → g (⨅ i, f i) = ⨅ i, g (f i)

theorem Finite.map_iSup_of_antitoneOn E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] {s : Set α} {f : ι → α} {g : α → β},
  AntitoneOn g s → (∀ (i : ι), f i ∈ s) → g (⨆ i, f i) = ⨅ i, g (f i)

theorem Finite.map_iInf_of_antitoneOn E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] {s : Set α} {f : ι → α} {g : α → β},
  AntitoneOn g s → (∀ (i : ι), f i ∈ s) → g (⨅ i, f i) = ⨆ i, g (f i)

theorem Finite.map_iSup_of_monotone E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] (f : ι → α) {g : α → β},
  Monotone g → g (⨆ i, f i) = ⨆ i, g (f i)

theorem Finite.map_iInf_of_monotone E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] (f : ι → α) {g : α → β},
  Monotone g → g (⨅ i, f i) = ⨅ i, g (f i)

theorem Finite.map_iSup_of_antitone E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] (f : ι → α) {g : α → β},
  Antitone g → g (⨆ i, f i) = ⨅ i, g (f i)

theorem Finite.map_iInf_of_antitone E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α]
  [inst_1 : ConditionallyCompleteLattice β] [Finite ι] [Nonempty ι] (f : ι → α) {g : α → β},
  Antitone g → g (⨅ i, f i) = ⨆ i, g (f i)

theorem Finite.le_ciSup_iff E0 #

∀ {α : Type u_1} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α] [Finite ι] [Nonempty ι] {a : α} {f : ι → α},
  a ≤ ⨆ i, f i ↔ ∃ x, a ≤ f x

theorem Finite.ciInf_le_iff E0 #

∀ {α : Type u_1} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α] [Finite ι] [Nonempty ι] {a : α} {f : ι → α},
  ⨅ i, f i ≤ a ↔ ∃ x, f x ≤ a

theorem Finite.lt_ciInf_iff E0 #

∀ {α : Type u_1} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α] [Finite ι] [Nonempty ι] {a : α} {f : ι → α},
  a < ⨅ i, f i ↔ ∀ (x : ι), a < f x

theorem Finite.ciSup_lt_iff E0 #

∀ {α : Type u_1} {ι : Type u_3} [inst : ConditionallyCompleteLinearOrder α] [Finite ι] [Nonempty ι] {a : α} {f : ι → α},
  ⨆ i, f i < a ↔ ∀ (x : ι), f x < a