Antidiagonals in ℕ × ℕ as multisets #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines the antidiagonals of ℕ × ℕ as multisets: the n
-th antidiagonal is the multiset
of pairs (i, j)
such that i + j = n
. This is useful for polynomial multiplication and more
generally for sums going from 0
to n
.
Notes #
This refines file data.list.nat_antidiagonal
and is further refined by file
data.finset.nat_antidiagonal
.
The antidiagonal of a natural number n
is
the multiset of pairs (i, j)
such that i + j = n
.
Equations
@[simp]
theorem
multiset.nat.card_antidiagonal
(n : ℕ) :
⇑multiset.card (multiset.nat.antidiagonal n) = n + 1
The cardinality of the antidiagonal of n
is n+1
.
@[simp]
The antidiagonal of 0
is the list [(0, 0)]
@[simp]
The antidiagonal of n
does not contain duplicate entries.
@[simp]
theorem
multiset.nat.antidiagonal_succ
{n : ℕ} :
multiset.nat.antidiagonal (n + 1) = (0, n + 1) ::ₘ multiset.map (prod.map nat.succ id) (multiset.nat.antidiagonal n)
theorem
multiset.nat.antidiagonal_succ'
{n : ℕ} :
multiset.nat.antidiagonal (n + 1) = (n + 1, 0) ::ₘ multiset.map (prod.map id nat.succ) (multiset.nat.antidiagonal n)
theorem
multiset.nat.antidiagonal_succ_succ'
{n : ℕ} :
multiset.nat.antidiagonal (n + 2) = (0, n + 2) ::ₘ (n + 2, 0) ::ₘ multiset.map (prod.map nat.succ nat.succ) (multiset.nat.antidiagonal n)