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

full_name: Finset.HasAntidiagonal
code: /-- The class of additive monoids with an antidiagonal -/
class HasAntidiagonal (A : Type*) [AddMonoid A] where
  /-- The antidiagonal of an element `n` is the finset of pairs `(i, j)` such that `i + j = n`. -/
  antidiagonal : A → Finset (A × A)
  /-- A pair belongs to `antidiagonal n` iff the sum of its components is equal to `n`. -/
  mem_antidiagonal {n} {a} : a ∈ antidiagonal n ↔ a.fst + a.snd = n
goal: Type u_1

full_name: Finset.HasAntidiagonal.mem_antidiagonal
code: /-- The class of additive monoids with an antidiagonal -/
class HasAntidiagonal (A : Type*) [AddMonoid A] where
  /-- The antidiagonal of an element `n` is the finset of pairs `(i, j)` such that `i + j = n`. -/
  antidiagonal : A → Finset (A × A)
  /-- A pair belongs to `antidiagonal n` iff the sum of its components is equal to `n`. -/
  mem_antidiagonal {n} {a} : a ∈ antidiagonal n ↔ a.fst + a.snd = n
goal: a ∈ Finset.antidiagonal n ↔ a.1 + a.2 = n

full_name: Finset.HasAntidiagonal.antidiagonal
code: /-- The class of additive monoids with an antidiagonal -/
class HasAntidiagonal (A : Type*) [AddMonoid A] where
  /-- The antidiagonal of an element `n` is the finset of pairs `(i, j)` such that `i + j = n`. -/
  antidiagonal : A → Finset (A × A)
  /-- A pair belongs to `antidiagonal n` iff the sum of its components is equal to `n`. -/
  mem_antidiagonal {n} {a} : a ∈ antidiagonal n ↔ a.fst + a.snd = n
goal: A → Finset (A × A)

full_name: Finset.instSubsingletonHasAntidiagonal
code: /-- All `HasAntidiagonal` instances are equal -/
instance [AddMonoid A] : Subsingleton (HasAntidiagonal A) 
goal: Subsingleton (Finset.HasAntidiagonal A)

full_name: Finset.hasAntidiagonal_congr
code: lemma hasAntidiagonal_congr (A : Type*) [AddMonoid A]
    [H1 : HasAntidiagonal A] [H2 : HasAntidiagonal A] :
    H1.antidiagonal = H2.antidiagonal 
goal: Finset.antidiagonal = Finset.antidiagonal

full_name: Finset.swap_mem_antidiagonal
code: theorem swap_mem_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} {xy : A × A} :
    xy.swap ∈ antidiagonal n ↔ xy ∈ antidiagonal n 
goal: xy.swap ∈ Finset.antidiagonal n ↔ xy ∈ Finset.antidiagonal n

full_name: Finset.map_prodComm_antidiagonal
code: @[simp] theorem map_prodComm_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} :
    (antidiagonal n).map (Equiv.prodComm A A) = antidiagonal n 
goal: Finset.map (Equiv.prodComm A A).toEmbedding (Finset.antidiagonal n) = Finset.antidiagonal n

full_name: Finset.map_swap_antidiagonal
code: /-- See also `Finset.map_prodComm_antidiagonal`. -/
@[simp] theorem map_swap_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} :
    (antidiagonal n).map ⟨Prod.swap, Prod.swap_injective⟩ = antidiagonal n 
