Antidiagonals in ℕ × ℕ as lists #
This file defines the antidiagonals of ℕ × ℕ as lists: the n
-th antidiagonal is the list 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 #
Files data.multiset.nat_antidiagonal
and data.finset.nat_antidiagonal
successively turn the
list
definition we have here into multiset
and finset
.
The antidiagonal of a natural number n
is the list of pairs (i, j)
such that i + j = n
.
Equations
- list.nat.antidiagonal n = list.map (λ (i : ℕ), (i, n - i)) (list.range (n + 1))
@[simp]
The length of the antidiagonal of n
is n + 1
.
@[simp]
The antidiagonal of 0
is the list [(0, 0)]
The antidiagonal of n
does not contain duplicate entries.
@[simp]
theorem
list.nat.antidiagonal_succ
{n : ℕ} :
list.nat.antidiagonal (n + 1) = (0, n + 1) :: list.map (prod.map nat.succ id) (list.nat.antidiagonal n)
theorem
list.nat.antidiagonal_succ'
{n : ℕ} :
list.nat.antidiagonal (n + 1) = list.map (prod.map id nat.succ) (list.nat.antidiagonal n) ++ [(n + 1, 0)]