File: Mathlib/Order/Partition/Finpartition.lean

full_name: Finpartition.supIndep
code: /-- A finite partition of `a : α` is a pairwise disjoint finite set of elements whose supremum is
`a`. We forbid `⊥` as a part. -/
@[ext]
structure Finpartition [Lattice α] [OrderBot α] (a : α) where
  -- Porting note: Docstrings added
  /-- The elements of the finite partition of `a` -/
  parts : Finset α
  /-- The partition is supremum-independent -/
  supIndep : parts.SupIndep id
  /-- The supremum of the partition is `a` -/
  sup_parts : parts.sup id = a
  /-- No element of the partition is bottom-/
  not_bot_mem : ⊥ ∉ parts
  deriving DecidableEq
goal: self.parts.SupIndep id

full_name: Finpartition
code: /-- A finite partition of `a : α` is a pairwise disjoint finite set of elements whose supremum is
`a`. We forbid `⊥` as a part. -/
@[ext]
structure Finpartition [Lattice α] [OrderBot α] (a : α) where
  -- Porting note: Docstrings added
  /-- The elements of the finite partition of `a` -/
  parts : Finset α
  /-- The partition is supremum-independent -/
  supIndep : parts.SupIndep id
  /-- The supremum of the partition is `a` -/
  sup_parts : parts.sup id = a
  /-- No element of the partition is bottom-/
  not_bot_mem : ⊥ ∉ parts
  deriving DecidableEq
goal: Type u_1

full_name: Finpartition.sup_parts
code: /-- A finite partition of `a : α` is a pairwise disjoint finite set of elements whose supremum is
`a`. We forbid `⊥` as a part. -/
@[ext]
structure Finpartition [Lattice α] [OrderBot α] (a : α) where
  -- Porting note: Docstrings added
  /-- The elements of the finite partition of `a` -/
  parts : Finset α
  /-- The partition is supremum-independent -/
  supIndep : parts.SupIndep id
  /-- The supremum of the partition is `a` -/
  sup_parts : parts.sup id = a
  /-- No element of the partition is bottom-/
  not_bot_mem : ⊥ ∉ parts
  deriving DecidableEq
goal: self.parts.sup id = a

full_name: Finpartition.not_bot_mem
code: /-- A finite partition of `a : α` is a pairwise disjoint finite set of elements whose supremum is
`a`. We forbid `⊥` as a part. -/
@[ext]
structure Finpartition [Lattice α] [OrderBot α] (a : α) where
  -- Porting note: Docstrings added
  /-- The elements of the finite partition of `a` -/
  parts : Finset α
  /-- The partition is supremum-independent -/
  supIndep : parts.SupIndep id
  /-- The supremum of the partition is `a` -/
  sup_parts : parts.sup id = a
  /-- No element of the partition is bottom-/
  not_bot_mem : ⊥ ∉ parts
  deriving DecidableEq
goal: ⊥ ∉ self.parts

full_name: Finpartition.parts
code: /-- A finite partition of `a : α` is a pairwise disjoint finite set of elements whose supremum is
`a`. We forbid `⊥` as a part. -/
@[ext]
structure Finpartition [Lattice α] [OrderBot α] (a : α) where
  -- Porting note: Docstrings added
  /-- The elements of the finite partition of `a` -/
  parts : Finset α
  /-- The partition is supremum-independent -/
  supIndep : parts.SupIndep id
  /-- The supremum of the partition is `a` -/
  sup_parts : parts.sup id = a
  /-- No element of the partition is bottom-/
  not_bot_mem : ⊥ ∉ parts
  deriving DecidableEq
goal: Finset α

full_name: Finpartition.ofErase
code: /-- A `Finpartition` constructor which does not insist on `⊥` not being a part. -/
@[simps]
def ofErase [DecidableEq α] {a : α} (parts : Finset α) (sup_indep : parts.SupIndep id)
    (sup_parts : parts.sup id = a) : Finpartition a 
goal: Finpartition a

full_name: Finpartition.ofErase_parts
code: /-- A `Finpartition` constructor which does not insist on `⊥` not being a part. -/
@[simps]
def ofErase [DecidableEq α] {a : α} (parts : Finset α) (sup_indep : parts.SupIndep id)
    (sup_parts : parts.sup id = a) : Finpartition a 
goal: (Finpartition.ofErase parts sup_indep sup_parts).parts = parts.erase ⊥

full_name: Finpartition.ofSubset_parts
code: /-- A `Finpartition` constructor from a bigger existing finpartition. -/
@[simps]
def ofSubset {a b : α} (P : Finpartition a) {parts : Finset α} (subset : parts ⊆ P.parts)
    (sup_parts : parts.sup id = b) : Finpartition b 
