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.Setoid.Partition

80 declarations. Mathlib docs · Source

Equivalence relations: partitions

This file comprises properties of equivalence relations viewed as partitions. There are two implementations of partitions here:

  • A collection c : Set (Set α) of sets is a partition of α if ∅ ∉ c and each element a : α belongs to a unique set b ∈ c. This is expressed as IsPartition c
  • An indexed partition is a map s : ι → Set α whose image is a partition. This is expressed as IndexedPartition s.

Of course both implementations are related to Quotient and Setoid.

Setoid.isPartition.partition and Finpartition.isPartition_parts furnish a link between Setoid.IsPartition and Finpartition.

TODO

Could the design of Finpartition inform the one of Setoid.IsPartition? Maybe bundling it and changing it from Set (Set α) to Set α where [Lattice α] [OrderBot α] would make it more usable.

Tags

setoid, equivalence, iseqv, relation, equivalence relation, partition, equivalence class

def IndexedPartition.ctorIdx E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → IndexedPartition s → ℕ

theorem IndexedPartition.mk.injEq E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (eq_of_mem : ∀ {x : α} {i j : ι}, x ∈ s i → x ∈ s j → i = j)
  (some : ι → α) (some_mem : ∀ (i : ι), some i ∈ s i) (index : α → ι) (mem_index : ∀ (x : α), x ∈ s (index x))
  (eq_of_mem_1 : ∀ {x : α} {i j : ι}, x ∈ s i → x ∈ s j → i = j) (some_1 : ι → α)
  (some_mem_1 : ∀ (i : ι), some_1 i ∈ s i) (index_1 : α → ι) (mem_index_1 : ∀ (x : α), x ∈ s (index_1 x)),
  ({ eq_of_mem := eq_of_mem, some := some, some_mem := some_mem, index := index, mem_index := mem_index } =
      { eq_of_mem := eq_of_mem_1, some := some_1, some_mem := some_mem_1, index := index_1,
        mem_index := mem_index_1 }) =
    (some = some_1 ∧ index = index_1)

theorem IndexedPartition.mk.inj E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} {eq_of_mem : ∀ {x : α} {i j : ι}, x ∈ s i → x ∈ s j → i = j}
  {some : ι → α} {some_mem : ∀ (i : ι), some i ∈ s i} {index : α → ι} {mem_index : ∀ (x : α), x ∈ s (index x)}
  {eq_of_mem_1 : ∀ {x : α} {i j : ι}, x ∈ s i → x ∈ s j → i = j} {some_1 : ι → α}
  {some_mem_1 : ∀ (i : ι), some_1 i ∈ s i} {index_1 : α → ι} {mem_index_1 : ∀ (x : α), x ∈ s (index_1 x)},
  { eq_of_mem := eq_of_mem, some := some, some_mem := some_mem, index := index, mem_index := mem_index } =
      { eq_of_mem := eq_of_mem_1, some := some_1, some_mem := some_mem_1, index := index_1, mem_index := mem_index_1 } →
    some = some_1 ∧ index = index_1

def Setoid.mkClasses E1 #

{α : Type u_1} → (c : Set (Set α)) → (∀ (a : α), ∃! b, b ∈ c ∧ a ∈ b) → Setoid α

Makes an equivalence relation from a set of sets partitioning α.

def Setoid.classes E1 #

{α : Type u_1} → Setoid α → Set (Set α)

Makes the equivalence classes of an equivalence relation.

theorem Setoid.mem_classes E0 #

∀ {α : Type u_1} (r : Setoid α) (y : α), {x | r x y} ∈ r.classes

theorem Setoid.classes_ker_subset_fiber_set E1 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β), (Setoid.ker f).classes ⊆ Set.range fun y ↦ {x | f x = y}

theorem Setoid.finite_classes_ker E1 #

∀ {α : Type u_2} {β : Type u_3} [Finite β] (f : α → β), (Setoid.ker f).classes.Finite

theorem Setoid.card_classes_ker_le E1 #

∀ {α : Type u_2} {β : Type u_3} [inst : Fintype β] (f : α → β) [inst_1 : Fintype ↑(Setoid.ker f).classes],
  Fintype.card ↑(Setoid.ker f).classes ≤ Fintype.card β

theorem Setoid.rel_iff_exists_classes E1 #

∀ {α : Type u_1} (r : Setoid α) {x y : α}, r x y ↔ ∃ c ∈ r.classes, x ∈ c ∧ y ∈ c

theorem Setoid.classes_inj E1 #

∀ {α : Type u_1} {r₁ r₂ : Setoid α}, r₁ = r₂ ↔ r₁.classes = r₂.classes

Two equivalence relations are equal iff their equivalence classes are equal.

theorem Setoid.empty_notMem_classes E1 #

∀ {α : Type u_1} {r : Setoid α}, ∅ ∉ r.classes

