data.list.infixMathlib.Data.List.Infix

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

feat(data/list/infix): list.slice is a sublist of the original (#18067)
Diff
@@ -212,6 +212,17 @@ lemma drop_subset (n) (l : list α) : drop n l ⊆ l := (drop_sublist n l).subse
 lemma mem_of_mem_take (h : a ∈ l.take n) : a ∈ l := take_subset n l h
 lemma mem_of_mem_drop (h : a ∈ l.drop n) : a ∈ l := drop_subset n l h
 
+lemma slice_sublist (n m : ℕ) (l : list α) : l.slice n m <+ l :=
+begin
+  rw list.slice_eq,
+  conv_rhs {rw ←list.take_append_drop n l},
+  rw [list.append_sublist_append_left, add_comm, list.drop_add],
+  exact list.drop_sublist _ _,
+end
+lemma slice_subset (n m : ℕ) (l : list α) : l.slice n m ⊆ l := (slice_sublist n m l).subset
+lemma mem_of_mem_slice {n m : ℕ} {l : list α} {a : α} (h : a ∈ l.slice n m) : a ∈ l :=
+slice_subset n m l h
+
 lemma take_while_prefix (p : α → Prop) [decidable_pred p] : l.take_while p <+: l :=
 ⟨l.drop_while p, take_while_append_drop p l⟩
 

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -849,9 +849,9 @@ theorem length_inits (l : List α) : length (inits l) = length l + 1 := by simp
 #align list.length_inits List.length_inits
 -/
 
-#print List.nth_le_tails /-
+#print List.get_tails /-
 @[simp]
-theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
+theorem get_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
     nthLe (tails l) n hn = l.drop n :=
   by
   induction' l with x l IH generalizing n
@@ -859,12 +859,12 @@ theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
   · cases n
     · simp
     · simpa using IH n _
-#align list.nth_le_tails List.nth_le_tails
+#align list.nth_le_tails List.get_tails
 -/
 
-#print List.nth_le_inits /-
+#print List.get_inits /-
 @[simp]
-theorem nth_le_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
+theorem get_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
     nthLe (inits l) n hn = l.take n :=
   by
   induction' l with x l IH generalizing n
@@ -872,7 +872,7 @@ theorem nth_le_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
   · cases n
     · simp
     · simpa using IH n _
-#align list.nth_le_inits List.nth_le_inits
+#align list.nth_le_inits List.get_inits
 -/
 
 end InitsTails
Diff
@@ -649,9 +649,8 @@ theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
 #align list.is_prefix.map List.IsPrefix.map
 -/
 
-#print List.IsPrefix.filter_map /-
-theorem IsPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
-    l₁.filterMap f <+: l₂.filterMap f :=
+#print List.IsPrefix.filterMap /-
+theorem IsPrefix.filterMap (h : l₁ <+: l₂) (f : α → Option β) : l₁.filterMap f <+: l₂.filterMap f :=
   by
   induction' l₁ with hd₁ tl₁ hl generalizing l₂
   · simp only [nil_prefix, filter_map_nil]
@@ -661,7 +660,7 @@ theorem IsPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
       rw [← @singleton_append _ hd₁ _, ← @singleton_append _ hd₂ _, filter_map_append,
         filter_map_append, h.left, prefix_append_right_inj]
       exact hl h.right
-#align list.is_prefix.filter_map List.IsPrefix.filter_map
+#align list.is_prefix.filter_map List.IsPrefix.filterMap
 -/
 
 #print List.IsPrefix.reduceOption /-
Diff
@@ -373,7 +373,7 @@ theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l
   constructor
   · rintro ⟨⟨hd, tl⟩, hl₃⟩
     · exact Or.inl hl₃
-    · simp only [cons_append] at hl₃ 
+    · simp only [cons_append] at hl₃
       exact Or.inr ⟨_, hl₃.2⟩
   · rintro (rfl | hl₁)
     · exact (a :: l₂).suffix_refl
@@ -387,7 +387,7 @@ theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+
   constructor
   · rintro ⟨⟨hd, tl⟩, t, hl₃⟩
     · exact Or.inl ⟨t, hl₃⟩
-    · simp only [cons_append] at hl₃ 
+    · simp only [cons_append] at hl₃
       exact Or.inr ⟨_, t, hl₃.2⟩
   · rintro (h | hl₁)
     · exact h.is_infix
@@ -595,7 +595,7 @@ instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
 #print List.decidableInfix /-
 instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+: l₂)
   | [], l₂ => isTrue ⟨[], l₂, rfl⟩
-  | a :: l₁, [] => isFalse fun ⟨s, t, te⟩ => by simp at te  <;> exact te
+  | a :: l₁, [] => isFalse fun ⟨s, t, te⟩ => by simp at te <;> exact te
   | l₁, b :: l₂ =>
     decidable_of_decidable_of_iff
       (@Or.decidable _ _ (l₁.decidablePrefix (b :: l₂)) (l₁.decidableInfix l₂)) infix_cons_iff.symm
@@ -617,9 +617,9 @@ theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
     rw [take_zero, take_nil]
     simp only [take]
     exact not_false
-  · simp only [length] at hm 
+  · simp only [length] at hm
     specialize IH ls n (Nat.lt_of_succ_lt_succ hm)
-    simp only [le_of_lt (Nat.lt_of_succ_lt_succ hm), min_eq_left] at IH 
+    simp only [le_of_lt (Nat.lt_of_succ_lt_succ hm), min_eq_left] at IH
     simp only [le_of_lt hm, IH, true_and_iff, min_eq_left, eq_self_iff_true, length, take]
     exact ⟨Nat.succ_le_succ, Nat.le_of_succ_le_succ⟩
 #align list.prefix_take_le_iff List.prefix_take_le_iff
@@ -630,7 +630,7 @@ theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ :=
   by
   constructor
   · rintro ⟨L, hL⟩
-    simp only [cons_append] at hL 
+    simp only [cons_append] at hL
     exact ⟨hL.left, ⟨L, hL.right⟩⟩
   · rintro ⟨rfl, h⟩
     rwa [prefix_cons_inj]
@@ -644,7 +644,7 @@ theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
   · simp only [nil_prefix, map_nil]
   · cases' l₂ with hd₂ tl₂
     · simpa only using eq_nil_of_prefix_nil h
-    · rw [cons_prefix_iff] at h 
+    · rw [cons_prefix_iff] at h
       simp only [h, prefix_cons_inj, hl, map]
 #align list.is_prefix.map List.IsPrefix.map
 -/
@@ -657,7 +657,7 @@ theorem IsPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
   · simp only [nil_prefix, filter_map_nil]
   · cases' l₂ with hd₂ tl₂
     · simpa only using eq_nil_of_prefix_nil h
-    · rw [cons_prefix_iff] at h 
+    · rw [cons_prefix_iff] at h
       rw [← @singleton_append _ hd₁ _, ← @singleton_append _ hd₂ _, filter_map_append,
         filter_map_append, h.left, prefix_append_right_inj]
       exact hl h.right
