Documentation

Mathlib.Algebra.Order.Antidiag.Pi

Antidiagonal of functions as finsets #

This file provides the finset of functions summing to a specific value on a finset. Such finsets should be thought of as the "antidiagonals" in the space of functions.

Precisely, for a commutative monoid μ with antidiagonals (see Finset.HasAntidiagonal), Finset.piAntidiag s n is the finset of all functions f : ι → μ with support contained in s and such that the sum of its values equals n : μ.

We define it recursively on s using Finset.HasAntidiagonal.antidiagonal : μ → Finset (μ × μ). Technically, we non-canonically identify s with Fin n where n = s.card, recurse on n using that (Fin (n + 1) → μ) ≃ (Fin n → μ) × μ, and show the end result doesn't depend on our identification. See Finset.finAntidiag for the details.

Main declarations #

TODO #

Finset.finAntidiagonal is strictly more general than Finset.Nat.antidiagonalTuple. Deduplicate.

See also #

Finset.finsuppAntidiag for the Finset (ι →₀ μ)-valued version of Finset.piAntidiag.

Fin d → μ #

In this section, we define the antidiagonals in Fin d → μ by recursion on d. Note that this is computationally efficient, although probably not as efficient as Finset.Nat.antidiagonalTuple.

def Finset.finAntidiagonal {μ : Type u_2} [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] (d : ) (n : μ) :
Finset (Fin dμ)

finAntidiagonal d n is the type of d-tuples with sum n.

TODO: deduplicate with the less general Finset.Nat.antidiagonalTuple.

Equations
Instances For
    def Finset.finAntidiagonal.aux {μ : Type u_2} [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] (d : ) (n : μ) :
    { s : Finset (Fin dμ) // ∀ (f : Fin dμ), f s i : Fin d, f i = n }

    Auxiliary construction for finAntidiagonal that bundles a proof of lawfulness (mem_finAntidiagonal), as this is needed to invoke disjiUnion. Using Finset.disjiUnion makes this computationally much more efficient than using Finset.biUnion.

    Equations
    Instances For
      @[simp]
      theorem Finset.mem_finAntidiagonal {μ : Type u_2} [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] {n : μ} {d : } {f : Fin dμ} :
      f Finset.finAntidiagonal d n i : Fin d, f i = n

      ι → μ #

      In this section, we transfer the antidiagonals in Fin s.card → μ to antidiagonals in ι → s by choosing an identification s ≃ Fin s.card and proving that the end result does not depend on that choice.

      def Finset.piAntidiag {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] (s : Finset ι) (n : μ) :
      Finset (ιμ)

      The finset of functions ι → μ with support contained in s and sum n.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[simp]
        theorem Finset.mem_piAntidiag {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] {s : Finset ι} {n : μ} {f : ιμ} :
        f s.piAntidiag n s.sum f = n ∀ (i : ι), f i 0i s
        @[simp]
        theorem Finset.piAntidiag_empty_zero {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] :
        .piAntidiag 0 = {0}
        @[simp]
        theorem Finset.piAntidiag_empty_of_ne_zero {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] {n : μ} (hn : n 0) :
        .piAntidiag n =
        theorem Finset.piAntidiag_empty {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] (n : μ) :
        .piAntidiag n = if n = 0 then {0} else
        theorem Finset.finsetCongr_piAntidiag_eq_antidiag {μ : Type u_2} [AddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] (n : μ) :
        (Equiv.boolArrowEquivProd μ).finsetCongr (Finset.univ.piAntidiag n) = Finset.antidiagonal n
        theorem Finset.pairwiseDisjoint_piAntidiag_map_addRightEmbedding {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCancelCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] {i : ι} {s : Finset ι} (hi : is) (n : μ) :
        (↑(Finset.antidiagonal n)).PairwiseDisjoint fun (p : μ × μ) => Finset.map (addRightEmbedding fun (j : ι) => if j = i then p.1 else 0) (s.piAntidiag p.2)
        theorem Finset.piAntidiag_cons {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCancelCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] {i : ι} {s : Finset ι} (hi : is) (n : μ) :
        (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))
        theorem Finset.piAntidiag_insert {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [AddCancelCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] {i : ι} {s : Finset ι} [DecidableEq (ιμ)] (hi : is) (n : μ) :
        (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)
        @[simp]
        theorem Finset.piAntidiag_zero {ι : Type u_1} {μ : Type u_2} [DecidableEq ι] [CanonicallyOrderedAddCommMonoid μ] [Finset.HasAntidiagonal μ] [DecidableEq μ] (s : Finset ι) :
        s.piAntidiag 0 = {0}
        theorem Finset.nsmul_piAntidiag {ι : Type u_1} [DecidableEq ι] [DecidableEq (ι)] (s : Finset ι) (m : ) {n : } (hn : n 0) :
        SMul.smul n (s.piAntidiag m) = Finset.filter (fun (f : ι) => is, n f i) (s.piAntidiag (n * m))
        theorem Finset.map_nsmul_piAntidiag {ι : Type u_1} [DecidableEq ι] (s : Finset ι) (m : ) {n : } (hn : n 0) :
        Finset.map { toFun := fun (x : ι) => n x, inj' := } (s.piAntidiag m) = Finset.filter (fun (f : ι) => is, n f i) (s.piAntidiag (n * m))
        theorem Finset.nsmul_piAntidiag_univ {ι : Type u_1} [DecidableEq ι] [Fintype ι] (m : ) {n : } (hn : n 0) :
        SMul.smul n (Finset.univ.piAntidiag m) = Finset.filter (fun (f : ι) => ∀ (i : ι), n f i) (Finset.univ.piAntidiag (n * m))
        theorem Finset.map_nsmul_piAntidiag_univ {ι : Type u_1} [DecidableEq ι] [Fintype ι] (m : ) {n : } (hn : n 0) :
        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))
        theorem Finset.map_sym_eq_piAntidiag {ι : Type u_1} [DecidableEq ι] (s : Finset ι) (n : ) :
        Finset.map { toFun := fun (m : Sym ι n) (a : ι) => Multiset.count a m, inj' := } (s.sym n) = s.piAntidiag n