file
stringlengths
21
79
dependencies
sequencelengths
1
16
definitions
listlengths
1
625
theorem_idx
int64
0
574
theorem
stringlengths
3
121
theorem_loc
sequencelengths
2
2
tactic_idx
int64
0
155
tactic_len
int64
1
156
tactic
stringlengths
3
5.76k
state_before
stringlengths
7
13.6k
state_after
stringlengths
7
13.6k
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
326
List.length_merge
[ [ 1586, 51 ], [ 1594, 43 ] ]
4
9
split
α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α ⊢ (if s a b = true then a :: merge s l (b :: r) else b :: merge s (a :: l) r).length = (a :: l).length + (b :: r).length
case isTrue α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : s a b = true ⊢ (a :: merge s l (b :: r)).length = (a :: l).length + (b :: r).length case isFalse α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ (b :: merge s (a :: l) r).length = (a :: l).length + (b :: r).length
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
326
List.length_merge
[ [ 1586, 51 ], [ 1594, 43 ] ]
5
9
· simp_arith [length_merge s l (b::r)]
case isTrue α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : s a b = true ⊢ (a :: merge s l (b :: r)).length = (a :: l).length + (b :: r).length case isFalse α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ (b :: merge s (a :: l) r).length = (a :: l).length + (b :: r).length
case isFalse α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ (b :: merge s (a :: l) r).length = (a :: l).length + (b :: r).length
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
326
List.length_merge
[ [ 1586, 51 ], [ 1594, 43 ] ]
6
9
· simp_arith [length_merge s (a::l) r]
case isFalse α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ (b :: merge s (a :: l) r).length = (a :: l).length + (b :: r).length
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
326
List.length_merge
[ [ 1586, 51 ], [ 1594, 43 ] ]
7
9
simp_arith [length_merge s l (b::r)]
case isTrue α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : s a b = true ⊢ (a :: merge s l (b :: r)).length = (a :: l).length + (b :: r).length
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
326
List.length_merge
[ [ 1586, 51 ], [ 1594, 43 ] ]
8
9
simp_arith [length_merge s (a::l) r]
case isFalse α : Type u_1 s : α → α → Bool l✝ r✝ : List α a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ (b :: merge s (a :: l) r).length = (a :: l).length + (b :: r).length
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
0
9
match l, r with | l, [] => simp | [], l => simp | a::l, b::r => rw [cons_merge_cons] split · simp [mem_merge (l := l) (r := b::r), or_assoc] · simp [mem_merge (l := a::l) (r := r), or_assoc, or_left_comm]
α : Type u_1 x : α l r : List α s : α → α → Bool ⊢ x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
1
9
simp
α : Type u_1 x : α l✝ r : List α s : α → α → Bool l : List α ⊢ x ∈ merge s l [] ↔ x ∈ l ∨ x ∈ []
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
2
9
simp
α : Type u_1 x : α l✝ r : List α s : α → α → Bool l : List α ⊢ x ∈ merge s [] l ↔ x ∈ [] ∨ x ∈ l
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
3
9
rw [cons_merge_cons]
α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α ⊢ x ∈ merge s (a :: l) (b :: r) ↔ x ∈ a :: l ∨ x ∈ b :: r
α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α ⊢ (x ∈ if s a b = true then a :: merge s l (b :: r) else b :: merge s (a :: l) r) ↔ x ∈ a :: l ∨ x ∈ b :: r
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
4
9
split
α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α ⊢ (x ∈ if s a b = true then a :: merge s l (b :: r) else b :: merge s (a :: l) r) ↔ x ∈ a :: l ∨ x ∈ b :: r
case isTrue α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : s a b = true ⊢ x ∈ a :: merge s l (b :: r) ↔ x ∈ a :: l ∨ x ∈ b :: r case isFalse α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ x ∈ b :: merge s (a :: l) r ↔ x ∈ a :: l ∨ x ∈ b :: r
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
5
9
· simp [mem_merge (l := l) (r := b::r), or_assoc]
case isTrue α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : s a b = true ⊢ x ∈ a :: merge s l (b :: r) ↔ x ∈ a :: l ∨ x ∈ b :: r case isFalse α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ x ∈ b :: merge s (a :: l) r ↔ x ∈ a :: l ∨ x ∈ b :: r
case isFalse α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ x ∈ b :: merge s (a :: l) r ↔ x ∈ a :: l ∨ x ∈ b :: r
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
6
9
· simp [mem_merge (l := a::l) (r := r), or_assoc, or_left_comm]
case isFalse α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ x ∈ b :: merge s (a :: l) r ↔ x ∈ a :: l ∨ x ∈ b :: r
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
7
9
simp [mem_merge (l := l) (r := b::r), or_assoc]
case isTrue α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : s a b = true ⊢ x ∈ a :: merge s l (b :: r) ↔ x ∈ a :: l ∨ x ∈ b :: r
no goals
.lake/packages/batteries/Batteries/Data/List/Lemmas.lean
[ [ "Batteries.Tactic.Alias", ".lake/packages/batteries/Batteries/Tactic/Alias.lean" ], [ "Init", ".lake/packages/lean4/src/lean/Init.lean" ], [ "Batteries.Control.ForInStep.Lemmas", ".lake/packages/batteries/Batteries/Control/ForInStep/Lemmas.lean" ], [ "Batteries.Tactic.Init", ".lake/packages/batteries/Batteries/Tactic/Init.lean" ], [ "Batteries.Data.List.Basic", ".lake/packages/batteries/Batteries/Data/List/Basic.lean" ] ]
[ { "code": "@[simp] theorem mem_toArray {a : α} {l : List α} : a ∈ l.toArray ↔ a ∈ l", "end": [ 18, 23 ], "full_name": "List.mem_toArray", "kind": "commanddeclaration", "start": [ 17, 1 ] }, { "code": "@[simp]\ntheorem drop_one : ∀ l : List α, drop 1 l = tail l", "end": [ 24, 23 ], "full_name": "List.drop_one", "kind": "commanddeclaration", "start": [ 22, 1 ] }, { "code": "theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail", "end": [ 29, 47 ], "full_name": "List.zipWith_distrib_tail", "kind": "commanddeclaration", "start": [ 28, 1 ] }, { "code": "theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂", "end": [ 33, 83 ], "full_name": "List.subset_def", "kind": "commanddeclaration", "start": [ 33, 1 ] }, { "code": "@[simp] theorem nil_subset (l : List α) : [] ⊆ l", "end": [ 35, 58 ], "full_name": "List.nil_subset", "kind": "commanddeclaration", "start": [ 35, 1 ] }, { "code": "@[simp] theorem Subset.refl (l : List α) : l ⊆ l", "end": [ 37, 65 ], "full_name": "List.Subset.refl", "kind": "commanddeclaration", "start": [ 37, 1 ] }, { "code": "theorem Subset.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃", "end": [ 40, 23 ], "full_name": "List.Subset.trans", "kind": "commanddeclaration", "start": [ 39, 1 ] }, { "code": "@[simp] theorem subset_cons (a : α) (l : List α) : l ⊆ a :: l", "end": [ 48, 85 ], "full_name": "List.subset_cons", "kind": "commanddeclaration", "start": [ 48, 1 ] }, { "code": "theorem subset_of_cons_subset {a : α} {l₁ l₂ : List α} : a :: l₁ ⊆ l₂ → l₁ ⊆ l₂", "end": [ 51, 39 ], "full_name": "List.subset_of_cons_subset", "kind": "commanddeclaration", "start": [ 50, 1 ] }, { "code": "theorem subset_cons_of_subset (a : α) {l₁ l₂ : List α} : l₁ ⊆ l₂ → l₁ ⊆ a :: l₂", "end": [ 54, 29 ], "full_name": "List.subset_cons_of_subset", "kind": "commanddeclaration", "start": [ 53, 1 ] }, { "code": "theorem cons_subset_cons {l₁ l₂ : List α} (a : α) (s : l₁ ⊆ l₂) : a :: l₁ ⊆ a :: l₂", "end": [ 57, 62 ], "full_name": "List.cons_subset_cons", "kind": "commanddeclaration", "start": [ 56, 1 ] }, { "code": "@[simp] theorem subset_append_left (l₁ l₂ : List α) : l₁ ⊆ l₁ ++ l₂", "end": [ 59, 98 ], "full_name": "List.subset_append_left", "kind": "commanddeclaration", "start": [ 59, 1 ] }, { "code": "@[simp] theorem subset_append_right (l₁ l₂ : List α) : l₂ ⊆ l₁ ++ l₂", "end": [ 61, 100 ], "full_name": "List.subset_append_right", "kind": "commanddeclaration", "start": [ 61, 1 ] }, { "code": "theorem subset_append_of_subset_left (l₂ : List α) : l ⊆ l₁ → l ⊆ l₁ ++ l₂", "end": [ 64, 50 ], "full_name": "List.subset_append_of_subset_left", "kind": "commanddeclaration", "start": [ 63, 1 ] }, { "code": "theorem subset_append_of_subset_right (l₁ : List α) : l ⊆ l₂ → l ⊆ l₁ ++ l₂", "end": [ 67, 51 ], "full_name": "List.subset_append_of_subset_right", "kind": "commanddeclaration", "start": [ 66, 1 ] }, { "code": "@[simp] theorem cons_subset : a :: l ⊆ m ↔ a ∈ m ∧ l ⊆ m", "end": [ 70, 66 ], "full_name": "List.cons_subset", "kind": "commanddeclaration", "start": [ 69, 1 ] }, { "code": "@[simp] theorem append_subset {l₁ l₂ l : List α} :\n l₁ ++ l₂ ⊆ l ↔ l₁ ⊆ l ∧ l₂ ⊆ l", "end": [ 73, 79 ], "full_name": "List.append_subset", "kind": "commanddeclaration", "start": [ 72, 1 ] }, { "code": "theorem subset_nil {l : List α} : l ⊆ [] ↔ l = []", "end": [ 76, 99 ], "full_name": "List.subset_nil", "kind": "commanddeclaration", "start": [ 75, 1 ] }, { "code": "theorem map_subset {l₁ l₂ : List α} (f : α → β) (H : l₁ ⊆ l₂) : map f l₁ ⊆ map f l₂", "end": [ 79, 72 ], "full_name": "List.map_subset", "kind": "commanddeclaration", "start": [ 78, 1 ] }, { "code": "@[simp] theorem nil_sublist : ∀ l : List α, [] <+ l", "end": [ 85, 37 ], "full_name": "List.nil_sublist", "kind": "commanddeclaration", "start": [ 83, 1 ] }, { "code": "@[simp] theorem Sublist.refl : ∀ l : List α, l <+ l", "end": [ 89, 39 ], "full_name": "List.Sublist.refl", "kind": "commanddeclaration", "start": [ 87, 1 ] }, { "code": "theorem Sublist.trans {l₁ l₂ l₃ : List α} (h₁ : l₁ <+ l₂) (h₂ : l₂ <+ l₃) : l₁ <+ l₃", "end": [ 100, 53 ], "full_name": "List.Sublist.trans", "kind": "commanddeclaration", "start": [ 91, 1 ] }, { "code": "@[simp] theorem sublist_cons (a : α) (l : List α) : l <+ a :: l", "end": [ 104, 91 ], "full_name": "List.sublist_cons", "kind": "commanddeclaration", "start": [ 104, 1 ] }, { "code": "theorem sublist_of_cons_sublist : a :: l₁ <+ l₂ → l₁ <+ l₂", "end": [ 107, 28 ], "full_name": "List.sublist_of_cons_sublist", "kind": "commanddeclaration", "start": [ 106, 1 ] }, { "code": "@[simp] theorem sublist_append_left : ∀ l₁ l₂ : List α, l₁ <+ l₁ ++ l₂", "end": [ 111, 55 ], "full_name": "List.sublist_append_left", "kind": "commanddeclaration", "start": [ 109, 1 ] }, { "code": "@[simp] theorem sublist_append_right : ∀ l₁ l₂ : List α, l₂ <+ l₁ ++ l₂", "end": [ 115, 55 ], "full_name": "List.sublist_append_right", "kind": "commanddeclaration", "start": [ 113, 1 ] }, { "code": "theorem sublist_append_of_sublist_left (s : l <+ l₁) : l <+ l₁ ++ l₂", "end": [ 118, 36 ], "full_name": "List.sublist_append_of_sublist_left", "kind": "commanddeclaration", "start": [ 117, 1 ] }, { "code": "theorem sublist_append_of_sublist_right (s : l <+ l₂) : l <+ l₁ ++ l₂", "end": [ 121, 37 ], "full_name": "List.sublist_append_of_sublist_right", "kind": "commanddeclaration", "start": [ 120, 1 ] }, { "code": "@[simp]\ntheorem cons_sublist_cons : a :: l₁ <+ a :: l₂ ↔ l₁ <+ l₂", "end": [ 125, 77 ], "full_name": "List.cons_sublist_cons", "kind": "commanddeclaration", "start": [ 123, 1 ] }, { "code": "@[simp] theorem append_sublist_append_left : ∀ l, l ++ l₁ <+ l ++ l₂ ↔ l₁ <+ l₂", "end": [ 129, 69 ], "full_name": "List.append_sublist_append_left", "kind": "commanddeclaration", "start": [ 127, 1 ] }, { "code": "theorem Sublist.append_left : l₁ <+ l₂ → ∀ l, l ++ l₁ <+ l ++ l₂", "end": [ 132, 50 ], "full_name": "List.Sublist.append_left", "kind": "commanddeclaration", "start": [ 131, 1 ] }, { "code": "theorem Sublist.append_right : l₁ <+ l₂ → ∀ l, l₁ ++ l <+ l₂ ++ l", "end": [ 137, 48 ], "full_name": "List.Sublist.append_right", "kind": "commanddeclaration", "start": [ 134, 1 ] }, { "code": "theorem sublist_or_mem_of_sublist (h : l <+ l₁ ++ a :: l₂) : l <+ l₁ ++ l₂ ∨ a ∈ l", "end": [ 147, 65 ], "full_name": "List.sublist_or_mem_of_sublist", "kind": "commanddeclaration", "start": [ 139, 1 ] }, { "code": "theorem Sublist.reverse : l₁ <+ l₂ → l₁.reverse <+ l₂.reverse", "end": [ 152, 85 ], "full_name": "List.Sublist.reverse", "kind": "commanddeclaration", "start": [ 149, 1 ] }, { "code": "@[simp] theorem reverse_sublist : l₁.reverse <+ l₂.reverse ↔ l₁ <+ l₂", "end": [ 155, 82 ], "full_name": "List.reverse_sublist", "kind": "commanddeclaration", "start": [ 154, 1 ] }, { "code": "@[simp] theorem append_sublist_append_right (l) : l₁ ++ l <+ l₂ ++ l ↔ l₁ <+ l₂", "end": [ 162, 30 ], "full_name": "List.append_sublist_append_right", "kind": "commanddeclaration", "start": [ 157, 1 ] }, { "code": "theorem Sublist.append (hl : l₁ <+ l₂) (hr : r₁ <+ r₂) : l₁ ++ r₁ <+ l₂ ++ r₂", "end": [ 165, 66 ], "full_name": "List.Sublist.append", "kind": "commanddeclaration", "start": [ 164, 1 ] }, { "code": "theorem Sublist.subset : l₁ <+ l₂ → l₁ ⊆ l₂", "end": [ 171, 53 ], "full_name": "List.Sublist.subset", "kind": "commanddeclaration", "start": [ 167, 1 ] }, { "code": "theorem Sublist.length_le : l₁ <+ l₂ → length l₁ ≤ length l₂", "end": [ 185, 45 ], "full_name": "List.Sublist.length_le", "kind": "commanddeclaration", "start": [ 182, 1 ] }, { "code": "@[simp] theorem sublist_nil {l : List α} : l <+ [] ↔ l = []", "end": [ 188, 64 ], "full_name": "List.sublist_nil", "kind": "commanddeclaration", "start": [ 187, 1 ] }, { "code": "theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l₁ = l₂", "end": [ 193, 57 ], "full_name": "List.Sublist.eq_of_length", "kind": "commanddeclaration", "start": [ 190, 1 ] }, { "code": "theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂", "end": [ 196, 50 ], "full_name": "List.Sublist.eq_of_length_le", "kind": "commanddeclaration", "start": [ 195, 1 ] }, { "code": "@[simp] theorem singleton_sublist {a : α} {l} : [a] <+ l ↔ a ∈ l", "end": [ 201, 66 ], "full_name": "List.singleton_sublist", "kind": "commanddeclaration", "start": [ 198, 1 ] }, { "code": "@[simp] theorem replicate_sublist_replicate {m n} (a : α) :\n replicate m a <+ replicate n a ↔ m ≤ n", "end": [ 209, 48 ], "full_name": "List.replicate_sublist_replicate", "kind": "commanddeclaration", "start": [ 203, 1 ] }, { "code": "theorem isSublist_iff_sublist [BEq α] [LawfulBEq α] {l₁ l₂ : List α} :\n l₁.isSublist l₂ ↔ l₁ <+ l₂", "end": [ 228, 24 ], "full_name": "List.isSublist_iff_sublist", "kind": "commanddeclaration", "start": [ 211, 1 ] }, { "code": "theorem tail_eq_tailD (l) : @tail α l = tailD l []", "end": [ 235, 73 ], "full_name": "List.tail_eq_tailD", "kind": "commanddeclaration", "start": [ 235, 1 ] }, { "code": "theorem tail_eq_tail? (l) : @tail α l = (tail? l).getD []", "end": [ 237, 85 ], "full_name": "List.tail_eq_tail?", "kind": "commanddeclaration", "start": [ 237, 1 ] }, { "code": "@[simp] theorem next?_nil : @next? α [] = none", "end": [ 241, 54 ], "full_name": "List.next?_nil", "kind": "commanddeclaration", "start": [ 241, 1 ] }, { "code": "@[simp] theorem next?_cons (a l) : @next? α (a :: l) = some (a, l)", "end": [ 242, 74 ], "full_name": "List.next?_cons", "kind": "commanddeclaration", "start": [ 242, 1 ] }, { "code": "theorem getElem_eq_iff {l : List α} {n : Nat} {h : n < l.length} : l[n] = x ↔ l[n]? = some x", "end": [ 248, 40 ], "full_name": "List.getElem_eq_iff", "kind": "commanddeclaration", "start": [ 246, 1 ] }, { "code": "@[deprecated getElem_eq_iff (since := \"2024-06-12\")]\ntheorem get_eq_iff : List.get l n = x ↔ l.get? n.1 = some x", "end": [ 252, 7 ], "full_name": "List.get_eq_iff", "kind": "commanddeclaration", "start": [ 250, 1 ] }, { "code": "theorem getElem?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs[i]? = xs[j]?) : i = j", "end": [ 273, 39 ], "full_name": "List.getElem?_inj", "kind": "commanddeclaration", "start": [ 254, 1 ] }, { "code": "@[deprecated getElem?_inj (since := \"2024-06-12\")]\ntheorem get?_inj\n (h₀ : i < xs.length) (h₁ : Nodup xs) (h₂ : xs.get? i = xs.get? j) : i = j", "end": [ 279, 11 ], "full_name": "List.get?_inj", "kind": "commanddeclaration", "start": [ 275, 1 ] }, { "code": "theorem tail_drop (l : List α) (n : Nat) : (l.drop n).tail = l.drop (n + 1)", "end": [ 289, 16 ], "full_name": "List.tail_drop", "kind": "commanddeclaration", "start": [ 283, 1 ] }, { "code": "@[simp] theorem modifyNth_nil (f : α → α) (n) : [].modifyNth f n = []", "end": [ 293, 92 ], "full_name": "List.modifyNth_nil", "kind": "commanddeclaration", "start": [ 293, 1 ] }, { "code": "@[simp] theorem modifyNth_zero_cons (f : α → α) (a : α) (l : List α) :\n (a :: l).modifyNth f 0 = f a :: l", "end": [ 296, 45 ], "full_name": "List.modifyNth_zero_cons", "kind": "commanddeclaration", "start": [ 295, 1 ] }, { "code": "@[simp] theorem modifyNth_succ_cons (f : α → α) (a : α) (l : List α) (n) :\n (a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n", "end": [ 299, 66 ], "full_name": "List.modifyNth_succ_cons", "kind": "commanddeclaration", "start": [ 298, 1 ] }, { "code": "theorem modifyNthTail_id : ∀ n (l : List α), l.modifyNthTail id n = l", "end": [ 304, 60 ], "full_name": "List.modifyNthTail_id", "kind": "commanddeclaration", "start": [ 301, 1 ] }, { "code": "theorem eraseIdx_eq_modifyNthTail : ∀ n (l : List α), eraseIdx l n = modifyNthTail tail n l", "end": [ 309, 69 ], "full_name": "List.eraseIdx_eq_modifyNthTail", "kind": "commanddeclaration", "start": [ 306, 1 ] }, { "code": "theorem getElem?_modifyNth (f : α → α) :\n ∀ n (l : List α) m, (modifyNth f n l)[m]? = (fun a => if n = m then f a else a) <$> l[m]?", "end": [ 322, 79 ], "full_name": "List.getElem?_modifyNth", "kind": "commanddeclaration", "start": [ 313, 1 ] }, { "code": "@[deprecated getElem?_modifyNth (since := \"2024-06-12\")]\ntheorem get?_modifyNth (f : α → α) (n) (l : List α) (m) :\n (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m", "end": [ 327, 28 ], "full_name": "List.get?_modifyNth", "kind": "commanddeclaration", "start": [ 324, 1 ] }, { "code": "theorem modifyNthTail_length (f : List α → List α) (H : ∀ l, length (f l) = length l) :\n ∀ n l, length (modifyNthTail f n l) = length l", "end": [ 333, 65 ], "full_name": "List.modifyNthTail_length", "kind": "commanddeclaration", "start": [ 329, 1 ] }, { "code": "theorem modifyNthTail_add (f : List α → List α) (n) (l₁ l₂ : List α) :\n modifyNthTail f (l₁.length + n) (l₁ ++ l₂) = l₁ ++ modifyNthTail f n l₂", "end": [ 337, 42 ], "full_name": "List.modifyNthTail_add", "kind": "commanddeclaration", "start": [ 335, 1 ] }, { "code": "theorem exists_of_modifyNthTail (f : List α → List α) {n} {l : List α} (h : n ≤ l.length) :\n ∃ l₁ l₂, l = l₁ ++ l₂ ∧ l₁.length = n ∧ modifyNthTail f n l = l₁ ++ f l₂", "end": [ 343, 58 ], "full_name": "List.exists_of_modifyNthTail", "kind": "commanddeclaration", "start": [ 339, 1 ] }, { "code": "@[simp] theorem modify_get?_length (f : α → α) : ∀ n l, length (modifyNth f n l) = length l", "end": [ 346, 53 ], "full_name": "List.modify_get?_length", "kind": "commanddeclaration", "start": [ 345, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l)[n]? = f <$> l[n]?", "end": [ 350, 41 ], "full_name": "List.getElem?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 348, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_eq (since := \"2024-06-12\")]\ntheorem get?_modifyNth_eq (f : α → α) (n) (l : List α) :\n (modifyNth f n l).get? n = f <$> l.get? n", "end": [ 355, 31 ], "full_name": "List.get?_modifyNth_eq", "kind": "commanddeclaration", "start": [ 352, 1 ] }, { "code": "@[simp] theorem getElem?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l)[n]? = l[n]?", "end": [ 359, 52 ], "full_name": "List.getElem?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 357, 1 ] }, { "code": "@[deprecated getElem?_modifyNth_ne (since := \"2024-06-12\")]\ntheorem get?_modifyNth_ne (f : α → α) {m n} (l : List α) (h : m ≠ n) :\n (modifyNth f m l).get? n = l.get? n", "end": [ 364, 11 ], "full_name": "List.get?_modifyNth_ne", "kind": "commanddeclaration", "start": [ 361, 1 ] }, { "code": "theorem exists_of_modifyNth (f : α → α) {n} {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ modifyNth f n l = l₁ ++ f a :: l₂", "end": [ 370, 74 ], "full_name": "List.exists_of_modifyNth", "kind": "commanddeclaration", "start": [ 366, 1 ] }, { "code": "theorem modifyNthTail_eq_take_drop (f : List α → List α) (H : f [] = []) :\n ∀ n l, modifyNthTail f n l = take n l ++ f (drop n l)", "end": [ 376, 76 ], "full_name": "List.modifyNthTail_eq_take_drop", "kind": "commanddeclaration", "start": [ 372, 1 ] }, { "code": "theorem modifyNth_eq_take_drop (f : α → α) :\n ∀ n l, modifyNth f n l = take n l ++ modifyHead f (drop n l)", "end": [ 380, 35 ], "full_name": "List.modifyNth_eq_take_drop", "kind": "commanddeclaration", "start": [ 378, 1 ] }, { "code": "theorem modifyNth_eq_take_cons_drop (f : α → α) {n l} (h) :\n modifyNth f n l = take n l ++ f l[n] :: drop (n + 1) l", "end": [ 384, 59 ], "full_name": "List.modifyNth_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 382, 1 ] }, { "code": "theorem set_eq_modifyNth (a : α) : ∀ n (l : List α), set l n a = modifyNth (fun _ => a) n l", "end": [ 391, 62 ], "full_name": "List.set_eq_modifyNth", "kind": "commanddeclaration", "start": [ 388, 1 ] }, { "code": "theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :\n set l n a = take n l ++ a :: drop (n + 1) l", "end": [ 395, 57 ], "full_name": "List.set_eq_take_cons_drop", "kind": "commanddeclaration", "start": [ 393, 1 ] }, { "code": "theorem modifyNth_eq_set_get? (f : α → α) :\n ∀ n (l : List α), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l", "end": [ 402, 92 ], "full_name": "List.modifyNth_eq_set_get?", "kind": "commanddeclaration", "start": [ 397, 1 ] }, { "code": "theorem modifyNth_eq_set_get (f : α → α) {n} {l : List α} (h) :\n l.modifyNth f n = l.set n (f (l.get ⟨n, h⟩))", "end": [ 406, 49 ], "full_name": "List.modifyNth_eq_set_get", "kind": "commanddeclaration", "start": [ 404, 1 ] }, { "code": "theorem exists_of_set {l : List α} (h : n < l.length) :\n ∃ l₁ a l₂, l = l₁ ++ a :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 410, 55 ], "full_name": "List.exists_of_set", "kind": "commanddeclaration", "start": [ 408, 1 ] }, { "code": "theorem exists_of_set' {l : List α} (h : n < l.length) :\n ∃ l₁ l₂, l = l₁ ++ l[n] :: l₂ ∧ l₁.length = n ∧ l.set n a' = l₁ ++ a' :: l₂", "end": [ 414, 94 ], "full_name": "List.exists_of_set'", "kind": "commanddeclaration", "start": [ 412, 1 ] }, { "code": "@[simp]\ntheorem getElem?_set_eq' (a : α) (n) (l : List α) : (set l n a)[n]? = (fun _ => a) <$> l[n]?", "end": [ 418, 54 ], "full_name": "List.getElem?_set_eq'", "kind": "commanddeclaration", "start": [ 416, 1 ] }, { "code": "@[deprecated getElem?_set_eq' (since := \"2024-06-12\")]\ntheorem get?_set_eq (a : α) (n) (l : List α) : (set l n a).get? n = (fun _ => a) <$> l.get? n", "end": [ 422, 7 ], "full_name": "List.get?_set_eq", "kind": "commanddeclaration", "start": [ 420, 1 ] }, { "code": "theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a)[n]? = some a", "end": [ 425, 85 ], "full_name": "List.getElem?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 424, 1 ] }, { "code": "@[deprecated getElem?_set_eq_of_lt (since := \"2024-06-12\")]\ntheorem get?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :\n (set l n a).get? n = some a", "end": [ 430, 70 ], "full_name": "List.get?_set_eq_of_lt", "kind": "commanddeclaration", "start": [ 427, 1 ] }, { "code": "@[deprecated getElem?_set_ne (since := \"2024-06-12\")]\ntheorem get?_set_ne (a : α) {m n} (l : List α) (h : m ≠ n) : (set l m a).get? n = l.get? n", "end": [ 434, 11 ], "full_name": "List.get?_set_ne", "kind": "commanddeclaration", "start": [ 432, 1 ] }, { "code": "theorem getElem?_set' (a : α) {m n} (l : List α) :\n (set l m a)[n]? = if m = n then (fun _ => a) <$> l[n]? else l[n]?", "end": [ 438, 30 ], "full_name": "List.getElem?_set'", "kind": "commanddeclaration", "start": [ 436, 1 ] }, { "code": "@[deprecated getElem?_set (since := \"2024-06-12\")]\ntheorem get?_set (a : α) {m n} (l : List α) :\n (set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n", "end": [ 443, 23 ], "full_name": "List.get?_set", "kind": "commanddeclaration", "start": [ 440, 1 ] }, { "code": "theorem get?_set_of_lt (a : α) {m n} (l : List α) (h : n < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 447, 46 ], "full_name": "List.get?_set_of_lt", "kind": "commanddeclaration", "start": [ 445, 1 ] }, { "code": "theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :\n (set l m a).get? n = if m = n then some a else l.get? n", "end": [ 451, 80 ], "full_name": "List.get?_set_of_lt'", "kind": "commanddeclaration", "start": [ 449, 1 ] }, { "code": "theorem drop_set_of_lt (a : α) {n m : Nat} (l : List α) (h : n < m) :\n (l.set n a).drop m = l.drop m", "end": [ 455, 94 ], "full_name": "List.drop_set_of_lt", "kind": "commanddeclaration", "start": [ 453, 1 ] }, { "code": "theorem take_set_of_lt (a : α) {n m : Nat} (l : List α) (h : m < n) :\n (l.set n a).take m = l.take m", "end": [ 463, 10 ], "full_name": "List.take_set_of_lt", "kind": "commanddeclaration", "start": [ 457, 1 ] }, { "code": "theorem length_eraseIdx : ∀ {l i}, i < length l → length (@eraseIdx α l i) = length l - 1", "end": [ 473, 92 ], "full_name": "List.length_eraseIdx", "kind": "commanddeclaration", "start": [ 467, 1 ] }, { "code": "@[simp] theorem length_tail (l : List α) : length (tail l) = length l - 1", "end": [ 479, 96 ], "full_name": "List.length_tail", "kind": "commanddeclaration", "start": [ 479, 1 ] }, { "code": "@[simp] theorem eraseP_nil : [].eraseP p = []", "end": [ 483, 53 ], "full_name": "List.eraseP_nil", "kind": "commanddeclaration", "start": [ 483, 1 ] }, { "code": "theorem eraseP_cons (a : α) (l : List α) :\n (a :: l).eraseP p = bif p a then l else a :: l.eraseP p", "end": [ 486, 67 ], "full_name": "List.eraseP_cons", "kind": "commanddeclaration", "start": [ 485, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_pos {l : List α} (p) (h : p a) : (a :: l).eraseP p = l", "end": [ 489, 24 ], "full_name": "List.eraseP_cons_of_pos", "kind": "commanddeclaration", "start": [ 488, 1 ] }, { "code": "@[simp] theorem eraseP_cons_of_neg {l : List α} (p) (h : ¬p a) :\n (a :: l).eraseP p = a :: l.eraseP p", "end": [ 492, 68 ], "full_name": "List.eraseP_cons_of_neg", "kind": "commanddeclaration", "start": [ 491, 1 ] }, { "code": "theorem eraseP_of_forall_not {l : List α} (h : ∀ a, a ∈ l → ¬p a) : l.eraseP p = l", "end": [ 497, 69 ], "full_name": "List.eraseP_of_forall_not", "kind": "commanddeclaration", "start": [ 494, 1 ] }, { "code": "theorem exists_of_eraseP : ∀ {l : List α} {a} (al : a ∈ l) (pa : p a),\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 510, 57 ], "full_name": "List.exists_of_eraseP", "kind": "commanddeclaration", "start": [ 499, 1 ] }, { "code": "theorem exists_or_eq_self_of_eraseP (p) (l : List α) :\n l.eraseP p = l ∨\n ∃ a l₁ l₂, (∀ b ∈ l₁, ¬p b) ∧ p a ∧ l = l₁ ++ a :: l₂ ∧ l.eraseP p = l₁ ++ l₂", "end": [ 519, 46 ], "full_name": "List.exists_or_eq_self_of_eraseP", "kind": "commanddeclaration", "start": [ 512, 1 ] }, { "code": "@[simp] theorem length_eraseP_of_mem (al : a ∈ l) (pa : p a) :\n length (l.eraseP p) = Nat.pred (length l)", "end": [ 524, 41 ], "full_name": "List.length_eraseP_of_mem", "kind": "commanddeclaration", "start": [ 521, 1 ] }, { "code": "theorem eraseP_append_left {a : α} (pa : p a) :\n ∀ {l₁ : List α} l₂, a ∈ l₁ → (l₁++l₂).eraseP p = l₁.eraseP p ++ l₂", "end": [ 531, 28 ], "full_name": "List.eraseP_append_left", "kind": "commanddeclaration", "start": [ 526, 1 ] }, { "code": "theorem eraseP_append_right :\n ∀ {l₁ : List α} l₂, (∀ b ∈ l₁, ¬p b) → eraseP p (l₁++l₂) = l₁ ++ l₂.eraseP p", "end": [ 537, 82 ], "full_name": "List.eraseP_append_right", "kind": "commanddeclaration", "start": [ 533, 1 ] }, { "code": "theorem eraseP_sublist (l : List α) : l.eraseP p <+ l", "end": [ 542, 56 ], "full_name": "List.eraseP_sublist", "kind": "commanddeclaration", "start": [ 539, 1 ] }, { "code": "theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l", "end": [ 544, 81 ], "full_name": "List.eraseP_subset", "kind": "commanddeclaration", "start": [ 544, 1 ] }, { "code": "protected theorem Sublist.eraseP : l₁ <+ l₂ → l₁.eraseP p <+ l₂.eraseP p", "end": [ 553, 25 ], "full_name": "List.Sublist.eraseP", "kind": "commanddeclaration", "start": [ 546, 1 ] }, { "code": "theorem mem_of_mem_eraseP {l : List α} : a ∈ l.eraseP p → a ∈ l", "end": [ 555, 87 ], "full_name": "List.mem_of_mem_eraseP", "kind": "commanddeclaration", "start": [ 555, 1 ] }, { "code": "@[simp] theorem mem_eraseP_of_neg {l : List α} (pa : ¬p a) : a ∈ l.eraseP p ↔ a ∈ l", "end": [ 564, 33 ], "full_name": "List.mem_eraseP_of_neg", "kind": "commanddeclaration", "start": [ 557, 1 ] }, { "code": "theorem eraseP_map (f : β → α) : ∀ (l : List β), (map f l).eraseP p = map f (l.eraseP (p ∘ f))", "end": [ 568, 85 ], "full_name": "List.eraseP_map", "kind": "commanddeclaration", "start": [ 566, 1 ] }, { "code": "@[simp] theorem extractP_eq_find?_eraseP\n (l : List α) : extractP p l = (find? p l, eraseP p l)", "end": [ 578, 21 ], "full_name": "List.extractP_eq_find?_eraseP", "kind": "commanddeclaration", "start": [ 570, 1 ] }, { "code": "theorem erase_eq_eraseP' (a : α) (l : List α) : l.erase a = l.eraseP (· == a)", "end": [ 590, 46 ], "full_name": "List.erase_eq_eraseP'", "kind": "commanddeclaration", "start": [ 585, 1 ] }, { "code": "theorem erase_eq_eraseP [LawfulBEq α] (a : α) : ∀ l : List α, l.erase a = l.eraseP (a == ·)", "end": [ 595, 77 ], "full_name": "List.erase_eq_eraseP", "kind": "commanddeclaration", "start": [ 592, 1 ] }, { "code": "theorem exists_erase_eq [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n ∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂", "end": [ 600, 99 ], "full_name": "List.exists_erase_eq", "kind": "commanddeclaration", "start": [ 597, 1 ] }, { "code": "@[simp] theorem length_erase_of_mem [LawfulBEq α] {a : α} {l : List α} (h : a ∈ l) :\n length (l.erase a) = Nat.pred (length l)", "end": [ 604, 74 ], "full_name": "List.length_erase_of_mem", "kind": "commanddeclaration", "start": [ 602, 1 ] }, { "code": "theorem erase_append_left [LawfulBEq α] {l₁ : List α} (l₂) (h : a ∈ l₁) :\n (l₁ ++ l₂).erase a = l₁.erase a ++ l₂", "end": [ 608, 77 ], "full_name": "List.erase_append_left", "kind": "commanddeclaration", "start": [ 606, 1 ] }, { "code": "theorem erase_append_right [LawfulBEq α] {a : α} {l₁ : List α} (l₂ : List α) (h : a ∉ l₁) :\n (l₁ ++ l₂).erase a = (l₁ ++ l₂.erase a)", "end": [ 613, 55 ], "full_name": "List.erase_append_right", "kind": "commanddeclaration", "start": [ 610, 1 ] }, { "code": "theorem erase_sublist (a : α) (l : List α) : l.erase a <+ l", "end": [ 616, 42 ], "full_name": "List.erase_sublist", "kind": "commanddeclaration", "start": [ 615, 1 ] }, { "code": "theorem erase_subset (a : α) (l : List α) : l.erase a ⊆ l", "end": [ 618, 88 ], "full_name": "List.erase_subset", "kind": "commanddeclaration", "start": [ 618, 1 ] }, { "code": "theorem Sublist.erase (a : α) {l₁ l₂ : List α} (h : l₁ <+ l₂) : l₁.erase a <+ l₂.erase a", "end": [ 621, 47 ], "full_name": "List.Sublist.erase", "kind": "commanddeclaration", "start": [ 620, 1 ] }, { "code": "theorem mem_of_mem_erase {a b : α} {l : List α} (h : a ∈ l.erase b) : a ∈ l", "end": [ 624, 98 ], "full_name": "List.mem_of_mem_erase", "kind": "commanddeclaration", "start": [ 624, 1 ] }, { "code": "@[simp] theorem mem_erase_of_ne [LawfulBEq α] {a b : α} {l : List α} (ab : a ≠ b) :\n a ∈ l.erase b ↔ a ∈ l", "end": [ 628, 65 ], "full_name": "List.mem_erase_of_ne", "kind": "commanddeclaration", "start": [ 626, 1 ] }, { "code": "theorem erase_comm [LawfulBEq α] (a b : α) (l : List α) :\n (l.erase a).erase b = (l.erase b).erase a", "end": [ 644, 49 ], "full_name": "List.erase_comm", "kind": "commanddeclaration", "start": [ 630, 1 ] }, { "code": "@[simp] theorem filter_sublist {p : α → Bool} : ∀ (l : List α), filter p l <+ l", "end": [ 652, 93 ], "full_name": "List.filter_sublist", "kind": "commanddeclaration", "start": [ 650, 1 ] }, { "code": "protected theorem Sublist.filterMap (f : α → Option β) (s : l₁ <+ l₂) :\n filterMap f l₁ <+ filterMap f l₂", "end": [ 658, 76 ], "full_name": "List.Sublist.filterMap", "kind": "commanddeclaration", "start": [ 656, 1 ] }, { "code": "theorem Sublist.filter (p : α → Bool) {l₁ l₂} (s : l₁ <+ l₂) : filter p l₁ <+ filter p l₂", "end": [ 661, 48 ], "full_name": "List.Sublist.filter", "kind": "commanddeclaration", "start": [ 660, 1 ] }, { "code": "@[simp] theorem findIdx_nil {α : Type _} (p : α → Bool) : [].findIdx p = 0", "end": [ 665, 82 ], "full_name": "List.findIdx_nil", "kind": "commanddeclaration", "start": [ 665, 1 ] }, { "code": "theorem findIdx_cons (p : α → Bool) (b : α) (l : List α) :\n (b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1", "end": [ 680, 43 ], "full_name": "List.findIdx_cons", "kind": "commanddeclaration", "start": [ 667, 1 ] }, { "code": "theorem findIdx_of_get?_eq_some {xs : List α} (w : xs.get? (xs.findIdx p) = some y) : p y", "end": [ 685, 65 ], "full_name": "List.findIdx_of_get?_eq_some", "kind": "commanddeclaration", "start": [ 682, 1 ] }, { "code": "theorem findIdx_get {xs : List α} {w : xs.findIdx p < xs.length} :\n p (xs.get ⟨xs.findIdx p, w⟩)", "end": [ 689, 45 ], "full_name": "List.findIdx_get", "kind": "commanddeclaration", "start": [ 687, 1 ] }, { "code": "theorem findIdx_lt_length_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.findIdx p < xs.length", "end": [ 703, 24 ], "full_name": "List.findIdx_lt_length_of_exists", "kind": "commanddeclaration", "start": [ 691, 1 ] }, { "code": "theorem findIdx_get?_eq_get_of_exists {xs : List α} (h : ∃ x ∈ xs, p x) :\n xs.get? (xs.findIdx p) = some (xs.get ⟨xs.findIdx p, xs.findIdx_lt_length_of_exists h⟩)", "end": [ 707, 46 ], "full_name": "List.findIdx_get?_eq_get_of_exists", "kind": "commanddeclaration", "start": [ 705, 1 ] }, { "code": "@[simp] theorem findIdx?_nil : ([] : List α).findIdx? p i = none", "end": [ 711, 72 ], "full_name": "List.findIdx?_nil", "kind": "commanddeclaration", "start": [ 711, 1 ] }, { "code": "@[simp] theorem findIdx?_cons :\n (x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1)", "end": [ 714, 82 ], "full_name": "List.findIdx?_cons", "kind": "commanddeclaration", "start": [ 713, 1 ] }, { "code": "@[simp] theorem findIdx?_succ :\n (xs : List α).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1", "end": [ 719, 37 ], "full_name": "List.findIdx?_succ", "kind": "commanddeclaration", "start": [ 716, 1 ] }, { "code": "theorem findIdx?_eq_some_iff (xs : List α) (p : α → Bool) :\n xs.findIdx? p = some i ↔ (xs.take (i + 1)).map p = replicate i false ++ [true]", "end": [ 727, 52 ], "full_name": "List.findIdx?_eq_some_iff", "kind": "commanddeclaration", "start": [ 721, 1 ] }, { "code": "theorem findIdx?_of_eq_some {xs : List α} {p : α → Bool} (w : xs.findIdx? p = some i) :\n match xs.get? i with | some a => p a | none => false", "end": [ 735, 40 ], "full_name": "List.findIdx?_of_eq_some", "kind": "commanddeclaration", "start": [ 729, 1 ] }, { "code": "theorem findIdx?_of_eq_none {xs : List α} {p : α → Bool} (w : xs.findIdx? p = none) :\n ∀ i, match xs.get? i with | some a => ¬ p a | none => true", "end": [ 750, 30 ], "full_name": "List.findIdx?_of_eq_none", "kind": "commanddeclaration", "start": [ 737, 1 ] }, { "code": "@[simp] theorem findIdx?_append :\n (xs ++ ys : List α).findIdx? p =\n (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)", "end": [ 756, 78 ], "full_name": "List.findIdx?_append", "kind": "commanddeclaration", "start": [ 752, 1 ] }, { "code": "@[simp] theorem findIdx?_replicate :\n (replicate n a).findIdx? p = if 0 < n ∧ p a then some 0 else none", "end": [ 764, 23 ], "full_name": "List.findIdx?_replicate", "kind": "commanddeclaration", "start": [ 758, 1 ] }, { "code": "theorem Pairwise.sublist : l₁ <+ l₂ → l₂.Pairwise R → l₁.Pairwise R", "end": [ 771, 80 ], "full_name": "List.Pairwise.sublist", "kind": "commanddeclaration", "start": [ 768, 1 ] }, { "code": "theorem pairwise_map {l : List α} :\n (l.map f).Pairwise R ↔ l.Pairwise fun a b => R (f a) (f b)", "end": [ 777, 58 ], "full_name": "List.pairwise_map", "kind": "commanddeclaration", "start": [ 773, 1 ] }, { "code": "theorem pairwise_append {l₁ l₂ : List α} :\n (l₁ ++ l₂).Pairwise R ↔ l₁.Pairwise R ∧ l₂.Pairwise R ∧ ∀ a ∈ l₁, ∀ b ∈ l₂, R a b", "end": [ 781, 74 ], "full_name": "List.pairwise_append", "kind": "commanddeclaration", "start": [ 779, 1 ] }, { "code": "theorem pairwise_reverse {l : List α} :\n l.reverse.Pairwise R ↔ l.Pairwise (fun a b => R b a)", "end": [ 785, 54 ], "full_name": "List.pairwise_reverse", "kind": "commanddeclaration", "start": [ 783, 1 ] }, { "code": "theorem Pairwise.imp {α R S} (H : ∀ {a b}, R a b → S a b) :\n ∀ {l : List α}, l.Pairwise R → l.Pairwise S", "end": [ 790, 50 ], "full_name": "List.Pairwise.imp", "kind": "commanddeclaration", "start": [ 787, 1 ] }, { "code": "theorem replaceF_nil : [].replaceF p = []", "end": [ 794, 49 ], "full_name": "List.replaceF_nil", "kind": "commanddeclaration", "start": [ 794, 1 ] }, { "code": "theorem replaceF_cons (a : α) (l : List α) :\n (a :: l).replaceF p = match p a with\n | none => a :: replaceF p l\n | some a' => a' :: l", "end": [ 799, 34 ], "full_name": "List.replaceF_cons", "kind": "commanddeclaration", "start": [ 796, 1 ] }, { "code": "theorem replaceF_cons_of_some {l : List α} (p) (h : p a = some a') :\n (a :: l).replaceF p = a' :: l", "end": [ 803, 26 ], "full_name": "List.replaceF_cons_of_some", "kind": "commanddeclaration", "start": [ 801, 1 ] }, { "code": "theorem replaceF_cons_of_none {l : List α} (p) (h : p a = none) :\n (a :: l).replaceF p = a :: l.replaceF p", "end": [ 806, 74 ], "full_name": "List.replaceF_cons_of_none", "kind": "commanddeclaration", "start": [ 805, 1 ] }, { "code": "theorem replaceF_of_forall_none {l : List α} (h : ∀ a, a ∈ l → p a = none) : l.replaceF p = l", "end": [ 811, 69 ], "full_name": "List.replaceF_of_forall_none", "kind": "commanddeclaration", "start": [ 808, 1 ] }, { "code": "theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),\n ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 825, 57 ], "full_name": "List.exists_of_replaceF", "kind": "commanddeclaration", "start": [ 813, 1 ] }, { "code": "theorem exists_or_eq_self_of_replaceF (p) (l : List α) :\n l.replaceF p = l ∨ ∃ a a' l₁ l₂,\n (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂", "end": [ 835, 62 ], "full_name": "List.exists_or_eq_self_of_replaceF", "kind": "commanddeclaration", "start": [ 827, 1 ] }, { "code": "@[simp] theorem length_replaceF : length (replaceF f l) = length l", "end": [ 838, 54 ], "full_name": "List.length_replaceF", "kind": "commanddeclaration", "start": [ 837, 1 ] }, { "code": "theorem disjoint_symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁", "end": [ 842, 86 ], "full_name": "List.disjoint_symm", "kind": "commanddeclaration", "start": [ 842, 1 ] }, { "code": "theorem disjoint_comm : Disjoint l₁ l₂ ↔ Disjoint l₂ l₁", "end": [ 844, 90 ], "full_name": "List.disjoint_comm", "kind": "commanddeclaration", "start": [ 844, 1 ] }, { "code": "theorem disjoint_left : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₁ → a ∉ l₂", "end": [ 846, 86 ], "full_name": "List.disjoint_left", "kind": "commanddeclaration", "start": [ 846, 1 ] }, { "code": "theorem disjoint_right : Disjoint l₁ l₂ ↔ ∀ ⦃a⦄, a ∈ l₂ → a ∉ l₁", "end": [ 848, 82 ], "full_name": "List.disjoint_right", "kind": "commanddeclaration", "start": [ 848, 1 ] }, { "code": "theorem disjoint_iff_ne : Disjoint l₁ l₂ ↔ ∀ a ∈ l₁, ∀ b ∈ l₂, a ≠ b", "end": [ 851, 83 ], "full_name": "List.disjoint_iff_ne", "kind": "commanddeclaration", "start": [ 850, 1 ] }, { "code": "theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂", "end": [ 854, 22 ], "full_name": "List.disjoint_of_subset_left", "kind": "commanddeclaration", "start": [ 853, 1 ] }, { "code": "theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂", "end": [ 857, 28 ], "full_name": "List.disjoint_of_subset_right", "kind": "commanddeclaration", "start": [ 856, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂", "end": [ 860, 42 ], "full_name": "List.disjoint_of_disjoint_cons_left", "kind": "commanddeclaration", "start": [ 859, 1 ] }, { "code": "theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂", "end": [ 863, 43 ], "full_name": "List.disjoint_of_disjoint_cons_right", "kind": "commanddeclaration", "start": [ 862, 1 ] }, { "code": "@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l", "end": [ 865, 96 ], "full_name": "List.disjoint_nil_left", "kind": "commanddeclaration", "start": [ 865, 1 ] }, { "code": "@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l []", "end": [ 868, 48 ], "full_name": "List.disjoint_nil_right", "kind": "commanddeclaration", "start": [ 867, 1 ] }, { "code": "@[simp 1100] theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l", "end": [ 870, 87 ], "full_name": "List.singleton_disjoint", "kind": "commanddeclaration", "start": [ 870, 1 ] }, { "code": "@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l", "end": [ 873, 41 ], "full_name": "List.disjoint_singleton", "kind": "commanddeclaration", "start": [ 872, 1 ] }, { "code": "@[simp] theorem disjoint_append_left : Disjoint (l₁ ++ l₂) l ↔ Disjoint l₁ l ∧ Disjoint l₂ l", "end": [ 876, 38 ], "full_name": "List.disjoint_append_left", "kind": "commanddeclaration", "start": [ 875, 1 ] }, { "code": "@[simp] theorem disjoint_append_right : Disjoint l (l₁ ++ l₂) ↔ Disjoint l l₁ ∧ Disjoint l l₂", "end": [ 879, 76 ], "full_name": "List.disjoint_append_right", "kind": "commanddeclaration", "start": [ 878, 1 ] }, { "code": "@[simp] theorem disjoint_cons_left : Disjoint (a::l₁) l₂ ↔ (a ∉ l₂) ∧ Disjoint l₁ l₂", "end": [ 882, 75 ], "full_name": "List.disjoint_cons_left", "kind": "commanddeclaration", "start": [ 881, 1 ] }, { "code": "@[simp] theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ (a ∉ l₁) ∧ Disjoint l₁ l₂", "end": [ 885, 74 ], "full_name": "List.disjoint_cons_right", "kind": "commanddeclaration", "start": [ 884, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l", "end": [ 888, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_left", "kind": "commanddeclaration", "start": [ 887, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_left_right (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₂ l", "end": [ 891, 31 ], "full_name": "List.disjoint_of_disjoint_append_left_right", "kind": "commanddeclaration", "start": [ 890, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₁", "end": [ 894, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_left", "kind": "commanddeclaration", "start": [ 893, 1 ] }, { "code": "theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (l₁ ++ l₂)) : Disjoint l l₂", "end": [ 897, 32 ], "full_name": "List.disjoint_of_disjoint_append_right_right", "kind": "commanddeclaration", "start": [ 896, 1 ] }, { "code": "theorem foldl_hom (f : α₁ → α₂) (g₁ : α₁ → β → α₁) (g₂ : α₂ → β → α₂) (l : List β) (init : α₁)\n (H : ∀ x y, g₂ (f x) y = f (g₁ x y)) : l.foldl g₂ (f init) = f (l.foldl g₁ init)", "end": [ 903, 48 ], "full_name": "List.foldl_hom", "kind": "commanddeclaration", "start": [ 901, 1 ] }, { "code": "theorem foldr_hom (f : β₁ → β₂) (g₁ : α → β₁ → β₁) (g₂ : α → β₂ → β₂) (l : List α) (init : β₁)\n (H : ∀ x y, g₂ x (f y) = f (g₁ x y)) : l.foldr g₂ (f init) = f (l.foldr g₁ init)", "end": [ 907, 30 ], "full_name": "List.foldr_hom", "kind": "commanddeclaration", "start": [ 905, 1 ] }, { "code": "theorem union_def [BEq α] (l₁ l₂ : List α) : l₁ ∪ l₂ = foldr .insert l₂ l₁", "end": [ 915, 83 ], "full_name": "List.union_def", "kind": "commanddeclaration", "start": [ 915, 1 ] }, { "code": "@[simp] theorem nil_union (l : List α) : nil ∪ l = l", "end": [ 917, 88 ], "full_name": "List.nil_union", "kind": "commanddeclaration", "start": [ 917, 1 ] }, { "code": "@[simp] theorem cons_union (a : α) (l₁ l₂ : List α) :\n (a :: l₁) ∪ l₂ = (l₁ ∪ l₂).insert a", "end": [ 920, 75 ], "full_name": "List.cons_union", "kind": "commanddeclaration", "start": [ 919, 1 ] }, { "code": "@[simp] theorem mem_union_iff [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∪ l₂ ↔ x ∈ l₁ ∨ x ∈ l₂", "end": [ 923, 76 ], "full_name": "List.mem_union_iff", "kind": "commanddeclaration", "start": [ 922, 1 ] }, { "code": "theorem inter_def [BEq α] (l₁ l₂ : List α) : l₁ ∩ l₂ = filter (elem · l₂) l₁", "end": [ 929, 85 ], "full_name": "List.inter_def", "kind": "commanddeclaration", "start": [ 929, 1 ] }, { "code": "@[simp] theorem mem_inter_iff [BEq α] [LawfulBEq α] {x : α} {l₁ l₂ : List α} :\n x ∈ l₁ ∩ l₂ ↔ x ∈ l₁ ∧ x ∈ l₂", "end": [ 933, 49 ], "full_name": "List.mem_inter_iff", "kind": "commanddeclaration", "start": [ 931, 1 ] }, { "code": "@[simp]\ntheorem pair_mem_product {xs : List α} {ys : List β} {x : α} {y : β} :\n (x, y) ∈ product xs ys ↔ x ∈ xs ∧ y ∈ ys", "end": [ 942, 47 ], "full_name": "List.pair_mem_product", "kind": "commanddeclaration", "start": [ 937, 1 ] }, { "code": "@[simp]\ntheorem leftpad_length (n : Nat) (a : α) (l : List α) :\n (leftpad n a l).length = max n l.length", "end": [ 951, 75 ], "full_name": "List.leftpad_length", "kind": "commanddeclaration", "start": [ 946, 1 ] }, { "code": "theorem leftpad_prefix (n : Nat) (a : α) (l : List α) :\n replicate (n - length l) a <+: leftpad n a l", "end": [ 956, 27 ], "full_name": "List.leftpad_prefix", "kind": "commanddeclaration", "start": [ 953, 1 ] }, { "code": "theorem leftpad_suffix (n : Nat) (a : α) (l : List α) : l <:+ (leftpad n a l)", "end": [ 960, 54 ], "full_name": "List.leftpad_suffix", "kind": "commanddeclaration", "start": [ 958, 1 ] }, { "code": "@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn α β m _ = forIn", "end": [ 965, 78 ], "full_name": "List.forIn_eq_forIn", "kind": "commanddeclaration", "start": [ 965, 1 ] }, { "code": "theorem forIn_eq_bindList [Monad m] [LawfulMonad m]\n (f : α → β → m (ForInStep β)) (l : List α) (init : β) :\n forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l", "end": [ 971, 30 ], "full_name": "List.forIn_eq_bindList", "kind": "commanddeclaration", "start": [ 967, 1 ] }, { "code": "@[simp] theorem forM_append [Monad m] [LawfulMonad m] (l₁ l₂ : List α) (f : α → m PUnit) :\n (l₁ ++ l₂).forM f = (do l₁.forM f; l₂.forM f)", "end": [ 974, 82 ], "full_name": "List.forM_append", "kind": "commanddeclaration", "start": [ 973, 1 ] }, { "code": "@[simp] theorem diff_nil (l : List α) : l.diff [] = l", "end": [ 982, 61 ], "full_name": "List.diff_nil", "kind": "commanddeclaration", "start": [ 982, 1 ] }, { "code": "@[simp] theorem diff_cons (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.erase a).diff l₂", "end": [ 985, 41 ], "full_name": "List.diff_cons", "kind": "commanddeclaration", "start": [ 984, 1 ] }, { "code": "theorem diff_cons_right (l₁ l₂ : List α) (a : α) : l₁.diff (a :: l₂) = (l₁.diff l₂).erase a", "end": [ 988, 71 ], "full_name": "List.diff_cons_right", "kind": "commanddeclaration", "start": [ 987, 1 ] }, { "code": "theorem diff_erase (l₁ l₂ : List α) (a : α) : (l₁.diff l₂).erase a = (l₁.erase a).diff l₂", "end": [ 991, 36 ], "full_name": "List.diff_erase", "kind": "commanddeclaration", "start": [ 990, 1 ] }, { "code": "@[simp] theorem nil_diff (l : List α) : [].diff l = []", "end": [ 994, 45 ], "full_name": "List.nil_diff", "kind": "commanddeclaration", "start": [ 993, 1 ] }, { "code": "theorem cons_diff (a : α) (l₁ l₂ : List α) :\n (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂", "end": [ 1005, 14 ], "full_name": "List.cons_diff", "kind": "commanddeclaration", "start": [ 996, 1 ] }, { "code": "theorem cons_diff_of_mem {a : α} {l₂ : List α} (h : a ∈ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = l₁.diff (l₂.erase a)", "end": [ 1008, 76 ], "full_name": "List.cons_diff_of_mem", "kind": "commanddeclaration", "start": [ 1007, 1 ] }, { "code": "theorem cons_diff_of_not_mem {a : α} {l₂ : List α} (h : a ∉ l₂) (l₁ : List α) :\n (a :: l₁).diff l₂ = a :: l₁.diff l₂", "end": [ 1011, 71 ], "full_name": "List.cons_diff_of_not_mem", "kind": "commanddeclaration", "start": [ 1010, 1 ] }, { "code": "theorem diff_eq_foldl : ∀ l₁ l₂ : List α, l₁.diff l₂ = foldl List.erase l₁ l₂", "end": [ 1015, 65 ], "full_name": "List.diff_eq_foldl", "kind": "commanddeclaration", "start": [ 1013, 1 ] }, { "code": "@[simp] theorem diff_append (l₁ l₂ l₃ : List α) : l₁.diff (l₂ ++ l₃) = (l₁.diff l₂).diff l₃", "end": [ 1018, 42 ], "full_name": "List.diff_append", "kind": "commanddeclaration", "start": [ 1017, 1 ] }, { "code": "theorem diff_sublist : ∀ l₁ l₂ : List α, l₁.diff l₂ <+ l₁", "end": [ 1026, 34 ], "full_name": "List.diff_sublist", "kind": "commanddeclaration", "start": [ 1020, 1 ] }, { "code": "theorem diff_subset (l₁ l₂ : List α) : l₁.diff l₂ ⊆ l₁", "end": [ 1028, 83 ], "full_name": "List.diff_subset", "kind": "commanddeclaration", "start": [ 1028, 1 ] }, { "code": "theorem mem_diff_of_mem {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁ → a ∉ l₂ → a ∈ l₁.diff l₂", "end": [ 1034, 94 ], "full_name": "List.mem_diff_of_mem", "kind": "commanddeclaration", "start": [ 1030, 1 ] }, { "code": "theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l₁.diff l₃ <+ l₂.diff l₃", "end": [ 1038, 75 ], "full_name": "List.Sublist.diff_right", "kind": "commanddeclaration", "start": [ 1036, 1 ] }, { "code": "theorem Sublist.erase_diff_erase_sublist {a : α} :\n ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁", "end": [ 1048, 71 ], "full_name": "List.Sublist.erase_diff_erase_sublist", "kind": "commanddeclaration", "start": [ 1040, 1 ] }, { "code": "@[simp] theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂", "end": [ 1054, 78 ], "full_name": "List.prefix_append", "kind": "commanddeclaration", "start": [ 1054, 1 ] }, { "code": "@[simp] theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂", "end": [ 1056, 78 ], "full_name": "List.suffix_append", "kind": "commanddeclaration", "start": [ 1056, 1 ] }, { "code": "theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃", "end": [ 1058, 83 ], "full_name": "List.infix_append", "kind": "commanddeclaration", "start": [ 1058, 1 ] }, { "code": "@[simp] theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃)", "end": [ 1061, 47 ], "full_name": "List.infix_append'", "kind": "commanddeclaration", "start": [ 1060, 1 ] }, { "code": "theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂", "end": [ 1063, 78 ], "full_name": "List.IsPrefix.isInfix", "kind": "commanddeclaration", "start": [ 1063, 1 ] }, { "code": "theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂", "end": [ 1065, 98 ], "full_name": "List.IsSuffix.isInfix", "kind": "commanddeclaration", "start": [ 1065, 1 ] }, { "code": "theorem nil_prefix (l : List α) : [] <+: l", "end": [ 1067, 55 ], "full_name": "List.nil_prefix", "kind": "commanddeclaration", "start": [ 1067, 1 ] }, { "code": "theorem nil_suffix (l : List α) : [] <:+ l", "end": [ 1069, 64 ], "full_name": "List.nil_suffix", "kind": "commanddeclaration", "start": [ 1069, 1 ] }, { "code": "theorem nil_infix (l : List α) : [] <:+: l", "end": [ 1071, 69 ], "full_name": "List.nil_infix", "kind": "commanddeclaration", "start": [ 1071, 1 ] }, { "code": "theorem prefix_refl (l : List α) : l <+: l", "end": [ 1073, 65 ], "full_name": "List.prefix_refl", "kind": "commanddeclaration", "start": [ 1073, 1 ] }, { "code": "theorem suffix_refl (l : List α) : l <:+ l", "end": [ 1075, 56 ], "full_name": "List.suffix_refl", "kind": "commanddeclaration", "start": [ 1075, 1 ] }, { "code": "theorem infix_refl (l : List α) : l <:+: l", "end": [ 1077, 70 ], "full_name": "List.infix_refl", "kind": "commanddeclaration", "start": [ 1077, 1 ] }, { "code": "@[simp] theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l", "end": [ 1079, 77 ], "full_name": "List.suffix_cons", "kind": "commanddeclaration", "start": [ 1079, 1 ] }, { "code": "theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂", "end": [ 1081, 95 ], "full_name": "List.infix_cons", "kind": "commanddeclaration", "start": [ 1081, 1 ] }, { "code": "theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a", "end": [ 1084, 67 ], "full_name": "List.infix_concat", "kind": "commanddeclaration", "start": [ 1083, 1 ] }, { "code": "theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃", "end": [ 1087, 75 ], "full_name": "List.IsPrefix.trans", "kind": "commanddeclaration", "start": [ 1086, 1 ] }, { "code": "theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃", "end": [ 1090, 68 ], "full_name": "List.IsSuffix.trans", "kind": "commanddeclaration", "start": [ 1089, 1 ] }, { "code": "theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃", "end": [ 1093, 95 ], "full_name": "List.IsInfix.trans", "kind": "commanddeclaration", "start": [ 1092, 1 ] }, { "code": "protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂", "end": [ 1096, 78 ], "full_name": "List.IsInfix.sublist", "kind": "commanddeclaration", "start": [ 1095, 1 ] }, { "code": "protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂", "end": [ 1099, 20 ], "full_name": "List.IsInfix.subset", "kind": "commanddeclaration", "start": [ 1098, 1 ] }, { "code": "protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂", "end": [ 1102, 20 ], "full_name": "List.IsPrefix.sublist", "kind": "commanddeclaration", "start": [ 1101, 1 ] }, { "code": "protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂", "end": [ 1105, 20 ], "full_name": "List.IsPrefix.subset", "kind": "commanddeclaration", "start": [ 1104, 1 ] }, { "code": "protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂", "end": [ 1108, 20 ], "full_name": "List.IsSuffix.sublist", "kind": "commanddeclaration", "start": [ 1107, 1 ] }, { "code": "protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂", "end": [ 1111, 20 ], "full_name": "List.IsSuffix.subset", "kind": "commanddeclaration", "start": [ 1110, 1 ] }, { "code": "@[simp] theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂", "end": [ 1115, 59 ], "full_name": "List.reverse_suffix", "kind": "commanddeclaration", "start": [ 1113, 1 ] }, { "code": "@[simp] theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂", "end": [ 1118, 53 ], "full_name": "List.reverse_prefix", "kind": "commanddeclaration", "start": [ 1117, 1 ] }, { "code": "@[simp] theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂", "end": [ 1124, 61 ], "full_name": "List.reverse_infix", "kind": "commanddeclaration", "start": [ 1120, 1 ] }, { "code": "theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length", "end": [ 1127, 22 ], "full_name": "List.IsInfix.length_le", "kind": "commanddeclaration", "start": [ 1126, 1 ] }, { "code": "theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length", "end": [ 1130, 22 ], "full_name": "List.IsPrefix.length_le", "kind": "commanddeclaration", "start": [ 1129, 1 ] }, { "code": "theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length", "end": [ 1133, 22 ], "full_name": "List.IsSuffix.length_le", "kind": "commanddeclaration", "start": [ 1132, 1 ] }, { "code": "@[simp] theorem infix_nil : l <:+: [] ↔ l = []", "end": [ 1135, 98 ], "full_name": "List.infix_nil", "kind": "commanddeclaration", "start": [ 1135, 1 ] }, { "code": "@[simp] theorem prefix_nil : l <+: [] ↔ l = []", "end": [ 1137, 99 ], "full_name": "List.prefix_nil", "kind": "commanddeclaration", "start": [ 1137, 1 ] }, { "code": "@[simp] theorem suffix_nil : l <:+ [] ↔ l = []", "end": [ 1139, 99 ], "full_name": "List.suffix_nil", "kind": "commanddeclaration", "start": [ 1139, 1 ] }, { "code": "theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂", "end": [ 1143, 60 ], "full_name": "List.infix_iff_prefix_suffix", "kind": "commanddeclaration", "start": [ 1141, 1 ] }, { "code": "theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1146, 25 ], "full_name": "List.IsInfix.eq_of_length", "kind": "commanddeclaration", "start": [ 1145, 1 ] }, { "code": "theorem IsPrefix.eq_of_length (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1149, 25 ], "full_name": "List.IsPrefix.eq_of_length", "kind": "commanddeclaration", "start": [ 1148, 1 ] }, { "code": "theorem IsSuffix.eq_of_length (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂", "end": [ 1152, 25 ], "full_name": "List.IsSuffix.eq_of_length", "kind": "commanddeclaration", "start": [ 1151, 1 ] }, { "code": "theorem prefix_of_prefix_length_le :\n ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂", "end": [ 1160, 20 ], "full_name": "List.prefix_of_prefix_length_le", "kind": "commanddeclaration", "start": [ 1154, 1 ] }, { "code": "theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁", "end": [ 1164, 39 ], "full_name": "List.prefix_or_prefix_of_prefix", "kind": "commanddeclaration", "start": [ 1162, 1 ] }, { "code": "theorem suffix_of_suffix_length_le\n (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) : l₁ <:+ l₂", "end": [ 1169, 90 ], "full_name": "List.suffix_of_suffix_length_le", "kind": "commanddeclaration", "start": [ 1166, 1 ] }, { "code": "theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁", "end": [ 1173, 21 ], "full_name": "List.suffix_or_suffix_of_suffix", "kind": "commanddeclaration", "start": [ 1171, 1 ] }, { "code": "theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂", "end": [ 1184, 41 ], "full_name": "List.suffix_cons_iff", "kind": "commanddeclaration", "start": [ 1175, 1 ] }, { "code": "theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂", "end": [ 1195, 27 ], "full_name": "List.infix_cons_iff", "kind": "commanddeclaration", "start": [ 1186, 1 ] }, { "code": "theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L", "end": [ 1202, 78 ], "full_name": "List.infix_of_mem_join", "kind": "commanddeclaration", "start": [ 1197, 1 ] }, { "code": "theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂", "end": [ 1205, 63 ], "full_name": "List.prefix_append_right_inj", "kind": "commanddeclaration", "start": [ 1204, 1 ] }, { "code": "@[simp]\ntheorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂", "end": [ 1209, 30 ], "full_name": "List.prefix_cons_inj", "kind": "commanddeclaration", "start": [ 1207, 1 ] }, { "code": "theorem take_prefix (n) (l : List α) : take n l <+: l", "end": [ 1212, 28 ], "full_name": "List.take_prefix", "kind": "commanddeclaration", "start": [ 1211, 1 ] }, { "code": "theorem drop_suffix (n) (l : List α) : drop n l <:+ l", "end": [ 1215, 28 ], "full_name": "List.drop_suffix", "kind": "commanddeclaration", "start": [ 1214, 1 ] }, { "code": "theorem take_sublist (n) (l : List α) : take n l <+ l", "end": [ 1218, 28 ], "full_name": "List.take_sublist", "kind": "commanddeclaration", "start": [ 1217, 1 ] }, { "code": "theorem drop_sublist (n) (l : List α) : drop n l <+ l", "end": [ 1221, 28 ], "full_name": "List.drop_sublist", "kind": "commanddeclaration", "start": [ 1220, 1 ] }, { "code": "theorem take_subset (n) (l : List α) : take n l ⊆ l", "end": [ 1224, 28 ], "full_name": "List.take_subset", "kind": "commanddeclaration", "start": [ 1223, 1 ] }, { "code": "theorem drop_subset (n) (l : List α) : drop n l ⊆ l", "end": [ 1227, 28 ], "full_name": "List.drop_subset", "kind": "commanddeclaration", "start": [ 1226, 1 ] }, { "code": "theorem mem_of_mem_take {l : List α} (h : a ∈ l.take n) : a ∈ l", "end": [ 1230, 20 ], "full_name": "List.mem_of_mem_take", "kind": "commanddeclaration", "start": [ 1229, 1 ] }, { "code": "theorem IsPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :\n l₁.filter p <+: l₂.filter p", "end": [ 1235, 42 ], "full_name": "List.IsPrefix.filter", "kind": "commanddeclaration", "start": [ 1232, 1 ] }, { "code": "theorem IsSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :\n l₁.filter p <:+ l₂.filter p", "end": [ 1240, 42 ], "full_name": "List.IsSuffix.filter", "kind": "commanddeclaration", "start": [ 1237, 1 ] }, { "code": "theorem IsInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :\n l₁.filter p <:+: l₂.filter p", "end": [ 1245, 58 ], "full_name": "List.IsInfix.filter", "kind": "commanddeclaration", "start": [ 1242, 1 ] }, { "code": "theorem mem_of_mem_drop {n} {l : List α} (h : a ∈ l.drop n) : a ∈ l", "end": [ 1249, 89 ], "full_name": "List.mem_of_mem_drop", "kind": "commanddeclaration", "start": [ 1249, 1 ] }, { "code": "theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)", "end": [ 1259, 61 ], "full_name": "List.disjoint_take_drop", "kind": "commanddeclaration", "start": [ 1251, 1 ] }, { "code": "@[simp]\ntheorem chain_cons {a b : α} {l : List α} : Chain R a (b :: l) ↔ R a b ∧ Chain R b l", "end": [ 1268, 27 ], "full_name": "List.chain_cons", "kind": "commanddeclaration", "start": [ 1265, 1 ] }, { "code": "theorem rel_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : R a b", "end": [ 1271, 21 ], "full_name": "List.rel_of_chain_cons", "kind": "commanddeclaration", "start": [ 1270, 1 ] }, { "code": "theorem chain_of_chain_cons {a b : α} {l : List α} (p : Chain R a (b :: l)) : Chain R b l", "end": [ 1274, 21 ], "full_name": "List.chain_of_chain_cons", "kind": "commanddeclaration", "start": [ 1273, 1 ] }, { "code": "theorem Chain.imp' {R S : α → α → Prop} (HRS : ∀ ⦃a b⦄, R a b → S a b) {a b : α}\n (Hab : ∀ ⦃c⦄, R a c → S b c) {l : List α} (p : Chain R a l) : Chain S b l", "end": [ 1283, 24 ], "full_name": "List.Chain.imp'", "kind": "commanddeclaration", "start": [ 1276, 1 ] }, { "code": "theorem Chain.imp {R S : α → α → Prop} (H : ∀ a b, R a b → S a b) {a : α} {l : List α}\n (p : Chain R a l) : Chain S a l", "end": [ 1287, 17 ], "full_name": "List.Chain.imp", "kind": "commanddeclaration", "start": [ 1285, 1 ] }, { "code": "protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l", "end": [ 1295, 36 ], "full_name": "List.Pairwise.chain", "kind": "commanddeclaration", "start": [ 1289, 1 ] }, { "code": "theorem range'_succ (s n step) : range' s (n + 1) step = s :: range' (s + step) n step", "end": [ 1300, 44 ], "full_name": "List.range'_succ", "kind": "commanddeclaration", "start": [ 1299, 1 ] }, { "code": "@[simp] theorem length_range' (s step) : ∀ n : Nat, length (range' s n step) = n", "end": [ 1304, 49 ], "full_name": "List.length_range'", "kind": "commanddeclaration", "start": [ 1302, 1 ] }, { "code": "@[simp] theorem range'_eq_nil : range' s n step = [] ↔ n = 0", "end": [ 1307, 39 ], "full_name": "List.range'_eq_nil", "kind": "commanddeclaration", "start": [ 1306, 1 ] }, { "code": "theorem mem_range' : ∀{n}, m ∈ range' s n step ↔ ∃ i < n, m = s + step * i", "end": [ 1314, 71 ], "full_name": "List.mem_range'", "kind": "commanddeclaration", "start": [ 1309, 1 ] }, { "code": "@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n", "end": [ 1319, 93 ], "full_name": "List.mem_range'_1", "kind": "commanddeclaration", "start": [ 1316, 1 ] }, { "code": "@[simp]\ntheorem map_add_range' (a) : ∀ s n step, map (a + ·) (range' s n step) = range' (a + s) n step", "end": [ 1324, 90 ], "full_name": "List.map_add_range'", "kind": "commanddeclaration", "start": [ 1321, 1 ] }, { "code": "theorem map_sub_range' (a s n : Nat) (h : a ≤ s) :\n map (· - a) (range' s n step) = range' (s - a) n step", "end": [ 1330, 42 ], "full_name": "List.map_sub_range'", "kind": "commanddeclaration", "start": [ 1326, 1 ] }, { "code": "theorem chain_succ_range' : ∀ s n step : Nat,\n Chain (fun a b => b = a + step) s (range' (s + step) n step)", "end": [ 1335, 69 ], "full_name": "List.chain_succ_range'", "kind": "commanddeclaration", "start": [ 1332, 1 ] }, { "code": "theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :\n Chain (· < ·) s (range' (s + step) n step)", "end": [ 1339, 83 ], "full_name": "List.chain_lt_range'", "kind": "commanddeclaration", "start": [ 1337, 1 ] }, { "code": "theorem range'_append : ∀ s m n step : Nat,\n range' s m step ++ range' (s + step * m) n step = range' s (n + m) step", "end": [ 1346, 46 ], "full_name": "List.range'_append", "kind": "commanddeclaration", "start": [ 1341, 1 ] }, { "code": "@[simp] theorem range'_append_1 (s m n : Nat) :\n range' s m ++ range' (s + m) n = range' s (n + m)", "end": [ 1349, 94 ], "full_name": "List.range'_append_1", "kind": "commanddeclaration", "start": [ 1348, 1 ] }, { "code": "theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step ↔ m ≤ n", "end": [ 1353, 88 ], "full_name": "List.range'_sublist_right", "kind": "commanddeclaration", "start": [ 1351, 1 ] }, { "code": "theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :\n range' s m step ⊆ range' s n step ↔ m ≤ n", "end": [ 1359, 82 ], "full_name": "List.range'_subset_right", "kind": "commanddeclaration", "start": [ 1355, 1 ] }, { "code": "theorem range'_subset_right_1 {s m n : Nat} : range' s m ⊆ range' s n ↔ m ≤ n", "end": [ 1362, 34 ], "full_name": "List.range'_subset_right_1", "kind": "commanddeclaration", "start": [ 1361, 1 ] }, { "code": "theorem getElem?_range' (s step) :\n ∀ {m n : Nat}, m < n → (range' s n step)[m]? = some (s + step * m)", "end": [ 1370, 55 ], "full_name": "List.getElem?_range'", "kind": "commanddeclaration", "start": [ 1364, 1 ] }, { "code": "@[simp] theorem getElem_range' {n m step} (i) (H : i < (range' n m step).length) :\n (range' n m step)[i] = n + step * i", "end": [ 1374, 70 ], "full_name": "List.getElem_range'", "kind": "commanddeclaration", "start": [ 1372, 1 ] }, { "code": "@[deprecated getElem?_range' (since := \"2024-06-12\")]\ntheorem get?_range' (s step) {m n : Nat} (h : m < n) :\n get? (range' s n step) m = some (s + step * m)", "end": [ 1379, 11 ], "full_name": "List.get?_range'", "kind": "commanddeclaration", "start": [ 1376, 1 ] }, { "code": "@[deprecated getElem_range' (since := \"2024-06-12\")]\ntheorem get_range' {n m step} (i) (H : i < (range' n m step).length) :\n get (range' n m step) ⟨i, H⟩ = n + step * i", "end": [ 1384, 7 ], "full_name": "List.get_range'", "kind": "commanddeclaration", "start": [ 1381, 1 ] }, { "code": "theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n]", "end": [ 1387, 63 ], "full_name": "List.range'_concat", "kind": "commanddeclaration", "start": [ 1386, 1 ] }, { "code": "theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n]", "end": [ 1390, 23 ], "full_name": "List.range'_1_concat", "kind": "commanddeclaration", "start": [ 1389, 1 ] }, { "code": "theorem range_loop_range' : ∀ s n : Nat, range.loop s (range' s n) = range' 0 (n + s)", "end": [ 1394, 101 ], "full_name": "List.range_loop_range'", "kind": "commanddeclaration", "start": [ 1392, 1 ] }, { "code": "theorem range_eq_range' (n : Nat) : range n = range' 0 n", "end": [ 1397, 56 ], "full_name": "List.range_eq_range'", "kind": "commanddeclaration", "start": [ 1396, 1 ] }, { "code": "theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n)", "end": [ 1401, 30 ], "full_name": "List.range_succ_eq_map", "kind": "commanddeclaration", "start": [ 1399, 1 ] }, { "code": "theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + ·) (range n)", "end": [ 1404, 44 ], "full_name": "List.range'_eq_map_range", "kind": "commanddeclaration", "start": [ 1403, 1 ] }, { "code": "@[simp] theorem length_range (n : Nat) : length (range n) = n", "end": [ 1407, 45 ], "full_name": "List.length_range", "kind": "commanddeclaration", "start": [ 1406, 1 ] }, { "code": "@[simp] theorem range_eq_nil {n : Nat} : range n = [] ↔ n = 0", "end": [ 1410, 38 ], "full_name": "List.range_eq_nil", "kind": "commanddeclaration", "start": [ 1409, 1 ] }, { "code": "@[simp]\ntheorem range_sublist {m n : Nat} : range m <+ range n ↔ m ≤ n", "end": [ 1414, 52 ], "full_name": "List.range_sublist", "kind": "commanddeclaration", "start": [ 1412, 1 ] }, { "code": "@[simp]\ntheorem range_subset {m n : Nat} : range m ⊆ range n ↔ m ≤ n", "end": [ 1418, 65 ], "full_name": "List.range_subset", "kind": "commanddeclaration", "start": [ 1416, 1 ] }, { "code": "@[simp]\ntheorem mem_range {m n : Nat} : m ∈ range n ↔ m < n", "end": [ 1422, 81 ], "full_name": "List.mem_range", "kind": "commanddeclaration", "start": [ 1420, 1 ] }, { "code": "theorem not_mem_range_self {n : Nat} : n ∉ range n", "end": [ 1424, 62 ], "full_name": "List.not_mem_range_self", "kind": "commanddeclaration", "start": [ 1424, 1 ] }, { "code": "theorem self_mem_range_succ (n : Nat) : n ∈ range (n + 1)", "end": [ 1426, 69 ], "full_name": "List.self_mem_range_succ", "kind": "commanddeclaration", "start": [ 1426, 1 ] }, { "code": "theorem getElem?_range {m n : Nat} (h : m < n) : (range n)[m]? = some m", "end": [ 1429, 48 ], "full_name": "List.getElem?_range", "kind": "commanddeclaration", "start": [ 1428, 1 ] }, { "code": "@[simp] theorem getElem_range {n : Nat} (m) (h : m < (range n).length) : (range n)[m] = m", "end": [ 1432, 25 ], "full_name": "List.getElem_range", "kind": "commanddeclaration", "start": [ 1431, 1 ] }, { "code": "@[deprecated getElem?_range (since := \"2024-06-12\")]\ntheorem get?_range {m n : Nat} (h : m < n) : get? (range n) m = some m", "end": [ 1436, 27 ], "full_name": "List.get?_range", "kind": "commanddeclaration", "start": [ 1434, 1 ] }, { "code": "@[deprecated getElem_range (since := \"2024-06-12\")]\ntheorem get_range {n} (i) (H : i < (range n).length) : get (range n) ⟨i, H⟩ = i", "end": [ 1440, 7 ], "full_name": "List.get_range", "kind": "commanddeclaration", "start": [ 1438, 1 ] }, { "code": "theorem range_succ (n : Nat) : range (succ n) = range n ++ [n]", "end": [ 1443, 61 ], "full_name": "List.range_succ", "kind": "commanddeclaration", "start": [ 1442, 1 ] }, { "code": "theorem range_add (a b : Nat) : range (a + b) = range a ++ (range b).map (a + ·)", "end": [ 1447, 75 ], "full_name": "List.range_add", "kind": "commanddeclaration", "start": [ 1445, 1 ] }, { "code": "theorem iota_eq_reverse_range' : ∀ n : Nat, iota n = reverse (range' 1 n)", "end": [ 1451, 99 ], "full_name": "List.iota_eq_reverse_range'", "kind": "commanddeclaration", "start": [ 1449, 1 ] }, { "code": "@[simp] theorem length_iota (n : Nat) : length (iota n) = n", "end": [ 1453, 96 ], "full_name": "List.length_iota", "kind": "commanddeclaration", "start": [ 1453, 1 ] }, { "code": "@[simp]\ntheorem mem_iota {m n : Nat} : m ∈ iota n ↔ 1 ≤ m ∧ m ≤ n", "end": [ 1457, 59 ], "full_name": "List.mem_iota", "kind": "commanddeclaration", "start": [ 1455, 1 ] }, { "code": "theorem reverse_range' : ∀ s n : Nat, reverse (range' s n) = map (s + n - 1 - ·) (range n)", "end": [ 1464, 59 ], "full_name": "List.reverse_range'", "kind": "commanddeclaration", "start": [ 1459, 1 ] }, { "code": "@[simp] theorem enumFrom_map_fst (n) :\n ∀ (l : List α), map Prod.fst (enumFrom n l) = range' n l.length", "end": [ 1472, 55 ], "full_name": "List.enumFrom_map_fst", "kind": "commanddeclaration", "start": [ 1469, 1 ] }, { "code": "@[simp] theorem enum_map_fst (l : List α) : map Prod.fst (enum l) = range l.length", "end": [ 1475, 54 ], "full_name": "List.enum_map_fst", "kind": "commanddeclaration", "start": [ 1474, 1 ] }, { "code": "theorem foldrIdx_start :\n (xs : List α).foldrIdx f i s = (xs : List α).foldrIdx (fun i => f (i + s)) i", "end": [ 1487, 43 ], "full_name": "List.foldrIdx_start", "kind": "commanddeclaration", "start": [ 1479, 1 ] }, { "code": "@[simp] theorem foldrIdx_cons :\n (x :: xs : List α).foldrIdx f i s = f s x (foldrIdx f i xs (s + 1))", "end": [ 1490, 79 ], "full_name": "List.foldrIdx_cons", "kind": "commanddeclaration", "start": [ 1489, 1 ] }, { "code": "theorem findIdxs_cons_aux (p : α → Bool) :\n foldrIdx (fun i a is => if p a = true then (i + 1) :: is else is) [] xs s =\n map (· + 1) (foldrIdx (fun i a is => if p a = true then i :: is else is) [] xs s)", "end": [ 1499, 24 ], "full_name": "List.findIdxs_cons_aux", "kind": "commanddeclaration", "start": [ 1492, 1 ] }, { "code": "theorem findIdxs_cons :\n (x :: xs : List α).findIdxs p =\n bif p x then 0 :: (xs.findIdxs p).map (· + 1) else (xs.findIdxs p).map (· + 1)", "end": [ 1508, 28 ], "full_name": "List.findIdxs_cons", "kind": "commanddeclaration", "start": [ 1501, 1 ] }, { "code": "@[simp] theorem indexesOf_nil [BEq α] : ([] : List α).indexesOf x = []", "end": [ 1510, 78 ], "full_name": "List.indexesOf_nil", "kind": "commanddeclaration", "start": [ 1510, 1 ] }, { "code": "theorem indexesOf_cons [BEq α] : (x :: xs : List α).indexesOf y =\n bif x == y then 0 :: (xs.indexesOf y).map (· + 1) else (xs.indexesOf y).map (· + 1)", "end": [ 1514, 34 ], "full_name": "List.indexesOf_cons", "kind": "commanddeclaration", "start": [ 1512, 1 ] }, { "code": "@[simp] theorem indexOf_nil [BEq α] : ([] : List α).indexOf x = 0", "end": [ 1516, 73 ], "full_name": "List.indexOf_nil", "kind": "commanddeclaration", "start": [ 1516, 1 ] }, { "code": "theorem indexOf_cons [BEq α] :\n (x :: xs : List α).indexOf y = bif x == y then 0 else xs.indexOf y + 1", "end": [ 1521, 22 ], "full_name": "List.indexOf_cons", "kind": "commanddeclaration", "start": [ 1518, 1 ] }, { "code": "theorem indexOf_mem_indexesOf [BEq α] [LawfulBEq α] {xs : List α} (m : x ∈ xs) :\n xs.indexOf x ∈ xs.indexesOf x", "end": [ 1535, 14 ], "full_name": "List.indexOf_mem_indexesOf", "kind": "commanddeclaration", "start": [ 1523, 1 ] }, { "code": "theorem merge_loop_nil_left (s : α → α → Bool) (r t) :\n merge.loop s [] r t = reverseAux t r", "end": [ 1539, 18 ], "full_name": "List.merge_loop_nil_left", "kind": "commanddeclaration", "start": [ 1537, 1 ] }, { "code": "theorem merge_loop_nil_right (s : α → α → Bool) (l t) :\n merge.loop s l [] t = reverseAux t l", "end": [ 1543, 52 ], "full_name": "List.merge_loop_nil_right", "kind": "commanddeclaration", "start": [ 1541, 1 ] }, { "code": "theorem merge_loop (s : α → α → Bool) (l r t) :\n merge.loop s l r t = reverseAux t (merge s l r)", "end": [ 1567, 64 ], "full_name": "List.merge_loop", "kind": "commanddeclaration", "start": [ 1545, 1 ] }, { "code": "@[simp] theorem merge_nil (s : α → α → Bool) (l) : merge s l [] = l", "end": [ 1569, 95 ], "full_name": "List.merge_nil", "kind": "commanddeclaration", "start": [ 1569, 1 ] }, { "code": "@[simp] theorem nil_merge (s : α → α → Bool) (r) : merge s [] r = r", "end": [ 1571, 94 ], "full_name": "List.nil_merge", "kind": "commanddeclaration", "start": [ 1571, 1 ] }, { "code": "theorem cons_merge_cons (s : α → α → Bool) (a b l r) :\n merge s (a::l) (b::r) = if s a b then a :: merge s l (b::r) else b :: merge s (a::l) r", "end": [ 1575, 87 ], "full_name": "List.cons_merge_cons", "kind": "commanddeclaration", "start": [ 1573, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_pos (s : α → α → Bool) (l r) (h : s a b) :\n merge s (a::l) (b::r) = a :: merge s l (b::r)", "end": [ 1579, 33 ], "full_name": "List.cons_merge_cons_pos", "kind": "commanddeclaration", "start": [ 1577, 1 ] }, { "code": "@[simp] theorem cons_merge_cons_neg (s : α → α → Bool) (l r) (h : ¬ s a b) :\n merge s (a::l) (b::r) = b :: merge s (a::l) r", "end": [ 1583, 33 ], "full_name": "List.cons_merge_cons_neg", "kind": "commanddeclaration", "start": [ 1581, 1 ] }, { "code": "@[simp] theorem length_merge (s : α → α → Bool) (l r) :\n (merge s l r).length = l.length + r.length", "end": [ 1594, 43 ], "full_name": "List.length_merge", "kind": "commanddeclaration", "start": [ 1585, 1 ] }, { "code": "@[simp]\ntheorem mem_merge {s : α → α → Bool} : x ∈ merge s l r ↔ x ∈ l ∨ x ∈ r", "end": [ 1605, 68 ], "full_name": "List.mem_merge", "kind": "commanddeclaration", "start": [ 1596, 1 ] }, { "code": "theorem mem_merge_left (s : α → α → Bool) (h : x ∈ l) : x ∈ merge s l r", "end": [ 1608, 24 ], "full_name": "List.mem_merge_left", "kind": "commanddeclaration", "start": [ 1607, 1 ] }, { "code": "theorem mem_merge_right (s : α → α → Bool) (h : x ∈ r) : x ∈ merge s l r", "end": [ 1611, 24 ], "full_name": "List.mem_merge_right", "kind": "commanddeclaration", "start": [ 1610, 1 ] } ]
327
List.mem_merge
[ [ 1597, 75 ], [ 1605, 68 ] ]
8
9
simp [mem_merge (l := a::l) (r := r), or_assoc, or_left_comm]
case isFalse α : Type u_1 x : α l✝ r✝ : List α s : α → α → Bool a : α l : List α b : α r : List α h✝ : ¬s a b = true ⊢ x ∈ b :: merge s (a :: l) r ↔ x ∈ a :: l ∨ x ∈ b :: r
no goals