Diff
@@ -559,14 +559,14 @@ theorem suffix_iff_eq_append : l₁ <:+ l₂ ↔ take (length l₂ - length l₁
 
 #print List.prefix_iff_eq_take /-
 theorem prefix_iff_eq_take : l₁ <+: l₂ ↔ l₁ = take (length l₁) l₂ :=
-  ⟨fun h => append_right_cancel <| (prefix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
+  ⟨fun h => append_cancel_right <| (prefix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
     fun e => e.symm ▸ take_prefix _ _⟩
 #align list.prefix_iff_eq_take List.prefix_iff_eq_take
 -/
 
 #print List.suffix_iff_eq_drop /-
 theorem suffix_iff_eq_drop : l₁ <:+ l₂ ↔ l₁ = drop (length l₂ - length l₁) l₂ :=
-  ⟨fun h => append_left_cancel <| (suffix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
+  ⟨fun h => append_cancel_left <| (suffix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
     fun e => e.symm ▸ drop_suffix _ _⟩
 #align list.suffix_iff_eq_drop List.suffix_iff_eq_drop
 -/
Diff
@@ -892,10 +892,10 @@ theorem insert_nil (a : α) : insert a nil = [a] :=
 #align list.insert_nil List.insert_nil
 -/
 
-#print List.insert.def /-
-theorem insert.def (a : α) (l : List α) : insert a l = if a ∈ l then l else a :: l :=
+#print List.insert_eq_ite /-
+theorem List.insert_eq_ite (a : α) (l : List α) : insert a l = if a ∈ l then l else a :: l :=
   rfl
-#align list.insert.def List.insert.def
+#align list.insert.def List.insert_eq_ite
 -/
 
 #print List.insert_of_mem /-
Diff
@@ -71,14 +71,14 @@ theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l
 #align list.infix_append' List.infix_append'
 -/
 
-#print List.isPrefix.isInfix /-
-theorem isPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨[], t, h⟩
-#align list.is_prefix.is_infix List.isPrefix.isInfix
+#print List.IsPrefix.isInfix /-
+theorem IsPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨[], t, h⟩
+#align list.is_prefix.is_infix List.IsPrefix.isInfix
 -/
 
-#print List.isSuffix.isInfix /-
-theorem isSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨t, [], by rw [h, append_nil]⟩
-#align list.is_suffix.is_infix List.isSuffix.isInfix
+#print List.IsSuffix.isInfix /-
+theorem IsSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨t, [], by rw [h, append_nil]⟩
+#align list.is_suffix.is_infix List.IsSuffix.isInfix
 -/
 
 #print List.nil_prefix /-
@@ -95,7 +95,7 @@ theorem nil_suffix (l : List α) : [] <:+ l :=
 
 #print List.nil_infix /-
 theorem nil_infix (l : List α) : [] <:+: l :=
-  (nil_prefix _).isInfix
+  (nil_prefix _).IsInfix
 #align list.nil_infix List.nil_infix
 -/
 
@@ -116,7 +116,7 @@ theorem suffix_refl (l : List α) : l <:+ l :=
 #print List.infix_refl /-
 @[refl]
 theorem infix_refl (l : List α) : l <:+: l :=
-  (prefix_refl l).isInfix
+  (prefix_refl l).IsInfix
 #align list.infix_refl List.infix_refl
 -/
 
@@ -161,61 +161,61 @@ theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a := fun ⟨L₁
 #align list.infix_concat List.infix_concat
 -/
 
-#print List.isPrefix.trans /-
+#print List.IsPrefix.trans /-
 @[trans]
-theorem isPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃
+theorem IsPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃
   | l, _, _, ⟨r₁, rfl⟩, ⟨r₂, rfl⟩ => ⟨r₁ ++ r₂, (append_assoc _ _ _).symm⟩
-#align list.is_prefix.trans List.isPrefix.trans
+#align list.is_prefix.trans List.IsPrefix.trans
 -/
 
-#print List.isSuffix.trans /-
+#print List.IsSuffix.trans /-
 @[trans]
-theorem isSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃
+theorem IsSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃
   | l, _, _, ⟨l₁, rfl⟩, ⟨l₂, rfl⟩ => ⟨l₂ ++ l₁, append_assoc _ _ _⟩
-#align list.is_suffix.trans List.isSuffix.trans
+#align list.is_suffix.trans List.IsSuffix.trans
 -/
 
-#print List.isInfix.trans /-
+#print List.IsInfix.trans /-
 @[trans]
-theorem isInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃
+theorem IsInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃
   | l, _, _, ⟨l₁, r₁, rfl⟩, ⟨l₂, r₂, rfl⟩ => ⟨l₂ ++ l₁, r₁ ++ r₂, by simp only [append_assoc]⟩
-#align list.is_infix.trans List.isInfix.trans
+#align list.is_infix.trans List.IsInfix.trans
 -/
 
-#print List.isInfix.sublist /-
-protected theorem isInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ => by rw [← h];
+#print List.IsInfix.sublist /-
+protected theorem IsInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ => by rw [← h];
   exact (sublist_append_right _ _).trans (sublist_append_left _ _)
-#align list.is_infix.sublist List.isInfix.sublist
+#align list.is_infix.sublist List.IsInfix.sublist
 -/
 
-#print List.isInfix.subset /-
-protected theorem isInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂ :=
+#print List.IsInfix.subset /-
+protected theorem IsInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂ :=
   hl.Sublist.Subset
-#align list.is_infix.subset List.isInfix.subset
+#align list.is_infix.subset List.IsInfix.subset
 -/
 
-#print List.isPrefix.sublist /-
-protected theorem isPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂ :=
-  h.isInfix.Sublist
-#align list.is_prefix.sublist List.isPrefix.sublist
+#print List.IsPrefix.sublist /-
+protected theorem IsPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂ :=
+  h.IsInfix.Sublist
+#align list.is_prefix.sublist List.IsPrefix.sublist
 -/
 
-#print List.isPrefix.subset /-
-protected theorem isPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂ :=
+#print List.IsPrefix.subset /-
+protected theorem IsPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂ :=
   hl.Sublist.Subset
-#align list.is_prefix.subset List.isPrefix.subset
+#align list.is_prefix.subset List.IsPrefix.subset
 -/
 
-#print List.isSuffix.sublist /-
-protected theorem isSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂ :=
-  h.isInfix.Sublist
-#align list.is_suffix.sublist List.isSuffix.sublist
+#print List.IsSuffix.sublist /-
+protected theorem IsSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂ :=
+  h.IsInfix.Sublist
+#align list.is_suffix.sublist List.IsSuffix.sublist
 -/
 
-#print List.isSuffix.subset /-
-protected theorem isSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂ :=
+#print List.IsSuffix.subset /-
+protected theorem IsSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂ :=
   hl.Sublist.Subset
-#align list.is_suffix.subset List.isSuffix.subset
+#align list.is_suffix.subset List.IsSuffix.subset
 -/
 
 #print List.reverse_suffix /-
@@ -254,22 +254,22 @@ alias ⟨_, is_prefix.reverse⟩ := reverse_suffix
 alias ⟨_, is_infix.reverse⟩ := reverse_infix
 #align list.is_infix.reverse List.isInfix.reverse
 
-#print List.isInfix.length_le /-
-theorem isInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length :=
+#print List.IsInfix.length_le /-
+theorem IsInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length :=
   h.Sublist.length_le
-#align list.is_infix.length_le List.isInfix.length_le
+#align list.is_infix.length_le List.IsInfix.length_le
 -/
 
-#print List.isPrefix.length_le /-
-theorem isPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length :=
+#print List.IsPrefix.length_le /-
+theorem IsPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length :=
   h.Sublist.length_le
-#align list.is_prefix.length_le List.isPrefix.length_le
+#align list.is_prefix.length_le List.IsPrefix.length_le
 -/
 
-#print List.isSuffix.length_le /-
-theorem isSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length :=
+#print List.IsSuffix.length_le /-
+theorem IsSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length :=
   h.Sublist.length_le
-#align list.is_suffix.length_le List.isSuffix.length_le
+#align list.is_suffix.length_le List.IsSuffix.length_le
 -/
 
 #print List.eq_nil_of_infix_nil /-
@@ -291,14 +291,14 @@ alias ⟨eq_nil_of_infix_nil, _⟩ := infix_nil_iff
 #print List.prefix_nil /-
 @[simp]
 theorem prefix_nil : l <+: [] ↔ l = [] :=
-  ⟨fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ prefix_rfl⟩
+  ⟨fun h => eq_nil_of_infix_nil h.IsInfix, fun h => h ▸ prefix_rfl⟩
 #align list.prefix_nil_iff List.prefix_nil
 -/
 
 #print List.suffix_nil /-
 @[simp]
 theorem suffix_nil : l <:+ [] ↔ l = [] :=
-  ⟨fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ suffix_rfl⟩
+  ⟨fun h => eq_nil_of_infix_nil h.IsInfix, fun h => h ▸ suffix_rfl⟩
 #align list.suffix_nil_iff List.suffix_nil
 -/
 
@@ -398,7 +398,7 @@ theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+
 #print List.infix_of_mem_join /-
 theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L
   | _ :: L, Or.inl rfl => infix_append [] _ _
-  | l' :: L, Or.inr h => isInfix.trans (infix_of_mem_join h) <| (suffix_append _ _).isInfix
+  | l' :: L, Or.inr h => IsInfix.trans (infix_of_mem_join h) <| (suffix_append _ _).IsInfix
 #align list.infix_of_mem_join List.infix_of_mem_join
 -/
 
@@ -586,7 +586,7 @@ instance decidablePrefix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
 -- Alternatively, use mem_tails
 instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+ l₂)
   | [], l₂ => isTrue ⟨l₂, append_nil _⟩
-  | a :: l₁, [] => isFalse <| mt (Sublist.length_le ∘ isSuffix.sublist) (by decide)
+  | a :: l₁, [] => isFalse <| mt (Sublist.length_le ∘ IsSuffix.sublist) (by decide)
   | l₁, b :: l₂ =>
     decidable_of_decidable_of_iff (@Or.decidable _ _ _ (l₁.decidableSuffix l₂)) suffix_cons_iff.symm
 #align list.decidable_suffix List.decidableSuffix
@@ -637,8 +637,8 @@ theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ :=
 #align list.cons_prefix_iff List.cons_prefix_iff
 -/
 
-#print List.isPrefix.map /-
-theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f :=
+#print List.IsPrefix.map /-
+theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f :=
   by
   induction' l₁ with hd tl hl generalizing l₂
   · simp only [nil_prefix, map_nil]
@@ -646,11 +646,11 @@ theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
     · simpa only using eq_nil_of_prefix_nil h
     · rw [cons_prefix_iff] at h 
       simp only [h, prefix_cons_inj, hl, map]
-#align list.is_prefix.map List.isPrefix.map
+#align list.is_prefix.map List.IsPrefix.map
 -/
 
-#print List.isPrefix.filter_map /-
-theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
+#print List.IsPrefix.filter_map /-
+theorem IsPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
     l₁.filterMap f <+: l₂.filterMap f :=
   by
   induction' l₁ with hd₁ tl₁ hl generalizing l₂
@@ -661,60 +661,60 @@ theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
       rw [← @singleton_append _ hd₁ _, ← @singleton_append _ hd₂ _, filter_map_append,
         filter_map_append, h.left, prefix_append_right_inj]
       exact hl h.right
-#align list.is_prefix.filter_map List.isPrefix.filter_map
+#align list.is_prefix.filter_map List.IsPrefix.filter_map
 -/
 
-#print List.isPrefix.reduceOption /-
-theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
+#print List.IsPrefix.reduceOption /-
+theorem IsPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
     l₁.reduceOption <+: l₂.reduceOption :=
   h.filterMap id
-#align list.is_prefix.reduce_option List.isPrefix.reduceOption
+#align list.is_prefix.reduce_option List.IsPrefix.reduceOption
 -/
 
-#print List.isPrefix.filter /-
-theorem isPrefix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
+#print List.IsPrefix.filter /-
+theorem IsPrefix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
     l₁.filterₓ p <+: l₂.filterₓ p := by
   obtain ⟨xs, rfl⟩ := h
   rw [filter_append]
   exact prefix_append _ _
-#align list.is_prefix.filter List.isPrefix.filter
+#align list.is_prefix.filter List.IsPrefix.filter
 -/
 
-#print List.isSuffix.filter /-
-theorem isSuffix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
+#print List.IsSuffix.filter /-
+theorem IsSuffix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
     l₁.filterₓ p <:+ l₂.filterₓ p := by
   obtain ⟨xs, rfl⟩ := h
   rw [filter_append]
   exact suffix_append _ _
-#align list.is_suffix.filter List.isSuffix.filter
+#align list.is_suffix.filter List.IsSuffix.filter
 -/
 
-#print List.isInfix.filter /-
-theorem isInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
+#print List.IsInfix.filter /-
+theorem IsInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
     l₁.filterₓ p <:+: l₂.filterₓ p :=
   by
   obtain ⟨xs, ys, rfl⟩ := h
   rw [filter_append, filter_append]
   exact infix_append _ _ _
-#align list.is_infix.filter List.isInfix.filter
+#align list.is_infix.filter List.IsInfix.filter
 -/
 
 instance : IsPartialOrder (List α) (· <+: ·)
     where
   refl := prefix_refl
-  trans _ _ _ := isPrefix.trans
+  trans _ _ _ := IsPrefix.trans
   antisymm _ _ h₁ h₂ := eq_of_prefix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
 instance : IsPartialOrder (List α) (· <:+ ·)
     where
   refl := suffix_refl
-  trans _ _ _ := isSuffix.trans
+  trans _ _ _ := IsSuffix.trans
   antisymm _ _ h₁ h₂ := eq_of_suffix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
 instance : IsPartialOrder (List α) (· <:+: ·)
     where
   refl := infix_refl
-  trans _ _ _ := isInfix.trans
+  trans _ _ _ := IsInfix.trans
   antisymm _ _ h₁ h₂ := eq_of_infix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
 end Fix
@@ -932,7 +932,7 @@ theorem suffix_insert (a : α) (l : List α) : l <:+ insert a l := by
 
 #print List.infix_insert /-
 theorem infix_insert (a : α) (l : List α) : l <:+: insert a l :=
-  (suffix_insert a l).isInfix
+  (suffix_insert a l).IsInfix
 #align list.infix_insert List.infix_insert
 -/
 
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2017 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 -/
-import Mathbin.Data.List.Basic
+import Data.List.Basic
 
 #align_import data.list.infix from "leanprover-community/mathlib"@"00f4ab49e7d5139216e0b3daad15fffa504897ab"
 
@@ -602,7 +602,7 @@ instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l
 #align list.decidable_infix List.decidableInfix
 -/
 
-/- ./././Mathport/Syntax/Translate/Tactic/Lean3.lean:567:6: unsupported: specialize @hyp -/
+/- ./././Mathport/Syntax/Translate/Tactic/Lean3.lean:570:6: unsupported: specialize @hyp -/
 #print List.prefix_take_le_iff /-
 theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
     L.take m <+: L.take n ↔ m ≤ n :=
Diff
@@ -245,13 +245,13 @@ theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂ :=
 #align list.reverse_infix List.reverse_infix
 -/
 
-alias reverse_prefix ↔ _ is_suffix.reverse
+alias ⟨_, is_suffix.reverse⟩ := reverse_prefix
 #align list.is_suffix.reverse List.isSuffix.reverse
 
-alias reverse_suffix ↔ _ is_prefix.reverse
+alias ⟨_, is_prefix.reverse⟩ := reverse_suffix
 #align list.is_prefix.reverse List.isPrefix.reverse
 
-alias reverse_infix ↔ _ is_infix.reverse
+alias ⟨_, is_infix.reverse⟩ := reverse_infix
 #align list.is_infix.reverse List.isInfix.reverse
 
 #print List.isInfix.length_le /-
@@ -285,7 +285,7 @@ theorem infix_nil : l <:+: [] ↔ l = [] :=
 #align list.infix_nil_iff List.infix_nil
 -/
 
-alias infix_nil_iff ↔ eq_nil_of_infix_nil _
+alias ⟨eq_nil_of_infix_nil, _⟩ := infix_nil_iff
 #align list.eq_nil_of_infix_nil List.eq_nil_of_infix_nil
 
 #print List.prefix_nil /-
@@ -302,10 +302,10 @@ theorem suffix_nil : l <:+ [] ↔ l = [] :=
 #align list.suffix_nil_iff List.suffix_nil
 -/
 
-alias prefix_nil_iff ↔ eq_nil_of_prefix_nil _
+alias ⟨eq_nil_of_prefix_nil, _⟩ := prefix_nil_iff
 #align list.eq_nil_of_prefix_nil List.eq_nil_of_prefix_nil
 
-alias suffix_nil_iff ↔ eq_nil_of_suffix_nil _
+alias ⟨eq_nil_of_suffix_nil, _⟩ := suffix_nil_iff
 #align list.eq_nil_of_suffix_nil List.eq_nil_of_suffix_nil
 
 #print List.infix_iff_prefix_suffix /-
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2017 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.list.infix
-! leanprover-community/mathlib commit 00f4ab49e7d5139216e0b3daad15fffa504897ab
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.List.Basic
 
+#align_import data.list.infix from "leanprover-community/mathlib"@"00f4ab49e7d5139216e0b3daad15fffa504897ab"
+
 /-!
 # Prefixes, subfixes, infixes
 
Diff
@@ -348,22 +348,29 @@ theorem prefix_of_prefix_length_le :
 #align list.prefix_of_prefix_length_le List.prefix_of_prefix_length_le
 -/
 
+#print List.prefix_or_prefix_of_prefix /-
 theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁ :=
   (le_total (length l₁) (length l₂)).imp (prefix_of_prefix_length_le h₁ h₂)
     (prefix_of_prefix_length_le h₂ h₁)
 #align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefix
+-/
 
+#print List.suffix_of_suffix_length_le /-
 theorem suffix_of_suffix_length_le (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) :
     l₁ <:+ l₂ :=
   reverse_prefix.1 <|
     prefix_of_prefix_length_le (reverse_prefix.2 h₁) (reverse_prefix.2 h₂) (by simp [ll])
 #align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_le
+-/
 
+#print List.suffix_or_suffix_of_suffix /-
 theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁ :=
   (prefix_or_prefix_of_prefix (reverse_prefix.2 h₁) (reverse_prefix.2 h₂)).imp reverse_prefix.1
     reverse_prefix.1
 #align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffix
+-/
 
+#print List.suffix_cons_iff /-
 theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂ :=
   by
   constructor
@@ -375,7 +382,9 @@ theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l
     · exact (a :: l₂).suffix_refl
     · exact hl₁.trans (l₂.suffix_cons _)
 #align list.suffix_cons_iff List.suffix_cons_iff
+-/
 
+#print List.infix_cons_iff /-
 theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂ :=
   by
   constructor
@@ -387,6 +396,7 @@ theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+
     · exact h.is_infix
     · exact infix_cons hl₁
 #align list.infix_cons_iff List.infix_cons_iff
+-/
 
 #print List.infix_of_mem_join /-
 theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L
@@ -443,13 +453,17 @@ theorem drop_subset (n) (l : List α) : drop n l ⊆ l :=
 #align list.drop_subset List.drop_subset
 -/
 
+#print List.mem_of_mem_take /-
 theorem mem_of_mem_take (h : a ∈ l.take n) : a ∈ l :=
   take_subset n l h
 #align list.mem_of_mem_take List.mem_of_mem_take
+-/
 
+#print List.mem_of_mem_drop /-
 theorem mem_of_mem_drop (h : a ∈ l.drop n) : a ∈ l :=
   drop_subset n l h
 #align list.mem_of_mem_drop List.mem_of_mem_drop
+-/
 
 #print List.dropSlice_sublist /-
 theorem dropSlice_sublist (n m : ℕ) (l : List α) : l.slice n m <+ l :=
@@ -473,13 +487,17 @@ theorem mem_of_mem_dropSlice {n m : ℕ} {l : List α} {a : α} (h : a ∈ l.sli
 #align list.mem_of_mem_slice List.mem_of_mem_dropSlice
 -/
 
+#print List.takeWhile_prefix /-
 theorem takeWhile_prefix (p : α → Prop) [DecidablePred p] : l.takeWhile p <+: l :=
   ⟨l.dropWhileₓ p, takeWhile_append_dropWhile p l⟩
 #align list.take_while_prefix List.takeWhile_prefix
+-/
 
+#print List.dropWhile_suffix /-
 theorem dropWhile_suffix (p : α → Prop) [DecidablePred p] : l.dropWhileₓ p <:+ l :=
   ⟨l.takeWhile p, takeWhile_append_dropWhile p l⟩
 #align list.drop_while_suffix List.dropWhile_suffix
+-/
 
 #print List.dropLast_prefix /-
 theorem dropLast_prefix : ∀ l : List α, l.dropLast <+: l
@@ -622,6 +640,7 @@ theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ :=
 #align list.cons_prefix_iff List.cons_prefix_iff
 -/
 
+#print List.isPrefix.map /-
 theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f :=
   by
   induction' l₁ with hd tl hl generalizing l₂
@@ -631,7 +650,9 @@ theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
     · rw [cons_prefix_iff] at h 
       simp only [h, prefix_cons_inj, hl, map]
 #align list.is_prefix.map List.isPrefix.map
+-/
 
+#print List.isPrefix.filter_map /-
 theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
     l₁.filterMap f <+: l₂.filterMap f :=
   by
@@ -644,6 +665,7 @@ theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
         filter_map_append, h.left, prefix_append_right_inj]
       exact hl h.right
 #align list.is_prefix.filter_map List.isPrefix.filter_map
+-/
 
 #print List.isPrefix.reduceOption /-
 theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
@@ -652,20 +674,25 @@ theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂)
 #align list.is_prefix.reduce_option List.isPrefix.reduceOption
 -/
 
+#print List.isPrefix.filter /-
 theorem isPrefix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
     l₁.filterₓ p <+: l₂.filterₓ p := by
   obtain ⟨xs, rfl⟩ := h
   rw [filter_append]
   exact prefix_append _ _
 #align list.is_prefix.filter List.isPrefix.filter
+-/
 
+#print List.isSuffix.filter /-
 theorem isSuffix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
     l₁.filterₓ p <:+ l₂.filterₓ p := by
   obtain ⟨xs, rfl⟩ := h
   rw [filter_append]
   exact suffix_append _ _
 #align list.is_suffix.filter List.isSuffix.filter
+-/
 
+#print List.isInfix.filter /-
 theorem isInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
     l₁.filterₓ p <:+: l₂.filterₓ p :=
   by
@@ -673,6 +700,7 @@ theorem isInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List 
   rw [filter_append, filter_append]
   exact infix_append _ _ _
 #align list.is_infix.filter List.isInfix.filter
+-/
 
 instance : IsPartialOrder (List α) (· <+: ·)
     where
@@ -867,19 +895,26 @@ theorem insert_nil (a : α) : insert a nil = [a] :=
 #align list.insert_nil List.insert_nil
 -/
 
+#print List.insert.def /-
 theorem insert.def (a : α) (l : List α) : insert a l = if a ∈ l then l else a :: l :=
   rfl
 #align list.insert.def List.insert.def
+-/
 
+#print List.insert_of_mem /-
 @[simp]
 theorem insert_of_mem (h : a ∈ l) : insert a l = l := by simp only [insert.def, if_pos h]
 #align list.insert_of_mem List.insert_of_mem
+-/
 
+#print List.insert_of_not_mem /-
 @[simp]
 theorem insert_of_not_mem (h : a ∉ l) : insert a l = a :: l := by
   simp only [insert.def, if_neg h] <;> constructor <;> rfl
 #align list.insert_of_not_mem List.insert_of_not_mem
+-/
 
+#print List.mem_insert_iff /-
 @[simp]
 theorem mem_insert_iff : a ∈ insert b l ↔ a = b ∨ a ∈ l :=
   by
@@ -889,6 +924,7 @@ theorem mem_insert_iff : a ∈ insert b l ↔ a = b ∨ a ∈ l :=
     exact fun e => e.symm ▸ h'
   · simp only [insert_of_not_mem h', mem_cons_iff]
 #align list.mem_insert_iff List.mem_insert_iff
+-/
 
 #print List.suffix_insert /-
 @[simp]
@@ -922,23 +958,31 @@ theorem mem_insert_self (a : α) (l : List α) : a ∈ l.insert a :=
 #align list.mem_insert_self List.mem_insert_self
 -/
 
+#print List.mem_insert_of_mem /-
 theorem mem_insert_of_mem (h : a ∈ l) : a ∈ insert b l :=
   mem_insert_iff.2 (Or.inr h)
 #align list.mem_insert_of_mem List.mem_insert_of_mem
+-/
 
+#print List.eq_or_mem_of_mem_insert /-
 theorem eq_or_mem_of_mem_insert (h : a ∈ insert b l) : a = b ∨ a ∈ l :=
   mem_insert_iff.1 h
 #align list.eq_or_mem_of_mem_insert List.eq_or_mem_of_mem_insert
+-/
 
+#print List.length_insert_of_mem /-
 @[simp]
 theorem length_insert_of_mem (h : a ∈ l) : (insert a l).length = l.length :=
   congr_arg _ <| insert_of_mem h
 #align list.length_insert_of_mem List.length_insert_of_mem
+-/
 
+#print List.length_insert_of_not_mem /-
 @[simp]
 theorem length_insert_of_not_mem (h : a ∉ l) : (insert a l).length = l.length + 1 :=
   congr_arg _ <| insert_of_not_mem h
 #align list.length_insert_of_not_mem List.length_insert_of_not_mem
+-/
 
 end Insert
 
Diff
@@ -587,7 +587,7 @@ instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l
 #align list.decidable_infix List.decidableInfix
 -/
 
-/- ./././Mathport/Syntax/Translate/Tactic/Lean3.lean:564:6: unsupported: specialize @hyp -/
+/- ./././Mathport/Syntax/Translate/Tactic/Lean3.lean:567:6: unsupported: specialize @hyp -/
 #print List.prefix_take_le_iff /-
 theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
     L.take m <+: L.take n ↔ m ≤ n :=
Diff
@@ -369,7 +369,7 @@ theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l
   constructor
   · rintro ⟨⟨hd, tl⟩, hl₃⟩
     · exact Or.inl hl₃
-    · simp only [cons_append] at hl₃
+    · simp only [cons_append] at hl₃ 
       exact Or.inr ⟨_, hl₃.2⟩
   · rintro (rfl | hl₁)
     · exact (a :: l₂).suffix_refl
@@ -381,7 +381,7 @@ theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+
   constructor
   · rintro ⟨⟨hd, tl⟩, t, hl₃⟩
     · exact Or.inl ⟨t, hl₃⟩
-    · simp only [cons_append] at hl₃
+    · simp only [cons_append] at hl₃ 
       exact Or.inr ⟨_, t, hl₃.2⟩
   · rintro (h | hl₁)
     · exact h.is_infix
@@ -580,7 +580,7 @@ instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
 #print List.decidableInfix /-
 instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+: l₂)
   | [], l₂ => isTrue ⟨[], l₂, rfl⟩
-  | a :: l₁, [] => isFalse fun ⟨s, t, te⟩ => by simp at te <;> exact te
+  | a :: l₁, [] => isFalse fun ⟨s, t, te⟩ => by simp at te  <;> exact te
   | l₁, b :: l₂ =>
     decidable_of_decidable_of_iff
       (@Or.decidable _ _ (l₁.decidablePrefix (b :: l₂)) (l₁.decidableInfix l₂)) infix_cons_iff.symm
@@ -602,9 +602,9 @@ theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
     rw [take_zero, take_nil]
     simp only [take]
     exact not_false
-  · simp only [length] at hm
+  · simp only [length] at hm 
     specialize IH ls n (Nat.lt_of_succ_lt_succ hm)
-    simp only [le_of_lt (Nat.lt_of_succ_lt_succ hm), min_eq_left] at IH
+    simp only [le_of_lt (Nat.lt_of_succ_lt_succ hm), min_eq_left] at IH 
     simp only [le_of_lt hm, IH, true_and_iff, min_eq_left, eq_self_iff_true, length, take]
     exact ⟨Nat.succ_le_succ, Nat.le_of_succ_le_succ⟩
 #align list.prefix_take_le_iff List.prefix_take_le_iff
@@ -615,7 +615,7 @@ theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ :=
   by
   constructor
   · rintro ⟨L, hL⟩
-    simp only [cons_append] at hL
+    simp only [cons_append] at hL 
     exact ⟨hL.left, ⟨L, hL.right⟩⟩
   · rintro ⟨rfl, h⟩
     rwa [prefix_cons_inj]
@@ -628,7 +628,7 @@ theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
   · simp only [nil_prefix, map_nil]
   · cases' l₂ with hd₂ tl₂
     · simpa only using eq_nil_of_prefix_nil h
-    · rw [cons_prefix_iff] at h
+    · rw [cons_prefix_iff] at h 
       simp only [h, prefix_cons_inj, hl, map]
 #align list.is_prefix.map List.isPrefix.map
 
@@ -639,7 +639,7 @@ theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
   · simp only [nil_prefix, filter_map_nil]
   · cases' l₂ with hd₂ tl₂
     · simpa only using eq_nil_of_prefix_nil h
-    · rw [cons_prefix_iff] at h
+    · rw [cons_prefix_iff] at h 
       rw [← @singleton_append _ hd₁ _, ← @singleton_append _ hd₂ _, filter_map_append,
         filter_map_append, h.left, prefix_append_right_inj]
       exact hl h.right
@@ -893,7 +893,7 @@ theorem mem_insert_iff : a ∈ insert b l ↔ a = b ∨ a ∈ l :=
 #print List.suffix_insert /-
 @[simp]
 theorem suffix_insert (a : α) (l : List α) : l <:+ insert a l := by
-  by_cases a ∈ l <;> [simp only [insert_of_mem h];simp only [insert_of_not_mem h, suffix_cons]]
+  by_cases a ∈ l <;> [simp only [insert_of_mem h]; simp only [insert_of_not_mem h, suffix_cons]]
 #align list.suffix_insert List.suffix_insert
 -/
 
Diff
@@ -348,46 +348,22 @@ theorem prefix_of_prefix_length_le :
 #align list.prefix_of_prefix_length_le List.prefix_of_prefix_length_le
 -/
 
-/- warning: list.prefix_or_prefix_of_prefix -> List.prefix_or_prefix_of_prefix is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isPrefix.{u1} α l₁ l₃) -> (List.isPrefix.{u1} α l₂ l₃) -> (Or (List.isPrefix.{u1} α l₁ l₂) (List.isPrefix.{u1} α l₂ l₁))
-but is expected to have type
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isPrefix.{u1} α l₁ l₂) -> (List.isPrefix.{u1} α l₃ l₂) -> (Or (List.isPrefix.{u1} α l₁ l₃) (List.isPrefix.{u1} α l₃ l₁))
-Case conversion may be inaccurate. Consider using '#align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefixₓ'. -/
 theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁ :=
   (le_total (length l₁) (length l₂)).imp (prefix_of_prefix_length_le h₁ h₂)
     (prefix_of_prefix_length_le h₂ h₁)
 #align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefix
 
-/- warning: list.suffix_of_suffix_length_le -> List.suffix_of_suffix_length_le is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₃) -> (List.isSuffix.{u1} α l₂ l₃) -> (LE.le.{0} Nat Nat.hasLe (List.length.{u1} α l₁) (List.length.{u1} α l₂)) -> (List.isSuffix.{u1} α l₁ l₂)
-but is expected to have type
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₂) -> (List.isSuffix.{u1} α l₃ l₂) -> (LE.le.{0} Nat instLENat (List.length.{u1} α l₁) (List.length.{u1} α l₃)) -> (List.isSuffix.{u1} α l₁ l₃)
-Case conversion may be inaccurate. Consider using '#align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_leₓ'. -/
 theorem suffix_of_suffix_length_le (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) :
     l₁ <:+ l₂ :=
   reverse_prefix.1 <|
     prefix_of_prefix_length_le (reverse_prefix.2 h₁) (reverse_prefix.2 h₂) (by simp [ll])
 #align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_le
 