goal: (P.ofSubset subset sup_parts).parts = parts

full_name: Finpartition.ofSubset
code: /-- A `Finpartition` constructor from a bigger existing finpartition. -/
@[simps]
def ofSubset {a b : α} (P : Finpartition a) {parts : Finset α} (subset : parts ⊆ P.parts)
    (sup_parts : parts.sup id = b) : Finpartition b 
goal: Finpartition b

full_name: Finpartition.copy_parts
code: /-- Changes the type of a finpartition to an equal one. -/
@[simps]
def copy {a b : α} (P : Finpartition a) (h : a = b) : Finpartition b 
goal: (P.copy h).parts = P.parts

full_name: Finpartition.copy
code: /-- Changes the type of a finpartition to an equal one. -/
@[simps]
def copy {a b : α} (P : Finpartition a) (h : a = b) : Finpartition b 
goal: Finpartition b

full_name: Finpartition.map
code: /-- Transfer a finpartition over an order isomorphism. -/
def map {β : Type*} [Lattice β] [OrderBot β] {a : α} (e : α ≃o β) (P : Finpartition a) :
    Finpartition (e a) 
goal: Finpartition (e a)

full_name: Finpartition.parts_map
code: @[simp]
theorem parts_map {β : Type*} [Lattice β] [OrderBot β] {a : α} {e : α ≃o β} {P : Finpartition a} :
    (P.map e).parts = P.parts.map e 
goal: (Finpartition.map e P).parts = Finset.map (↑e).toEmbedding P.parts

full_name: Finpartition.empty
code: /-- The empty finpartition. -/
@[simps]
protected def empty : Finpartition (⊥ : α) 
goal: Finpartition ⊥

full_name: Finpartition.empty_parts
code: /-- The empty finpartition. -/
@[simps]
protected def empty : Finpartition (⊥ : α) 
goal: (Finpartition.empty α).parts = ∅

full_name: Finpartition.instInhabitedBot
code: instance : Inhabited (Finpartition (⊥ : α)) 
goal: Inhabited (Finpartition ⊥)

full_name: Finpartition.default_eq_empty
code: @[simp]
theorem default_eq_empty : (default : Finpartition (⊥ : α)) = Finpartition.empty α 
goal: default = Finpartition.empty α

full_name: Finpartition.indiscrete
code: /-- The finpartition in one part, aka indiscrete finpartition. -/
@[simps]
def indiscrete (ha : a ≠ ⊥) : Finpartition a 
goal: Finpartition a

full_name: Finpartition.indiscrete_parts
code: /-- The finpartition in one part, aka indiscrete finpartition. -/
@[simps]
def indiscrete (ha : a ≠ ⊥) : Finpartition a 
goal: (Finpartition.indiscrete ha).parts = {a}

full_name: Finpartition.le
code: protected theorem le {b : α} (hb : b ∈ P.parts) : b ≤ a 
goal: b ≤ a

full_name: Finpartition.ne_bot
code: theorem ne_bot {b : α} (hb : b ∈ P.parts) : b ≠ ⊥ 
goal: b ≠ ⊥

full_name: Finpartition.disjoint
code: protected theorem disjoint : (P.parts : Set α).PairwiseDisjoint id 
goal: (↑P.parts).PairwiseDisjoint id

full_name: Finpartition.parts_eq_empty_iff
code: theorem parts_eq_empty_iff : P.parts = ∅ ↔ a = ⊥ 
goal: P.parts = ∅ ↔ a = ⊥

full_name: Finpartition.parts_nonempty_iff
code: theorem parts_nonempty_iff : P.parts.Nonempty ↔ a ≠ ⊥ 
goal: P.parts.Nonempty ↔ a ≠ ⊥

full_name: Finpartition.parts_nonempty
code: theorem parts_nonempty (P : Finpartition a) (ha : a ≠ ⊥) : P.parts.Nonempty 
goal: P.parts.Nonempty

full_name: Finpartition.instUniqueBot
code: instance : Unique (Finpartition (⊥ : α)) 
goal: Unique (Finpartition ⊥)

full_name: IsAtom.uniqueFinpartition
code: /-- There's a unique partition of an atom. -/
abbrev _root_.IsAtom.uniqueFinpartition (ha : IsAtom a) : Unique (Finpartition a) 
goal: Unique (Finpartition a)

full_name: Finpartition.instFintypeOfDecidableEq
code: instance [Fintype α] [DecidableEq α] (a : α) : Fintype (Finpartition a) 
goal: Fintype (Finpartition a)

