Antidiagonals in ℕ × ℕ as finsets #
This file defines the antidiagonals of ℕ × ℕ as finsets: the n
-th antidiagonal is the finset 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 files Data.List.NatAntidiagonal
and Data.Multiset.NatAntidiagonal
, providing an
instance enabling Finset.antidiagonal
on Nat
.
The antidiagonal of a natural number n
is
the finset of pairs (i, j)
such that i + j = n
.
Equations
- Finset.Nat.instHasAntidiagonal = { antidiagonal := fun (n : ℕ) => { val := Multiset.Nat.antidiagonal n, nodup := ⋯ }, mem_antidiagonal := @Finset.Nat.instHasAntidiagonal.proof_1 }
theorem
Finset.Nat.antidiagonal_eq_map
(n : ℕ)
:
Finset.antidiagonal n = Finset.map { toFun := fun (i : ℕ) => (i, n - i), inj' := ⋯ } (Finset.range (n + 1))
theorem
Finset.Nat.antidiagonal_eq_map'
(n : ℕ)
:
Finset.antidiagonal n = Finset.map { toFun := fun (i : ℕ) => (n - i, i), inj' := ⋯ } (Finset.range (n + 1))
theorem
Finset.Nat.antidiagonal_eq_image
(n : ℕ)
:
Finset.antidiagonal n = Finset.image (fun (i : ℕ) => (i, n - i)) (Finset.range (n + 1))
theorem
Finset.Nat.antidiagonal_eq_image'
(n : ℕ)
:
Finset.antidiagonal n = Finset.image (fun (i : ℕ) => (n - i, i)) (Finset.range (n + 1))
@[simp]
The cardinality of the antidiagonal of n
is n + 1
.
@[simp]
The antidiagonal of 0
is the list [(0, 0)]
theorem
Finset.Nat.antidiagonal_succ
(n : ℕ)
:
Finset.antidiagonal (n + 1) = Finset.cons (0, n + 1)
(Finset.map ({ toFun := Nat.succ, inj' := Nat.succ_injective }.prodMap (Function.Embedding.refl ℕ))
(Finset.antidiagonal n))
⋯
theorem
Finset.Nat.antidiagonal_succ'
(n : ℕ)
:
Finset.antidiagonal (n + 1) = Finset.cons (n + 1, 0)
(Finset.map ((Function.Embedding.refl ℕ).prodMap { toFun := Nat.succ, inj' := Nat.succ_injective })
(Finset.antidiagonal n))
⋯
theorem
Finset.Nat.antidiagonal_succ_succ'
{n : ℕ}
:
Finset.antidiagonal (n + 2) = Finset.cons (0, n + 2)
(Finset.cons (n + 2, 0)
(Finset.map
({ toFun := Nat.succ, inj' := Nat.succ_injective }.prodMap { toFun := Nat.succ, inj' := Nat.succ_injective })
(Finset.antidiagonal n))
⋯)
⋯
@[simp]
theorem
Finset.Nat.antidiagonal_filter_snd_le_of_le
{n : ℕ}
{k : ℕ}
(h : k ≤ n)
:
Finset.filter (fun (a : ℕ × ℕ) => a.2 ≤ k) (Finset.antidiagonal n) = Finset.map ({ toFun := fun (x : ℕ) => x + (n - k), inj' := ⋯ }.prodMap (Function.Embedding.refl ℕ))
(Finset.antidiagonal k)
@[simp]
theorem
Finset.Nat.antidiagonal_filter_fst_le_of_le
{n : ℕ}
{k : ℕ}
(h : k ≤ n)
:
Finset.filter (fun (a : ℕ × ℕ) => a.1 ≤ k) (Finset.antidiagonal n) = Finset.map ((Function.Embedding.refl ℕ).prodMap { toFun := fun (x : ℕ) => x + (n - k), inj' := ⋯ })
(Finset.antidiagonal k)
@[simp]
theorem
Finset.Nat.antidiagonal_filter_le_fst_of_le
{n : ℕ}
{k : ℕ}
(h : k ≤ n)
:
Finset.filter (fun (a : ℕ × ℕ) => k ≤ a.1) (Finset.antidiagonal n) = Finset.map ({ toFun := fun (x : ℕ) => x + k, inj' := ⋯ }.prodMap (Function.Embedding.refl ℕ))
(Finset.antidiagonal (n - k))
@[simp]
theorem
Finset.Nat.antidiagonal_filter_le_snd_of_le
{n : ℕ}
{k : ℕ}
(h : k ≤ n)
:
Finset.filter (fun (a : ℕ × ℕ) => k ≤ a.2) (Finset.antidiagonal n) = Finset.map ((Function.Embedding.refl ℕ).prodMap { toFun := fun (x : ℕ) => x + k, inj' := ⋯ })
(Finset.antidiagonal (n - k))
@[simp]
theorem
Finset.Nat.antidiagonalEquivFin_symm_apply_coe
(n : ℕ)
:
∀ (x : Fin (n + 1)), ↑((Finset.Nat.antidiagonalEquivFin n).symm x) = (↑x, n - ↑x)
@[simp]
theorem
Finset.Nat.antidiagonalEquivFin_apply_val
(n : ℕ)
:
∀ (x : { x : ℕ × ℕ // x ∈ Finset.antidiagonal n }), ↑((Finset.Nat.antidiagonalEquivFin n) x) = x.1.1