-/- warning: list.suffix_or_suffix_of_suffix -> List.suffix_or_suffix_of_suffix is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₃) -> (List.isSuffix.{u1} α l₂ l₃) -> (Or (List.isSuffix.{u1} α l₁ l₂) (List.isSuffix.{u1} α l₂ l₁))
-but is expected to have type
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₂) -> (List.isSuffix.{u1} α l₃ l₂) -> (Or (List.isSuffix.{u1} α l₁ l₃) (List.isSuffix.{u1} α l₃ l₁))
-Case conversion may be inaccurate. Consider using '#align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffixₓ'. -/
 theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁ :=
   (prefix_or_prefix_of_prefix (reverse_prefix.2 h₁) (reverse_prefix.2 h₂)).imp reverse_prefix.1
     reverse_prefix.1
 #align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffix
 
-/- warning: list.suffix_cons_iff -> List.suffix_cons_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {a : α}, Iff (List.isSuffix.{u1} α l₁ (List.cons.{u1} α a l₂)) (Or (Eq.{succ u1} (List.{u1} α) l₁ (List.cons.{u1} α a l₂)) (List.isSuffix.{u1} α l₁ l₂))
-but is expected to have type
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : α} {a : List.{u1} α}, Iff (List.isSuffix.{u1} α l₁ (List.cons.{u1} α l₂ a)) (Or (Eq.{succ u1} (List.{u1} α) l₁ (List.cons.{u1} α l₂ a)) (List.isSuffix.{u1} α l₁ a))
-Case conversion may be inaccurate. Consider using '#align list.suffix_cons_iff List.suffix_cons_iffₓ'. -/
 theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂ :=
   by
   constructor
@@ -400,12 +376,6 @@ theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l
     · exact hl₁.trans (l₂.suffix_cons _)
 #align list.suffix_cons_iff List.suffix_cons_iff
 
-/- warning: list.infix_cons_iff -> List.infix_cons_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {a : α}, Iff (List.isInfix.{u1} α l₁ (List.cons.{u1} α a l₂)) (Or (List.isPrefix.{u1} α l₁ (List.cons.{u1} α a l₂)) (List.isInfix.{u1} α l₁ l₂))
-but is expected to have type
-  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : α} {a : List.{u1} α}, Iff (List.isInfix.{u1} α l₁ (List.cons.{u1} α l₂ a)) (Or (List.isPrefix.{u1} α l₁ (List.cons.{u1} α l₂ a)) (List.isInfix.{u1} α l₁ a))
-Case conversion may be inaccurate. Consider using '#align list.infix_cons_iff List.infix_cons_iffₓ'. -/
 theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂ :=
   by
   constructor
@@ -473,22 +443,10 @@ theorem drop_subset (n) (l : List α) : drop n l ⊆ l :=
 #align list.drop_subset List.drop_subset
 -/
 
-/- warning: list.mem_of_mem_take -> List.mem_of_mem_take is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} {n : Nat}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a (List.take.{u1} α n l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l)
-but is expected to have type
-  forall {α : Type.{u1}} {l : α} {a : Nat} {n : List.{u1} α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) l (List.take.{u1} α a n)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) l n)
-Case conversion may be inaccurate. Consider using '#align list.mem_of_mem_take List.mem_of_mem_takeₓ'. -/
 theorem mem_of_mem_take (h : a ∈ l.take n) : a ∈ l :=
   take_subset n l h
 #align list.mem_of_mem_take List.mem_of_mem_take
 
-/- warning: list.mem_of_mem_drop -> List.mem_of_mem_drop is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} {n : Nat}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a (List.drop.{u1} α n l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l)
-but is expected to have type
-  forall {α : Type.{u1}} {l : α} {a : Nat} {n : List.{u1} α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) l (List.drop.{u1} α a n)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) l n)
-Case conversion may be inaccurate. Consider using '#align list.mem_of_mem_drop List.mem_of_mem_dropₓ'. -/
 theorem mem_of_mem_drop (h : a ∈ l.drop n) : a ∈ l :=
   drop_subset n l h
 #align list.mem_of_mem_drop List.mem_of_mem_drop
@@ -515,22 +473,10 @@ theorem mem_of_mem_dropSlice {n m : ℕ} {l : List α} {a : α} (h : a ∈ l.sli
 #align list.mem_of_mem_slice List.mem_of_mem_dropSlice
 -/
 
-/- warning: list.take_while_prefix -> List.takeWhile_prefix is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} (p : α -> Prop) [_inst_1 : DecidablePred.{succ u1} α p], List.isPrefix.{u1} α (List.takeWhile.{u1} α p (fun (a : α) => _inst_1 a) l) l
-but is expected to have type
-  forall {α : Type.{u1}} {l : List.{u1} α} (p : α -> Bool), List.isPrefix.{u1} α (List.takeWhile.{u1} α p l) l
-Case conversion may be inaccurate. Consider using '#align list.take_while_prefix List.takeWhile_prefixₓ'. -/
 theorem takeWhile_prefix (p : α → Prop) [DecidablePred p] : l.takeWhile p <+: l :=
   ⟨l.dropWhileₓ p, takeWhile_append_dropWhile p l⟩
 #align list.take_while_prefix List.takeWhile_prefix
 
-/- warning: list.drop_while_suffix -> List.dropWhile_suffix is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} (p : α -> Prop) [_inst_1 : DecidablePred.{succ u1} α p], List.isSuffix.{u1} α (List.dropWhileₓ.{u1} α p (fun (a : α) => _inst_1 a) l) l
-but is expected to have type
-  forall {α : Type.{u1}} {l : List.{u1} α} (p : α -> Bool), List.isSuffix.{u1} α (List.dropWhile.{u1} α p l) l
-Case conversion may be inaccurate. Consider using '#align list.drop_while_suffix List.dropWhile_suffixₓ'. -/
 theorem dropWhile_suffix (p : α → Prop) [DecidablePred p] : l.dropWhileₓ p <:+ l :=
   ⟨l.takeWhile p, takeWhile_append_dropWhile p l⟩
 #align list.drop_while_suffix List.dropWhile_suffix
@@ -676,12 +622,6 @@ theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ :=
 #align list.cons_prefix_iff List.cons_prefix_iff
 -/
 
-/- warning: list.is_prefix.map -> List.isPrefix.map is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {l₁ : List.{u1} α} {l₂ : List.{u1} α}, (List.isPrefix.{u1} α l₁ l₂) -> (forall (f : α -> β), List.isPrefix.{u2} β (List.map.{u1, u2} α β f l₁) (List.map.{u1, u2} α β f l₂))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {l₁ : List.{u2} α} {l₂ : List.{u2} α}, (List.isPrefix.{u2} α l₁ l₂) -> (forall (f : α -> β), List.isPrefix.{u1} β (List.map.{u2, u1} α β f l₁) (List.map.{u2, u1} α β f l₂))
-Case conversion may be inaccurate. Consider using '#align list.is_prefix.map List.isPrefix.mapₓ'. -/
 theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f :=
   by
   induction' l₁ with hd tl hl generalizing l₂
@@ -692,12 +632,6 @@ theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
       simp only [h, prefix_cons_inj, hl, map]
 #align list.is_prefix.map List.isPrefix.map
 
-/- warning: list.is_prefix.filter_map -> List.isPrefix.filter_map is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {l₁ : List.{u1} α} {l₂ : List.{u1} α}, (List.isPrefix.{u1} α l₁ l₂) -> (forall (f : α -> (Option.{u2} β)), List.isPrefix.{u2} β (List.filterMap.{u1, u2} α β f l₁) (List.filterMap.{u1, u2} α β f l₂))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {l₁ : List.{u2} α} {l₂ : List.{u2} α}, (List.isPrefix.{u2} α l₁ l₂) -> (forall (f : α -> (Option.{u1} β)), List.isPrefix.{u1} β (List.filterMap.{u2, u1} α β f l₁) (List.filterMap.{u2, u1} α β f l₂))
-Case conversion may be inaccurate. Consider using '#align list.is_prefix.filter_map List.isPrefix.filter_mapₓ'. -/
 theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
     l₁.filterMap f <+: l₂.filterMap f :=
   by
@@ -718,12 +652,6 @@ theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂)
 #align list.is_prefix.reduce_option List.isPrefix.reduceOption
 -/
 
-/- warning: list.is_prefix.filter -> List.isPrefix.filter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} (p : α -> Prop) [_inst_1 : DecidablePred.{succ u1} α p] {{l₁ : List.{u1} α}} {{l₂ : List.{u1} α}}, (List.isPrefix.{u1} α l₁ l₂) -> (List.isPrefix.{u1} α (List.filterₓ.{u1} α p (fun (a : α) => _inst_1 a) l₁) (List.filterₓ.{u1} α p (fun (a : α) => _inst_1 a) l₂))
-but is expected to have type
-  forall {α : Type.{u1}} (p : α -> Bool) {{_inst_1 : List.{u1} α}} {{l₁ : List.{u1} α}}, (List.isPrefix.{u1} α _inst_1 l₁) -> (List.isPrefix.{u1} α (List.filter.{u1} α p _inst_1) (List.filter.{u1} α p l₁))
-Case conversion may be inaccurate. Consider using '#align list.is_prefix.filter List.isPrefix.filterₓ'. -/
 theorem isPrefix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
     l₁.filterₓ p <+: l₂.filterₓ p := by
   obtain ⟨xs, rfl⟩ := h
@@ -731,12 +659,6 @@ theorem isPrefix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List
   exact prefix_append _ _
 #align list.is_prefix.filter List.isPrefix.filter
 
-/- warning: list.is_suffix.filter -> List.isSuffix.filter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} (p : α -> Prop) [_inst_1 : DecidablePred.{succ u1} α p] {{l₁ : List.{u1} α}} {{l₂ : List.{u1} α}}, (List.isSuffix.{u1} α l₁ l₂) -> (List.isSuffix.{u1} α (List.filterₓ.{u1} α p (fun (a : α) => _inst_1 a) l₁) (List.filterₓ.{u1} α p (fun (a : α) => _inst_1 a) l₂))
-but is expected to have type
-  forall {α : Type.{u1}} (p : α -> Bool) {{_inst_1 : List.{u1} α}} {{l₁ : List.{u1} α}}, (List.isSuffix.{u1} α _inst_1 l₁) -> (List.isSuffix.{u1} α (List.filter.{u1} α p _inst_1) (List.filter.{u1} α p l₁))
-Case conversion may be inaccurate. Consider using '#align list.is_suffix.filter List.isSuffix.filterₓ'. -/
 theorem isSuffix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
     l₁.filterₓ p <:+ l₂.filterₓ p := by
   obtain ⟨xs, rfl⟩ := h
@@ -744,12 +666,6 @@ theorem isSuffix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List
   exact suffix_append _ _
 #align list.is_suffix.filter List.isSuffix.filter
 
-/- warning: list.is_infix.filter -> List.isInfix.filter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} (p : α -> Prop) [_inst_1 : DecidablePred.{succ u1} α p] {{l₁ : List.{u1} α}} {{l₂ : List.{u1} α}}, (List.isInfix.{u1} α l₁ l₂) -> (List.isInfix.{u1} α (List.filterₓ.{u1} α p (fun (a : α) => _inst_1 a) l₁) (List.filterₓ.{u1} α p (fun (a : α) => _inst_1 a) l₂))
-but is expected to have type
-  forall {α : Type.{u1}} (p : α -> Bool) {{_inst_1 : List.{u1} α}} {{l₁ : List.{u1} α}}, (List.isInfix.{u1} α _inst_1 l₁) -> (List.isInfix.{u1} α (List.filter.{u1} α p _inst_1) (List.filter.{u1} α p l₁))
-Case conversion may be inaccurate. Consider using '#align list.is_infix.filter List.isInfix.filterₓ'. -/
 theorem isInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
     l₁.filterₓ p <:+: l₂.filterₓ p :=
   by
