Definition and basic properties of List.offDiag #
In this file we define List.offDiag l to be the product l.product l
with the diagonal removed.
The actual definition is more complicated to avoid assuming that equality on α is decidable.
List.offDiag l is the product l.product l with the diagonal removed.
Instances For
theorem
List.length_offDiag'
{α : Type u_1}
(l : List α)
:
l.offDiag.length = l.length * (l.length - 1)
@[simp]
theorem
List.count_offDiag_eq_mul_sub_ite
{α : Type u_1}
[DecidableEq α]
(l : List α)
(a b : α)
:
count (a, b) l.offDiag = count a l * count b l - if a = b then count a l else 0
@[simp]
List.offDiag l has no duplicates iff the original list has no duplicates.
theorem
List.Nodup.mem_offDiag
{α : Type u_1}
{l : List α}
(h : l.Nodup)
{x : α × α}
:
x ∈ l.offDiag ↔ x.1 ∈ l ∧ x.2 ∈ l ∧ x.1 ≠ x.2
If l : List α is a list with no duplicates, then x : α × α belongs to List.offDiag l
iff both components of x belong to l and they are not equal.