The empty set is not an equivalence class.

theorem Setoid.classes_eqv_classes E1 #

∀ {α : Type u_1} {r : Setoid α} (a : α), ∃! b, b ∈ r.classes ∧ a ∈ b

Equivalence classes partition the type.

theorem Setoid.eqv_class_mem E1 #

∀ {α : Type u_1} {c : Set (Set α)} (H : ∀ (a : α), ∃! b, b ∈ c ∧ a ∈ b) {y : α}, {x | (Setoid.mkClasses c H) x y} ∈ c

The equivalence classes of the equivalence relation defined by a set of sets partitioning α are elements of the set of sets.

theorem Setoid.eqv_class_mem' E1 #

∀ {α : Type u_1} {c : Set (Set α)} (H : ∀ (a : α), ∃! b, b ∈ c ∧ a ∈ b) {x : α}, {y | (Setoid.mkClasses c H) x y} ∈ c

theorem Setoid.eqv_classes_disjoint E1 #

∀ {α : Type u_1} {c : Set (Set α)}, (∀ (a : α), ∃! b, b ∈ c ∧ a ∈ b) → c.PairwiseDisjoint id

Distinct elements of a set of sets partitioning α are disjoint.

theorem Setoid.eqv_classes_of_disjoint_union E1 #

∀ {α : Type u_1} {c : Set (Set α)}, ⋃₀ c = Set.univ → c.PairwiseDisjoint id → ∀ (a : α), ∃! b, b ∈ c ∧ a ∈ b

A set of disjoint sets covering α partition α (classical).

def Setoid.setoidOfDisjointUnion E1 #

{α : Type u_1} → {c : Set (Set α)} → ⋃₀ c = Set.univ → c.PairwiseDisjoint id → Setoid α

Makes an equivalence relation from a set of disjoints sets covering α.

theorem Setoid.mkClasses_classes E1 #

∀ {α : Type u_1} (r : Setoid α), Setoid.mkClasses r.classes ⋯ = r

The equivalence relation made from the equivalence classes of an equivalence relation r equals r.

theorem Setoid.sUnion_classes E0 #

∀ {α : Type u_1} (r : Setoid α), ⋃₀ r.classes = Set.univ

def Setoid.quotientEquivClasses E1 #

{α : Type u_1} → (r : Setoid α) → Quotient r ≃ ↑r.classes

The equivalence between the quotient by an equivalence relation and its type of equivalence classes.

theorem Setoid.quotientEquivClasses_mk_eq E0 #

∀ {α : Type u_1} (r : Setoid α) (a : α), ↑(r.quotientEquivClasses ⟦a⟧) = {x | r x a}

def Setoid.IsPartition E1 #

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

A collection c : Set (Set α) of sets is a partition of α into pairwise disjoint sets if ∅ ∉ c and each element a : α belongs to a unique set b ∈ c.

theorem Setoid.nonempty_of_mem_partition E1 #

∀ {α : Type u_1} {c : Set (Set α)}, Setoid.IsPartition c → ∀ {s : Set α}, s ∈ c → s.Nonempty

A partition of α does not contain the empty set.

theorem Setoid.isPartition_classes E1 #

∀ {α : Type u_1} (r : Setoid α), Setoid.IsPartition r.classes

theorem Setoid.IsPartition.pairwiseDisjoint E1 #

∀ {α : Type u_1} {c : Set (Set α)}, Setoid.IsPartition c → c.PairwiseDisjoint id

theorem Set.PairwiseDisjoint.isPartition_of_exists_of_ne_empty E1 #

∀ {α : Type u_2} {s : Set (Set α)}, s.PairwiseDisjoint id → (∀ (a : α), ∃ x ∈ s, a ∈ x) → ∅ ∉ s → Setoid.IsPartition s

theorem Setoid.IsPartition.sUnion_eq_univ E1 #

∀ {α : Type u_1} {c : Set (Set α)}, Setoid.IsPartition c → ⋃₀ c = Set.univ

theorem Setoid.exists_of_mem_partition E1 #

∀ {α : Type u_1} {c : Set (Set α)} (hc : Setoid.IsPartition c) {s : Set α},
  s ∈ c → ∃ y, s = {x | (Setoid.mkClasses c ⋯) x y}

All elements of a partition of α are the equivalence class of some y ∈ α.

theorem Setoid.classes_mkClasses E1 #

∀ {α : Type u_1} (c : Set (Set α)) (hc : Setoid.IsPartition c), (Setoid.mkClasses c ⋯).classes = c

The equivalence classes of the equivalence relation defined by a partition of α equal the original partition.

def Setoid.Partitions E1 #

Type u_2 → Type u_2

The subtype of partitions of a type, endowed with the canonical order on partitions.

def Setoid.Partitions.toSet E1 #