@@ -951,43 +867,19 @@ theorem insert_nil (a : α) : insert a nil = [a] :=
 #align list.insert_nil List.insert_nil
 -/
 
-/- warning: list.insert.def -> List.insert.def is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (a : α) (l : List.{u1} α), Eq.{succ u1} (List.{u1} α) (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a l) (ite.{succ u1} (List.{u1} α) (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) (List.decidableMem.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a l) l (List.cons.{u1} α a l))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (a : α) (l : List.{u1} α), Eq.{succ u1} (List.{u1} α) (Insert.insert.{u1, u1} α (List.{u1} α) (List.instInsertList.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a l) (ite.{succ u1} (List.{u1} α) (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) (List.instDecidableMemListInstMembershipList.{u1} α (fun (a : α) (b : α) => _inst_1 a b) a l) l (List.cons.{u1} α a l))
-Case conversion may be inaccurate. Consider using '#align list.insert.def List.insert.defₓ'. -/
 theorem insert.def (a : α) (l : List α) : insert a l = if a ∈ l then l else a :: l :=
   rfl
 #align list.insert.def List.insert.def
 
-/- warning: list.insert_of_mem -> List.insert_of_mem is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α], (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{succ u1} (List.{u1} α) (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a l) l)
-but is expected to have type
-  forall {α : Type.{u1}} [l : DecidableEq.{succ u1} α] {a : α} {_inst_1 : List.{u1} α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a _inst_1) -> (Eq.{succ u1} (List.{u1} α) (List.insert.{u1} α (fun (a : α) (b : α) => l a b) a _inst_1) _inst_1)
-Case conversion may be inaccurate. Consider using '#align list.insert_of_mem List.insert_of_memₓ'. -/
 @[simp]
 theorem insert_of_mem (h : a ∈ l) : insert a l = l := by simp only [insert.def, if_pos h]
 #align list.insert_of_mem List.insert_of_mem
 
-/- warning: list.insert_of_not_mem -> List.insert_of_not_mem is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α], (Not (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l)) -> (Eq.{succ u1} (List.{u1} α) (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a l) (List.cons.{u1} α a l))
-but is expected to have type
-  forall {α : Type.{u1}} [l : DecidableEq.{succ u1} α] {a : α} {_inst_1 : List.{u1} α}, (Not (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a _inst_1)) -> (Eq.{succ u1} (List.{u1} α) (List.insert.{u1} α (fun (a : α) (b : α) => l a b) a _inst_1) (List.cons.{u1} α a _inst_1))
-Case conversion may be inaccurate. Consider using '#align list.insert_of_not_mem List.insert_of_not_memₓ'. -/
 @[simp]
 theorem insert_of_not_mem (h : a ∉ l) : insert a l = a :: l := by
   simp only [insert.def, if_neg h] <;> constructor <;> rfl
 #align list.insert_of_not_mem List.insert_of_not_mem
 
-/- warning: list.mem_insert_iff -> List.mem_insert_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} {b : α} [_inst_1 : DecidableEq.{succ u1} α], Iff (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) b l)) (Or (Eq.{succ u1} α a b) (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l))
-but is expected to have type
-  forall {α : Type.{u1}} [l : DecidableEq.{succ u1} α] {a : α} {b : α} {_inst_1 : List.{u1} α}, Iff (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a (List.insert.{u1} α (fun (a : α) (b : α) => l a b) b _inst_1)) (Or (Eq.{succ u1} α a b) (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a _inst_1))
-Case conversion may be inaccurate. Consider using '#align list.mem_insert_iff List.mem_insert_iffₓ'. -/
 @[simp]
 theorem mem_insert_iff : a ∈ insert b l ↔ a = b ∨ a ∈ l :=
   by
@@ -1030,43 +922,19 @@ theorem mem_insert_self (a : α) (l : List α) : a ∈ l.insert a :=
 #align list.mem_insert_self List.mem_insert_self
 -/
 
-/- warning: list.mem_insert_of_mem -> List.mem_insert_of_mem is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} {b : α} [_inst_1 : DecidableEq.{succ u1} α], (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) b l))
-but is expected to have type
-  forall {α : Type.{u1}} [l : DecidableEq.{succ u1} α] {a : α} {b : α} {_inst_1 : List.{u1} α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a _inst_1) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a (List.insert.{u1} α (fun (a : α) (b : α) => l a b) b _inst_1))
-Case conversion may be inaccurate. Consider using '#align list.mem_insert_of_mem List.mem_insert_of_memₓ'. -/
 theorem mem_insert_of_mem (h : a ∈ l) : a ∈ insert b l :=
   mem_insert_iff.2 (Or.inr h)
 #align list.mem_insert_of_mem List.mem_insert_of_mem
 
-/- warning: list.eq_or_mem_of_mem_insert -> List.eq_or_mem_of_mem_insert is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} {b : α} [_inst_1 : DecidableEq.{succ u1} α], (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) b l)) -> (Or (Eq.{succ u1} α a b) (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l))
-but is expected to have type
-  forall {α : Type.{u1}} [l : DecidableEq.{succ u1} α] {a : α} {b : α} {_inst_1 : List.{u1} α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a (List.insert.{u1} α (fun (a : α) (b : α) => l a b) b _inst_1)) -> (Or (Eq.{succ u1} α a b) (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a _inst_1))
-Case conversion may be inaccurate. Consider using '#align list.eq_or_mem_of_mem_insert List.eq_or_mem_of_mem_insertₓ'. -/
 theorem eq_or_mem_of_mem_insert (h : a ∈ insert b l) : a = b ∨ a ∈ l :=
   mem_insert_iff.1 h
 #align list.eq_or_mem_of_mem_insert List.eq_or_mem_of_mem_insert
 
-/- warning: list.length_insert_of_mem -> List.length_insert_of_mem is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α], (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{1} Nat (List.length.{u1} α (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a l)) (List.length.{u1} α l))
-but is expected to have type
-  forall {α : Type.{u1}} [l : DecidableEq.{succ u1} α] {a : α} {_inst_1 : List.{u1} α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a _inst_1) -> (Eq.{1} Nat (List.length.{u1} α (List.insert.{u1} α (fun (a : α) (b : α) => l a b) a _inst_1)) (List.length.{u1} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align list.length_insert_of_mem List.length_insert_of_memₓ'. -/
 @[simp]
 theorem length_insert_of_mem (h : a ∈ l) : (insert a l).length = l.length :=
   congr_arg _ <| insert_of_mem h
 #align list.length_insert_of_mem List.length_insert_of_mem
 
-/- warning: list.length_insert_of_not_mem -> List.length_insert_of_not_mem is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α], (Not (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l)) -> (Eq.{1} Nat (List.length.{u1} α (Insert.insert.{u1, u1} α (List.{u1} α) (List.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) a l)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (List.length.{u1} α l) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))
-but is expected to have type
-  forall {α : Type.{u1}} [l : DecidableEq.{succ u1} α] {a : α} {_inst_1 : List.{u1} α}, (Not (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a _inst_1)) -> (Eq.{1} Nat (List.length.{u1} α (List.insert.{u1} α (fun (a : α) (b : α) => l a b) a _inst_1)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (List.length.{u1} α _inst_1) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))
-Case conversion may be inaccurate. Consider using '#align list.length_insert_of_not_mem List.length_insert_of_not_memₓ'. -/
 @[simp]
 theorem length_insert_of_not_mem (h : a ∉ l) : (insert a l).length = l.length + 1 :=
   congr_arg _ <| insert_of_not_mem h
Diff
@@ -186,9 +186,7 @@ theorem isInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂
 -/
 
 #print List.isInfix.sublist /-
-protected theorem isInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ =>
-  by
-  rw [← h]
+protected theorem isInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ => by rw [← h];
   exact (sublist_append_right _ _).trans (sublist_append_left _ _)
 #align list.is_infix.sublist List.isInfix.sublist
 -/
@@ -872,34 +870,26 @@ theorem tails_eq_inits : ∀ l : List α, l.tails = (reverse <| map reverse <| i
 -/
 
 #print List.inits_reverse /-
-theorem inits_reverse (l : List α) : inits (reverse l) = reverse (map reverse l.tails) :=
-  by
-  rw [tails_eq_inits l]
-  simp [reverse_involutive.comp_self]
+theorem inits_reverse (l : List α) : inits (reverse l) = reverse (map reverse l.tails) := by
+  rw [tails_eq_inits l]; simp [reverse_involutive.comp_self]
 #align list.inits_reverse List.inits_reverse
 -/
 
 #print List.tails_reverse /-
-theorem tails_reverse (l : List α) : tails (reverse l) = reverse (map reverse l.inits) :=
-  by
-  rw [inits_eq_tails l]
-  simp [reverse_involutive.comp_self]
+theorem tails_reverse (l : List α) : tails (reverse l) = reverse (map reverse l.inits) := by
+  rw [inits_eq_tails l]; simp [reverse_involutive.comp_self]
 #align list.tails_reverse List.tails_reverse
 -/
 
 #print List.map_reverse_inits /-
-theorem map_reverse_inits (l : List α) : map reverse l.inits = (reverse <| tails <| reverse l) :=
-  by
-  rw [inits_eq_tails l]
-  simp [reverse_involutive.comp_self]
+theorem map_reverse_inits (l : List α) : map reverse l.inits = (reverse <| tails <| reverse l) := by
+  rw [inits_eq_tails l]; simp [reverse_involutive.comp_self]
 #align list.map_reverse_inits List.map_reverse_inits
 -/
 
 #print List.map_reverse_tails /-
-theorem map_reverse_tails (l : List α) : map reverse l.tails = (reverse <| inits <| reverse l) :=
-  by
-  rw [tails_eq_inits l]
-  simp [reverse_involutive.comp_self]
+theorem map_reverse_tails (l : List α) : map reverse l.tails = (reverse <| inits <| reverse l) := by
+  rw [tails_eq_inits l]; simp [reverse_involutive.comp_self]
 #align list.map_reverse_tails List.map_reverse_tails
 -/
 
Diff
@@ -524,7 +524,7 @@ but is expected to have type
   forall {α : Type.{u1}} {l : List.{u1} α} (p : α -> Bool), List.isPrefix.{u1} α (List.takeWhile.{u1} α p l) l
 Case conversion may be inaccurate. Consider using '#align list.take_while_prefix List.takeWhile_prefixₓ'. -/
 theorem takeWhile_prefix (p : α → Prop) [DecidablePred p] : l.takeWhile p <+: l :=
-  ⟨l.dropWhileₓ p, takeWhile_append_drop p l⟩
+  ⟨l.dropWhileₓ p, takeWhile_append_dropWhile p l⟩
 #align list.take_while_prefix List.takeWhile_prefix
 
 /- warning: list.drop_while_suffix -> List.dropWhile_suffix is a dubious translation:
@@ -534,7 +534,7 @@ but is expected to have type
   forall {α : Type.{u1}} {l : List.{u1} α} (p : α -> Bool), List.isSuffix.{u1} α (List.dropWhile.{u1} α p l) l
 Case conversion may be inaccurate. Consider using '#align list.drop_while_suffix List.dropWhile_suffixₓ'. -/
 theorem dropWhile_suffix (p : α → Prop) [DecidablePred p] : l.dropWhileₓ p <:+ l :=
-  ⟨l.takeWhile p, takeWhile_append_drop p l⟩
+  ⟨l.takeWhile p, takeWhile_append_dropWhile p l⟩
 #align list.drop_while_suffix List.dropWhile_suffix
 
 #print List.dropLast_prefix /-
@@ -1011,7 +1011,7 @@ theorem mem_insert_iff : a ∈ insert b l ↔ a = b ∨ a ∈ l :=
 #print List.suffix_insert /-
 @[simp]
 theorem suffix_insert (a : α) (l : List α) : l <:+ insert a l := by
-  by_cases a ∈ l <;> [simp only [insert_of_mem h], simp only [insert_of_not_mem h, suffix_cons]]
+  by_cases a ∈ l <;> [simp only [insert_of_mem h];simp only [insert_of_not_mem h, suffix_cons]]
 #align list.suffix_insert List.suffix_insert
 -/
 
Diff
@@ -283,28 +283,28 @@ theorem eq_nil_of_infix_nil (h : l <:+: []) : l = [] :=
 #align list.eq_nil_of_infix_nil List.eq_nil_of_infix_nil
 -/
 
-#print List.infix_nil_iff /-
+#print List.infix_nil /-
 @[simp]
-theorem infix_nil_iff : l <:+: [] ↔ l = [] :=
+theorem infix_nil : l <:+: [] ↔ l = [] :=
   ⟨fun h => eq_nil_of_sublist_nil h.Sublist, fun h => h ▸ infix_rfl⟩
-#align list.infix_nil_iff List.infix_nil_iff
+#align list.infix_nil_iff List.infix_nil
 -/
 
 alias infix_nil_iff ↔ eq_nil_of_infix_nil _
 #align list.eq_nil_of_infix_nil List.eq_nil_of_infix_nil
 
-#print List.prefix_nil_iff /-
+#print List.prefix_nil /-
 @[simp]
-theorem prefix_nil_iff : l <+: [] ↔ l = [] :=
+theorem prefix_nil : l <+: [] ↔ l = [] :=
   ⟨fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ prefix_rfl⟩
-#align list.prefix_nil_iff List.prefix_nil_iff
+#align list.prefix_nil_iff List.prefix_nil
 -/
 
-#print List.suffix_nil_iff /-
+#print List.suffix_nil /-
 @[simp]
-theorem suffix_nil_iff : l <:+ [] ↔ l = [] :=
+theorem suffix_nil : l <:+ [] ↔ l = [] :=
   ⟨fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ suffix_rfl⟩
-#align list.suffix_nil_iff List.suffix_nil_iff
+#align list.suffix_nil_iff List.suffix_nil
 -/
 
 alias prefix_nil_iff ↔ eq_nil_of_prefix_nil _
@@ -350,29 +350,46 @@ theorem prefix_of_prefix_length_le :
 #align list.prefix_of_prefix_length_le List.prefix_of_prefix_length_le
 -/
 
-#print List.prefix_or_prefix_of_prefix /-
+/- warning: list.prefix_or_prefix_of_prefix -> List.prefix_or_prefix_of_prefix is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isPrefix.{u1} α l₁ l₃) -> (List.isPrefix.{u1} α l₂ l₃) -> (Or (List.isPrefix.{u1} α l₁ l₂) (List.isPrefix.{u1} α l₂ l₁))
+but is expected to have type
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isPrefix.{u1} α l₁ l₂) -> (List.isPrefix.{u1} α l₃ l₂) -> (Or (List.isPrefix.{u1} α l₁ l₃) (List.isPrefix.{u1} α l₃ l₁))
+Case conversion may be inaccurate. Consider using '#align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefixₓ'. -/
 theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁ :=
   (le_total (length l₁) (length l₂)).imp (prefix_of_prefix_length_le h₁ h₂)
     (prefix_of_prefix_length_le h₂ h₁)
 #align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefix
--/
 
-#print List.suffix_of_suffix_length_le /-
+/- warning: list.suffix_of_suffix_length_le -> List.suffix_of_suffix_length_le is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₃) -> (List.isSuffix.{u1} α l₂ l₃) -> (LE.le.{0} Nat Nat.hasLe (List.length.{u1} α l₁) (List.length.{u1} α l₂)) -> (List.isSuffix.{u1} α l₁ l₂)
+but is expected to have type
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₂) -> (List.isSuffix.{u1} α l₃ l₂) -> (LE.le.{0} Nat instLENat (List.length.{u1} α l₁) (List.length.{u1} α l₃)) -> (List.isSuffix.{u1} α l₁ l₃)
+Case conversion may be inaccurate. Consider using '#align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_leₓ'. -/
 theorem suffix_of_suffix_length_le (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) :
     l₁ <:+ l₂ :=
   reverse_prefix.1 <|
     prefix_of_prefix_length_le (reverse_prefix.2 h₁) (reverse_prefix.2 h₂) (by simp [ll])
 #align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_le
--/
 
-#print List.suffix_or_suffix_of_suffix /-
+/- warning: list.suffix_or_suffix_of_suffix -> List.suffix_or_suffix_of_suffix is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₃) -> (List.isSuffix.{u1} α l₂ l₃) -> (Or (List.isSuffix.{u1} α l₁ l₂) (List.isSuffix.{u1} α l₂ l₁))
+but is expected to have type
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {l₃ : List.{u1} α}, (List.isSuffix.{u1} α l₁ l₂) -> (List.isSuffix.{u1} α l₃ l₂) -> (Or (List.isSuffix.{u1} α l₁ l₃) (List.isSuffix.{u1} α l₃ l₁))
+Case conversion may be inaccurate. Consider using '#align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffixₓ'. -/
 theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁ :=
   (prefix_or_prefix_of_prefix (reverse_prefix.2 h₁) (reverse_prefix.2 h₂)).imp reverse_prefix.1
     reverse_prefix.1
 #align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffix
