Documentation

Mathlib.Data.List.OffDiag

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.

def List.offDiag {α : Type u_1} (l : List α) :
List (α × α)

List.offDiag lis the productl.product l` with the diagonal removed.

Equations
Instances For
    @[simp]
    theorem List.offDiag_nil {α : Type u_1} :
    theorem List.offDiag_cons_perm {α : Type u_1} (a : α) (l : List α) :
    (a :: l).offDiag.Perm (map (fun (x : α) => (a, x)) l ++ map (fun (x : α) => (x, a)) l ++ l.offDiag)
    @[simp]
    theorem List.offDiag_singleton {α : Type u_1} (a : α) :
    theorem List.length_offDiag' {α : Type u_1} (l : List α) :
    @[simp]
    theorem List.length_offDiag {α : Type u_1} (l : List α) :
    theorem List.mem_offDiag_iff_getElem {α : Type u_1} {l : List α} {x : α × α} :
    x l.offDiag (i : ), (x_1 : i < l.length), (j : ), (x_2 : j < l.length), i j l[i] = x.fst l[j] = x.snd
    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
    theorem List.Perm.offDiag {α : Type u_1} {l₁ l₂ : List α} (h : l₁.Perm l₂) :
    l₁.offDiag.Perm l₂.offDiag
    theorem List.Nodup.offDiag {α : Type u_1} {l : List α} (h : l.Nodup) :
    theorem List.Nodup.of_offDiag {α : Type u_1} {l : List α} (h : l.offDiag.Nodup) :
    @[simp]
    theorem List.nodup_offDiag {α : Type u_1} {l : List α} :

    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.fst l x.snd l x.fst x.snd

    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.

    theorem List.map_prodMap_offDiag {α : Type u_1} {β : Type u_2} (f : αβ) (l : List α) :