File: Mathlib/Algebra/Order/Antidiag/Finsupp.lean

full_name: Finset.finsuppAntidiag
code: /-- The finset of functions `ι →₀ μ` with support contained in `s` and sum equal to `n`. -/
def finsuppAntidiag (s : Finset ι) (n : μ) : Finset (ι →₀ μ) 
goal: Finset (ι →₀ μ)

full_name: Finset.mem_finsuppAntidiag
code: @[simp] lemma mem_finsuppAntidiag : f ∈ finsuppAntidiag s n ↔ s.sum f = n ∧ f.support ⊆ s 
goal: f ∈ s.finsuppAntidiag n ↔ s.sum ⇑f = n ∧ f.support ⊆ s

full_name: Finset.mem_finsuppAntidiag'
code: lemma mem_finsuppAntidiag' :
    f ∈ finsuppAntidiag s n ↔ f.sum (fun _ x ↦ x) = n ∧ f.support ⊆ s 
goal: f ∈ s.finsuppAntidiag n ↔ (f.sum fun x x => x) = n ∧ f.support ⊆ s

full_name: Finset.finsuppAntidiag_empty_zero
code: @[simp] lemma finsuppAntidiag_empty_zero : finsuppAntidiag (∅ : Finset ι) (0 : μ) = {0} 
goal: ∅.finsuppAntidiag 0 = {0}

full_name: Finset.finsuppAntidiag_empty_of_ne_zero
code: @[simp] lemma finsuppAntidiag_empty_of_ne_zero (hn : n ≠ 0) :
    finsuppAntidiag (∅ : Finset ι) n = ∅ 
goal: ∅.finsuppAntidiag n = ∅

full_name: Finset.finsuppAntidiag_empty
code: lemma finsuppAntidiag_empty (n : μ) :
    finsuppAntidiag (∅ : Finset ι) n = if n = 0 then {0} else ∅ 
goal: ∅.finsuppAntidiag n = if n = 0 then {0} else ∅

full_name: Finset.mem_finsuppAntidiag_insert
code: theorem mem_finsuppAntidiag_insert {a : ι} {s : Finset ι}
    (h : a ∉ s) (n : μ) {f : ι →₀ μ} :
    f ∈ finsuppAntidiag (insert a s) n ↔
      ∃ m ∈ antidiagonal n, ∃ (g : ι →₀ μ),
        f = Finsupp.update g a m.1 ∧ g ∈ finsuppAntidiag s m.2 
goal: f ∈ (insert a s).finsuppAntidiag n ↔ ∃ m ∈ Finset.antidiagonal n, ∃ g, f = g.update a m.1 ∧ g ∈ s.finsuppAntidiag m.2

full_name: Finset.finsuppAntidiag_insert
code: theorem finsuppAntidiag_insert [DecidableEq μ] {a : ι} {s : Finset ι}
    (h : a ∉ s) (n : μ) :
    finsuppAntidiag (insert a s) n = (antidiagonal n).biUnion
      (fun p : μ × μ =>
        (finsuppAntidiag s p.snd).attach.map
        ⟨fun f => Finsupp.update f.val a p.fst,
        (fun ⟨f, hf⟩ ⟨g, hg⟩ hfg => Subtype.ext <| by
          simp only [mem_val, mem_finsuppAntidiag] at hf hg
          simp only [DFunLike.ext_iff] at hfg ⊢
          intro x
          obtain rfl | hx := eq_or_ne x a
          · replace hf := mt (hf.2 ·) h
            replace hg := mt (hg.2 ·) h
            rw [not_mem_support_iff.mp hf, not_mem_support_iff.mp hg]
          · simpa only [coe_update, Function.update, dif_neg hx] using hfg x)⟩) 
goal: (insert a s).finsuppAntidiag n =
  (Finset.antidiagonal n).biUnion fun p =>
    Finset.map { toFun := fun f => (↑f).update a p.1, inj' := ⋯ } (s.finsuppAntidiag p.2).attach

full_name: Finset.mapRange_finsuppAntidiag_subset
code: lemma mapRange_finsuppAntidiag_subset {e : μ ≃+ μ'} {s : Finset ι} {n : μ} :
    (finsuppAntidiag s n).map (mapRange.addEquiv e).toEmbedding ⊆ finsuppAntidiag s (e n) 
goal: Finset.map (Finsupp.mapRange.addEquiv e).toEmbedding (s.finsuppAntidiag n) ⊆ s.finsuppAntidiag (e n)

full_name: Finset.mapRange_finsuppAntidiag_eq
code: lemma mapRange_finsuppAntidiag_eq {e : μ ≃+ μ'} {s : Finset ι} {n : μ} :
    (finsuppAntidiag s n).map (mapRange.addEquiv e).toEmbedding = finsuppAntidiag s (e n) 
goal: Finset.map (Finsupp.mapRange.addEquiv e).toEmbedding (s.finsuppAntidiag n) = s.finsuppAntidiag (e n)

full_name: Finset.finsuppAntidiag_zero
code: @[simp] lemma finsuppAntidiag_zero (s : Finset ι) : finsuppAntidiag s (0 : μ) = {0} 
goal: s.finsuppAntidiag 0 = {0}