goal: Finset.map { toFun := Prod.swap, inj' := ⋯ } (Finset.antidiagonal n) = Finset.antidiagonal n

full_name: Finset.antidiagonal_congr
code: /-- A point in the antidiagonal is determined by its first coordinate.

See also `Finset.antidiagonal_congr'`. -/
theorem antidiagonal_congr (hp : p ∈ antidiagonal n) (hq : q ∈ antidiagonal n) :
    p = q ↔ p.1 = q.1 
goal: p = q ↔ p.1 = q.1

full_name: Finset.antidiagonal_subtype_ext
code: /-- A point in the antidiagonal is determined by its first co-ordinate (subtype version of
`Finset.antidiagonal_congr`). This lemma is used by the `ext` tactic. -/
@[ext] theorem antidiagonal_subtype_ext {p q : antidiagonal n} (h : p.val.1 = q.val.1) : p = q 
goal: p = q

full_name: Finset.antidiagonal_congr'
code: /-- A point in the antidiagonal is determined by its second coordinate.

See also `Finset.antidiagonal_congr`. -/
lemma antidiagonal_congr' (hp : p ∈ antidiagonal n) (hq : q ∈ antidiagonal n) :
    p = q ↔ p.2 = q.2 
goal: p = q ↔ p.2 = q.2

full_name: Finset.antidiagonal_zero
code: @[simp]
theorem antidiagonal_zero : antidiagonal (0 : A) = {(0, 0)} 
goal: Finset.antidiagonal 0 = {(0, 0)}

full_name: Finset.antidiagonal.fst_le
code: theorem antidiagonal.fst_le {n : A} {kl : A × A} (hlk : kl ∈ antidiagonal n) : kl.1 ≤ n 
goal: kl.1 ≤ n

full_name: Finset.antidiagonal.snd_le
code: theorem antidiagonal.snd_le {n : A} {kl : A × A} (hlk : kl ∈ antidiagonal n) : kl.2 ≤ n 
goal: kl.2 ≤ n

full_name: Finset.filter_fst_eq_antidiagonal
code: theorem filter_fst_eq_antidiagonal (n m : A) [DecidablePred (· = m)] [Decidable (m ≤ n)] :
    filter (fun x : A × A ↦ x.fst = m) (antidiagonal n) = if m ≤ n then {(m, n - m)} else ∅ 
goal: Finset.filter (fun x => x.1 = m) (Finset.antidiagonal n) = if m ≤ n then {(m, n - m)} else ∅

full_name: Finset.filter_snd_eq_antidiagonal
code: theorem filter_snd_eq_antidiagonal (n m : A) [DecidablePred (· = m)] [Decidable (m ≤ n)] :
    filter (fun x : A × A ↦ x.snd = m) (antidiagonal n) = if m ≤ n then {(n - m, m)} else ∅ 
goal: Finset.filter (fun x => x.2 = m) (Finset.antidiagonal n) = if m ≤ n then {(n - m, m)} else ∅

full_name: Finset.sigmaAntidiagonalEquivProd
code: /-- The disjoint union of antidiagonals `Σ (n : A), antidiagonal n` is equivalent to the product
    `A × A`. This is such an equivalence, obtained by mapping `(n, (k, l))` to `(k, l)`. -/
@[simps]
def sigmaAntidiagonalEquivProd [AddMonoid A] [HasAntidiagonal A] :
    (Σ n : A, antidiagonal n) ≃ A × A 
goal: (n : A) × { x // x ∈ Finset.antidiagonal n } ≃ A × A

full_name: Finset.sigmaAntidiagonalEquivProd_apply
code: /-- The disjoint union of antidiagonals `Σ (n : A), antidiagonal n` is equivalent to the product
    `A × A`. This is such an equivalence, obtained by mapping `(n, (k, l))` to `(k, l)`. -/
@[simps]
def sigmaAntidiagonalEquivProd [AddMonoid A] [HasAntidiagonal A] :
    (Σ n : A, antidiagonal n) ≃ A × A 
goal: Finset.sigmaAntidiagonalEquivProd x = ↑x.snd

full_name: Finset.sigmaAntidiagonalEquivProd_symm_apply_fst
code: /-- The disjoint union of antidiagonals `Σ (n : A), antidiagonal n` is equivalent to the product
    `A × A`. This is such an equivalence, obtained by mapping `(n, (k, l))` to `(k, l)`. -/
@[simps]
def sigmaAntidiagonalEquivProd [AddMonoid A] [HasAntidiagonal A] :
    (Σ n : A, antidiagonal n) ≃ A × A 
goal: (Finset.sigmaAntidiagonalEquivProd.symm x).fst = x.1 + x.2

full_name: Finset.sigmaAntidiagonalEquivProd_symm_apply_snd_coe
code: /-- The disjoint union of antidiagonals `Σ (n : A), antidiagonal n` is equivalent to the product
    `A × A`. This is such an equivalence, obtained by mapping `(n, (k, l))` to `(k, l)`. -/
@[simps]
def sigmaAntidiagonalEquivProd [AddMonoid A] [HasAntidiagonal A] :
    (Σ n : A, antidiagonal n) ≃ A × A 
goal: ↑(Finset.sigmaAntidiagonalEquivProd.symm x).snd = x

full_name: Finset.antidiagonalOfLocallyFinite
code: /-- In a canonically ordered add monoid, the antidiagonal can be construct by filtering.

Note that this is not an instance, as for some times a more efficient algorithm is available. -/
abbrev antidiagonalOfLocallyFinite : HasAntidiagonal A 
goal: Finset.HasAntidiagonal A