File: Mathlib/Order/Partition/Equipartition.lean

full_name: Finpartition.IsEquipartition
code: /-- An equipartition is a partition whose parts are all the same size, up to a difference of `1`. -/
def IsEquipartition : Prop 
goal: Prop

full_name: Finpartition.isEquipartition_iff_card_parts_eq_average
code: theorem isEquipartition_iff_card_parts_eq_average :
    P.IsEquipartition ↔
      ∀ a : Finset α,
        a ∈ P.parts → a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1 
goal: P.IsEquipartition ↔ ∀ a ∈ P.parts, a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1

full_name: Finpartition.not_isEquipartition
code: lemma not_isEquipartition :
    ¬P.IsEquipartition ↔ ∃ a ∈ P.parts, ∃ b ∈ P.parts, b.card + 1 < a.card 
goal: ¬P.IsEquipartition ↔ ∃ a ∈ P.parts, ∃ b ∈ P.parts, b.card + 1 < a.card

full_name: Set.Subsingleton.isEquipartition
code: theorem _root_.Set.Subsingleton.isEquipartition (h : (P.parts : Set (Finset α)).Subsingleton) :
    P.IsEquipartition 
goal: P.IsEquipartition

full_name: Finpartition.IsEquipartition.card_parts_eq_average
code: theorem IsEquipartition.card_parts_eq_average (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
    t.card = s.card / P.parts.card ∨ t.card = s.card / P.parts.card + 1 
goal: t.card = s.card / P.parts.card ∨ t.card = s.card / P.parts.card + 1

full_name: Finpartition.IsEquipartition.card_part_eq_average_iff
code: theorem IsEquipartition.card_part_eq_average_iff (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
    t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1 
goal: t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1

full_name: Finpartition.IsEquipartition.average_le_card_part
code: theorem IsEquipartition.average_le_card_part (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
    s.card / P.parts.card ≤ t.card 
goal: s.card / P.parts.card ≤ t.card

full_name: Finpartition.IsEquipartition.card_part_le_average_add_one
code: theorem IsEquipartition.card_part_le_average_add_one (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
    t.card ≤ s.card / P.parts.card + 1 
goal: t.card ≤ s.card / P.parts.card + 1

full_name: Finpartition.IsEquipartition.filter_ne_average_add_one_eq_average
code: theorem IsEquipartition.filter_ne_average_add_one_eq_average (hP : P.IsEquipartition) :
    P.parts.filter (fun p ↦ ¬p.card = s.card / P.parts.card + 1) =
    P.parts.filter (fun p ↦ p.card = s.card / P.parts.card) 
goal: Finset.filter (fun p => ¬p.card = s.card / P.parts.card + 1) P.parts =
  Finset.filter (fun p => p.card = s.card / P.parts.card) P.parts

full_name: Finpartition.IsEquipartition.card_large_parts_eq_mod
code: /-- An equipartition of a finset with `n` elements into `k` parts has
`n % k` parts of size `n / k + 1`. -/
theorem IsEquipartition.card_large_parts_eq_mod (hP : P.IsEquipartition) :
    (P.parts.filter fun p ↦ p.card = s.card / P.parts.card + 1).card = s.card % P.parts.card 
goal: (Finset.filter (fun p => p.card = s.card / P.parts.card + 1) P.parts).card = s.card % P.parts.card

full_name: Finpartition.IsEquipartition.card_small_parts_eq_mod
code: /-- An equipartition of a finset with `n` elements into `k` parts has
`n - n % k` parts of size `n / k`. -/
theorem IsEquipartition.card_small_parts_eq_mod (hP : P.IsEquipartition) :
    (P.parts.filter fun p ↦ p.card = s.card / P.parts.card).card =
    P.parts.card - s.card % P.parts.card 
goal: (Finset.filter (fun p => p.card = s.card / P.parts.card) P.parts).card = P.parts.card - s.card % P.parts.card

full_name: Finpartition.IsEquipartition.exists_partsEquiv
code: /-- There exists an enumeration of an equipartition's parts where
larger parts map to smaller numbers and vice versa. -/
theorem IsEquipartition.exists_partsEquiv (hP : P.IsEquipartition) :
    ∃ f : P.parts ≃ Fin P.parts.card,
      ∀ t, t.1.card = s.card / P.parts.card + 1 ↔ f t < s.card % P.parts.card 
goal: ∃ f, ∀ (t : { x // x ∈ P.parts }), (↑t).card = s.card / P.parts.card + 1 ↔ ↑(f t) < s.card % P.parts.card

full_name: Finpartition.IsEquipartition.exists_partPreservingEquiv
code: /-- Given a finset equipartitioned into `k` parts, its elements can be enumerated such that
elements in the same part have congruent indices modulo `k`. -/
theorem IsEquipartition.exists_partPreservingEquiv (hP : P.IsEquipartition) : ∃ f : s ≃ Fin s.card,
    ∀ a b : s, P.part a = P.part b ↔ f a % P.parts.card = f b % P.parts.card 
goal: ∃ f, ∀ (a b : { x // x ∈ s }), P.part ↑a = P.part ↑b ↔ ↑(f a) % P.parts.card = ↑(f b) % P.parts.card

full_name: Finpartition.bot_isEquipartition
code: theorem bot_isEquipartition : (⊥ : Finpartition s).IsEquipartition 
goal: ⊥.IsEquipartition

full_name: Finpartition.top_isEquipartition
code: theorem top_isEquipartition [Decidable (s = ⊥)] : (⊤ : Finpartition s).IsEquipartition 
goal: ⊤.IsEquipartition

full_name: Finpartition.indiscrete_isEquipartition
code: theorem indiscrete_isEquipartition {hs : s ≠ ∅} : (indiscrete hs).IsEquipartition 
goal: (Finpartition.indiscrete hs).IsEquipartition