File: Mathlib/Data/Finset/Union.lean

full_name: Finset.disjiUnion
code: /-- `disjiUnion s f h` is the set such that `a ∈ disjiUnion s f` iff `a ∈ f i` for some `i ∈ s`.
It is the same as `s.biUnion f`, but it does not require decidable equality on the type. The
hypothesis ensures that the sets are disjoint. -/
def disjiUnion (s : Finset α) (t : α → Finset β) (hf : (s : Set α).PairwiseDisjoint t) : Finset β 
goal: Finset β

full_name: Finset.disjiUnion_val
code: @[simp]
lemma disjiUnion_val (s : Finset α) (t : α → Finset β) (h) :
    (s.disjiUnion t h).1 = s.1.bind fun a ↦ (t a).1 
goal: (s.disjiUnion t h).val = s.val.bind fun a => (t a).val

full_name: Finset.disjiUnion_empty
code: @[simp] lemma disjiUnion_empty (t : α → Finset β) : disjiUnion ∅ t (by simp) = ∅ 
goal: ∅.disjiUnion t ⋯ = ∅

full_name: Finset.mem_disjiUnion
code: @[simp] lemma mem_disjiUnion {b : β} {h} : b ∈ s.disjiUnion t h ↔ ∃ a ∈ s, b ∈ t a 
goal: b ∈ s.disjiUnion t h ↔ ∃ a ∈ s, b ∈ t a

full_name: Finset.coe_disjiUnion
code: @[simp, norm_cast]
lemma coe_disjiUnion {h} : (s.disjiUnion t h : Set β) = ⋃ x ∈ (s : Set α), t x 
goal: ↑(s.disjiUnion t h) = ⋃ x ∈ ↑s, ↑(t x)

full_name: Finset.disjiUnion_cons
code: @[simp] lemma disjiUnion_cons (a : α) (s : Finset α) (ha : a ∉ s) (f : α → Finset β) (H) :
    disjiUnion (cons a s ha) f H =
    (f a).disjUnion ((s.disjiUnion f) fun _ hb _ hc ↦ H (mem_cons_of_mem hb) (mem_cons_of_mem hc))
      (disjoint_left.2 fun _ hb h ↦
        let ⟨_, hc, h⟩ := mem_disjiUnion.mp h
        disjoint_left.mp
          (H (mem_cons_self a s) (mem_cons_of_mem hc) (ne_of_mem_of_not_mem hc ha).symm) hb h) 
goal: (Finset.cons a s ha).disjiUnion f H = (f a).disjUnion (s.disjiUnion f ⋯) ⋯

full_name: Finset.singleton_disjiUnion
code: @[simp] lemma singleton_disjiUnion (a : α) {h} : Finset.disjiUnion {a} t h = t a 
goal: {a}.disjiUnion t h = t a

full_name: Finset.disjiUnion_disjiUnion
code: lemma disjiUnion_disjiUnion (s : Finset α) (f : α → Finset β) (g : β → Finset γ) (h1 h2) :
    (s.disjiUnion f h1).disjiUnion g h2 =
      s.attach.disjiUnion
        (fun a ↦ ((f a).disjiUnion g) fun b hb c hc ↦
            h2 (mem_disjiUnion.mpr ⟨_, a.prop, hb⟩) (mem_disjiUnion.mpr ⟨_, a.prop, hc⟩))
        fun a _ b _ hab ↦
        disjoint_left.mpr fun x hxa hxb ↦ by
          obtain ⟨xa, hfa, hga⟩ := mem_disjiUnion.mp hxa
          obtain ⟨xb, hfb, hgb⟩ := mem_disjiUnion.mp hxb
          refine disjoint_left.mp
            (h2 (mem_disjiUnion.mpr ⟨_, a.prop, hfa⟩) (mem_disjiUnion.mpr ⟨_, b.prop, hfb⟩) ?_) hga
            hgb
          rintro rfl
          exact disjoint_left.mp (h1 a.prop b.prop <| Subtype.coe_injective.ne hab) hfa hfb 
goal: (s.disjiUnion f h1).disjiUnion g h2 = s.attach.disjiUnion (fun a => (f ↑a).disjiUnion g ⋯) ⋯

full_name: _private.Mathlib.Data.Finset.Union.0.Finset.pairwiseDisjoint_fibers
code: private lemma pairwiseDisjoint_fibers : Set.PairwiseDisjoint ↑t fun a ↦ s.filter (f · = a) 
goal: (↑t).PairwiseDisjoint fun a => Finset.filter (fun x => f x = a) s