{α : Type u_1} → Setoid.Partitions α → Set (Set α)

Interpreting an element of Partitions α as a set of sets.

theorem Setoid.Partitions.ext_iff E0 #

∀ {α : Type u_1} (p q : Setoid.Partitions α), p = q ↔ p.toSet = q.toSet

theorem Setoid.Partitions.isPartition E1 #

∀ {α : Type u_1} (p : Setoid.Partitions α), Setoid.IsPartition p.toSet

instance Setoid.Partition.le E0 #

{α : Type u_1} → LE (Setoid.Partitions α)

Defining ≤ on partitions as the ≤ defined on their induced equivalence relations.

instance Setoid.Partition.partialOrder E0 #

{α : Type u_1} → PartialOrder (Setoid.Partitions α)

Defining a partial order on partitions as the partial order on their induced equivalence relations.

def Setoid.Partition.orderIso E1 #

(α : Type u_1) → Setoid α ≃o Setoid.Partitions α

The order-preserving bijection between equivalence relations on a type α, and partitions of α into subsets.

instance Setoid.Partition.completeLattice E0 #

{α : Type u_1} → CompleteLattice (Setoid.Partitions α)

A complete lattice instance for partitions; there is more infrastructure for the equivalent complete lattice on equivalence relations.

def Setoid.IsPartition.finpartition E1 #

{α : Type u_1} → {c : Finset (Set α)} → Setoid.IsPartition ↑c → Finpartition Set.univ

A finite setoid partition furnishes a finpartition

theorem Setoid.IsPartition.finpartition_parts E0 #

∀ {α : Type u_1} {c : Finset (Set α)} (hc : Setoid.IsPartition ↑c), hc.finpartition.parts = c

theorem Finpartition.isPartition_parts E1 #

∀ {α : Type u_1} (f : Finpartition Set.univ), Setoid.IsPartition ↑f.parts

A finpartition gives rise to a setoid partition

structure IndexedPartition E1 #

{ι : Type u_1} → {α : Type u_2} → (ι → Set α) → Type (max u_1 u_2)

Constructive information associated with a partition of a type α indexed by another type ι, s : ι → Set α.

IndexedPartition.index sends an element to its index, while IndexedPartition.some sends an index to an element of the corresponding set.

This type is primarily useful for definitional control of s - if this is not needed, then Setoid.ker index by itself may be sufficient.

ctor IndexedPartition.mk E0 #

{ι : Type u_1} →
  {α : Type u_2} →
    {s : ι → Set α} →
      (∀ {x : α} {i j : ι}, x ∈ s i → x ∈ s j → i = j) →
        (some : ι → α) → (∀ (i : ι), some i ∈ s i) → (index : α → ι) → (∀ (x : α), x ∈ s (index x)) → IndexedPartition s

abbrev IndexedPartition.some E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → IndexedPartition s → ι → α

sends an index to an element of the corresponding set

theorem IndexedPartition.some_mem E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (self : IndexedPartition s) (i : ι), self.some i ∈ s i

membership invariance for some

abbrev IndexedPartition.index E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → IndexedPartition s → α → ι

index for type α

theorem IndexedPartition.mem_index E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (self : IndexedPartition s) (x : α), x ∈ s (self.index x)

membership invariance for index

def IndexedPartition.mk' E1 #

{ι : Type u_1} →
  {α : Type u_2} →
    (s : ι → Set α) →
      Pairwise (Function.onFun Disjoint s) →
        (∀ (i : ι), (s i).Nonempty) → (∀ (x : α), ∃ i, x ∈ s i) → IndexedPartition s

The non-constructive constructor for IndexedPartition.

instance IndexedPartition.instInhabitedUnivOfUnique E0 #

{ι : Type u_1} → {α : Type u_2} → [Unique ι] → [Inhabited α] → Inhabited (IndexedPartition fun _i ↦ Set.univ)

On a unique index set there is the obvious trivial partition

theorem IndexedPartition.exists_mem E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : α), ∃ i, x ∈ s i

theorem IndexedPartition.iUnion E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s), ⋃ i, s i = Set.univ

theorem IndexedPartition.disjoint E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s), Pairwise (Function.onFun Disjoint s)

theorem IndexedPartition.mem_iff_index_eq E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {x : α} {i : ι}, x ∈ s i ↔ hs.index x = i

theorem IndexedPartition.eq E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (i : ι), s i = {x | hs.index x = i}

abbrev IndexedPartition.setoid E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → IndexedPartition s → Setoid α

The equivalence relation associated to an indexed partition. Two elements are equivalent if they belong to the same set of the partition.

theorem IndexedPartition.index_some E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (i : ι), hs.index (hs.some i) = i

theorem IndexedPartition.some_index E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : α), hs.setoid (hs.some (hs.index x)) x