full_name: Finpartition.instLE
code: /-- We say that `P ≤ Q` if `P` refines `Q`: each part of `P` is less than some part of `Q`. -/
instance : LE (Finpartition a) 
goal: LE (Finpartition a)

full_name: Finpartition.instPartialOrder
code: instance : PartialOrder (Finpartition a) 
goal: PartialOrder (Finpartition a)

full_name: Finpartition.instOrderTopOfDecidableEqBot
code: instance [Decidable (a = ⊥)] : OrderTop (Finpartition a) 
goal: OrderTop (Finpartition a)

full_name: Finpartition.parts_top_subset
code: theorem parts_top_subset (a : α) [Decidable (a = ⊥)] : (⊤ : Finpartition a).parts ⊆ {a} 
goal: ⊤.parts ⊆ {a}

full_name: Finpartition.parts_top_subsingleton
code: theorem parts_top_subsingleton (a : α) [Decidable (a = ⊥)] :
    ((⊤ : Finpartition a).parts : Set α).Subsingleton 
goal: (↑⊤.parts).Subsingleton

full_name: Finpartition.instInf
code: instance : Inf (Finpartition a) 
goal: Inf (Finpartition a)

full_name: Finpartition.parts_inf
code: @[simp]
theorem parts_inf (P Q : Finpartition a) :
    (P ⊓ Q).parts = ((P.parts ×ˢ Q.parts).image fun bc : α × α ↦ bc.1 ⊓ bc.2).erase ⊥ 
goal: (P ⊓ Q).parts = (Finset.image (fun bc => bc.1 ⊓ bc.2) (P.parts ×ˢ Q.parts)).erase ⊥

full_name: Finpartition.instSemilatticeInf
code: instance : SemilatticeInf (Finpartition a) 
goal: SemilatticeInf (Finpartition a)

full_name: Finpartition.exists_le_of_le
code: theorem exists_le_of_le {a b : α} {P Q : Finpartition a} (h : P ≤ Q) (hb : b ∈ Q.parts) :
    ∃ c ∈ P.parts, c ≤ b 
goal: ∃ c ∈ P.parts, c ≤ b

full_name: Finpartition.card_mono
code: theorem card_mono {a : α} {P Q : Finpartition a} (h : P ≤ Q) : Q.parts.card ≤ P.parts.card 
goal: Q.parts.card ≤ P.parts.card

full_name: Finpartition.bind_parts
code: /-- Given a finpartition `P` of `a` and finpartitions of each part of `P`, this yields the
finpartition of `a` obtained by juxtaposing all the subpartitions. -/
@[simps]
def bind (P : Finpartition a) (Q : ∀ i ∈ P.parts, Finpartition i) : Finpartition a 
goal: (P.bind Q).parts = P.parts.attach.biUnion fun i => (Q ↑i ⋯).parts

full_name: Finpartition.bind
code: /-- Given a finpartition `P` of `a` and finpartitions of each part of `P`, this yields the
finpartition of `a` obtained by juxtaposing all the subpartitions. -/
@[simps]
def bind (P : Finpartition a) (Q : ∀ i ∈ P.parts, Finpartition i) : Finpartition a 
goal: Finpartition a

full_name: Finpartition.mem_bind
code: theorem mem_bind : b ∈ (P.bind Q).parts ↔ ∃ A hA, b ∈ (Q A hA).parts 
goal: b ∈ (P.bind Q).parts ↔ ∃ A, ∃ (hA : A ∈ P.parts), b ∈ (Q A hA).parts

full_name: Finpartition.card_bind
code: theorem card_bind (Q : ∀ i ∈ P.parts, Finpartition i) :
    (P.bind Q).parts.card = ∑ A ∈ P.parts.attach, (Q _ A.2).parts.card 
goal: (P.bind Q).parts.card = ∑ A ∈ P.parts.attach, (Q ↑A ⋯).parts.card

full_name: Finpartition.extend
code: /-- Adds `b` to a finpartition of `a` to make a finpartition of `a ⊔ b`. -/
@[simps]
def extend (P : Finpartition a) (hb : b ≠ ⊥) (hab : Disjoint a b) (hc : a ⊔ b = c) :
    Finpartition c 
goal: Finpartition c

full_name: Finpartition.extend_parts
code: /-- Adds `b` to a finpartition of `a` to make a finpartition of `a ⊔ b`. -/
@[simps]
def extend (P : Finpartition a) (hb : b ≠ ⊥) (hab : Disjoint a b) (hc : a ⊔ b = c) :
    Finpartition c 
