The areas / V33. Data structures and computation
Mathlib.Data.List.OffDiag
15 declarations. Mathlib docs · Source
theorem List.offDiag.match_1.congr_eq_1 E1 #
∀ {α : Type u_1} (motive : α × ℕ → Sort u_2) (x : α × ℕ) (h_1 : (x : α) → (n : ℕ) → motive (x, n)) (x_1 : α) (n : ℕ),
x = (x_1, n) →
(match x with
| (x, n) => h_1 x n) ≍
h_1 x_1 n
def List.offDiag E1 #
{α : Type u_1} → List α → List (α × α)
List.offDiag l is the product l.product l with the diagonal removed.
theorem List.offDiag_nil E0 #
∀ {α : Type u_1}, [].offDiag = []
theorem List.offDiag_cons_perm E1 #
∀ {α : Type u_1} (a : α) (l : List α),
(a :: l).offDiag.Perm (List.map (fun x ↦ (a, x)) l ++ List.map (fun x ↦ (x, a)) l ++ l.offDiag)
theorem List.offDiag_singleton E0 #
∀ {α : Type u_1} (a : α), [a].offDiag = []
theorem List.length_offDiag' E1 #
∀ {α : Type u_1} (l : List α), l.offDiag.length = l.length * (l.length - 1)
theorem List.length_offDiag E0 #
∀ {α : Type u_1} (l : List α), l.offDiag.length = l.length ^ 2 - l.length
theorem List.mem_offDiag_iff_getElem E0 #
∀ {α : 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.1 ∧ l[j] = x.2
theorem List.count_offDiag_eq_mul_sub_ite E1 #
∀ {α : Type u_1} [inst : DecidableEq α] (l : List α) (a b : α),
List.count (a, b) l.offDiag = List.count a l * List.count b l - if a = b then List.count a l else 0
theorem List.Perm.offDiag E1 #
∀ {α : Type u_1} {l₁ l₂ : List α}, l₁.Perm l₂ → l₁.offDiag.Perm l₂.offDiag
theorem List.Nodup.offDiag E1 #
∀ {α : Type u_1} {l : List α}, l.Nodup → l.offDiag.Nodup
theorem List.Nodup.of_offDiag E1 #
∀ {α : Type u_1} {l : List α}, l.offDiag.Nodup → l.Nodup
theorem List.nodup_offDiag E0 #
∀ {α : Type u_1} {l : List α}, l.offDiag.Nodup ↔ l.Nodup
List.offDiag l has no duplicates iff the original list has no duplicates.
theorem List.Nodup.mem_offDiag E0 #
∀ {α : Type u_1} {l : List α}, 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.
theorem List.map_prodMap_offDiag E0 #
∀ {α : Type u_1} {β : Type u_2} (f : α → β) (l : List α), List.map (Prod.map f f) l.offDiag = (List.map f l).offDiag