def IndexedPartition.Quotient E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → IndexedPartition s → Type u_2

The quotient associated to an indexed partition.

def IndexedPartition.proj E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → (hs : IndexedPartition s) → α → hs.Quotient

The projection onto the quotient associated to an indexed partition.

instance IndexedPartition.instInhabitedQuotient E0 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → (hs : IndexedPartition s) → [Inhabited α] → Inhabited hs.Quotient

theorem IndexedPartition.proj_eq_iff E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {x y : α},
  hs.proj x = hs.proj y ↔ hs.index x = hs.index y

theorem IndexedPartition.proj_some_index E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : α),
  hs.proj (hs.some (hs.index x)) = hs.proj x

def IndexedPartition.equivQuotient E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → (hs : IndexedPartition s) → ι ≃ hs.Quotient

The obvious equivalence between the quotient associated to an indexed partition and the indexing type.

theorem IndexedPartition.equivQuotient_index_apply E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : α),
  hs.equivQuotient (hs.index x) = hs.proj x

theorem IndexedPartition.equivQuotient_symm_proj_apply E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : α),
  hs.equivQuotient.symm (hs.proj x) = hs.index x

theorem IndexedPartition.equivQuotient_index E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s), ⇑hs.equivQuotient ∘ hs.index = hs.proj

def IndexedPartition.out E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → (hs : IndexedPartition s) → hs.Quotient ↪ α

A map choosing a representative for each element of the quotient associated to an indexed partition. This is a computable version of Quotient.out using IndexedPartition.some.

theorem IndexedPartition.out_proj E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : α),
  hs.out (hs.proj x) = hs.some (hs.index x)

This lemma is analogous to Quotient.mk_out'.

theorem IndexedPartition.index_out E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : hs.Quotient),
  hs.index (Quotient.out x) = hs.index (hs.out x)

The indices of Quotient.out and IndexedPartition.out are equal.

theorem IndexedPartition.proj_out E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : hs.Quotient), hs.proj (hs.out x) = x

This lemma is analogous to Quotient.out_eq'.

theorem IndexedPartition.class_of E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {x : α},
  Set.ofPred (hs.setoid x) = s (hs.index x)

theorem IndexedPartition.proj_fiber E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) (x : hs.Quotient),
  hs.proj ⁻¹' {x} = s (hs.equivQuotient.symm x)

def IndexedPartition.piecewise E1 #

{ι : Type u_1} → {α : Type u_2} → {s : ι → Set α} → IndexedPartition s → {β : Type u_3} → (ι → α → β) → α → β

Combine functions with disjoint domains into a new function. You can use the regular expression def.*piecewise to search for other ways to define piecewise functions in mathlib4.

theorem IndexedPartition.piecewise_apply E0 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {β : Type u_3} {f : ι → α → β} (x : α),
  hs.piecewise f x = f (hs.index x) x

theorem IndexedPartition.piecewise_inj E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {β : Type u_3} {f : ι → α → β},
  (∀ (i : ι), Set.InjOn (f i) (s i)) →
    (Set.univ.PairwiseDisjoint fun i ↦ f i '' s i) → Function.Injective (hs.piecewise f)

A family of injective functions with pairwise disjoint domains and pairwise disjoint ranges can be glued together to form an injective function.

theorem IndexedPartition.piecewise_bij E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {β : Type u_3} {f : ι → α → β} {t : ι → Set β}
  (ht : IndexedPartition t), (∀ (i : ι), Set.BijOn (f i) (s i) (t i)) → Function.Bijective (hs.piecewise f)

A family of bijective functions with pairwise disjoint domains and pairwise disjoint ranges can be glued together to form a bijective function.

theorem IndexedPartition.piecewise_preimage E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {β : Type u_3} (f : ι → α → β) (t : Set β),
  hs.piecewise f ⁻¹' t = ⋃ i, s i ∩ f i ⁻¹' t

theorem IndexedPartition.range_piecewise E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {β : Type u_3} (f : ι → α → β),
  Set.range (hs.piecewise f) = ⋃ i, f i '' s i

theorem IndexedPartition.range_piecewise_subset E1 #

∀ {ι : Type u_1} {α : Type u_2} {s : ι → Set α} (hs : IndexedPartition s) {β : Type u_3} (f : ι → α → β),
  Set.range (hs.piecewise f) ⊆ ⋃ i, Set.range (f i)

def IndexedPartition.coarserPartition E1 #

{ι : Type u_1} →
  {α : Type u_2} →
    {s : ι → Set α} →
      IndexedPartition s →
        {κ : Type u_4} → (g : ι → κ) → Function.Surjective g → IndexedPartition fun k ↦ ⋃ i ∈ g ⁻¹' {k}, s i

Given a collections of sets s : ι → Set α that forms an indexed partition, we can group some of the sets to obtain a coarser partition.