full_name: Finset.disjiUnion_filter_eq
code: @[simp, nolint simpNF] lemma disjiUnion_filter_eq (s : Finset α) (t : Finset β) (f : α → β) :
    t.disjiUnion (fun a ↦ s.filter (f · = a)) pairwiseDisjoint_fibers =
      s.filter fun c ↦ f c ∈ t 
goal: t.disjiUnion (fun a => Finset.filter (fun x => f x = a) s) ⋯ = Finset.filter (fun c => f c ∈ t) s

full_name: Finset.disjiUnion_filter_eq_of_maps_to
code: lemma disjiUnion_filter_eq_of_maps_to (h : ∀ x ∈ s, f x ∈ t) :
    t.disjiUnion (fun a ↦ s.filter (f · = a)) pairwiseDisjoint_fibers = s 
goal: t.disjiUnion (fun a => Finset.filter (fun x => f x = a) s) ⋯ = s

full_name: Finset.biUnion
code: /-- `Finset.biUnion s t` is the union of `t a` over `a ∈ s`.

(This was formerly `bind` due to the monad structure on types with `DecidableEq`.) -/
protected def biUnion (s : Finset α) (t : α → Finset β) : Finset β 
goal: Finset β

full_name: Finset.biUnion_val
code: @[simp] lemma biUnion_val (s : Finset α) (t : α → Finset β) :
    (s.biUnion t).1 = (s.1.bind fun a ↦ (t a).1).dedup 
goal: (s.biUnion t).val = (s.val.bind fun a => (t a).val).dedup

full_name: Finset.biUnion_empty
code: @[simp] lemma biUnion_empty : Finset.biUnion ∅ t = ∅ 
goal: ∅.biUnion t = ∅

full_name: Finset.mem_biUnion
code: @[simp] lemma mem_biUnion {b : β} : b ∈ s.biUnion t ↔ ∃ a ∈ s, b ∈ t a 
goal: b ∈ s.biUnion t ↔ ∃ a ∈ s, b ∈ t a

full_name: Finset.coe_biUnion
code: @[simp, norm_cast]
lemma coe_biUnion : (s.biUnion t : Set β) = ⋃ x ∈ (s : Set α), t x 
goal: ↑(s.biUnion t) = ⋃ x ∈ ↑s, ↑(t x)

full_name: Finset.biUnion_insert
code: @[simp]
lemma biUnion_insert [DecidableEq α] {a : α} : (insert a s).biUnion t = t a ∪ s.biUnion t 
goal: (insert a s).biUnion t = t a ∪ s.biUnion t

full_name: Finset.biUnion_congr
code: lemma biUnion_congr (hs : s₁ = s₂) (ht : ∀ a ∈ s₁, t₁ a = t₂ a) : s₁.biUnion t₁ = s₂.biUnion t₂ 
goal: s₁.biUnion t₁ = s₂.biUnion t₂

full_name: Finset.disjiUnion_eq_biUnion
code: @[simp]
lemma disjiUnion_eq_biUnion (s : Finset α) (f : α → Finset β) (hf) :
    s.disjiUnion f hf = s.biUnion f 
goal: s.disjiUnion f hf = s.biUnion f