goal: (P.extend hb hab hc).parts = insert b P.parts

full_name: Finpartition.card_extend
code: theorem card_extend (P : Finpartition a) (b c : α) {hb : b ≠ ⊥} {hab : Disjoint a b}
    {hc : a ⊔ b = c} : (P.extend hb hab hc).parts.card = P.parts.card + 1 
goal: (P.extend hb hab hc).parts.card = P.parts.card + 1

full_name: Finpartition.avoid_parts_val
code: /-- Restricts a finpartition to avoid a given element. -/
@[simps!]
def avoid (b : α) : Finpartition (a \ b) 
goal: (P.avoid b).parts.val = (Multiset.map (fun x => x \ b) P.parts.val).dedup.erase ⊥

full_name: Finpartition.avoid
code: /-- Restricts a finpartition to avoid a given element. -/
@[simps!]
def avoid (b : α) : Finpartition (a \ b) 
goal: Finpartition (a \ b)

full_name: Finpartition.mem_avoid
code: @[simp]
theorem mem_avoid : c ∈ (P.avoid b).parts ↔ ∃ d ∈ P.parts, ¬d ≤ b ∧ d \ b = c 
goal: c ∈ (P.avoid b).parts ↔ ∃ d ∈ P.parts, ¬d ≤ b ∧ d \ b = c

full_name: Finpartition.nonempty_of_mem_parts
code: theorem nonempty_of_mem_parts {a : Finset α} (ha : a ∈ P.parts) : a.Nonempty 
goal: a.Nonempty

full_name: Finpartition.eq_of_mem_parts
code: lemma eq_of_mem_parts (ht : t ∈ P.parts) (hu : u ∈ P.parts) (hat : a ∈ t) (hau : a ∈ u) : t = u 
goal: t = u

full_name: Finpartition.exists_mem
code: theorem exists_mem (ha : a ∈ s) : ∃ t ∈ P.parts, a ∈ t 
goal: ∃ t ∈ P.parts, a ∈ t

full_name: Finpartition.biUnion_parts
code: theorem biUnion_parts : P.parts.biUnion id = s 
goal: P.parts.biUnion id = s

full_name: Finpartition.existsUnique_mem
code: theorem existsUnique_mem (ha : a ∈ s) : ∃! t, t ∈ P.parts ∧ a ∈ t 
goal: ∃! t, t ∈ P.parts ∧ a ∈ t

full_name: Finpartition.part
code: /-- The part of the finpartition that `a` lies in. -/
def part (a : α) : Finset α 
goal: Finset α

full_name: Finpartition.part_mem
code: lemma part_mem (ha : a ∈ s) : P.part a ∈ P.parts 
goal: P.part a ∈ P.parts

full_name: Finpartition.mem_part
code: lemma mem_part (ha : a ∈ s) : a ∈ P.part a 
goal: a ∈ P.part a

full_name: Finpartition.part_eq_of_mem
code: lemma part_eq_of_mem (ht : t ∈ P.parts) (hat : a ∈ t) : P.part a = t 
goal: P.part a = t

full_name: Finpartition.mem_part_iff_part_eq_part
code: lemma mem_part_iff_part_eq_part {b : α} (ha : a ∈ s) (hb : b ∈ s) :
    a ∈ P.part b ↔ P.part a = P.part b 
goal: a ∈ P.part b ↔ P.part a = P.part b

full_name: Finpartition.part_surjOn
code: theorem part_surjOn : Set.SurjOn P.part s P.parts 
goal: Set.SurjOn P.part ↑s ↑P.parts

full_name: Finpartition.exists_subset_part_bijOn
code: theorem exists_subset_part_bijOn : ∃ r ⊆ s, Set.BijOn P.part r P.parts 
goal: ∃ r ⊆ s, Set.BijOn P.part ↑r ↑P.parts