--/
 
-#print List.suffix_cons_iff /-
+/- warning: list.suffix_cons_iff -> List.suffix_cons_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {a : α}, Iff (List.isSuffix.{u1} α l₁ (List.cons.{u1} α a l₂)) (Or (Eq.{succ u1} (List.{u1} α) l₁ (List.cons.{u1} α a l₂)) (List.isSuffix.{u1} α l₁ l₂))
+but is expected to have type
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : α} {a : List.{u1} α}, Iff (List.isSuffix.{u1} α l₁ (List.cons.{u1} α l₂ a)) (Or (Eq.{succ u1} (List.{u1} α) l₁ (List.cons.{u1} α l₂ a)) (List.isSuffix.{u1} α l₁ a))
+Case conversion may be inaccurate. Consider using '#align list.suffix_cons_iff List.suffix_cons_iffₓ'. -/
 theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂ :=
   by
   constructor
@@ -384,9 +401,13 @@ theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l
     · exact (a :: l₂).suffix_refl
     · exact hl₁.trans (l₂.suffix_cons _)
 #align list.suffix_cons_iff List.suffix_cons_iff
--/
 
-#print List.infix_cons_iff /-
+/- warning: list.infix_cons_iff -> List.infix_cons_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {a : α}, Iff (List.isInfix.{u1} α l₁ (List.cons.{u1} α a l₂)) (Or (List.isPrefix.{u1} α l₁ (List.cons.{u1} α a l₂)) (List.isInfix.{u1} α l₁ l₂))
+but is expected to have type
+  forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : α} {a : List.{u1} α}, Iff (List.isInfix.{u1} α l₁ (List.cons.{u1} α l₂ a)) (Or (List.isPrefix.{u1} α l₁ (List.cons.{u1} α l₂ a)) (List.isInfix.{u1} α l₁ a))
+Case conversion may be inaccurate. Consider using '#align list.infix_cons_iff List.infix_cons_iffₓ'. -/
 theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂ :=
   by
   constructor
@@ -398,7 +419,6 @@ theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+
     · exact h.is_infix
     · exact infix_cons hl₁
 #align list.infix_cons_iff List.infix_cons_iff
--/
 
 #print List.infix_of_mem_join /-
 theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L
@@ -455,11 +475,15 @@ theorem drop_subset (n) (l : List α) : drop n l ⊆ l :=
 #align list.drop_subset List.drop_subset
 -/
 
-#print List.mem_of_mem_take /-
+/- warning: list.mem_of_mem_take -> List.mem_of_mem_take is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {l : List.{u1} α} {a : α} {n : Nat}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a (List.take.{u1} α n l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l)
+but is expected to have type
+  forall {α : Type.{u1}} {l : α} {a : Nat} {n : List.{u1} α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) l (List.take.{u1} α a n)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) l n)
+Case conversion may be inaccurate. Consider using '#align list.mem_of_mem_take List.mem_of_mem_takeₓ'. -/
 theorem mem_of_mem_take (h : a ∈ l.take n) : a ∈ l :=
   take_subset n l h
 #align list.mem_of_mem_take List.mem_of_mem_take
--/
 
 /- warning: list.mem_of_mem_drop -> List.mem_of_mem_drop is a dubious translation:
 lean 3 declaration is
Diff
@@ -471,6 +471,7 @@ theorem mem_of_mem_drop (h : a ∈ l.drop n) : a ∈ l :=
   drop_subset n l h
 #align list.mem_of_mem_drop List.mem_of_mem_drop
 
+#print List.dropSlice_sublist /-
 theorem dropSlice_sublist (n m : ℕ) (l : List α) : l.slice n m <+ l :=
   by
   rw [List.dropSlice_eq]
@@ -478,14 +479,19 @@ theorem dropSlice_sublist (n m : ℕ) (l : List α) : l.slice n m <+ l :=
   rw [List.append_sublist_append_left, add_comm, List.drop_add]
   exact List.drop_sublist _ _
 #align list.slice_sublist List.dropSlice_sublist
+-/
 
+#print List.dropSlice_subset /-
 theorem dropSlice_subset (n m : ℕ) (l : List α) : l.slice n m ⊆ l :=
   (dropSlice_sublist n m l).Subset
 #align list.slice_subset List.dropSlice_subset
+-/
 
+#print List.mem_of_mem_dropSlice /-
 theorem mem_of_mem_dropSlice {n m : ℕ} {l : List α} {a : α} (h : a ∈ l.slice n m) : a ∈ l :=
   dropSlice_subset n m l h
 #align list.mem_of_mem_slice List.mem_of_mem_dropSlice
+-/
 
 /- warning: list.take_while_prefix -> List.takeWhile_prefix is a dubious translation:
 lean 3 declaration is

Changes in mathlib4