full_name: Finset.biUnion_subset
code: lemma biUnion_subset {s' : Finset β} : s.biUnion t ⊆ s' ↔ ∀ x ∈ s, t x ⊆ s' 
goal: s.biUnion t ⊆ s' ↔ ∀ x ∈ s, t x ⊆ s'

full_name: Finset.singleton_biUnion
code: @[simp]
lemma singleton_biUnion {a : α} : Finset.biUnion {a} t = t a 
goal: {a}.biUnion t = t a

full_name: Finset.biUnion_inter
code: lemma biUnion_inter (s : Finset α) (f : α → Finset β) (t : Finset β) :
    s.biUnion f ∩ t = s.biUnion fun x ↦ f x ∩ t 
goal: s.biUnion f ∩ t = s.biUnion fun x => f x ∩ t

full_name: Finset.inter_biUnion
code: lemma inter_biUnion (t : Finset β) (s : Finset α) (f : α → Finset β) :
    t ∩ s.biUnion f = s.biUnion fun x ↦ t ∩ f x 
goal: t ∩ s.biUnion f = s.biUnion fun x => t ∩ f x

full_name: Finset.biUnion_biUnion
code: lemma biUnion_biUnion [DecidableEq γ] (s : Finset α) (f : α → Finset β) (g : β → Finset γ) :
    (s.biUnion f).biUnion g = s.biUnion fun a ↦ (f a).biUnion g 
goal: (s.biUnion f).biUnion g = s.biUnion fun a => (f a).biUnion g

full_name: Finset.bind_toFinset
code: lemma bind_toFinset [DecidableEq α] (s : Multiset α) (t : α → Multiset β) :
    (s.bind t).toFinset = s.toFinset.biUnion fun a ↦ (t a).toFinset 
goal: (s.bind t).toFinset = s.toFinset.biUnion fun a => (t a).toFinset

full_name: Finset.biUnion_mono
code: lemma biUnion_mono (h : ∀ a ∈ s, t₁ a ⊆ t₂ a) : s.biUnion t₁ ⊆ s.biUnion t₂ 
goal: s.biUnion t₁ ⊆ s.biUnion t₂

full_name: Finset.biUnion_subset_biUnion_of_subset_left
code: lemma biUnion_subset_biUnion_of_subset_left (t : α → Finset β) (h : s₁ ⊆ s₂) :
    s₁.biUnion t ⊆ s₂.biUnion t 
goal: s₁.biUnion t ⊆ s₂.biUnion t

full_name: Finset.subset_biUnion_of_mem
code: lemma subset_biUnion_of_mem (u : α → Finset β) {x : α} (xs : x ∈ s) : u x ⊆ s.biUnion u 
goal: u x ⊆ s.biUnion u

full_name: Finset.biUnion_subset_iff_forall_subset
code: @[simp]
lemma biUnion_subset_iff_forall_subset {α β : Type*} [DecidableEq β] {s : Finset α}
    {t : Finset β} {f : α → Finset β} : s.biUnion f ⊆ t ↔ ∀ x ∈ s, f x ⊆ t 
goal: s.biUnion f ⊆ t ↔ ∀ x ∈ s, f x ⊆ t

full_name: Finset.biUnion_singleton_eq_self
code: @[simp]
lemma biUnion_singleton_eq_self [DecidableEq α] : s.biUnion (singleton : α → Finset α) = s 
goal: s.biUnion singleton = s

full_name: Finset.filter_biUnion
code: lemma filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a ↦ (f a).filter p 
goal: Finset.filter p (s.biUnion f) = s.biUnion fun a => Finset.filter p (f a)

full_name: Finset.biUnion_filter_eq_of_maps_to
code: lemma biUnion_filter_eq_of_maps_to [DecidableEq α] {s : Finset α} {t : Finset β} {f : α → β}
    (h : ∀ x ∈ s, f x ∈ t) : (t.biUnion fun a ↦ s.filter fun c ↦ f c = a) = s 
goal: (t.biUnion fun a => Finset.filter (fun c => f c = a) s) = s

full_name: Finset.erase_biUnion
code: lemma erase_biUnion (f : α → Finset β) (s : Finset α) (b : β) :
    (s.biUnion f).erase b = s.biUnion fun x ↦ (f x).erase b 
goal: (s.biUnion f).erase b = s.biUnion fun x => (f x).erase b

full_name: Finset.biUnion_nonempty
code: @[simp]
lemma biUnion_nonempty : (s.biUnion t).Nonempty ↔ ∃ x ∈ s, (t x).Nonempty 
goal: (s.biUnion t).Nonempty ↔ ∃ x ∈ s, (t x).Nonempty

full_name: Finset.Nonempty.biUnion
code: lemma Nonempty.biUnion (hs : s.Nonempty) (ht : ∀ x ∈ s, (t x).Nonempty) :
    (s.biUnion t).Nonempty 
goal: (s.biUnion t).Nonempty

full_name: Finset.disjoint_biUnion_left
code: lemma disjoint_biUnion_left (s : Finset α) (f : α → Finset β) (t : Finset β) :
    Disjoint (s.biUnion f) t ↔ ∀ i ∈ s, Disjoint (f i) t 
goal: Disjoint (s.biUnion f) t ↔ ∀ i ∈ s, Disjoint (f i) t

full_name: Finset.disjoint_biUnion_right
code: lemma disjoint_biUnion_right (s : Finset β) (t : Finset α) (f : α → Finset β) :
    Disjoint s (t.biUnion f) ↔ ∀ i ∈ t, Disjoint s (f i) 
goal: Disjoint s (t.biUnion f) ↔ ∀ i ∈ t, Disjoint s (f i)