full_name: Finpartition.equivSigmaParts
code: /-- Equivalence between a finpartition's parts as a dependent sum and the partitioned set. -/
def equivSigmaParts : s ≃ Σ t : P.parts, t.1 
goal: { x // x ∈ s } ≃ (t : { x // x ∈ P.parts }) × { x // x ∈ ↑t }

full_name: Finpartition.exists_enumeration
code: lemma exists_enumeration : ∃ f : s ≃ Σ t : P.parts, Fin t.1.card,
    ∀ a b : s, P.part a = P.part b ↔ (f a).1 = (f b).1 
goal: ∃ f, ∀ (a b : { x // x ∈ s }), P.part ↑a = P.part ↑b ↔ (f a).fst = (f b).fst

full_name: Finpartition.sum_card_parts
code: theorem sum_card_parts : ∑ i ∈ P.parts, i.card = s.card 
goal: ∑ i ∈ P.parts, i.card = s.card

full_name: Finpartition.instBotFinset
code: /-- `⊥` is the partition in singletons, aka discrete partition. -/
instance (s : Finset α) : Bot (Finpartition s) 
goal: Bot (Finpartition s)

full_name: Finpartition.parts_bot
code: @[simp]
theorem parts_bot (s : Finset α) :
    (⊥ : Finpartition s).parts = s.map ⟨singleton, singleton_injective⟩ 
goal: ⊥.parts = Finset.map { toFun := singleton, inj' := ⋯ } s

full_name: Finpartition.card_bot
code: theorem card_bot (s : Finset α) : (⊥ : Finpartition s).parts.card = s.card 
goal: ⊥.parts.card = s.card

full_name: Finpartition.mem_bot_iff
code: theorem mem_bot_iff : t ∈ (⊥ : Finpartition s).parts ↔ ∃ a ∈ s, {a} = t 
goal: t ∈ ⊥.parts ↔ ∃ a ∈ s, {a} = t

full_name: Finpartition.instOrderBotFinset
code: instance (s : Finset α) : OrderBot (Finpartition s) 
goal: OrderBot (Finpartition s)

full_name: Finpartition.card_parts_le_card
code: theorem card_parts_le_card : P.parts.card ≤ s.card 
goal: P.parts.card ≤ s.card

full_name: Finpartition.card_mod_card_parts_le
code: lemma card_mod_card_parts_le : s.card % P.parts.card ≤ P.parts.card 
goal: s.card % P.parts.card ≤ P.parts.card

full_name: Finpartition.ofSetoid
code: /-- A setoid over a finite type induces a finpartition of the type's elements,
where the parts are the setoid's equivalence classes. -/
def ofSetoid (s : Setoid α) [DecidableRel s.r] : Finpartition (univ : Finset α) 
goal: Finpartition Finset.univ

full_name: Finpartition.mem_part_ofSetoid_iff_rel
code: theorem mem_part_ofSetoid_iff_rel {s : Setoid α} [DecidableRel s.r] {b : α} :
    b ∈ (ofSetoid s).part a ↔ s.r a b 
goal: b ∈ (Finpartition.ofSetoid s).part a ↔ Setoid.r a b

full_name: Finpartition.atomise
code: /-- Cuts `s` along the finsets in `F`: Two elements of `s` will be in the same part if they are
in the same finsets of `F`. -/
def atomise (s : Finset α) (F : Finset (Finset α)) : Finpartition s 
goal: Finpartition s

full_name: Finpartition.mem_atomise
code: theorem mem_atomise :
    t ∈ (atomise s F).parts ↔
      t.Nonempty ∧ ∃ Q ⊆ F, (s.filter fun i ↦ ∀ u ∈ F, u ∈ Q ↔ i ∈ u) = t 
goal: t ∈ (Finpartition.atomise s F).parts ↔ t.Nonempty ∧ ∃ Q ⊆ F, Finset.filter (fun i => ∀ u ∈ F, u ∈ Q ↔ i ∈ u) s = t

full_name: Finpartition.atomise_empty
code: theorem atomise_empty (hs : s.Nonempty) : (atomise s ∅).parts = {s} 
goal: (Finpartition.atomise s ∅).parts = {s}

full_name: Finpartition.card_atomise_le
code: theorem card_atomise_le : (atomise s F).parts.card ≤ 2 ^ F.card 
goal: (Finpartition.atomise s F).parts.card ≤ 2 ^ F.card

full_name: Finpartition.biUnion_filter_atomise
code: theorem biUnion_filter_atomise (ht : t ∈ F) (hts : t ⊆ s) :
    ((atomise s F).parts.filter fun u ↦ u ⊆ t ∧ u.Nonempty).biUnion id = t 
goal: (Finset.filter (fun u => u ⊆ t ∧ u.Nonempty) (Finpartition.atomise s F).parts).biUnion id = t

full_name: Finpartition.card_filter_atomise_le_two_pow
code: theorem card_filter_atomise_le_two_pow (ht : t ∈ F) :
    ((atomise s F).parts.filter fun u ↦ u ⊆ t ∧ u.Nonempty).card ≤ 2 ^ (F.card - 1) 
goal: (Finset.filter (fun u => u ⊆ t ∧ u.Nonempty) (Finpartition.atomise s F).parts).card ≤ 2 ^ (F.card - 1)