mathlib3
mathlib4
feat(List): add lemmas about Sublist (#12326)
  • Move tail_sublist to Basic
  • Rename sublist_of_cons_sublist_cons to Sublist.of_cons_cos
  • Rename cons_sublist_cons_iff to cons_sublist_cons
  • Add Sublist.tail, drop_sublist_drop_left, Sublist.drop
  • Protect some lemmas
Diff
@@ -90,13 +90,13 @@ theorem prefix_concat_iff {l₁ l₂ : List α} {a : α} :
 #align list.reverse_prefix List.reverse_prefix
 #align list.reverse_infix List.reverse_infix
 
-alias ⟨_, isSuffix.reverse⟩ := reverse_prefix
+protected alias ⟨_, isSuffix.reverse⟩ := reverse_prefix
 #align list.is_suffix.reverse List.isSuffix.reverse
 
-alias ⟨_, isPrefix.reverse⟩ := reverse_suffix
+protected alias ⟨_, isPrefix.reverse⟩ := reverse_suffix
 #align list.is_prefix.reverse List.isPrefix.reverse
 
-alias ⟨_, isInfix.reverse⟩ := reverse_infix
+protected alias ⟨_, isInfix.reverse⟩ := reverse_infix
 #align list.is_infix.reverse List.isInfix.reverse
 
 #align list.is_infix.length_le List.IsInfix.length_le
@@ -182,9 +182,10 @@ theorem dropLast_sublist (l : List α) : l.dropLast <+ l :=
   (dropLast_prefix l).sublist
 #align list.init_sublist List.dropLast_sublist
 
-theorem tail_sublist (l : List α) : l.tail <+ l :=
-  (tail_suffix l).sublist
-#align list.tail_sublist List.tail_sublist
+@[gcongr]
+theorem drop_sublist_drop_left (l : List α) {m n : ℕ} (h : m ≤ n) : drop n l <+ drop m l := by
+  rw [← Nat.sub_add_cancel h, drop_add]
+  apply drop_sublist
 
 theorem dropLast_subset (l : List α) : l.dropLast ⊆ l :=
   (dropLast_sublist l).subset
@@ -202,6 +203,11 @@ theorem mem_of_mem_tail (h : a ∈ l.tail) : a ∈ l :=
   tail_subset l h
 #align list.mem_of_mem_tail List.mem_of_mem_tail
 
+@[gcongr]
+protected theorem Sublist.drop : ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → ∀ n, l₁.drop n <+ l₂.drop n
+  | _, _, h, 0 => h
+  | _, _, h, n + 1 => by rw [← drop_tail, ← drop_tail]; exact h.tail.drop n
+
 theorem prefix_iff_eq_append : l₁ <+: l₂ ↔ l₁ ++ drop (length l₁) l₂ = l₂ :=
   ⟨by rintro ⟨r, rfl⟩; rw [drop_left], fun e => ⟨_, e⟩⟩
 #align list.prefix_iff_eq_append List.prefix_iff_eq_append
chore(Data/List): add dates to all deprecated lemmas (#12337)

Most of them go back to the port.

Diff
@@ -325,7 +325,7 @@ protected theorem IsPrefix.filterMap (h : l₁ <+: l₂) (f : α → Option β)
       exact hl h.right
 #align list.is_prefix.filter_map List.IsPrefix.filterMap
 
-@[deprecated] alias IsPrefix.filter_map := IsPrefix.filterMap
+@[deprecated] alias IsPrefix.filter_map := IsPrefix.filterMap -- 2024-03-26
 
 protected theorem IsPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
     l₁.reduceOption <+: l₂.reduceOption :=
feat(List/Infix): add get_tails and get_inits (#12170)

The goal is to drop nth_le_tails and nth_le_inits soon.

Written for #9607, moved to a separate PR

Diff
@@ -458,28 +458,38 @@ theorem length_tails (l : List α) : length (tails l) = length l + 1 := by
 theorem length_inits (l : List α) : length (inits l) = length l + 1 := by simp [inits_eq_tails]
 #align list.length_inits List.length_inits
 
-section deprecated
-set_option linter.deprecated false -- TODO(Henrik): make replacements for theorems in this section
+@[simp]
+theorem get_tails (l : List α) (n : Fin (length (tails l))) : (tails l).get n = l.drop n := by
+  induction l with
+  | nil => simp
+  | cons a l ihl =>
+    cases n using Fin.cases with
+    | zero => simp
+    | succ n => simp [ihl]
+#align list.nth_le_tails List.get_tails
 
 @[simp]
+theorem get_inits (l : List α) (n : Fin (length (inits l))) : (inits l).get n = l.take n := by
+  induction l with
+  | nil => simp
+  | cons a l ihl =>
+    cases n using Fin.cases with
+    | zero => simp
+    | succ n => simp [ihl]
+#align list.nth_le_inits List.get_inits
+
+section deprecated
+set_option linter.deprecated false
+
+@[simp, deprecated get_tails] -- 2024-04-16
 theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
-    nthLe (tails l) n hn = l.drop n := by
-  induction' l with x l IH generalizing n
-  · simp
-  · cases n
-    · simp [nthLe_cons]
-    · simpa [nthLe_cons] using IH _ _
-#align list.nth_le_tails List.nth_le_tails
+    nthLe (tails l) n hn = l.drop n :=
+  get_tails l _
 
-@[simp]
+@[simp, deprecated get_inits] -- 2024-04-16
 theorem nth_le_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
-    nthLe (inits l) n hn = l.take n := by
-  induction' l with x l IH generalizing n
-  · simp
-  · cases n
-    · simp [nthLe_cons]
-    · simpa [nthLe_cons] using IH _ _
-#align list.nth_le_inits List.nth_le_inits
+    nthLe (inits l) n hn = l.take n :=
+  get_inits l _
 end deprecated
 
 end InitsTails
feat: list lemmas (#11626)

Add some general purpose lemmas on lists. The new ext_get?' is intermediate between ext and ext_get, and for consistent naming add an alias ext_get? for ext.

Co-authored-by: sven-manthe <147848313+sven-manthe@users.noreply.github.com>

Diff
@@ -70,6 +70,11 @@ theorem infix_rfl : l <:+: l :=
 theorem prefix_concat (a : α) (l) : l <+: concat l a := by simp
 #align list.prefix_concat List.prefix_concat
 
+theorem prefix_concat_iff {l₁ l₂ : List α} {a : α} :
+    l₁ <+: l₂ ++ [a] ↔ l₁ = l₂ ++ [a] ∨ l₁ <+: l₂ := by
+  simpa only [← reverse_concat', reverse_inj, reverse_suffix] using
+    suffix_cons_iff (l₁ := l₁.reverse) (l₂ := l₂.reverse)
+
 #align list.infix_cons List.infix_cons
 #align list.infix_concat List.infix_concat
 #align list.is_prefix.trans List.IsPrefix.trans
@@ -211,6 +216,27 @@ theorem prefix_iff_eq_take : l₁ <+: l₂ ↔ l₁ = take (length l₁) l₂ :=
     fun e => e.symm ▸ take_prefix _ _⟩
 #align list.prefix_iff_eq_take List.prefix_iff_eq_take
 
+theorem prefix_take_iff {x y : List α} {n : ℕ} : x <+: y.take n ↔ x <+: y ∧ x.length ≤ n := by
+  constructor
+  · intro h
+    constructor
+    · exact List.IsPrefix.trans h <| List.take_prefix n y
+    · replace h := h.length_le
+      rw [length_take, Nat.le_min] at h
+      exact h.left
+  · intro ⟨hp, hl⟩
+    have hl' := hp.length_le
+    rw [List.prefix_iff_eq_take] at *
+    rw [hp, List.take_take]
+    simp [min_eq_left, hl, hl']
+
+theorem concat_get_prefix {x y : List α} (h : x <+: y) (hl : x.length < y.length) :
+    x ++ [y.get ⟨x.length, hl⟩] <+: y := by
+  use y.drop (x.length + 1)
+  nth_rw 1 [List.prefix_iff_eq_take.mp h]
+  convert List.take_append_drop (x.length + 1) y using 2
+  rw [← List.take_concat_get, List.concat_eq_append]; rfl
+
 theorem suffix_iff_eq_drop : l₁ <:+ l₂ ↔ l₁ = drop (length l₂ - length l₁) l₂ :=
   ⟨fun h => append_cancel_left <| (suffix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
     fun e => e.symm ▸ drop_suffix _ _⟩
@@ -442,7 +468,7 @@ theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
   · simp
   · cases n
     · simp [nthLe_cons]
-    · simpa[nthLe_cons] using IH _ _
+    · simpa [nthLe_cons] using IH _ _
 #align list.nth_le_tails List.nth_le_tails
 
 @[simp]
@@ -452,7 +478,7 @@ theorem nth_le_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
   · simp
   · cases n
     · simp [nthLe_cons]
-    · simpa[nthLe_cons] using IH _ _
+    · simpa [nthLe_cons] using IH _ _
 #align list.nth_le_inits List.nth_le_inits
 end deprecated
 
@@ -510,4 +536,17 @@ theorem mem_of_mem_suffix (hx : a ∈ l₁) (hl : l₁ <:+ l₂) : a ∈ l₂ :=
   hl.subset hx
 #align list.mem_of_mem_suffix List.mem_of_mem_suffix
 
+theorem IsPrefix.ne_nil {x y : List α} (h : x <+: y) (hx : x ≠ []) : y ≠ [] := by
+  rintro rfl; exact hx <| List.prefix_nil.mp h
+
+theorem IsPrefix.get_eq {x y : List α} (h : x <+: y) {n} (hn : n < x.length) :
+    x.get ⟨n, hn⟩ = y.get ⟨n, hn.trans_le h.length_le⟩ := by
+  obtain ⟨_, rfl⟩ := h
+  exact (List.get_append n hn).symm
+
+theorem IsPrefix.head_eq {x y : List α} (h : x <+: y) (hx : x ≠ []) :
+    x.head hx = y.head (h.ne_nil hx) := by
+  cases x <;> cases y <;> simp only [head_cons, ne_eq, not_true_eq_false] at hx ⊢
+  all_goals (obtain ⟨_, h⟩ := h; injection h)
+
 end List
chore(Data/List): Use Std lemmas (#11711)

Make use of Nat-specific lemmas from Std rather than the general ones provided by mathlib. Also reverse the dependency between Multiset.Nodup/Multiset.dedup and Multiset.sum since only the latter needs algebra. Also rename Algebra.BigOperators.Multiset.Abs to Algebra.BigOperators.Multiset.Order and move some lemmas from Algebra.BigOperators.Multiset.Basic to it.

The ultimate goal here is to carve out Data, Algebra and Order sublibraries.

Diff
@@ -143,7 +143,8 @@ theorem eq_of_suffix_of_length_eq (h : l₁ <:+ l₂) : l₁.length = l₂.lengt
 #align list.mem_of_mem_drop List.mem_of_mem_drop
 
 lemma dropSlice_sublist (n m : ℕ) (l : List α) : l.dropSlice n m <+ l :=
-  calc l.dropSlice n m = take n l ++ drop m (drop n l) := by rw [dropSlice_eq, drop_drop, add_comm]
+  calc
+    l.dropSlice n m = take n l ++ drop m (drop n l) := by rw [dropSlice_eq, drop_drop, Nat.add_comm]
   _ <+ take n l ++ drop n l := (Sublist.refl _).append (drop_sublist _ _)
   _ = _ := take_append_drop _ _
 #align list.slice_sublist List.dropSlice_sublist
style: add missing spaces between a tactic name and its arguments (#11714)

After the (d)simp and rw tactics - hints to find further occurrences welcome.

zulip discussion

Co-authored-by: @sven-manthe

Diff
@@ -377,7 +377,7 @@ theorem tails_cons (a : α) (l : List α) : tails (a :: l) = (a :: l) :: l.tails
 @[simp]
 theorem inits_append : ∀ s t : List α, inits (s ++ t) = s.inits ++ t.inits.tail.map fun l => s ++ l
   | [], [] => by simp
-  | [], a :: t => by simp[· ∘ ·]
+  | [], a :: t => by simp [· ∘ ·]
   | a :: s, t => by simp [inits_append s t, · ∘ ·]
 #align list.inits_append List.inits_append
 
@@ -440,7 +440,7 @@ theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
   induction' l with x l IH generalizing n
   · simp
   · cases n
-    · simp[nthLe_cons]
+    · simp [nthLe_cons]
     · simpa[nthLe_cons] using IH _ _
 #align list.nth_le_tails List.nth_le_tails
 
@@ -450,7 +450,7 @@ theorem nth_le_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
   induction' l with x l IH generalizing n
   · simp
   · cases n
-    · simp[nthLe_cons]
+    · simp [nthLe_cons]
     · simpa[nthLe_cons] using IH _ _
 #align list.nth_le_inits List.nth_le_inits
 end deprecated
chore(List/ReduceOption): move from Basic.lean (#11662)

Also rename List.IsPrefix.filter_map to List.IsPrefix.filterMap and protect some theorems in the List.IsPrefix namespace.

Diff
@@ -277,7 +277,7 @@ theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ :=
     rwa [prefix_cons_inj]
 #align list.cons_prefix_iff List.cons_prefix_iff
 
-theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f := by
+protected theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f := by
   induction' l₁ with hd tl hl generalizing l₂
   · simp only [nil_prefix, map_nil]
   · cases' l₂ with hd₂ tl₂
@@ -286,7 +286,7 @@ theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
       simp only [List.map_cons, h, prefix_cons_inj, hl, map]
 #align list.is_prefix.map List.IsPrefix.map
 
-theorem IsPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
+protected theorem IsPrefix.filterMap (h : l₁ <+: l₂) (f : α → Option β) :
     l₁.filterMap f <+: l₂.filterMap f := by
   induction' l₁ with hd₁ tl₁ hl generalizing l₂
   · simp only [nil_prefix, filterMap_nil]
@@ -296,9 +296,11 @@ theorem IsPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
       rw [← @singleton_append _ hd₁ _, ← @singleton_append _ hd₂ _, filterMap_append,
         filterMap_append, h.left, prefix_append_right_inj]
       exact hl h.right
-#align list.is_prefix.filter_map List.IsPrefix.filter_map
+#align list.is_prefix.filter_map List.IsPrefix.filterMap
 
-theorem IsPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
+@[deprecated] alias IsPrefix.filter_map := IsPrefix.filterMap
+
+protected theorem IsPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
     l₁.reduceOption <+: l₂.reduceOption :=
   h.filter_map id
 #align list.is_prefix.reduce_option List.IsPrefix.reduceOption
chore(Mathlib/Data/List/Basic): minimize imports (#11497)

Use Nat specialized theorems, and omega, where necessary to avoid needing to import the abstract ordered algebra hierarchy for basic results about List.

Import graph between Mathlib.Order.Basic and Mathlib.Data.List.Basic:

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -201,7 +201,7 @@ theorem prefix_iff_eq_append : l₁ <+: l₂ ↔ l₁ ++ drop (length l₁) l₂
 #align list.prefix_iff_eq_append List.prefix_iff_eq_append
 
 theorem suffix_iff_eq_append : l₁ <:+ l₂ ↔ take (length l₂ - length l₁) l₂ ++ l₁ = l₂ :=
-  ⟨by rintro ⟨r, rfl⟩; simp only [length_append, add_tsub_cancel_right, take_left], fun e =>
+  ⟨by rintro ⟨r, rfl⟩; simp only [length_append, Nat.add_sub_cancel_right, take_left], fun e =>
     ⟨_, e⟩⟩
 #align list.suffix_iff_eq_append List.suffix_iff_eq_append
 
@@ -251,7 +251,7 @@ theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
   | zero => simp [min_eq_left, eq_self_iff_true, Nat.zero_le, take]
   | succ m IH =>
     cases L with
-    | nil => exact (not_lt_bot hm).elim
+    | nil => simp_all
     | cons l ls =>
       cases n with
       | zero =>
chore: remove unneeded decreasing_by and termination_by (#11386)

The termination checker has been getting more capable, and many of the termination_by or decreasing_by clauses in Mathlib are no longer needed.

(Note that termination_by? will show the automatically derived termination expression, so no information is being lost by removing these.)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -233,7 +233,6 @@ instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
     @decidable_of_decidable_of_iff _ _
       (@instDecidableOr _ _ _ (l₁.decidableSuffix l₂))
       suffix_cons_iff.symm
-termination_by l₁ l₂ => (l₁, l₂)
 #align list.decidable_suffix List.decidableSuffix
 
 instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+: l₂)
@@ -243,7 +242,6 @@ instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l
     @decidable_of_decidable_of_iff _ _
       (@instDecidableOr _ _ (l₁.decidablePrefix (b :: l₂)) (l₁.decidableInfix l₂))
       infix_cons_iff.symm
-termination_by l₁ l₂ => (l₁, l₂)
 #align list.decidable_infix List.decidableInfix
 
 theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
chore: move to v4.6.0-rc1, merging adaptations from bump/v4.6.0 (#10176)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>

Diff
@@ -233,7 +233,7 @@ instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
     @decidable_of_decidable_of_iff _ _
       (@instDecidableOr _ _ _ (l₁.decidableSuffix l₂))
       suffix_cons_iff.symm
-termination_by decidableSuffix l₁ l₂ => (l₁, l₂)
+termination_by l₁ l₂ => (l₁, l₂)
 #align list.decidable_suffix List.decidableSuffix
 
 instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+: l₂)
@@ -243,7 +243,7 @@ instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l
     @decidable_of_decidable_of_iff _ _
       (@instDecidableOr _ _ (l₁.decidablePrefix (b :: l₂)) (l₁.decidableInfix l₂))
       infix_cons_iff.symm
-termination_by decidableInfix l₁ l₂ => (l₁, l₂)
+termination_by l₁ l₂ => (l₁, l₂)
 #align list.decidable_infix List.decidableInfix
 
 theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
chore: remove duplicates about List.append (#9376)

Replace duplicates in Mathlib with theorems in Lean core.

  • List.append_left_cancelList.append_cancel_left
  • List.append_right_cancelList.append_cancel_right
Diff
@@ -206,12 +206,12 @@ theorem suffix_iff_eq_append : l₁ <:+ l₂ ↔ take (length l₂ - length l₁
 #align list.suffix_iff_eq_append List.suffix_iff_eq_append
 
 theorem prefix_iff_eq_take : l₁ <+: l₂ ↔ l₁ = take (length l₁) l₂ :=
-  ⟨fun h => append_right_cancel <| (prefix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
+  ⟨fun h => append_cancel_right <| (prefix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
     fun e => e.symm ▸ take_prefix _ _⟩
 #align list.prefix_iff_eq_take List.prefix_iff_eq_take
 
 theorem suffix_iff_eq_drop : l₁ <:+ l₂ ↔ l₁ = drop (length l₂ - length l₁) l₂ :=
-  ⟨fun h => append_left_cancel <| (suffix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
+  ⟨fun h => append_cancel_left <| (suffix_iff_eq_append.1 h).trans (take_append_drop _ _).symm,
     fun e => e.symm ▸ drop_suffix _ _⟩
 #align list.suffix_iff_eq_drop List.suffix_iff_eq_drop
 
chore: bump Std to match leanprover/std4#448 (#9044)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -469,9 +469,10 @@ theorem insert_nil (a : α) : insert a nil = [a] :=
   rfl
 #align list.insert_nil List.insert_nil
 
-theorem insert.def (a : α) (l : List α) : insert a l = if a ∈ l then l else a :: l :=
+theorem insert_eq_ite (a : α) (l : List α) : insert a l = if a ∈ l then l else a :: l := by
+  simp only [← elem_iff]
   rfl
-#align list.insert.def List.insert.def
+#align list.insert.def List.insert_eq_ite
 
 #align list.insert_of_mem List.insert_of_mem
 #align list.insert_of_not_mem List.insert_of_not_mem
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -259,7 +259,7 @@ theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
       | zero =>
         refine' iff_of_false _ (zero_lt_succ _).not_le
         rw [take_zero, take_nil]
-        simp only [take]
+        simp only [take, not_false_eq_true]
       | succ n =>
         simp only [length] at hm
         have specializedIH := @IH n ls (Nat.lt_of_succ_lt_succ hm)
docs: prevent lists running onto a single line (#8122)
Diff
@@ -22,9 +22,9 @@ All those (except `insert`) are defined in `Mathlib.Data.List.Defs`.
 
 ## Notation
 
-`l₁ <+: l₂`: `l₁` is a prefix of `l₂`.
-`l₁ <:+ l₂`: `l₁` is a suffix of `l₂`.
-`l₁ <:+: l₂`: `l₁` is an infix of `l₂`.
+* `l₁ <+: l₂`: `l₁` is a prefix of `l₂`.
+* `l₁ <:+ l₂`: `l₁` is a suffix of `l₂`.
+* `l₁ <:+: l₂`: `l₁` is an infix of `l₂`.
 -/
 
 open Nat
chore: remove nonterminal simp (#7580)

Removes nonterminal simps on lines looking like simp [...]

Diff
@@ -264,7 +264,8 @@ theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
         simp only [length] at hm
         have specializedIH := @IH n ls (Nat.lt_of_succ_lt_succ hm)
         simp only [le_of_lt (Nat.lt_of_succ_lt_succ hm), min_eq_left] at specializedIH
-        simp [le_of_lt hm, specializedIH, true_and_iff, min_eq_left, eq_self_iff_true, length, take]
+        simp only [take, length, ge_iff_le, le_of_lt hm, min_eq_left, take_cons_succ, cons.injEq,
+          specializedIH, true_and]
         exact ⟨Nat.succ_le_succ, Nat.le_of_succ_le_succ⟩
 #align list.prefix_take_le_iff List.prefix_take_le_iff
 
chore: bump std (#7602)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -44,8 +44,8 @@ section Fix
 #align list.suffix_append List.suffix_append
 #align list.infix_append List.infix_append
 #align list.infix_append' List.infix_append'
-#align list.is_prefix.is_infix List.isPrefix.isInfix
-#align list.is_suffix.is_infix List.isSuffix.isInfix
+#align list.is_prefix.is_infix List.IsPrefix.isInfix
+#align list.is_suffix.is_infix List.IsSuffix.isInfix
 #align list.nil_prefix List.nil_prefix
 #align list.nil_suffix List.nil_suffix
 #align list.nil_infix List.nil_infix
@@ -72,15 +72,15 @@ theorem prefix_concat (a : α) (l) : l <+: concat l a := by simp
 
 #align list.infix_cons List.infix_cons
 #align list.infix_concat List.infix_concat
-#align list.is_prefix.trans List.isPrefix.trans
-#align list.is_suffix.trans List.isSuffix.trans
-#align list.is_infix.trans List.isInfix.trans
-#align list.is_infix.sublist List.isInfix.sublist
-#align list.is_infix.subset List.isInfix.subset
-#align list.is_prefix.sublist List.isPrefix.sublist
-#align list.is_prefix.subset List.isPrefix.subset
-#align list.is_suffix.sublist List.isSuffix.sublist
-#align list.is_suffix.subset List.isSuffix.subset
+#align list.is_prefix.trans List.IsPrefix.trans
+#align list.is_suffix.trans List.IsSuffix.trans
+#align list.is_infix.trans List.IsInfix.trans
+#align list.is_infix.sublist List.IsInfix.sublist
+#align list.is_infix.subset List.IsInfix.subset
+#align list.is_prefix.sublist List.IsPrefix.sublist
+#align list.is_prefix.subset List.IsPrefix.subset
+#align list.is_suffix.sublist List.IsSuffix.sublist
+#align list.is_suffix.subset List.IsSuffix.subset
 #align list.reverse_suffix List.reverse_suffix
 #align list.reverse_prefix List.reverse_prefix
 #align list.reverse_infix List.reverse_infix
@@ -94,9 +94,9 @@ alias ⟨_, isPrefix.reverse⟩ := reverse_suffix
 alias ⟨_, isInfix.reverse⟩ := reverse_infix
 #align list.is_infix.reverse List.isInfix.reverse
 
-#align list.is_infix.length_le List.isInfix.length_le
-#align list.is_prefix.length_le List.isPrefix.length_le
-#align list.is_suffix.length_le List.isSuffix.length_le
+#align list.is_infix.length_le List.IsInfix.length_le
+#align list.is_prefix.length_le List.IsPrefix.length_le
+#align list.is_suffix.length_le List.IsSuffix.length_le
 #align list.infix_nil_iff List.infix_nil
 #align list.prefix_nil_iff List.prefix_nil
 #align list.suffix_nil_iff List.suffix_nil
@@ -228,7 +228,7 @@ instance decidablePrefix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
 -- Alternatively, use mem_tails
 instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+ l₂)
   | [], l₂ => isTrue ⟨l₂, append_nil _⟩
-  | a :: l₁, [] => isFalse <| mt (Sublist.length_le ∘ isSuffix.sublist) (by simp)
+  | a :: l₁, [] => isFalse <| mt (Sublist.length_le ∘ IsSuffix.sublist) (by simp)
   | l₁, b :: l₂ =>
     @decidable_of_decidable_of_iff _ _
       (@instDecidableOr _ _ _ (l₁.decidableSuffix l₂))
@@ -278,16 +278,16 @@ theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ :=
     rwa [prefix_cons_inj]
 #align list.cons_prefix_iff List.cons_prefix_iff
 
-theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f := by
+theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f := by
   induction' l₁ with hd tl hl generalizing l₂
   · simp only [nil_prefix, map_nil]
   · cases' l₂ with hd₂ tl₂
     · simpa only using eq_nil_of_prefix_nil h
     · rw [cons_prefix_iff] at h
       simp only [List.map_cons, h, prefix_cons_inj, hl, map]
-#align list.is_prefix.map List.isPrefix.map
+#align list.is_prefix.map List.IsPrefix.map
 
-theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
+theorem IsPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
     l₁.filterMap f <+: l₂.filterMap f := by
   induction' l₁ with hd₁ tl₁ hl generalizing l₂
   · simp only [nil_prefix, filterMap_nil]
@@ -297,30 +297,30 @@ theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
       rw [← @singleton_append _ hd₁ _, ← @singleton_append _ hd₂ _, filterMap_append,
         filterMap_append, h.left, prefix_append_right_inj]
       exact hl h.right
-#align list.is_prefix.filter_map List.isPrefix.filter_map
+#align list.is_prefix.filter_map List.IsPrefix.filter_map
 
-theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
+theorem IsPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
     l₁.reduceOption <+: l₂.reduceOption :=
   h.filter_map id
-#align list.is_prefix.reduce_option List.isPrefix.reduceOption
+#align list.is_prefix.reduce_option List.IsPrefix.reduceOption
 
-#align list.is_prefix.filter List.isPrefix.filter
-#align list.is_suffix.filter List.isSuffix.filter
-#align list.is_infix.filter List.isInfix.filter
+#align list.is_prefix.filter List.IsPrefix.filter
+#align list.is_suffix.filter List.IsSuffix.filter
+#align list.is_infix.filter List.IsInfix.filter
 
 instance : IsPartialOrder (List α) (· <+: ·) where
   refl := prefix_refl
-  trans _ _ _ := isPrefix.trans
+  trans _ _ _ := IsPrefix.trans
   antisymm _ _ h₁ h₂ := eq_of_prefix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
 instance : IsPartialOrder (List α) (· <:+ ·) where
   refl := suffix_refl
-  trans _ _ _ := isSuffix.trans
+  trans _ _ _ := IsSuffix.trans
   antisymm _ _ h₁ h₂ := eq_of_suffix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
 instance : IsPartialOrder (List α) (· <:+: ·) where
   refl := infix_refl
-  trans _ _ _ := isInfix.trans
+  trans _ _ _ := IsInfix.trans
   antisymm _ _ h₁ h₂ := eq_of_infix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
 end Fix
feat: patch for new alias command (#6172)
Diff
@@ -85,13 +85,13 @@ theorem prefix_concat (a : α) (l) : l <+: concat l a := by simp
 #align list.reverse_prefix List.reverse_prefix
 #align list.reverse_infix List.reverse_infix
 
-alias reverse_prefix ↔ _ isSuffix.reverse
+alias ⟨_, isSuffix.reverse⟩ := reverse_prefix
 #align list.is_suffix.reverse List.isSuffix.reverse
 
-alias reverse_suffix ↔ _ isPrefix.reverse
+alias ⟨_, isPrefix.reverse⟩ := reverse_suffix
 #align list.is_prefix.reverse List.isPrefix.reverse
 
-alias reverse_infix ↔ _ isInfix.reverse
+alias ⟨_, isInfix.reverse⟩ := reverse_infix
 #align list.is_infix.reverse List.isInfix.reverse
 
 #align list.is_infix.length_le List.isInfix.length_le
@@ -101,13 +101,13 @@ alias reverse_infix ↔ _ isInfix.reverse
 #align list.prefix_nil_iff List.prefix_nil
 #align list.suffix_nil_iff List.suffix_nil
 
-alias infix_nil ↔ eq_nil_of_infix_nil _
+alias ⟨eq_nil_of_infix_nil, _⟩ := infix_nil
 #align list.eq_nil_of_infix_nil List.eq_nil_of_infix_nil
 
-alias prefix_nil ↔ eq_nil_of_prefix_nil _
+alias ⟨eq_nil_of_prefix_nil, _⟩ := prefix_nil
 #align list.eq_nil_of_prefix_nil List.eq_nil_of_prefix_nil
 
-alias suffix_nil ↔ eq_nil_of_suffix_nil _
+alias ⟨eq_nil_of_suffix_nil, _⟩ := suffix_nil
 #align list.eq_nil_of_suffix_nil List.eq_nil_of_suffix_nil
 
 #align list.infix_iff_prefix_suffix List.infix_iff_prefix_suffix
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -29,7 +29,7 @@ All those (except `insert`) are defined in `Mathlib.Data.List.Defs`.
 
 open Nat
 
-variable {α β : Type _}
+variable {α β : Type*}
 
 namespace List
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2017 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.list.infix
-! leanprover-community/mathlib commit 26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.List.Basic
 
+#align_import data.list.infix from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
+
 /-!
 # Prefixes, suffixes, infixes
 
chore: fix many typos (#4983)

These are all doc fixes

Diff
@@ -11,12 +11,12 @@ Authors: Mario Carneiro
 import Mathlib.Data.List.Basic
 
 /-!
-# Prefixes, subfixes, infixes
+# Prefixes, suffixes, infixes
 
 This file proves properties about
-* `List.prefix`: `l₁` is a prefix of `l₂` if `l₂` starts with `l₁`.
-* `List.subfix`: `l₁` is a subfix of `l₂` if `l₂` ends with `l₁`.
-* `List.infix`: `l₁` is an infix of `l₂` if `l₁` is a prefix of some subfix of `l₂`.
+* `List.isPrefix`: `l₁` is a prefix of `l₂` if `l₂` starts with `l₁`.
+* `List.isSuffix`: `l₁` is a suffix of `l₂` if `l₂` ends with `l₁`.
+* `List.isInfix`: `l₁` is an infix of `l₂` if `l₁` is a prefix of some suffix of `l₂`.
 * `List.inits`: The list of prefixes of a list.
 * `List.tails`: The list of prefixes of a list.
 * `insert` on lists
@@ -26,7 +26,7 @@ All those (except `insert`) are defined in `Mathlib.Data.List.Defs`.
 ## Notation
 
 `l₁ <+: l₂`: `l₁` is a prefix of `l₂`.
-`l₁ <:+ l₂`: `l₁` is a subfix of `l₂`.
+`l₁ <:+ l₂`: `l₁` is a suffix of `l₂`.
 `l₁ <:+: l₂`: `l₁` is an infix of `l₂`.
 -/
 
chore: update std 05-22 (#4248)

The main breaking change is that tac <;> [t1, t2] is now written tac <;> [t1; t2], to avoid clashing with tactics like cases and use that take comma-separated lists.

Diff
@@ -160,11 +160,11 @@ lemma mem_of_mem_dropSlice {n m : ℕ} {l : List α} {a : α} (h : a ∈ l.dropS
 #align list.mem_of_mem_slice List.mem_of_mem_dropSlice
 
 theorem takeWhile_prefix (p : α → Bool) : l.takeWhile p <+: l :=
-  ⟨l.dropWhile p, takeWhile_append_drop p l⟩
+  ⟨l.dropWhile p, takeWhile_append_dropWhile p l⟩
 #align list.take_while_prefix List.takeWhile_prefix
 
 theorem dropWhile_suffix (p : α → Bool) : l.dropWhile p <:+ l :=
-  ⟨l.takeWhile p, takeWhile_append_drop p l⟩
+  ⟨l.takeWhile p, takeWhile_append_dropWhile p l⟩
 #align list.drop_while_suffix List.dropWhile_suffix
 
 theorem dropLast_prefix : ∀ l : List α, l.dropLast <+: l
chore: bump dependencies (#4012)

This just bumps the Std dependency, to get access to Mario's new "Try this:" implementation.

Co-authored-by: Bulhwi Cha <chabulhwi@semmalgil.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -43,56 +43,17 @@ variable {l l₁ l₂ l₃ : List α} {a b : α} {m n : ℕ}
 
 section Fix
 
-@[simp]
-theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂ :=
-  ⟨l₂, rfl⟩
 #align list.prefix_append List.prefix_append
-
-@[simp]
-theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂ :=
-  ⟨l₁, rfl⟩
 #align list.suffix_append List.suffix_append
-
-theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃ :=
-  ⟨l₁, l₃, rfl⟩
 #align list.infix_append List.infix_append
-
-@[simp]
-theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃) := by
-  rw [← List.append_assoc]; apply infix_append
 #align list.infix_append' List.infix_append'
-
-theorem isPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨[], t, h⟩
 #align list.is_prefix.is_infix List.isPrefix.isInfix
-
-theorem isSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨t, [], by rw [h, append_nil]⟩
 #align list.is_suffix.is_infix List.isSuffix.isInfix
-
-theorem nil_prefix (l : List α) : [] <+: l :=
-  ⟨l, rfl⟩
 #align list.nil_prefix List.nil_prefix
-
-theorem nil_suffix (l : List α) : [] <:+ l :=
-  ⟨l, append_nil _⟩
 #align list.nil_suffix List.nil_suffix
-
-theorem nil_infix (l : List α) : [] <:+: l :=
-  (nil_prefix _).isInfix
 #align list.nil_infix List.nil_infix
-
-@[refl]
-theorem prefix_refl (l : List α) : l <+: l :=
-  ⟨[], append_nil _⟩
 #align list.prefix_refl List.prefix_refl
-
-@[refl]
-theorem suffix_refl (l : List α) : l <:+ l :=
-  ⟨[], rfl⟩
 #align list.suffix_refl List.suffix_refl
-
-@[refl]
-theorem infix_refl (l : List α) : l <:+: l :=
-  (prefix_refl l).isInfix
 #align list.infix_refl List.infix_refl
 
 theorem prefix_rfl : l <+: l :=
@@ -107,80 +68,24 @@ theorem infix_rfl : l <:+: l :=
   infix_refl _
 #align list.infix_rfl List.infix_rfl
 
-@[simp]
-theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l :=
-  suffix_append [a]
 #align list.suffix_cons List.suffix_cons
 
 theorem prefix_concat (a : α) (l) : l <+: concat l a := by simp
 #align list.prefix_concat List.prefix_concat
 
-theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂ := fun ⟨L₁, L₂, h⟩ => ⟨a :: L₁, L₂, h ▸ rfl⟩
 #align list.infix_cons List.infix_cons
-
-theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a := fun ⟨L₁, L₂, h⟩ =>
-  ⟨L₁, concat L₂ a, by simp_rw [← h, concat_eq_append, append_assoc]⟩
 #align list.infix_concat List.infix_concat
-
-@[trans]
-theorem isPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃
-  | _, _, _, ⟨r₁, rfl⟩, ⟨r₂, rfl⟩ => ⟨r₁ ++ r₂, (append_assoc _ _ _).symm⟩
 #align list.is_prefix.trans List.isPrefix.trans
-
-@[trans]
-theorem isSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃
-  | _, _, _, ⟨l₁, rfl⟩, ⟨l₂, rfl⟩ => ⟨l₂ ++ l₁, append_assoc _ _ _⟩
 #align list.is_suffix.trans List.isSuffix.trans
-
-@[trans]
-theorem isInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃
-  | l, _, _, ⟨l₁, r₁, rfl⟩, ⟨l₂, r₂, rfl⟩ => ⟨l₂ ++ l₁, r₁ ++ r₂, by simp only [append_assoc]⟩
 #align list.is_infix.trans List.isInfix.trans
-
-protected theorem isInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ => by
-  rw [← h]
-  exact (sublist_append_right _ _).trans (sublist_append_left _ _)
 #align list.is_infix.sublist List.isInfix.sublist
-
-protected theorem isInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂ :=
-  hl.sublist.subset
 #align list.is_infix.subset List.isInfix.subset
-
-protected theorem isPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂ :=
-  h.isInfix.sublist
 #align list.is_prefix.sublist List.isPrefix.sublist
-
-protected theorem isPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂ :=
-  hl.sublist.subset
 #align list.is_prefix.subset List.isPrefix.subset
-
-protected theorem isSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂ :=
-  h.isInfix.sublist
 #align list.is_suffix.sublist List.isSuffix.sublist
-
-protected theorem isSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂ :=
-  hl.sublist.subset
 #align list.is_suffix.subset List.isSuffix.subset
-
-@[simp]
-theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂ :=
-  ⟨fun ⟨r, e⟩ => ⟨reverse r, by rw [← reverse_reverse l₁, ← reverse_append, e, reverse_reverse]⟩,
-    fun ⟨r, e⟩ => ⟨reverse r, by rw [← reverse_append, e]⟩⟩
 #align list.reverse_suffix List.reverse_suffix
-
-@[simp]
-theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂ := by
-  rw [← reverse_suffix]; simp only [reverse_reverse]
 #align list.reverse_prefix List.reverse_prefix
-
-@[simp]
-theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂ :=
-  ⟨fun ⟨s, t, e⟩ =>
-    ⟨reverse t, reverse s, by
-      rw [← reverse_reverse l₁, append_assoc, ← reverse_append, ← reverse_append, e,
-        reverse_reverse]⟩,
-    fun ⟨s, t, e⟩ =>
-    ⟨reverse t, reverse s, by rw [append_assoc, ← reverse_append, ← reverse_append, e]⟩⟩
 #align list.reverse_infix List.reverse_infix
 
 alias reverse_prefix ↔ _ isSuffix.reverse
@@ -192,46 +97,22 @@ alias reverse_suffix ↔ _ isPrefix.reverse
 alias reverse_infix ↔ _ isInfix.reverse
 #align list.is_infix.reverse List.isInfix.reverse
 
-theorem isInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length :=
-  h.sublist.length_le
 #align list.is_infix.length_le List.isInfix.length_le
-
-theorem isPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length :=
-  h.sublist.length_le
 #align list.is_prefix.length_le List.isPrefix.length_le
-
-theorem isSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length :=
-  h.sublist.length_le
 #align list.is_suffix.length_le List.isSuffix.length_le
+#align list.infix_nil_iff List.infix_nil
+#align list.prefix_nil_iff List.prefix_nil
+#align list.suffix_nil_iff List.suffix_nil
 
-theorem eq_nil_of_infix_nil (h : l <:+: []) : l = [] :=
-  eq_nil_of_sublist_nil h.sublist
+alias infix_nil ↔ eq_nil_of_infix_nil _
 #align list.eq_nil_of_infix_nil List.eq_nil_of_infix_nil
 
-@[simp]
-theorem infix_nil_iff : l <:+: [] ↔ l = [] :=
-  ⟨fun h => eq_nil_of_sublist_nil h.sublist, fun h => h ▸ infix_rfl⟩
-#align list.infix_nil_iff List.infix_nil_iff
-
-@[simp]
-theorem prefix_nil_iff : l <+: [] ↔ l = [] :=
-  ⟨fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ prefix_rfl⟩
-#align list.prefix_nil_iff List.prefix_nil_iff
-
-@[simp]
-theorem suffix_nil_iff : l <:+ [] ↔ l = [] :=
-  ⟨fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ suffix_rfl⟩
-#align list.suffix_nil_iff List.suffix_nil_iff
-
-alias prefix_nil_iff ↔ eq_nil_of_prefix_nil _
+alias prefix_nil ↔ eq_nil_of_prefix_nil _
 #align list.eq_nil_of_prefix_nil List.eq_nil_of_prefix_nil
 
-alias suffix_nil_iff ↔ eq_nil_of_suffix_nil _
+alias suffix_nil ↔ eq_nil_of_suffix_nil _
 #align list.eq_nil_of_suffix_nil List.eq_nil_of_suffix_nil
 
-theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂ :=
-  ⟨fun ⟨s, t, e⟩ => ⟨l₁ ++ t, ⟨_, rfl⟩, by rw [← e, append_assoc]; exact ⟨_, rfl⟩⟩,
-    fun ⟨_, ⟨t, rfl⟩, s, e⟩ => ⟨s, t, by rw [append_assoc]; exact e⟩⟩
 #align list.infix_iff_prefix_suffix List.infix_iff_prefix_suffix
 
 theorem eq_of_infix_of_length_eq (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂ :=
@@ -246,101 +127,22 @@ theorem eq_of_suffix_of_length_eq (h : l₁ <:+ l₂) : l₁.length = l₂.lengt
   h.sublist.eq_of_length
 #align list.eq_of_suffix_of_length_eq List.eq_of_suffix_of_length_eq
 
-theorem prefix_of_prefix_length_le : ∀ { l₁ l₂ l₃ : List α } ,
-  l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂
-| [] , l₂ , _, _, _, _ => nil_prefix _
-| a :: l₁ , b :: l₂ , _ , ⟨ r₁ , rfl ⟩ , ⟨ r₂ , e ⟩ , ll => by
-  injection e with _ e'
-  subst b
-  rcases prefix_of_prefix_length_le ⟨ _ , rfl ⟩ ⟨ _ , e' ⟩
-    (le_of_succ_le_succ ll) with ⟨ r₃ , rfl ⟩
-  exact ⟨ r₃ , rfl ⟩
 #align list.prefix_of_prefix_length_le List.prefix_of_prefix_length_le
-
-theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁ :=
-  (le_total (length l₁) (length l₂)).imp (prefix_of_prefix_length_le h₁ h₂)
-    (prefix_of_prefix_length_le h₂ h₁)
 #align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefix
-
-theorem suffix_of_suffix_length_le (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) :
-    l₁ <:+ l₂ :=
-  reverse_prefix.1 <|
-    prefix_of_prefix_length_le (reverse_prefix.2 h₁) (reverse_prefix.2 h₂) (by simp [ll])
 #align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_le
-
-theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁ :=
-  (prefix_or_prefix_of_prefix (reverse_prefix.2 h₁) (reverse_prefix.2 h₂)).imp reverse_prefix.1
-    reverse_prefix.1
 #align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffix
-
-theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂ := by
-  constructor
-  · rintro ⟨⟨hd, tl⟩, hl₃⟩
-    · exact Or.inl hl₃
-    · simp only [cons_append] at hl₃
-      injection hl₃ with _ hl₄
-      exact Or.inr ⟨_, hl₄⟩
-  · rintro (rfl | hl₁)
-    · exact (a :: l₂).suffix_refl
-    · exact hl₁.trans (l₂.suffix_cons _)
 #align list.suffix_cons_iff List.suffix_cons_iff
-
-theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂ := by
-  constructor
-  · rintro ⟨⟨hd, tl⟩, t, hl₃⟩
-    · exact Or.inl ⟨t, hl₃⟩
-    · simp only [cons_append] at hl₃
-      injection hl₃ with _ hl₄
-      exact Or.inr ⟨_, t, hl₄⟩
-  · rintro (h | hl₁)
-    · exact h.isInfix
-    · exact infix_cons hl₁
 #align list.infix_cons_iff List.infix_cons_iff
-
-theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L
-  | l' :: _, h =>
-    match h with
-    | List.Mem.head .. => infix_append [] _ _
-    | List.Mem.tail _ hlMemL =>
-      isInfix.trans (infix_of_mem_join hlMemL) <| (suffix_append _ _).isInfix
 #align list.infix_of_mem_join List.infix_of_mem_join
-
-theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂ :=
-  exists_congr fun r => by rw [append_assoc, append_right_inj]
 #align list.prefix_append_right_inj List.prefix_append_right_inj
-
-theorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂ :=
-  prefix_append_right_inj [a]
 #align list.prefix_cons_inj List.prefix_cons_inj
-
-theorem take_prefix (n) (l : List α) : take n l <+: l :=
-  ⟨_, take_append_drop _ _⟩
 #align list.take_prefix List.take_prefix
-
-theorem drop_suffix (n) (l : List α) : drop n l <:+ l :=
-  ⟨_, take_append_drop _ _⟩
 #align list.drop_suffix List.drop_suffix
-
-theorem take_sublist (n) (l : List α) : take n l <+ l :=
-  (take_prefix n l).sublist
 #align list.take_sublist List.take_sublist
-
-theorem drop_sublist (n) (l : List α) : drop n l <+ l :=
-  (drop_suffix n l).sublist
 #align list.drop_sublist List.drop_sublist
-
-theorem take_subset (n) (l : List α) : take n l ⊆ l :=
-  (take_sublist n l).subset
 #align list.take_subset List.take_subset
-
-theorem drop_subset (n) (l : List α) : drop n l ⊆ l :=
-  (drop_sublist n l).subset
 #align list.drop_subset List.drop_subset
-
-theorem mem_of_mem_take (h : a ∈ l.take n) : a ∈ l :=
-  take_subset n l h
 #align list.mem_of_mem_take List.mem_of_mem_take
-
 #align list.mem_of_mem_drop List.mem_of_mem_drop
 
 lemma dropSlice_sublist (n m : ℕ) (l : List α) : l.dropSlice n m <+ l :=
@@ -505,25 +307,8 @@ theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂)
   h.filter_map id
 #align list.is_prefix.reduce_option List.isPrefix.reduceOption
 
-theorem isPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
-    l₁.filter p <+: l₂.filter p := by
-  obtain ⟨xs, rfl⟩ := h
-  rw [filter_append]
-  exact prefix_append _ _
 #align list.is_prefix.filter List.isPrefix.filter
-
-theorem isSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
-    l₁.filter p <:+ l₂.filter p := by
-  obtain ⟨xs, rfl⟩ := h
-  rw [filter_append]
-  exact suffix_append _ _
 #align list.is_suffix.filter List.isSuffix.filter
-
-theorem isInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
-    l₁.filter p <:+: l₂.filter p := by
-  obtain ⟨xs, ys, rfl⟩ := h
-  rw [filter_append, filter_append]
-  exact infix_append _ _ _
 #align list.is_infix.filter List.isInfix.filter
 
 instance : IsPartialOrder (List α) (· <+: ·) where
@@ -569,8 +354,7 @@ theorem mem_inits : ∀ s t : List α, s ∈ inits t ↔ s <+: t
 @[simp]
 theorem mem_tails : ∀ s t : List α, s ∈ tails t ↔ s <:+ t
   | s, [] => by
-    simp only [tails, mem_singleton]
-    exact ⟨fun h => by rw [h], eq_nil_of_suffix_nil⟩
+    simp only [tails, mem_singleton, suffix_nil]
   | s, a :: t => by
     simp only [tails, mem_cons, mem_tails s t];
     exact
chore: fix #align lines (#3640)

This PR fixes two things:

  • Most align statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align). This is often seen in the mathport output after ending calc blocks.
  • All remaining more-than-one-line #align statements. (This was needed for a script I wrote for #3630.)
Diff
@@ -435,7 +435,6 @@ instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
       (@instDecidableOr _ _ _ (l₁.decidableSuffix l₂))
       suffix_cons_iff.symm
 termination_by decidableSuffix l₁ l₂ => (l₁, l₂)
-
 #align list.decidable_suffix List.decidableSuffix
 
 instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+: l₂)
@@ -701,7 +700,6 @@ theorem suffix_insert (a : α) (l : List α) : l <:+ l.insert a := by
   by_cases h : a ∈ l
   · simp only [insert_of_mem h, insert, suffix_refl]
   · simp only [insert_of_not_mem h, suffix_cons, insert]
-
 #align list.suffix_insert List.suffix_insert
 
 theorem infix_insert (a : α) (l : List α) : l <:+: l.insert a :=
chore: add missing hypothesis names to by_cases (#2679)
Diff
@@ -698,7 +698,7 @@ theorem insert.def (a : α) (l : List α) : insert a l = if a ∈ l then l else
 
 @[simp]
 theorem suffix_insert (a : α) (l : List α) : l <:+ l.insert a := by
-  by_cases a ∈ l
+  by_cases h : a ∈ l
   · simp only [insert_of_mem h, insert, suffix_refl]
   · simp only [insert_of_not_mem h, suffix_cons, insert]
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module data.list.infix
-! leanprover-community/mathlib commit 6d0adfa76594f304b4650d098273d4366edeb61b
+! leanprover-community/mathlib commit 26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -343,6 +343,20 @@ theorem mem_of_mem_take (h : a ∈ l.take n) : a ∈ l :=
 
 #align list.mem_of_mem_drop List.mem_of_mem_drop
 
+lemma dropSlice_sublist (n m : ℕ) (l : List α) : l.dropSlice n m <+ l :=
+  calc l.dropSlice n m = take n l ++ drop m (drop n l) := by rw [dropSlice_eq, drop_drop, add_comm]
+  _ <+ take n l ++ drop n l := (Sublist.refl _).append (drop_sublist _ _)
+  _ = _ := take_append_drop _ _
+#align list.slice_sublist List.dropSlice_sublist
+
+lemma dropSlice_subset (n m : ℕ) (l : List α) : l.dropSlice n m ⊆ l :=
+  (dropSlice_sublist n m l).subset
+#align list.slice_subset List.dropSlice_subset
+
+lemma mem_of_mem_dropSlice {n m : ℕ} {l : List α} {a : α} (h : a ∈ l.dropSlice n m) : a ∈ l :=
+  dropSlice_subset n m l h
+#align list.mem_of_mem_slice List.mem_of_mem_dropSlice
+
 theorem takeWhile_prefix (p : α → Bool) : l.takeWhile p <+: l :=
   ⟨l.dropWhile p, takeWhile_append_drop p l⟩
 #align list.take_while_prefix List.takeWhile_prefix
chore: add missing #align statements (#1902)

This PR is the result of a slight variant on the following "algorithm"

  • take all mathlib 3 names, remove _ and make all uppercase letters into lowercase
  • take all mathlib 4 names, remove _ and make all uppercase letters into lowercase
  • look for matches, and create pairs (original_lean3_name, OriginalLean4Name)
  • for pairs that do not have an align statement:
    • use Lean 4 to lookup the file + position of the Lean 4 name
    • add an #align statement just before the next empty line
  • manually fix some tiny mistakes (e.g., empty lines in proofs might cause the #align statement to have been inserted too early)
Diff
@@ -184,10 +184,13 @@ theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂ :=
 #align list.reverse_infix List.reverse_infix
 
 alias reverse_prefix ↔ _ isSuffix.reverse
+#align list.is_suffix.reverse List.isSuffix.reverse
 
 alias reverse_suffix ↔ _ isPrefix.reverse
+#align list.is_prefix.reverse List.isPrefix.reverse
 
 alias reverse_infix ↔ _ isInfix.reverse
+#align list.is_infix.reverse List.isInfix.reverse
 
 theorem isInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length :=
   h.sublist.length_le
@@ -221,8 +224,10 @@ theorem suffix_nil_iff : l <:+ [] ↔ l = [] :=
 #align list.suffix_nil_iff List.suffix_nil_iff
 
 alias prefix_nil_iff ↔ eq_nil_of_prefix_nil _
+#align list.eq_nil_of_prefix_nil List.eq_nil_of_prefix_nil
 
 alias suffix_nil_iff ↔ eq_nil_of_suffix_nil _
+#align list.eq_nil_of_suffix_nil List.eq_nil_of_suffix_nil
 
 theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂ :=
   ⟨fun ⟨s, t, e⟩ => ⟨l₁ ++ t, ⟨_, rfl⟩, by rw [← e, append_assoc]; exact ⟨_, rfl⟩⟩,
chore: format by line breaks (#1523)

During porting, I usually fix the desired format we seem to want for the line breaks around by with

awk '{do {{if (match($0, "^  by$") && length(p) < 98) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}' Mathlib/File/Im/Working/On.lean

I noticed there are some more files that slipped through.

This pull request is the result of running this command:

grep -lr "^  by\$" Mathlib | xargs -n 1 awk -i inplace '{do {{if (match($0, "^  by$") && length(p) < 98 && not (match(p, "^[ \t]*--"))) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}'

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -137,8 +137,7 @@ theorem isInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂
   | l, _, _, ⟨l₁, r₁, rfl⟩, ⟨l₂, r₂, rfl⟩ => ⟨l₂ ++ l₁, r₁ ++ r₂, by simp only [append_assoc]⟩
 #align list.is_infix.trans List.isInfix.trans
 
-protected theorem isInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ =>
-  by
+protected theorem isInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ => by
   rw [← h]
   exact (sublist_append_right _ _).trans (sublist_append_left _ _)
 #align list.is_infix.sublist List.isInfix.sublist
@@ -472,8 +471,7 @@ theorem isPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.m
 #align list.is_prefix.map List.isPrefix.map
 
 theorem isPrefix.filter_map (h : l₁ <+: l₂) (f : α → Option β) :
-    l₁.filterMap f <+: l₂.filterMap f :=
-  by
+    l₁.filterMap f <+: l₂.filterMap f := by
   induction' l₁ with hd₁ tl₁ hl generalizing l₂
   · simp only [nil_prefix, filterMap_nil]
   · cases' l₂ with hd₂ tl₂
feat: port Mathlib.Data.List.Perm (#1478)

Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: ChrisHughes24 <chrishughes24@gmail.com>

Diff
@@ -680,14 +680,14 @@ theorem insert.def (a : α) (l : List α) : insert a l = if a ∈ l then l else
 #align list.mem_insert_iff List.mem_insert_iff
 
 @[simp]
-theorem suffix_insert (a : α) (l : List α) : l <:+ insert a l := by
+theorem suffix_insert (a : α) (l : List α) : l <:+ l.insert a := by
   by_cases a ∈ l
   · simp only [insert_of_mem h, insert, suffix_refl]
   · simp only [insert_of_not_mem h, suffix_cons, insert]
 
 #align list.suffix_insert List.suffix_insert
 
-theorem infix_insert (a : α) (l : List α) : l <:+: insert a l :=
+theorem infix_insert (a : α) (l : List α) : l <:+: l.insert a :=
   (suffix_insert a l).isInfix
 #align list.infix_insert List.infix_insert
 
feat: port Data.List.Rdrop (#1382)

Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: qawbecrdtey <40463813+qawbecrdtey@users.noreply.github.com> Co-authored-by: Lukas Miaskiwskyi <lukas.mias@gmail.com>

Diff
@@ -339,11 +339,11 @@ theorem mem_of_mem_take (h : a ∈ l.take n) : a ∈ l :=
 
 #align list.mem_of_mem_drop List.mem_of_mem_drop
 
-theorem takeWhile_prefix (p : α → Prop) [DecidablePred p] : l.takeWhile p <+: l :=
+theorem takeWhile_prefix (p : α → Bool) : l.takeWhile p <+: l :=
   ⟨l.dropWhile p, takeWhile_append_drop p l⟩
 #align list.take_while_prefix List.takeWhile_prefix
 
-theorem dropWhile_suffix (p : α → Prop) [DecidablePred p] : l.dropWhile p <:+ l :=
+theorem dropWhile_suffix (p : α → Bool) : l.dropWhile p <:+ l :=
   ⟨l.takeWhile p, takeWhile_append_drop p l⟩
 #align list.drop_while_suffix List.dropWhile_suffix
 
@@ -489,21 +489,21 @@ theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂)
   h.filter_map id
 #align list.is_prefix.reduce_option List.isPrefix.reduceOption
 
-theorem isPrefix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
+theorem isPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
     l₁.filter p <+: l₂.filter p := by
   obtain ⟨xs, rfl⟩ := h
   rw [filter_append]
   exact prefix_append _ _
 #align list.is_prefix.filter List.isPrefix.filter
 
-theorem isSuffix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
+theorem isSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
     l₁.filter p <:+ l₂.filter p := by
   obtain ⟨xs, rfl⟩ := h
   rw [filter_append]
   exact suffix_append _ _
 #align list.is_suffix.filter List.isSuffix.filter
 
-theorem isInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
+theorem isInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
     l₁.filter p <:+: l₂.filter p := by
   obtain ⟨xs, ys, rfl⟩ := h
   rw [filter_append, filter_append]
chore: tidy various files (#1412)
Diff
@@ -21,7 +21,7 @@ This file proves properties about
 * `List.tails`: The list of prefixes of a list.
 * `insert` on lists
 
-All those (except `insert`) are defined in `Mathlib>Data.List.Defs`.
+All those (except `insert`) are defined in `Mathlib.Data.List.Defs`.
 
 ## Notation
 
@@ -418,9 +418,6 @@ instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
       suffix_cons_iff.symm
 termination_by decidableSuffix l₁ l₂ => (l₁, l₂)
 
-instance foo {a b : Prop }[Decidable a] [Decidable b] : Decidable (a ∨ b) :=
-  instDecidableOr
-
 #align list.decidable_suffix List.decidableSuffix
 
 instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+: l₂)
@@ -513,20 +510,17 @@ theorem isInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List 
   exact infix_append _ _ _
 #align list.is_infix.filter List.isInfix.filter
 
-instance : IsPartialOrder (List α) (· <+: ·)
-    where
+instance : IsPartialOrder (List α) (· <+: ·) where
   refl := prefix_refl
   trans _ _ _ := isPrefix.trans
   antisymm _ _ h₁ h₂ := eq_of_prefix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
-instance : IsPartialOrder (List α) (· <:+ ·)
-    where
+instance : IsPartialOrder (List α) (· <:+ ·) where
   refl := suffix_refl
   trans _ _ _ := isSuffix.trans
   antisymm _ _ h₁ h₂ := eq_of_suffix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
 
-instance : IsPartialOrder (List α) (· <:+: ·)
-    where
+instance : IsPartialOrder (List α) (· <:+: ·) where
   refl := infix_refl
   trans _ _ _ := isInfix.trans
   antisymm _ _ h₁ h₂ := eq_of_infix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
chore: bump to nightly-2023-01-06 (#1397)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -600,7 +600,7 @@ theorem tails_append :
 -- the lemma names `inits_eq_tails` and `tails_eq_inits` are like `sublists_eq_sublists'`
 theorem inits_eq_tails : ∀ l : List α, l.inits = (reverse <| map reverse <| tails <| reverse l)
   | [] => by simp
-  | a :: l => by simp [inits_eq_tails l, map_eq_map_iff]
+  | a :: l => by simp [inits_eq_tails l, map_eq_map_iff, reverse_map]
 #align list.inits_eq_tails List.inits_eq_tails
 
 theorem tails_eq_inits : ∀ l : List α, l.tails = (reverse <| map reverse <| inits <| reverse l)
@@ -608,33 +608,28 @@ theorem tails_eq_inits : ∀ l : List α, l.tails = (reverse <| map reverse <| i
   | a :: l => by simp [tails_eq_inits l, append_left_inj]
 #align list.tails_eq_inits List.tails_eq_inits
 
-theorem inits_reverse (l : List α) : inits (reverse l) = reverse (map reverse l.tails) :=
-  by
+theorem inits_reverse (l : List α) : inits (reverse l) = reverse (map reverse l.tails) := by
   rw [tails_eq_inits l]
-  simp [reverse_involutive.comp_self]
+  simp [reverse_involutive.comp_self, reverse_map]
 #align list.inits_reverse List.inits_reverse
 
-theorem tails_reverse (l : List α) : tails (reverse l) = reverse (map reverse l.inits) :=
-  by
+theorem tails_reverse (l : List α) : tails (reverse l) = reverse (map reverse l.inits) := by
   rw [inits_eq_tails l]
-  simp [reverse_involutive.comp_self]
+  simp [reverse_involutive.comp_self, reverse_map]
 #align list.tails_reverse List.tails_reverse
 
-theorem map_reverse_inits (l : List α) : map reverse l.inits = (reverse <| tails <| reverse l) :=
-  by
+theorem map_reverse_inits (l : List α) : map reverse l.inits = (reverse <| tails <| reverse l) := by
   rw [inits_eq_tails l]
-  simp [reverse_involutive.comp_self]
+  simp [reverse_involutive.comp_self, reverse_map]
 #align list.map_reverse_inits List.map_reverse_inits
 
-theorem map_reverse_tails (l : List α) : map reverse l.tails = (reverse <| inits <| reverse l) :=
-  by
+theorem map_reverse_tails (l : List α) : map reverse l.tails = (reverse <| inits <| reverse l) := by
   rw [tails_eq_inits l]
-  simp [reverse_involutive.comp_self]
+  simp [reverse_involutive.comp_self, reverse_map]
 #align list.map_reverse_tails List.map_reverse_tails
 
 @[simp]
-theorem length_tails (l : List α) : length (tails l) = length l + 1 :=
-  by
+theorem length_tails (l : List α) : length (tails l) = length l + 1 := by
   induction' l with x l IH
   · simp
   · simpa using IH
@@ -649,8 +644,7 @@ set_option linter.deprecated false -- TODO(Henrik): make replacements for theore
 
 @[simp]
 theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
-    nthLe (tails l) n hn = l.drop n :=
-  by
+    nthLe (tails l) n hn = l.drop n := by
   induction' l with x l IH generalizing n
   · simp
   · cases n
@@ -660,8 +654,7 @@ theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
 
 @[simp]
 theorem nth_le_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
-    nthLe (inits l) n hn = l.take n :=
-  by
+    nthLe (inits l) n hn = l.take n := by
   induction' l with x l IH generalizing n
   · simp
   · cases n
feat: port Data.List.Infix (#1350)

Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Dependencies 1 + 72

73 files ported (98.6%)
37547 lines ported (99.8%)
Show graph

The unported dependencies are