Documentation

Projects.Util.List.Part_003

@[simp]
theorem le_trans_simp {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
a ≤ b → b ≤ c → a ≤ c ↔ True
@[simp]
theorem le_trans_simp' {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
b ≤ c → a ≤ b → a ≤ c ↔ True
@[simp]
theorem le_total_simp {α : Type u_1} [ha : LinearOrder α] {a b : α} :
a ≤ b ∨ b ≤ a ↔ True
@[simp]
theorem le_antisymm_simp {α : Type u_1} [ha : LinearOrder α] {a b : α} :
a ≤ b → b ≤ a → a = b ↔ True
@[simp]
theorem le_antisymm'_simp {α : Type u_1} [ha : LinearOrder α] {a b : α} :
a ≤ b → b ≤ a → b = a ↔ True
@[simp]
theorem lt_trans_simp {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
a < b → b < c → a < c ↔ True
@[simp]
theorem lt_trans_simp' {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
b < c → a < b → a < c ↔ True
@[simp]
theorem List.mkList_eq_mkList_iff {α : Type u_1} {n m : ℕ} {f g : ℕ → α} :
mkList n f = mkList m g ↔ n = m ∧ ∀ i < n, f i = g i
theorem List.sum_mkList_fn_add {f g : ℕ → ℕ} {n : ℕ} :
(mkList n fun (i : ℕ) => f i + g i).sum = (mkList n f).sum + (mkList n g).sum
@[simp]
theorem List.mkList_const {α : Type u_1} {n : ℕ} {x : α} :
(mkList n fun (x_1 : ℕ) => x) = replicate n x
theorem List.sum_mkList_nat_eq_self_iff_of_pos {n : ℕ} {f : ℕ → ℕ} (h : ∀ i < n, 0 < f i) :
(mkList n f).sum = n ↔ ∀ i < n, f i = 1
theorem List.le_sum_mkList_of_pos {n : ℕ} {f : ℕ → ℕ} (h : ∀ i < n, 0 < f i) :
n ≤ (mkList n f).sum
theorem List.lt_sum_mkList_of_pos_and_exi {n : ℕ} {f : ℕ → ℕ} (h₁ : ∀ i < n, 0 < f i) (h₂ : ∃ i < n, 2 ≤ f i) :
n < (mkList n f).sum
theorem List.countP_eq_countP! :
@countP = fun (x : Type u_4) (p : x → Bool) (xs : List x) => xs.countP! fun (x : x) => p x = true
@[simp]
theorem List.countP!_nil {α : Type u_1} {p : α → Prop} :
theorem List.countP!_eq_attach {α : Type u_1} {xs : List α} {p : α → Prop} :
xs.countP! p = xs.attach.countP! fun (i : { x : α // x ∈ xs }) => p ↑i
theorem List.countP!_congr {α : Type u_1} {xs : List α} {p q : α → Prop} (h : ∀ x ∈ xs, p x ↔ q x) :
xs.countP! p = xs.countP! q
@[simp]
theorem List.countP!_append {α : Type u_1} {xs ys : List α} {p : α → Prop} :
(xs ++ ys).countP! p = xs.countP! p + ys.countP! p
@[simp]
theorem List.changesNum_nil {α : Type u_1} :
theorem List.flatIdx₁_cons_left {α : Type u_1} {xs : List α} {L : List (List α)} {i : ℕ} (h : i < xs.length) :
(xs :: L).flatIdx₁ i = 0
theorem List.flatIdx₂_append_left {α : Type u_1} {L₁ L₂ : List (List α)} {i : ℕ} (h : i < (map length L₁).sum) :
(L₁ ++ L₂).flatIdx₂ i = L₁.flatIdx₂ i
theorem List.flatIdx₂_cons_left {α : Type u_1} {xs : List α} {L : List (List α)} {i : ℕ} (h : i < xs.length) :
(xs :: L).flatIdx₂ i = i
@[simp]
theorem List.flatIdx₁_cons_add {α : Type u_1} {xs : List α} {L : List (List α)} {i : ℕ} :
(xs :: L).flatIdx₁ (xs.length + i) = L.flatIdx₁ i + 1
@[simp]
theorem List.flatIdx₂_cons_add {α : Type u_1} {xs : List α} {L : List (List α)} {i : ℕ} :
(xs :: L).flatIdx₂ (xs.length + i) = L.flatIdx₂ i
theorem List.take_flatten {α : Type u_1} {L : List (List α)} {i : ℕ} (h : i < (map length L).sum) :
theorem List.getElem_eq_getElem!_simp! {α : Type u_1} [ha : Inhabited α] :
getElem = fun (xs : List α) (i : ℕ) (x : i < xs.length) => xs[i]!
@[simp]
theorem List.countP!_map {α : Type u_1} {β : Type u_2} {xs : List α} {f : α → β} {p : β → Prop} :
(map f xs).countP! p = xs.countP! fun (x : α) => p (f x)
@[simp]
theorem List.countP!_cons {α : Type u_1} {xs : List α} {p : α → Prop} {x : α} :
(x :: xs).countP! p = xs.countP! p + Nat.ofProp (p x)
theorem List.countP!_or_of_disjoint {α : Type u_1} {xs : List α} {p q : α → Prop} (h : ∀ x ∈ xs, ¬p x ∨ ¬q x) :
(xs.countP! fun (x : α) => p x ∨ q x) = xs.countP! p + xs.countP! q
theorem List.countP!_eq_one_iff_of_nodup {α : Type u_1} {xs : List α} {p : α → Prop} (h : xs.Nodup) :
xs.countP! p = 1 ↔ ∃! x : α, x ∈ xs ∧ p x
theorem List.changesNum_append' {α : Type u_1} {xs ys : List α} :
(xs ++ ys).changesNum = xs.changesNum + ys.changesNum - if xs ≠ [] ∧ ys ≠ [] ∧ xs[xs.length - 1]? = ys[0]? then 1 else 0
theorem List.changesNum_append {α : Type u_1} {xs ys : List α} :
@[simp]
theorem List.changesNum_replicate {α : Type u_1} {n : ℕ} {x : α} :
theorem List.changesNum_flatten_mkList_replicate_ite_even {α : Type u_1} {n : ℕ} {f : ℕ → ℕ} {x y : α} (hx : x ≠ y) (hf : ∀ i < n, f i ≠ 0) :
(mkList n fun (i : ℕ) => replicate (f i) (if Even i then x else y)).flatten.changesNum = n
@[simp]
theorem List.take_mkList {α : Type u_1} {n i : ℕ} {f : ℕ → α} :
take i (mkList n f) = mkList (min i n) f
@[simp]
theorem List.countP!_le_length {α : Type u_1} {xs : List α} {p : α → Prop} :
@[simp]
theorem List.changesNum_le_length {α : Type u_1} {xs : List α} :
theorem List.sum_mkList_eq_zero_iff_of_pos {f : ℕ → ℕ} {n : ℕ} (h : ∀ k < n, 0 < f k) :
(mkList n f).sum = 0 ↔ n = 0
theorem List.prefix_take_of {α : Type u_1} {xs ys : List α} {n : ℕ} (h₁ : xs.length ≤ n) (h₂ : xs <+: ys) :
xs <+: take n ys
theorem List.le_sum_take_of {xs : List ℕ} {n : ℕ} (h₁ : ∀ x ∈ take n xs, 0 < x) (h₂ : n ≤ xs.length) :
n ≤ (take n xs).sum
theorem List.prefix_of_getElem {α : Type u_1} {xs ys : List α} (h₁ : xs.length ≤ ys.length) (h₂ : ∀ (i : ℕ) (h₁ : i < xs.length) (h₂ : i < ys.length), xs[i] = ys[i]) :
xs <+: ys
theorem List.flatIdx₁_le_flatIdx₁ {α : Type u_1} {L : List (List α)} {k n : ℕ} (h : k ≤ n) :
theorem List.flatIdx₁_sub_one_of_flatIdx₂_eq_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i < (map length L).sum) (h₃ : L.flatIdx₂ i = 0) :
L.flatIdx₁ (i - 1) = L.flatIdx₁ i - 1
theorem List.flatIdx₂_sub_one_of_flatIdx₂_eq_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i < (map length L).sum) (h₃ : L.flatIdx₂ i = 0) (h₄ : i ≠ 0) :
L.flatIdx₂ (i - 1) = L[L.flatIdx₁ i - 1].length - 1
theorem List.flatIdx₁_succ_ne_zero_of_flatIdx₂_eq_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : i + 1 < (map length L).sum) (h₂ : L.flatIdx₂ (i + 1) = 0) :
L.flatIdx₁ (i + 1) ≠ 0
theorem List.flatIdx₁_add_one_of_flatIdx₂_eq_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i + 1 < (map length L).sum) (h₃ : L.flatIdx₂ (i + 1) = 0) :
L.flatIdx₁ (i + 1) = L.flatIdx₁ i + 1
theorem List.flatIdx₂_add_one_of_flatIdx₂_eq_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i + 1 < (map length L).sum) (h₃ : L.flatIdx₂ (i + 1) = 0) :
@[simp]
theorem List.changesNum_singleton {α : Type u_1} {x : α} :
@[simp]
theorem List.changesNum_cons_cons {α : Type u_1} {xs : List α} {x y : α} :
(x :: y :: xs).changesNum = (y :: xs).changesNum + Nat.ofProp (x ≠ y)
theorem List.flatIdx₁_le_self {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : i < (map length L).sum) (h₂ : [] ∉ L) :
theorem List.flatIdx₁_sub_one_of_flatIdx₂_ne_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i < (map length L).sum) (h₃ : L.flatIdx₂ i ≠ 0) :
L.flatIdx₁ (i - 1) = L.flatIdx₁ i
theorem List.flatIdx₂_sub_one_of_flatIdx₂_ne_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i < (map length L).sum) (h₃ : L.flatIdx₂ i ≠ 0) :
L.flatIdx₂ (i - 1) = L.flatIdx₂ i - 1
theorem List.flatIdx₁_add_one_of_flatIdx₂_ne_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i + 1 < (map length L).sum) (h₃ : L.flatIdx₂ (i + 1) ≠ 0) :
L.flatIdx₁ (i + 1) = L.flatIdx₁ i
theorem List.flatIdx₂_add_one_of_flatIdx₂_ne_zero {α : Type u_1} {L : List (List α)} {i : ℕ} (h₁ : [] ∉ L) (h₂ : i + 1 < (map length L).sum) (h₃ : L.flatIdx₂ (i + 1) ≠ 0) :
L.flatIdx₂ (i + 1) = L.flatIdx₂ i + 1
@[simp]
theorem List.countP!_eq_zero_iff {α : Type u_1} {xs : List α} {p : α → Prop} :
xs.countP! p = 0 ↔ ∀ x ∈ xs, ¬p x
@[simp]
theorem List.countP!_range_congr {n m : ℕ} {p : ℕ → Prop} :
(range n).countP! p = (range m).countP! p ↔ ∀ (i : ℕ), min n m ≤ i → i < max n m → ¬p i
@[simp]
theorem List.flatten_mkList_getElem? {α : Type u_1} {xs : List α} {n : ℕ} :
(mkList n fun (x : ℕ) => xs[x]?.toList).flatten = take n xs
theorem List.flatIdx₂_replicate {α : Type u_1} {xs : List α} {n i : ℕ} (h : i < n * xs.length) :
(replicate n xs).flatIdx₂ i = i % xs.length
@[simp]
theorem List.zipWith_fst {α : Type u_1} {xs ys : List α} :
zipWith (fun (x x_1 : α) => x) xs ys = take ys.length xs
@[simp]
theorem List.zipWith_snd {α : Type u_1} {xs ys : List α} :
zipWith (fun (x y : α) => y) xs ys = take xs.length ys
@[simp]
theorem List.map_fst_zip_eq_take {α : Type u_1} {xs ys : List α} :
map (fun (x : α × α) => x.1) (xs.zip ys) = take ys.length xs
@[simp]
theorem List.map_snd_zip_eq_take {α : Type u_1} {xs ys : List α} :
map (fun (x : α × α) => x.2) (xs.zip ys) = take xs.length ys
theorem List.map_eq_map_iff' {α : Type u_1} {β : Type u_2} {xs ys : List α} {f g : α → β} :
map f xs = map g ys ↔ xs.length = ys.length ∧ ∀ (i : ℕ) (h₁ : i < xs.length) (h₂ : i < ys.length), f xs[i] = g ys[i]
theorem List.flatIdx₁_eq_length_of {α : Type u_1} {L : List (List α)} {i : ℕ} (h : (map length L).sum ≤ i) :
theorem List.flatIdx₁_eq_flatIdx₁_of {α : Type u_1} {L₁ L₂ : List (List α)} {i : ℕ} (h₁ : L₁.length = L₂.length) (h₂ : ∀ (i : ℕ) (h₁ : i < L₁.length) (h₂ : i < L₂.length), L₁[i].length = L₂[i].length) :
L₁.flatIdx₁ i = L₂.flatIdx₁ i
@[simp]
theorem List.default_eq {α : Type u_1} :
@[simp]
theorem List.sortedGT_cons {α : Type u_1} {xs : List α} [ha : LinearOrder α] {x : α} :
(x :: xs).SortedGT ↔ (∀ y ∈ xs, y < x) ∧ xs.SortedGT
theorem List.eq_reverse_of_perm_and_sortedLE_and_sortedGE {α : Type u_1} {xs ys : List α} [ha : LinearOrder α] (h₁ : xs.Perm ys) (h₂ : xs.SortedLE) (h₃ : ys.SortedGE) :
xs = ys.reverse
@[simp]
theorem List.sortedLT_nil {α : Type u_1} [ha : LinearOrder α] :
theorem List.Perm.min? {α : Type u_1} {xs ys : List α} [ha : LinearOrder α] (h : xs.Perm ys) :
xs.min? = ys.min?
theorem List.Perm.max? {α : Type u_1} {xs ys : List α} [ha : LinearOrder α] (h : xs.Perm ys) :
xs.max? = ys.max?
@[simp]
theorem List.min_dedup {α : Type u_1} {xs : List α} [ha : LinearOrder α] {h : xs.dedup ≠ []} :
xs.dedup.min h = xs.min ⋯
@[simp]
theorem List.max_dedup {α : Type u_1} {xs : List α} [ha : LinearOrder α] {h : xs.dedup ≠ []} :
xs.dedup.max h = xs.max ⋯
@[simp]
theorem List.min?_dedup {α : Type u_1} {xs : List α} [ha : LinearOrder α] :
@[simp]
theorem List.max?_dedup {α : Type u_1} {xs : List α} [ha : LinearOrder α] :
theorem List.min?_congr_of_dedup_perm {α : Type u_1} {xs ys : List α} [ha : LinearOrder α] (h : xs.dedup.Perm ys.dedup) :
xs.min? = ys.min?
theorem List.max?_congr_of_dedup_perm {α : Type u_1} {xs ys : List α} [ha : LinearOrder α] (h : xs.dedup.Perm ys.dedup) :
xs.max? = ys.max?
theorem List.dedup_perm_dedup_iff {α : Type u_1} {xs ys : List α} [ha : DecidableEq α] :
xs.dedup.Perm ys.dedup ↔ ∀ (x : α), x ∈ xs ↔ x ∈ ys
theorem List.length_eq_add_iff {α : Type u_1} {xs : List α} {n m : ℕ} :
xs.length = n + m ↔ ∃ (ys : List α) (zs : List α), ys.length = n ∧ zs.length = m ∧ xs = ys ++ zs
@[simp]
theorem List.getElem?_range_eq_some_iff {n i j : ℕ} :
(range n)[i]? = some j ↔ i < n ∧ i = j
@[simp]
@[simp]
theorem List.getElem?_mkList_eq_some_iff {α : Type u_1} {f : ℕ → α} {n i : ℕ} {x : α} :
(mkList n f)[i]? = some x ↔ i < n ∧ f i = x
@[simp]
theorem List.getElem?_mkList_eq_none_iff {α : Type u_1} {f : ℕ → α} {n i : ℕ} :
(mkList n f)[i]? = none ↔ n ≤ i
@[simp]
theorem List.flatten_mkList_fun_singleton {α : Type u_1} {f : ℕ → α} {n : ℕ} :
(mkList n fun (x : ℕ) => [f x]).flatten = mkList n f
@[simp]
theorem List.mkList_prefix_mkList_iff {α : Type u_1} {a b : ℕ → α} {k n : ℕ} :
mkList k a <+: mkList n b ↔ k ≤ n ∧ ∀ i < k, a i = b i
theorem List.exi_eq_replicate_append_of_ne_nil {α : Type u_1} {xs : List α} (h : xs ≠ []) :
∃ (n : ℕ) (x : α) (ys : List α), xs.head? ≠ ys.head? ∧ xs = replicate n x ++ ys
@[simp]
theorem List.head?_replicate_succ {α : Type u_1} {n : ℕ} {x : α} :
(replicate (n + 1) x).head? = some x
@[simp]
theorem List.getLast?_replicate_succ {α : Type u_1} {n : ℕ} {x : α} :
(replicate (n + 1) x).getLast? = some x
theorem List.eq_of_map_eq_map {α : Type u_1} {β : Type u_2} {xs ys : List α} (f : α → β) (h₁ : ∀ x ∈ xs ++ ys, ∀ y ∈ xs ++ ys, f x = f y → x = y) (h₂ : map f xs = map f ys) :
xs = ys
theorem List.apply_getElem_nil {α : Type u_1} (p : α → Prop) {n : ℕ} {h : n < [].length} :
p [][n]
@[simp]
theorem List.take_infix {α : Type u_1} {xs : List α} {n : ℕ} :
take n xs <:+: xs
@[simp]
theorem List.drop_infix {α : Type u_1} {xs : List α} {n : ℕ} :
drop n xs <:+: xs
theorem List.append_eq_append_iff_of_left {α : Type u_1} {l₁ l₂ l₃ l₄ : List α} (h : l₁.length = l₃.length) :
l₁ ++ l₂ = l₃ ++ l₄ ↔ l₁ = l₃ ∧ l₂ = l₄
theorem List.append_eq_append_iff_of_right {α : Type u_1} {l₁ l₂ l₃ l₄ : List α} (h : l₂.length = l₄.length) :
l₁ ++ l₂ = l₃ ++ l₄ ↔ l₁ = l₃ ∧ l₂ = l₄
theorem List.ind_reverse {α : Type u_1} {p : List α → Prop} (h : ∀ (xs : List α), p xs.reverse) (xs : List α) :
p xs
theorem List.ind_replicate_left {α : Type u_1} {p : List α → Prop} (h₁ : p []) (h₂ : ∀ (n : ℕ) (x : α) (xs : List α), n ≠ 0 → xs.head? ≠ some x → p xs → p (replicate n x ++ xs)) (xs : List α) :
p xs
theorem List.ind_replicate_right {α : Type u_1} {p : List α → Prop} (h₁ : p []) (h₂ : ∀ (n : ℕ) (x : α) (xs : List α), n ≠ 0 → xs.getLast? ≠ some x → p xs → p (xs ++ replicate n x)) (xs : List α) :
p xs
theorem List.changesNum_map {α : Type u_1} {β : Type u_2} {xs : List α} {f : α → β} (h : ∀ x ∈ xs, ∀ y ∈ xs, f x = f y → x = y) :
@[simp]
theorem List.getElem?_replicate_eq_some_iff {α : Type u_1} {n i : ℕ} {x y : α} :
(replicate n x)[i]? = some y ↔ i < n ∧ x = y
@[simp]
theorem List.some_eq_getElem?_replicate_iff {α : Type u_1} {n i : ℕ} {x y : α} :
some y = (replicate n x)[i]? ↔ i < n ∧ x = y
theorem List.mkList_eq_replicate_iff {α : Type u_1} {f : ℕ → α} {x : α} {n k : ℕ} :
mkList n f = replicate k x ↔ n = k ∧ ∀ i < n, f i = x
theorem List.replicate_eq_mkList_iff {α : Type u_1} {f : ℕ → α} {x : α} {n k : ℕ} :
replicate k x = mkList n f ↔ n = k ∧ ∀ i < n, f i = x
@[simp]
theorem List.changesNum_eq_zero_iff {α : Type u_1} {xs : List α} :
xs.changesNum = 0 ↔ xs = []
@[simp]
theorem List.getElem?_replicate_length_append {α : Type u_1} {xs : List α} {n : ℕ} {x : α} :
(replicate n x ++ xs)[n]? = xs[0]?
@[simp]
theorem List.changesNum_reverse {α : Type u_1} {xs : List α} :
theorem List.changesNum_eq_succ_iff_left {α : Type u_1} {xs : List α} {n : ℕ} :
xs.changesNum = n + 1 ↔ ∃ (k : ℕ) (x : α) (ys : List α), k ≠ 0 ∧ ys.head? ≠ some x ∧ ys.changesNum = n ∧ xs = replicate k x ++ ys
theorem List.changesNum_eq_succ_iff_right {α : Type u_1} {xs : List α} {n : ℕ} :
xs.changesNum = n + 1 ↔ ∃ (k : ℕ) (x : α) (ys : List α), k ≠ 0 ∧ ys.getLast? ≠ some x ∧ ys.changesNum = n ∧ xs = ys ++ replicate k x
@[simp]
theorem List.changesNum_le_of_infix {α : Type u_1} {xs ys : List α} (h : xs <:+: ys) :
@[simp]
theorem List.changesNum_take_le_changesNum {α : Type u_1} {xs : List α} {n : ℕ} :
theorem List.getElem_append_congr_right {α : Type u_1} {xs ys zs : List α} {i : ℕ} {h₁ : i < (xs ++ ys).length} {h₂ : i < (xs ++ zs).length} (h₃ : ∀ (k : ℕ) (h : i = xs.length + k), ys[k] = zs[k]) :
(xs ++ ys)[i] = (xs ++ zs)[i]
theorem List.init_eq_take {α : Type u_1} {xs : List α} :
xs.init = take (xs.length - 1) xs
@[simp]
theorem List.prefix_init {α : Type u_1} {xs : List α} :
xs.init <+: xs
@[simp]
theorem List.infix_init {α : Type u_1} {xs : List α} :
xs.init <:+: xs
@[simp]
theorem List.init_append_cons {α : Type u_1} {xs ys : List α} {x : α} :
(xs ++ x :: ys).init = xs ++ (x :: ys).init
@[simp]
theorem List.init_append_snoc {α : Type u_1} {xs ys : List α} {x : α} :
(xs ++ (ys ++ [x])).init = xs ++ ys
@[simp]
theorem List.take_one_append_tail {α : Type u_1} {xs : List α} :
take 1 xs ++ xs.tail = xs
@[simp]
theorem List.suffix_tail {α : Type u_1} {xs : List α} :
xs.tail <:+ xs
@[simp]
theorem List.infix_tail {α : Type u_1} {xs : List α} :
xs.tail <:+: xs
theorem List.infix_append_iff_of {α : Type u_1} {xs ys zs : List α} (h : ∀ (h : zs ≠ []), zs.head h ∉ xs) :
xs <:+: ys ++ zs ↔ xs <:+: ys ∨ xs <:+: zs
@[simp]
theorem List.getElem?_add_replicate {α : Type u_1} {xs : List α} {n k : ℕ} {x : α} :
(replicate n x ++ xs)[n + k]? = xs[k]?
theorem List.replicate_append_eq_replicate_iff {α : Type u_1} {xs : List α} {n m : ℕ} {x y : α} :
replicate n x ++ xs = replicate m y ↔ xs = replicate xs.length y ∧ n + xs.length = m ∧ (n ≠ 0 → x = y)
theorem List.append_replicate_eq_replicate_iff {α : Type u_1} {xs : List α} {n m : ℕ} {x y : α} :
xs ++ replicate n x = replicate m y ↔ xs = replicate xs.length y ∧ n + xs.length = m ∧ (n ≠ 0 → x = y)
theorem List.append_replicate_append_eq_replicate_iff {α : Type u_1} {xs ys : List α} {n m : ℕ} {x y : α} :
xs ++ replicate n x ++ ys = replicate m y ↔ xs = replicate xs.length y ∧ ys = replicate ys.length y ∧ n + xs.length + ys.length = m ∧ (n ≠ 0 → x = y)
theorem List.append_replicate_append_eq_replicate_iff' {α : Type u_1} {xs ys : List α} {n m : ℕ} {x y : α} :
xs ++ (replicate n x ++ ys) = replicate m y ↔ xs = replicate xs.length y ∧ ys = replicate ys.length y ∧ n + xs.length + ys.length = m ∧ (n ≠ 0 → x = y)
theorem List.replicate_prefix_replicate_aux {α : Type u_1} {n m : ℕ} {x y : α} :
(∃ (t : List α), t = replicate t.length y ∧ n + t.length = m ∧ (n ≠ 0 → x = y)) ↔ n ≤ m ∧ (¬n = 0 → x = y)
@[simp]
theorem List.replicate_prefix_replicate_iff {α : Type u_1} {n m : ℕ} {x y : α} :
replicate n x <+: replicate m y ↔ n ≤ m ∧ (n ≠ 0 → x = y)
@[simp]
theorem List.replicate_suffix_replicate_iff {α : Type u_1} {n m : ℕ} {x y : α} :
replicate n x <:+ replicate m y ↔ n ≤ m ∧ (n ≠ 0 → x = y)
@[simp]
theorem List.replicate_infix_replicate_iff {α : Type u_1} {n m : ℕ} {x y : α} :
replicate n x <:+: replicate m y ↔ n ≤ m ∧ (n ≠ 0 → x = y)
@[simp]
theorem List.sum_map_ite_eq_count {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x : α} :
(map (fun (i : α) => if i = x then 1 else 0) xs).sum = count x xs
@[simp]
theorem List.sum_map_ite_eq_count' {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x : α} :
(map (fun (i : α) => if x = i then 1 else 0) xs).sum = count x xs
theorem List.length_eq_sum_map_count_of_nodup_and_subset {α : Type u_1} {xs ys : List α} [ha : DecidableEq α] (h₁ : ys.Nodup) (h₂ : xs ⊆ ys) :
xs.length = (map (fun (a : α) => count a xs) ys).sum