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

full_name: Finset.finAntidiagonal
code: /-- `finAntidiagonal d n` is the type of `d`-tuples with sum `n`.

TODO: deduplicate with the less general `Finset.Nat.antidiagonalTuple`. -/
def finAntidiagonal (d : ℕ) (n : μ) : Finset (Fin d → μ) 
goal: Finset (Fin d → μ)

full_name: Finset.finAntidiagonal.aux
code: /-- `finAntidiagonal d n` is the type of `d`-tuples with sum `n`.

TODO: deduplicate with the less general `Finset.Nat.antidiagonalTuple`. -/
def finAntidiagonal (d : ℕ) (n : μ) : Finset (Fin d → μ) 
goal: { s // ∀ (f : Fin d → μ), f ∈ s ↔ ∑ i : Fin d, f i = n }

full_name: Finset.mem_finAntidiagonal
code: @[simp] lemma mem_finAntidiagonal {d : ℕ} {f : Fin d → μ} :
    f ∈ finAntidiagonal d n ↔ ∑ i, f i = n 
goal: f ∈ Finset.finAntidiagonal d n ↔ ∑ i : Fin d, f i = n

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

full_name: Finset.mem_piAntidiag
code: @[simp] lemma mem_piAntidiag : f ∈ piAntidiag s n ↔ s.sum f = n ∧ ∀ i, f i ≠ 0 → i ∈ s 
goal: f ∈ s.piAntidiag n ↔ s.sum f = n ∧ ∀ (i : ι), f i ≠ 0 → i ∈ s

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

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

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

full_name: Finset.finsetCongr_piAntidiag_eq_antidiag
code: lemma finsetCongr_piAntidiag_eq_antidiag (n : μ) :
    Equiv.finsetCongr (Equiv.boolArrowEquivProd _) (piAntidiag univ n) = antidiagonal n 
goal: (Equiv.boolArrowEquivProd μ).finsetCongr (Finset.univ.piAntidiag n) = Finset.antidiagonal n

full_name: Finset.pairwiseDisjoint_piAntidiag_map_addRightEmbedding
code: lemma pairwiseDisjoint_piAntidiag_map_addRightEmbedding (hi : i ∉ s) (n : μ) :
    (antidiagonal n : Set (μ × μ)).PairwiseDisjoint fun p ↦
      map (addRightEmbedding fun j ↦ if j = i then p.1 else 0) (s.piAntidiag p.2) 
goal: (↑(Finset.antidiagonal n)).PairwiseDisjoint fun p =>
  Finset.map (addRightEmbedding fun j => if j = i then p.1 else 0) (s.piAntidiag p.2)

full_name: Finset.piAntidiag_cons
code: lemma piAntidiag_cons (hi : i ∉ s)  (n : μ) :
    piAntidiag (cons i s hi) n = (antidiagonal n).disjiUnion (fun p : μ × μ ↦
      (piAntidiag s p.snd).map (addRightEmbedding fun t ↦ if t = i then p.fst else 0))
        (pairwiseDisjoint_piAntidiag_map_addRightEmbedding hi _) 
goal: (Finset.cons i s hi).piAntidiag n =
  (Finset.antidiagonal n).disjiUnion
    (fun p => Finset.map (addRightEmbedding fun t => if t = i then p.1 else 0) (s.piAntidiag p.2)) ⋯

full_name: Finset.piAntidiag_insert
code: lemma piAntidiag_insert [DecidableEq (ι → μ)] (hi : i ∉ s) (n : μ) :
    piAntidiag (insert i s) n = (antidiagonal n).biUnion fun p : μ × μ ↦ (piAntidiag s p.snd).image
      (fun f j ↦ f j + if j = i then p.fst else 0) 
goal: (insert i s).piAntidiag n =
  (Finset.antidiagonal n).biUnion fun p => Finset.image (fun f j => f j + if j = i then p.1 else 0) (s.piAntidiag p.2)

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

full_name: Finset.«_aux_Mathlib_Algebra_Order_Antidiag_Pi___macroRules_Finset_term_•ℕ__1»
code: /-- Local notation for the pointwise operation `n • s := {n • a | a ∈ s}` to avoid conflict with the
pointwise operation `n • s := s + ... + s` (`n` times). -/
local infixr:73 "•ℕ" => @SMul.smul _ _ Finset.smulFinset
goal: Lean.Macro

full_name: Finset.piAntidiag_univ_fin_eq_antidiagonalTuple
code: lemma piAntidiag_univ_fin_eq_antidiagonalTuple (n k : ℕ) :
    piAntidiag univ n = Nat.antidiagonalTuple k n 
goal: Finset.univ.piAntidiag n = Finset.Nat.antidiagonalTuple k n

full_name: Finset.nsmul_piAntidiag
code: lemma nsmul_piAntidiag [DecidableEq (ι → ℕ)] (s : Finset ι) (m : ℕ) {n : ℕ} (hn : n ≠ 0) :
    n •ℕ piAntidiag s m = (piAntidiag s (n * m)).filter fun f : ι → ℕ ↦ ∀ i ∈ s, n ∣ f i 
goal: SMul.smul n (s.piAntidiag m) = Finset.filter (fun f => ∀ i ∈ s, n ∣ f i) (s.piAntidiag (n * m))

full_name: Finset.map_nsmul_piAntidiag
code: lemma map_nsmul_piAntidiag (s : Finset ι) (m : ℕ) {n : ℕ} (hn : n ≠ 0) :
    (piAntidiag s m).map
      ⟨(n • ·), fun f g h ↦ funext fun i ↦ mul_right_injective₀ hn (congr_fun h i)⟩ =
        (piAntidiag s (n * m)).filter fun f : ι → ℕ ↦ ∀ i ∈ s, n ∣ f i 
goal: Finset.map { toFun := fun x => n • x, inj' := ⋯ } (s.piAntidiag m) =
  Finset.filter (fun f => ∀ i ∈ s, n ∣ f i) (s.piAntidiag (n * m))

full_name: Finset.nsmul_piAntidiag_univ
code: lemma nsmul_piAntidiag_univ [Fintype ι] (m : ℕ) {n : ℕ} (hn : n ≠ 0) :
    @SMul.smul _ _ Finset.smulFinset n (piAntidiag univ m) =
      (piAntidiag univ (n * m)).filter fun f : ι → ℕ ↦ ∀ i, n ∣ f i 
goal: SMul.smul n (Finset.univ.piAntidiag m) = Finset.filter (fun f => ∀ (i : ι), n ∣ f i) (Finset.univ.piAntidiag (n * m))

full_name: Finset.map_nsmul_piAntidiag_univ
code: lemma map_nsmul_piAntidiag_univ [Fintype ι] (m : ℕ) {n : ℕ} (hn : n ≠ 0) :
    (piAntidiag (univ : Finset ι) m).map
        ⟨(n • ·), fun f g h ↦ funext fun i ↦ mul_right_injective₀ hn (congr_fun h i)⟩ =
      (piAntidiag univ (n * m)).filter fun f : ι → ℕ ↦ ∀ i, n ∣ f i 
goal: Finset.map { toFun := fun x => n • x, inj' := ⋯ } (Finset.univ.piAntidiag m) =
  Finset.filter (fun f => ∀ (i : ι), n ∣ f i) (Finset.univ.piAntidiag (n * m))

full_name: Finset.map_sym_eq_piAntidiag
code: lemma map_sym_eq_piAntidiag [DecidableEq ι] (s : Finset ι) (n : ℕ) :
    (s.sym n).map ⟨fun m a ↦ m.1.count a, Multiset.count_injective.comp Sym.coe_injective⟩ =
      piAntidiag s n 
goal: Finset.map { toFun := fun m a => Multiset.count a ↑m, inj' := ⋯ } (s.sym n) = s.piAntidiag n