data.list.indexesMathlib.Data.List.Indexes

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2020 Jannis Limperg. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jannis Limperg
 -/
-import Mathbin.Data.List.OfFn
-import Mathbin.Data.List.Range
+import Data.List.OfFn
+import Data.List.Range
 
 #align_import data.list.indexes from "leanprover-community/mathlib"@"34ee86e6a59d911a8e4f89b68793ee7577ae79c7"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2020 Jannis Limperg. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jannis Limperg
-
-! This file was ported from Lean 3 source module data.list.indexes
-! leanprover-community/mathlib commit 34ee86e6a59d911a8e4f89b68793ee7577ae79c7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.List.OfFn
 import Mathbin.Data.List.Range
 
+#align_import data.list.indexes from "leanprover-community/mathlib"@"34ee86e6a59d911a8e4f89b68793ee7577ae79c7"
+
 /-!
 # Lemmas about list.*_with_index functions.
 
Diff
@@ -32,10 +32,12 @@ variable {α : Type u} {β : Type v}
 
 section MapWithIndex
 
+#print List.mapIdx_nil /-
 @[simp]
 theorem mapIdx_nil {α β} (f : ℕ → α → β) : mapIdx f [] = [] :=
   rfl
 #align list.map_with_index_nil List.mapIdx_nil
+-/
 
 theorem mapWithIndexCore_eq (l : List α) (f : ℕ → α → β) (n : ℕ) :
     l.mapWithIndexCore f n = l.mapIdx fun i a => f (i + n) a :=
@@ -57,13 +59,16 @@ theorem mapIdx_eq_enum_map (l : List α) (f : ℕ → α → β) :
 #align list.map_with_index_eq_enum_map List.mapIdx_eq_enum_map
 -/
 
+#print List.mapIdx_cons /-
 @[simp]
 theorem mapIdx_cons {α β} (l : List α) (f : ℕ → α → β) (a : α) :
     mapIdx f (a :: l) = f 0 a :: mapIdx (fun i => f (i + 1)) l := by
   simp [map_with_index_eq_enum_map, enum_eq_zip_range, map_uncurry_zip_eq_zip_with,
     range_succ_eq_map, zip_with_map_left]
 #align list.map_with_index_cons List.mapIdx_cons
+-/
 
+#print List.mapIdx_append /-
 theorem mapIdx_append {α} (K L : List α) (f : ℕ → α → β) :
     (K ++ L).mapIdx f = K.mapIdx f ++ L.mapIdx fun i a => f (i + K.length) a :=
   by
@@ -71,7 +76,9 @@ theorem mapIdx_append {α} (K L : List α) (f : ℕ → α → β) :
   · simp
   · simp [IH fun i => f (i + 1), add_assoc]
 #align list.map_with_index_append List.mapIdx_append
+-/
 
+#print List.length_mapIdx /-
 @[simp]
 theorem length_mapIdx {α β} (l : List α) (f : ℕ → α → β) : (l.mapIdx f).length = l.length :=
   by
@@ -79,14 +86,18 @@ theorem length_mapIdx {α β} (l : List α) (f : ℕ → α → β) : (l.mapIdx
   · simp
   · simp [IH]
 #align list.length_map_with_index List.length_mapIdx
+-/
 
+#print List.nthLe_mapIdx /-
 @[simp]
 theorem nthLe_mapIdx {α β} (l : List α) (f : ℕ → α → β) (i : ℕ) (h : i < l.length)
     (h' : i < (l.mapIdx f).length := h.trans_le (l.length_mapIdx f).ge) :
     (l.mapIdx f).nthLe i h' = f i (l.nthLe i h) := by
   simp [map_with_index_eq_enum_map, enum_eq_zip_range]
 #align list.nth_le_map_with_index List.nthLe_mapIdx
+-/
 
+#print List.mapIdx_eq_ofFn /-
 theorem mapIdx_eq_ofFn {α β} (l : List α) (f : ℕ → α → β) :
     l.mapIdx f = ofFn fun i : Fin l.length => f (i : ℕ) (l.nthLe i i.is_lt) :=
   by
@@ -94,6 +105,7 @@ theorem mapIdx_eq_ofFn {α β} (l : List α) (f : ℕ → α → β) :
   · simp
   · simpa [IH]
 #align list.map_with_index_eq_of_fn List.mapIdx_eq_ofFn
+-/
 
 end MapWithIndex
 
@@ -117,11 +129,13 @@ theorem foldrIdx_eq_foldrIdxSpec (f : ℕ → α → β → β) (start b as) :
   · simp only [foldr_with_index_aux, foldr_with_index_aux_spec_cons, *]
 #align list.foldr_with_index_aux_eq_foldr_with_index_aux_spec List.foldrIdx_eq_foldrIdxSpecₓ
 
+#print List.foldrIdx_eq_foldr_enum /-
 theorem foldrIdx_eq_foldr_enum (f : ℕ → α → β → β) (b : β) (as : List α) :
     foldrIdx f b as = foldr (uncurry f) b (enum as) := by
   simp only [foldr_with_index, foldr_with_index_aux_spec,
     foldr_with_index_aux_eq_foldr_with_index_aux_spec, enum]
 #align list.foldr_with_index_eq_foldr_enum List.foldrIdx_eq_foldr_enum
+-/
 
 end FoldrWithIndex
 
@@ -160,11 +174,13 @@ theorem foldlIdx_eq_foldlIdxSpec (f : ℕ → α → β → α) (start a bs) :
   · simp [foldl_with_index_aux, foldl_with_index_aux_spec_cons, *]
 #align list.foldl_with_index_aux_eq_foldl_with_index_aux_spec List.foldlIdx_eq_foldlIdxSpecₓ
 
+#print List.foldlIdx_eq_foldl_enum /-
 theorem foldlIdx_eq_foldl_enum (f : ℕ → α → β → α) (a : α) (bs : List β) :
     foldlIdx f a bs = foldl (fun a (p : ℕ × β) => f p.fst a p.snd) a (enum bs) := by
   simp only [foldl_with_index, foldl_with_index_aux_spec,
     foldl_with_index_aux_eq_foldl_with_index_aux_spec, enum]
 #align list.foldl_with_index_eq_foldl_enum List.foldlIdx_eq_foldl_enum
+-/
 
 end FoldlWithIndex
 
@@ -172,15 +188,19 @@ section MfoldWithIndex
 
 variable {m : Type u → Type v} [Monad m]
 
+#print List.foldrIdxM_eq_foldrM_enum /-
 theorem foldrIdxM_eq_foldrM_enum {α β} (f : ℕ → α → β → m β) (b : β) (as : List α) :
     foldrIdxM f b as = foldrM (uncurry f) b (enum as) := by
   simp only [mfoldr_with_index, mfoldr_eq_foldr, foldr_with_index_eq_foldr_enum, uncurry]
 #align list.mfoldr_with_index_eq_mfoldr_enum List.foldrIdxM_eq_foldrM_enum
+-/
 
+#print List.foldlIdxM_eq_foldlM_enum /-
 theorem foldlIdxM_eq_foldlM_enum [LawfulMonad m] {α β} (f : ℕ → β → α → m β) (b : β) (as : List α) :
     foldlIdxM f b as = foldlM (fun b (p : ℕ × α) => f p.fst b p.snd) b (enum as) := by
   rw [mfoldl_with_index, mfoldl_eq_foldl, foldl_with_index_eq_foldl_enum]
 #align list.mfoldl_with_index_eq_mfoldl_enum List.foldlIdxM_eq_foldlM_enum
+-/
 
 end MfoldWithIndex
 
@@ -188,11 +208,14 @@ section MmapWithIndex
 
 variable {m : Type u → Type v} [Applicative m]
 
+#print List.mapIdxMAuxSpec /-
 /-- Specification of `mmap_with_index_aux`. -/
 def mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : ℕ) (as : List α) : m (List β) :=
   List.traverse (uncurry f) <| enumFrom start as
 #align list.mmap_with_index_aux_spec List.mapIdxMAuxSpec
+-/
 
+#print List.mapIdxMAuxSpec_cons /-
 -- Note: `traverse` the class method would require a less universe-polymorphic
 -- `m : Type u → Type u`.
 theorem mapIdxMAuxSpec_cons {α β} (f : ℕ → α → m β) (start : ℕ) (a : α) (as : List α) :
@@ -200,7 +223,9 @@ theorem mapIdxMAuxSpec_cons {α β} (f : ℕ → α → m β) (start : ℕ) (a :
       List.cons <$> f start a <*> mapIdxMAuxSpec f (start + 1) as :=
   rfl
 #align list.mmap_with_index_aux_spec_cons List.mapIdxMAuxSpec_cons
+-/
 
+#print List.mapIdxMGo_eq_mapIdxMAuxSpec /-
 theorem mapIdxMGo_eq_mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : ℕ) (as : List α) :
     mmapWithIndexAux f start as = mapIdxMAuxSpec f start as :=
   by
@@ -208,12 +233,15 @@ theorem mapIdxMGo_eq_mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : 
   · rfl
   · simp [mmap_with_index_aux, mmap_with_index_aux_spec_cons, *]
 #align list.mmap_with_index_aux_eq_mmap_with_index_aux_spec List.mapIdxMGo_eq_mapIdxMAuxSpec
+-/
 
+#print List.mapIdxM_eq_mmap_enum /-
 theorem mapIdxM_eq_mmap_enum {α β} (f : ℕ → α → m β) (as : List α) :
     mapIdxM f as = List.traverse (uncurry f) (enum as) := by
   simp only [mmap_with_index, mmap_with_index_aux_spec,
     mmap_with_index_aux_eq_mmap_with_index_aux_spec, enum]
 #align list.mmap_with_index_eq_mmap_enum List.mapIdxM_eq_mmap_enum
+-/
 
 end MmapWithIndex
 
@@ -221,17 +249,21 @@ section MmapWithIndex'
 
 variable {m : Type u → Type v} [Applicative m] [LawfulApplicative m]
 
+#print List.mapIdxMAux'_eq_mapIdxMGo /-
 theorem mapIdxMAux'_eq_mapIdxMGo {α} (f : ℕ → α → m PUnit) (start : ℕ) (as : List α) :
     mapIdxMAux' f start as = mmapWithIndexAux f start as *> pure PUnit.unit := by
   induction as generalizing start <;>
     simp [mmap_with_index'_aux, mmap_with_index_aux, *, seq_right_eq, const, -comp_const,
       functor_norm]
 #align list.mmap_with_index'_aux_eq_mmap_with_index_aux List.mapIdxMAux'_eq_mapIdxMGo
+-/
 
+#print List.mapIdxM'_eq_mapIdxM /-
 theorem mapIdxM'_eq_mapIdxM {α} (f : ℕ → α → m PUnit) (as : List α) :
     mapIdxM' f as = mapIdxM f as *> pure PUnit.unit := by
   apply mmap_with_index'_aux_eq_mmap_with_index_aux
 #align list.mmap_with_index'_eq_mmap_with_index List.mapIdxM'_eq_mapIdxM
+-/
 
 end MmapWithIndex'
 
Diff
@@ -37,16 +37,14 @@ theorem mapIdx_nil {α β} (f : ℕ → α → β) : mapIdx f [] = [] :=
   rfl
 #align list.map_with_index_nil List.mapIdx_nil
 
-/- warning: list.map_with_index_core_eq clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.map_with_index_core_eq [anonymous]ₓ'. -/
-theorem [anonymous] (l : List α) (f : ℕ → α → β) (n : ℕ) :
-    l.map_with_index_core f n = l.mapIdx fun i a => f (i + n) a :=
+theorem mapWithIndexCore_eq (l : List α) (f : ℕ → α → β) (n : ℕ) :
+    l.mapWithIndexCore f n = l.mapIdx fun i a => f (i + n) a :=
   by
   induction' l with hd tl hl generalizing f n
   · simpa
   · rw [map_with_index]
     simp [map_with_index_core, hl, add_left_comm, add_assoc, add_comm]
-#align list.map_with_index_core_eq [anonymous]
+#align list.map_with_index_core_eq List.mapWithIndexCore_eq
 
 #print List.mapIdx_eq_enum_map /-
 theorem mapIdx_eq_enum_map (l : List α) (f : ℕ → α → β) :
Diff
@@ -32,23 +32,12 @@ variable {α : Type u} {β : Type v}
 
 section MapWithIndex
 
-/- warning: list.map_with_index_nil -> List.mapIdx_nil is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β), Eq.{succ u2} (List.{u2} β) (List.mapIdx.{u1, u2} α β f (List.nil.{u1} α)) (List.nil.{u2} β)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (f : Nat -> α -> β), Eq.{succ u1} (List.{u1} β) (List.mapIdx.{u2, u1} α β f (List.nil.{u2} α)) (List.nil.{u1} β)
-Case conversion may be inaccurate. Consider using '#align list.map_with_index_nil List.mapIdx_nilₓ'. -/
 @[simp]
 theorem mapIdx_nil {α β} (f : ℕ → α → β) : mapIdx f [] = [] :=
   rfl
 #align list.map_with_index_nil List.mapIdx_nil
 
 /- warning: list.map_with_index_core_eq clashes with [anonymous] -> [anonymous]
-warning: list.map_with_index_core_eq -> [anonymous] is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : Nat -> α -> β) (n : Nat), Eq.{succ u2} (List.{u2} β) ([anonymous].{u1, u2} α β f n l) (List.mapIdx.{u1, u2} α β (fun (i : Nat) (a : α) => f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) i n) a) l)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
 Case conversion may be inaccurate. Consider using '#align list.map_with_index_core_eq [anonymous]ₓ'. -/
 theorem [anonymous] (l : List α) (f : ℕ → α → β) (n : ℕ) :
     l.map_with_index_core f n = l.mapIdx fun i a => f (i + n) a :=
@@ -70,12 +59,6 @@ theorem mapIdx_eq_enum_map (l : List α) (f : ℕ → α → β) :
 #align list.map_with_index_eq_enum_map List.mapIdx_eq_enum_map
 -/
 
-/- warning: list.map_with_index_cons -> List.mapIdx_cons is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : Nat -> α -> β) (a : α), Eq.{succ u2} (List.{u2} β) (List.mapIdx.{u1, u2} α β f (List.cons.{u1} α a l)) (List.cons.{u2} β (f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) a) (List.mapIdx.{u1, u2} α β (fun (i : Nat) => f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) i (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) l))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (l : List.{u2} α) (f : Nat -> α -> β) (a : α), Eq.{succ u1} (List.{u1} β) (List.mapIdx.{u2, u1} α β f (List.cons.{u2} α a l)) (List.cons.{u1} β (f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) a) (List.mapIdx.{u2, u1} α β (fun (i : Nat) => f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) i (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) l))
-Case conversion may be inaccurate. Consider using '#align list.map_with_index_cons List.mapIdx_consₓ'. -/
 @[simp]
 theorem mapIdx_cons {α β} (l : List α) (f : ℕ → α → β) (a : α) :
     mapIdx f (a :: l) = f 0 a :: mapIdx (fun i => f (i + 1)) l := by
@@ -83,12 +66,6 @@ theorem mapIdx_cons {α β} (l : List α) (f : ℕ → α → β) (a : α) :
     range_succ_eq_map, zip_with_map_left]
 #align list.map_with_index_cons List.mapIdx_cons
 
-/- warning: list.map_with_index_append -> List.mapIdx_append is a dubious translation:
-lean 3 declaration is
-  forall {β : Type.{u1}} {α : Type.{u2}} (K : List.{u2} α) (L : List.{u2} α) (f : Nat -> α -> β), Eq.{succ u1} (List.{u1} β) (List.mapIdx.{u2, u1} α β f (Append.append.{u2} (List.{u2} α) (List.hasAppend.{u2} α) K L)) (Append.append.{u1} (List.{u1} β) (List.hasAppend.{u1} β) (List.mapIdx.{u2, u1} α β f K) (List.mapIdx.{u2, u1} α β (fun (i : Nat) (a : α) => f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) i (List.length.{u2} α K)) a) L))
-but is expected to have type
-  forall {β : Type.{u2}} {α : Type.{u1}} (K : List.{u1} α) (L : List.{u1} α) (f : Nat -> α -> β), Eq.{succ u2} (List.{u2} β) (List.mapIdx.{u1, u2} α β f (HAppend.hAppend.{u1, u1, u1} (List.{u1} α) (List.{u1} α) (List.{u1} α) (instHAppend.{u1} (List.{u1} α) (List.instAppendList.{u1} α)) K L)) (HAppend.hAppend.{u2, u2, u2} (List.{u2} β) (List.{u2} β) (List.{u2} β) (instHAppend.{u2} (List.{u2} β) (List.instAppendList.{u2} β)) (List.mapIdx.{u1, u2} α β f K) (List.mapIdx.{u1, u2} α β (fun (i : Nat) (a : α) => f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) i (List.length.{u1} α K)) a) L))
-Case conversion may be inaccurate. Consider using '#align list.map_with_index_append List.mapIdx_appendₓ'. -/
 theorem mapIdx_append {α} (K L : List α) (f : ℕ → α → β) :
     (K ++ L).mapIdx f = K.mapIdx f ++ L.mapIdx fun i a => f (i + K.length) a :=
   by
@@ -97,12 +74,6 @@ theorem mapIdx_append {α} (K L : List α) (f : ℕ → α → β) :
   · simp [IH fun i => f (i + 1), add_assoc]
 #align list.map_with_index_append List.mapIdx_append
 
-/- warning: list.length_map_with_index -> List.length_mapIdx is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : Nat -> α -> β), Eq.{1} Nat (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l)) (List.length.{u1} α l)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (l : List.{u2} α) (f : Nat -> α -> β), Eq.{1} Nat (List.length.{u1} β (List.mapIdx.{u2, u1} α β f l)) (List.length.{u2} α l)
-Case conversion may be inaccurate. Consider using '#align list.length_map_with_index List.length_mapIdxₓ'. -/
 @[simp]
 theorem length_mapIdx {α β} (l : List α) (f : ℕ → α → β) : (l.mapIdx f).length = l.length :=
   by
@@ -111,12 +82,6 @@ theorem length_mapIdx {α β} (l : List α) (f : ℕ → α → β) : (l.mapIdx
   · simp [IH]
 #align list.length_map_with_index List.length_mapIdx
 
-/- warning: list.nth_le_map_with_index -> List.nthLe_mapIdx is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : Nat -> α -> β) (i : Nat) (h : LT.lt.{0} Nat Nat.hasLt i (List.length.{u1} α l)) (h' : optParam.{0} (LT.lt.{0} Nat (Preorder.toHasLt.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring)))) i (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l))) (LT.lt.trans_le.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) i (List.length.{u1} α l) (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l)) h (Eq.ge.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l)) (List.length.{u1} α l) (List.length_mapIdx.{u1, u2} α β l f)))), Eq.{succ u2} β (List.nthLe.{u2} β (List.mapIdx.{u1, u2} α β f l) i h') (f i (List.nthLe.{u1} α l i h))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (l : List.{u2} α) (f : Nat -> α -> β) (i : Nat) (h : LT.lt.{0} Nat instLTNat i (List.length.{u2} α l)) (h' : optParam.{0} (LT.lt.{0} Nat instLTNat i (List.length.{u1} β (List.mapIdx.{u2, u1} α β f l))) (LT.lt.trans_le.{0} Nat (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) i (List.length.{u2} α l) (List.length.{u1} β (List.mapIdx.{u2, u1} α β f l)) h (Eq.ge.{0} Nat (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) (List.length.{u1} β (List.mapIdx.{u2, u1} α β f l)) (List.length.{u2} α l) (List.length_mapIdx.{u1, u2} α β l f)))), Eq.{succ u1} β (List.nthLe.{u1} β (List.mapIdx.{u2, u1} α β f l) i h') (f i (List.nthLe.{u2} α l i h))
-Case conversion may be inaccurate. Consider using '#align list.nth_le_map_with_index List.nthLe_mapIdxₓ'. -/
 @[simp]
 theorem nthLe_mapIdx {α β} (l : List α) (f : ℕ → α → β) (i : ℕ) (h : i < l.length)
     (h' : i < (l.mapIdx f).length := h.trans_le (l.length_mapIdx f).ge) :
@@ -124,12 +89,6 @@ theorem nthLe_mapIdx {α β} (l : List α) (f : ℕ → α → β) (i : ℕ) (h
   simp [map_with_index_eq_enum_map, enum_eq_zip_range]
 #align list.nth_le_map_with_index List.nthLe_mapIdx
 
-/- warning: list.map_with_index_eq_of_fn -> List.mapIdx_eq_ofFn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : Nat -> α -> β), Eq.{succ u2} (List.{u2} β) (List.mapIdx.{u1, u2} α β f l) (List.ofFn.{u2} β (List.length.{u1} α l) (fun (i : Fin (List.length.{u1} α l)) => f ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin (List.length.{u1} α l)) Nat (HasLiftT.mk.{1, 1} (Fin (List.length.{u1} α l)) Nat (CoeTCₓ.coe.{1, 1} (Fin (List.length.{u1} α l)) Nat (coeBase.{1, 1} (Fin (List.length.{u1} α l)) Nat (Fin.coeToNat (List.length.{u1} α l))))) i) (List.nthLe.{u1} α l ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin (List.length.{u1} α l)) Nat (HasLiftT.mk.{1, 1} (Fin (List.length.{u1} α l)) Nat (CoeTCₓ.coe.{1, 1} (Fin (List.length.{u1} α l)) Nat (coeBase.{1, 1} (Fin (List.length.{u1} α l)) Nat (Fin.coeToNat (List.length.{u1} α l))))) i) (Fin.is_lt (List.length.{u1} α l) i))))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (l : List.{u2} α) (f : Nat -> α -> β), Eq.{succ u1} (List.{u1} β) (List.mapIdx.{u2, u1} α β f l) (List.ofFn.{u1} β (List.length.{u2} α l) (fun (i : Fin (List.length.{u2} α l)) => f (Fin.val (List.length.{u2} α l) i) (List.get.{u2} α l i)))
-Case conversion may be inaccurate. Consider using '#align list.map_with_index_eq_of_fn List.mapIdx_eq_ofFnₓ'. -/
 theorem mapIdx_eq_ofFn {α β} (l : List α) (f : ℕ → α → β) :
     l.mapIdx f = ofFn fun i : Fin l.length => f (i : ℕ) (l.nthLe i i.is_lt) :=
   by
@@ -160,12 +119,6 @@ theorem foldrIdx_eq_foldrIdxSpec (f : ℕ → α → β → β) (start b as) :
   · simp only [foldr_with_index_aux, foldr_with_index_aux_spec_cons, *]
 #align list.foldr_with_index_aux_eq_foldr_with_index_aux_spec List.foldrIdx_eq_foldrIdxSpecₓ
 
-/- warning: list.foldr_with_index_eq_foldr_enum -> List.foldrIdx_eq_foldr_enum is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> β) (b : β) (as : List.{u1} α), Eq.{succ u2} β (List.foldrIdx.{u1, succ u2} α β f b as) (List.foldr.{u1, u2} (Prod.{0, u1} Nat α) β (Function.uncurry.{0, u1, u2} Nat α (β -> β) f) b (List.enum.{u1} α as))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> β) (b : β) (as : List.{u1} α), Eq.{succ u2} β (List.foldrIdx.{u1, succ u2} α β f b as (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (List.foldr.{u1, u2} (Prod.{0, u1} Nat α) β (Function.uncurry.{0, u1, u2} Nat α (β -> β) f) b (List.enum.{u1} α as))
-Case conversion may be inaccurate. Consider using '#align list.foldr_with_index_eq_foldr_enum List.foldrIdx_eq_foldr_enumₓ'. -/
 theorem foldrIdx_eq_foldr_enum (f : ℕ → α → β → β) (b : β) (as : List α) :
     foldrIdx f b as = foldr (uncurry f) b (enum as) := by
   simp only [foldr_with_index, foldr_with_index_aux_spec,
@@ -209,12 +162,6 @@ theorem foldlIdx_eq_foldlIdxSpec (f : ℕ → α → β → α) (start a bs) :
   · simp [foldl_with_index_aux, foldl_with_index_aux_spec_cons, *]
 #align list.foldl_with_index_aux_eq_foldl_with_index_aux_spec List.foldlIdx_eq_foldlIdxSpecₓ
 
-/- warning: list.foldl_with_index_eq_foldl_enum -> List.foldlIdx_eq_foldl_enum is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> α) (a : α) (bs : List.{u2} β), Eq.{succ u1} α (List.foldlIdx.{succ u1, u2} α β f a bs) (List.foldl.{u1, u2} α (Prod.{0, u2} Nat β) (fun (a : α) (p : Prod.{0, u2} Nat β) => f (Prod.fst.{0, u2} Nat β p) a (Prod.snd.{0, u2} Nat β p)) a (List.enum.{u2} β bs))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> α) (a : α) (bs : List.{u2} β), Eq.{succ u1} α (List.foldlIdx.{succ u1, u2} α β f a bs (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (List.foldl.{u1, u2} α (Prod.{0, u2} Nat β) (fun (a : α) (p : Prod.{0, u2} Nat β) => f (Prod.fst.{0, u2} Nat β p) a (Prod.snd.{0, u2} Nat β p)) a (List.enum.{u2} β bs))
-Case conversion may be inaccurate. Consider using '#align list.foldl_with_index_eq_foldl_enum List.foldlIdx_eq_foldl_enumₓ'. -/
 theorem foldlIdx_eq_foldl_enum (f : ℕ → α → β → α) (a : α) (bs : List β) :
     foldlIdx f a bs = foldl (fun a (p : ℕ × β) => f p.fst a p.snd) a (enum bs) := by
   simp only [foldl_with_index, foldl_with_index_aux_spec,
@@ -227,23 +174,11 @@ section MfoldWithIndex
 
 variable {m : Type u → Type v} [Monad m]
 
-/- warning: list.mfoldr_with_index_eq_mfoldr_enum -> List.foldrIdxM_eq_foldrM_enum is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Monad.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> α -> β -> (m β)) (b : β) (as : List.{u3} α), Eq.{succ u2} (m β) (List.foldrIdxM.{u1, u2, u3} (fun {β : Type.{u1}} => m β) _inst_1 α β f b as) (List.foldrM.{u1, u2, u3} m _inst_1 β (Prod.{0, u3} Nat α) (Function.uncurry.{0, u3, max u1 u2} Nat α (β -> (m β)) f) b (List.enum.{u3} α as))
-but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> (m β)) (b : β) (as : List.{u1} α) [inst._@.Mathlib.Data.List.Indexes._hyg.2623 : LawfulMonad.{u2, u3} m _inst_1], Eq.{succ u3} (m β) (List.foldrIdxM.{u2, u3, u1} m _inst_1 α β f b as) (List.foldrM.{u2, u3, u1} m _inst_1 β (Prod.{0, u1} Nat α) (Function.uncurry.{0, u1, max u3 u2} Nat α (β -> (m β)) f) b (List.enum.{u1} α as))
-Case conversion may be inaccurate. Consider using '#align list.mfoldr_with_index_eq_mfoldr_enum List.foldrIdxM_eq_foldrM_enumₓ'. -/
 theorem foldrIdxM_eq_foldrM_enum {α β} (f : ℕ → α → β → m β) (b : β) (as : List α) :
     foldrIdxM f b as = foldrM (uncurry f) b (enum as) := by
   simp only [mfoldr_with_index, mfoldr_eq_foldr, foldr_with_index_eq_foldr_enum, uncurry]
 #align list.mfoldr_with_index_eq_mfoldr_enum List.foldrIdxM_eq_foldrM_enum
 
-/- warning: list.mfoldl_with_index_eq_mfoldl_enum -> List.foldlIdxM_eq_foldlM_enum is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Monad.{u1, u2} m] [_inst_2 : LawfulMonad.{u1, u2} m _inst_1] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> β -> α -> (m β)) (b : β) (as : List.{u3} α), Eq.{succ u2} (m β) (List.foldlIdxM.{u1, u2, u3} (fun {β : Type.{u1}} => m β) _inst_1 α β f b as) (List.foldlM.{u1, u2, u3} m _inst_1 β (Prod.{0, u3} Nat α) (fun (b : β) (p : Prod.{0, u3} Nat α) => f (Prod.fst.{0, u3} Nat α p) b (Prod.snd.{0, u3} Nat α p)) b (List.enum.{u3} α as))
-but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [_inst_2 : LawfulMonad.{u2, u3} m _inst_1] {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> β -> α -> (m β)) (b : β) (as : List.{u1} α), Eq.{succ u3} (m β) (List.foldlIdxM.{u2, u3, u1} m _inst_1 α β f b as) (List.foldlM.{u2, u3, u1} m _inst_1 β (Prod.{0, u1} Nat α) (fun (b : β) (p : Prod.{0, u1} Nat α) => f (Prod.fst.{0, u1} Nat α p) b (Prod.snd.{0, u1} Nat α p)) b (List.enum.{u1} α as))
-Case conversion may be inaccurate. Consider using '#align list.mfoldl_with_index_eq_mfoldl_enum List.foldlIdxM_eq_foldlM_enumₓ'. -/
 theorem foldlIdxM_eq_foldlM_enum [LawfulMonad m] {α β} (f : ℕ → β → α → m β) (b : β) (as : List α) :
     foldlIdxM f b as = foldlM (fun b (p : ℕ × α) => f p.fst b p.snd) b (enum as) := by
   rw [mfoldl_with_index, mfoldl_eq_foldl, foldl_with_index_eq_foldl_enum]
@@ -255,23 +190,11 @@ section MmapWithIndex
 
 variable {m : Type u → Type v} [Applicative m]
 
-/- warning: list.mmap_with_index_aux_spec -> List.mapIdxMAuxSpec is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}}, (Nat -> α -> (m β)) -> Nat -> (List.{u3} α) -> (m (List.{u1} β))
-but is expected to have type
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Monad.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}}, (Nat -> α -> (m β)) -> Nat -> (List.{u3} α) -> (m (List.{u1} β))
-Case conversion may be inaccurate. Consider using '#align list.mmap_with_index_aux_spec List.mapIdxMAuxSpecₓ'. -/
 /-- Specification of `mmap_with_index_aux`. -/
 def mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : ℕ) (as : List α) : m (List β) :=
   List.traverse (uncurry f) <| enumFrom start as
 #align list.mmap_with_index_aux_spec List.mapIdxMAuxSpec
 
-/- warning: list.mmap_with_index_aux_spec_cons -> List.mapIdxMAuxSpec_cons is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> α -> (m β)) (start : Nat) (a : α) (as : List.{u3} α), Eq.{succ u2} (m (List.{u1} β)) (List.mapIdxMAuxSpec.{u1, u2, u3} m _inst_1 α β f start (List.cons.{u3} α a as)) (Seq.seq.{u1, u2} m (Applicative.toHasSeq.{u1, u2} m _inst_1) (List.{u1} β) (List.{u1} β) (Functor.map.{u1, u2} m (Applicative.toFunctor.{u1, u2} m _inst_1) β ((List.{u1} β) -> (List.{u1} β)) (List.cons.{u1} β) (f start a)) (List.mapIdxMAuxSpec.{u1, u2, u3} m _inst_1 α β f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) start (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) as))
-but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> (m β)) (start : Nat) (a : α) (as : List.{u1} α), Eq.{succ u3} (m (List.{u2} β)) (List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 α β f start (List.cons.{u1} α a as)) (Seq.seq.{u2, u3} m (Applicative.toSeq.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} β) (List.{u2} β) (Functor.map.{u2, u3} m (Applicative.toFunctor.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) β ((List.{u2} β) -> (List.{u2} β)) (List.cons.{u2} β) (f start a)) (fun (x._@.Mathlib.Data.List.Indexes._hyg.2846 : Unit) => List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 α β f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) start (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) as))
-Case conversion may be inaccurate. Consider using '#align list.mmap_with_index_aux_spec_cons List.mapIdxMAuxSpec_consₓ'. -/
 -- Note: `traverse` the class method would require a less universe-polymorphic
 -- `m : Type u → Type u`.
 theorem mapIdxMAuxSpec_cons {α β} (f : ℕ → α → m β) (start : ℕ) (a : α) (as : List α) :
@@ -280,12 +203,6 @@ theorem mapIdxMAuxSpec_cons {α β} (f : ℕ → α → m β) (start : ℕ) (a :
   rfl
 #align list.mmap_with_index_aux_spec_cons List.mapIdxMAuxSpec_cons
 
-/- warning: list.mmap_with_index_aux_eq_mmap_with_index_aux_spec -> List.mapIdxMGo_eq_mapIdxMAuxSpec is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> α -> (m β)) (start : Nat) (as : List.{u3} α), Eq.{succ u2} (m (List.{u1} β)) (List.mmapWithIndexAux.{u1, u2, u3} m _inst_1 α β f start as) (List.mapIdxMAuxSpec.{u1, u2, u3} m _inst_1 α β f start as)
-but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [α : LawfulMonad.{u2, u3} m _inst_1] {β : Type.{u1}} {f : Type.{u2}} (start : Nat -> β -> (m f)) (as : Array.{u2} f) (as_1 : List.{u1} β), Eq.{succ u3} (m (List.{u2} f)) (List.mapIdxM.go.{u2, u3, u1} β f m _inst_1 start as_1 as) (Functor.map.{u2, u3} m (Applicative.toFunctor.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} f) (List.{u2} f) (fun (x._@.Mathlib.Data.List.Indexes._hyg.2898 : List.{u2} f) => HAppend.hAppend.{u2, u2, u2} (List.{u2} f) (List.{u2} f) (List.{u2} f) (instHAppend.{u2} (List.{u2} f) (List.instAppendList.{u2} f)) (Array.toList.{u2} f as) x._@.Mathlib.Data.List.Indexes._hyg.2898) (List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 β f start (Array.size.{u2} f as) as_1))
-Case conversion may be inaccurate. Consider using '#align list.mmap_with_index_aux_eq_mmap_with_index_aux_spec List.mapIdxMGo_eq_mapIdxMAuxSpecₓ'. -/
 theorem mapIdxMGo_eq_mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : ℕ) (as : List α) :
     mmapWithIndexAux f start as = mapIdxMAuxSpec f start as :=
   by
@@ -294,12 +211,6 @@ theorem mapIdxMGo_eq_mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : 
   · simp [mmap_with_index_aux, mmap_with_index_aux_spec_cons, *]
 #align list.mmap_with_index_aux_eq_mmap_with_index_aux_spec List.mapIdxMGo_eq_mapIdxMAuxSpec
 
-/- warning: list.mmap_with_index_eq_mmap_enum -> List.mapIdxM_eq_mmap_enum is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> α -> (m β)) (as : List.{u3} α), Eq.{succ u2} (m (List.{u1} β)) (List.mapIdxM.{u1, u2, u3} m _inst_1 α β f as) (List.traverse.{u1, u2, u3} m _inst_1 (Prod.{0, u3} Nat α) β (Function.uncurry.{0, u3, u2} Nat α (m β) f) (List.enum.{u3} α as))
-but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [α : LawfulMonad.{u2, u3} m _inst_1] {β : Type.{u1}} {f : Type.{u2}} (as : Nat -> β -> (m f)) (as_1 : List.{u1} β), Eq.{succ u3} (m (List.{u2} f)) (List.mapIdxM.{u2, u3, u1} β f m _inst_1 as_1 as) (List.traverse.{u2, u3, u1} m (Monad.toApplicative.{u2, u3} m _inst_1) (Prod.{0, u1} Nat β) f (Function.uncurry.{0, u1, u3} Nat β (m f) as) (List.enum.{u1} β as_1))
-Case conversion may be inaccurate. Consider using '#align list.mmap_with_index_eq_mmap_enum List.mapIdxM_eq_mmap_enumₓ'. -/
 theorem mapIdxM_eq_mmap_enum {α β} (f : ℕ → α → m β) (as : List α) :
     mapIdxM f as = List.traverse (uncurry f) (enum as) := by
   simp only [mmap_with_index, mmap_with_index_aux_spec,
@@ -312,12 +223,6 @@ section MmapWithIndex'
 
 variable {m : Type u → Type v} [Applicative m] [LawfulApplicative m]
 
-/- warning: list.mmap_with_index'_aux_eq_mmap_with_index_aux -> List.mapIdxMAux'_eq_mapIdxMGo is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] [_inst_2 : LawfulApplicative.{u1, u2} m _inst_1] {α : Type.{u3}} (f : Nat -> α -> (m PUnit.{succ u1})) (start : Nat) (as : List.{u3} α), Eq.{succ u2} (m PUnit.{succ u1}) (List.mapIdxMAux'.{u1, u2, u3} m _inst_1 α f start as) (SeqRight.seqRight.{u1, u2} m (Applicative.toHasSeqRight.{u1, u2} m _inst_1) (List.{u1} PUnit.{succ u1}) PUnit.{succ u1} (List.mmapWithIndexAux.{u1, u2, u3} m _inst_1 α PUnit.{succ u1} f start as) (Pure.pure.{u1, u2} m (Applicative.toHasPure.{u1, u2} m _inst_1) PUnit.{succ u1} PUnit.unit.{succ u1}))
-but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [_inst_2 : LawfulMonad.{u2, u3} m _inst_1] {α : Type.{u1}} (f : Nat -> α -> (m PUnit.{succ u2})) (start : List.{u1} α) (as : Array.{u2} PUnit.{succ u2}), Eq.{succ u3} (m PUnit.{succ u2}) (List.mapIdxMAux'.{u2, u3, u1} m _inst_1 α f (Array.size.{u2} PUnit.{succ u2} as) start) (SeqRight.seqRight.{u2, u3} m (Applicative.toSeqRight.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} PUnit.{succ u2}) PUnit.{succ u2} (List.mapIdxM.go.{u2, u3, u1} α PUnit.{succ u2} m _inst_1 f start as) (fun (x._@.Mathlib.Data.List.Indexes._hyg.3204 : Unit) => Pure.pure.{u2, u3} m (Applicative.toPure.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) PUnit.{succ u2} PUnit.unit.{succ u2}))
-Case conversion may be inaccurate. Consider using '#align list.mmap_with_index'_aux_eq_mmap_with_index_aux List.mapIdxMAux'_eq_mapIdxMGoₓ'. -/
 theorem mapIdxMAux'_eq_mapIdxMGo {α} (f : ℕ → α → m PUnit) (start : ℕ) (as : List α) :
     mapIdxMAux' f start as = mmapWithIndexAux f start as *> pure PUnit.unit := by
   induction as generalizing start <;>
@@ -325,12 +230,6 @@ theorem mapIdxMAux'_eq_mapIdxMGo {α} (f : ℕ → α → m PUnit) (start : ℕ)
       functor_norm]
 #align list.mmap_with_index'_aux_eq_mmap_with_index_aux List.mapIdxMAux'_eq_mapIdxMGo
 
-/- warning: list.mmap_with_index'_eq_mmap_with_index -> List.mapIdxM'_eq_mapIdxM is a dubious translation:
-lean 3 declaration is
-  forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] [_inst_2 : LawfulApplicative.{u1, u2} m _inst_1] {α : Type.{u3}} (f : Nat -> α -> (m PUnit.{succ u1})) (as : List.{u3} α), Eq.{succ u2} (m PUnit.{succ u1}) (List.mapIdxM'.{u1, u2, u3} m _inst_1 α f as) (SeqRight.seqRight.{u1, u2} m (Applicative.toHasSeqRight.{u1, u2} m _inst_1) (List.{u1} PUnit.{succ u1}) PUnit.{succ u1} (List.mapIdxM.{u1, u2, u3} m _inst_1 α PUnit.{succ u1} f as) (Pure.pure.{u1, u2} m (Applicative.toHasPure.{u1, u2} m _inst_1) PUnit.{succ u1} PUnit.unit.{succ u1}))
-but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [_inst_2 : LawfulMonad.{u2, u3} m _inst_1] {α : Type.{u1}} (f : Nat -> α -> (m PUnit.{succ u2})) (as : List.{u1} α), Eq.{succ u3} (m PUnit.{succ u2}) (List.mapIdxM'.{u2, u3, u1} m _inst_1 α f as) (SeqRight.seqRight.{u2, u3} m (Applicative.toSeqRight.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} PUnit.{succ u2}) PUnit.{succ u2} (List.mapIdxM.{u2, u3, u1} α PUnit.{succ u2} m _inst_1 as f) (fun (x._@.Mathlib.Data.List.Indexes._hyg.3378 : Unit) => Pure.pure.{u2, u3} m (Applicative.toPure.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) PUnit.{succ u2} PUnit.unit.{succ u2}))
-Case conversion may be inaccurate. Consider using '#align list.mmap_with_index'_eq_mmap_with_index List.mapIdxM'_eq_mapIdxMₓ'. -/
 theorem mapIdxM'_eq_mapIdxM {α} (f : ℕ → α → m PUnit) (as : List α) :
     mapIdxM' f as = mapIdxM f as *> pure PUnit.unit := by
   apply mmap_with_index'_aux_eq_mmap_with_index_aux
Diff
@@ -113,7 +113,7 @@ theorem length_mapIdx {α β} (l : List α) (f : ℕ → α → β) : (l.mapIdx
 
 /- warning: list.nth_le_map_with_index -> List.nthLe_mapIdx is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : Nat -> α -> β) (i : Nat) (h : LT.lt.{0} Nat Nat.hasLt i (List.length.{u1} α l)) (h' : optParam.{0} (LT.lt.{0} Nat (Preorder.toLT.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring)))) i (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l))) (LT.lt.trans_le.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) i (List.length.{u1} α l) (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l)) h (Eq.ge.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l)) (List.length.{u1} α l) (List.length_mapIdx.{u1, u2} α β l f)))), Eq.{succ u2} β (List.nthLe.{u2} β (List.mapIdx.{u1, u2} α β f l) i h') (f i (List.nthLe.{u1} α l i h))
+  forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : Nat -> α -> β) (i : Nat) (h : LT.lt.{0} Nat Nat.hasLt i (List.length.{u1} α l)) (h' : optParam.{0} (LT.lt.{0} Nat (Preorder.toHasLt.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring)))) i (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l))) (LT.lt.trans_le.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) i (List.length.{u1} α l) (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l)) h (Eq.ge.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) (List.length.{u2} β (List.mapIdx.{u1, u2} α β f l)) (List.length.{u1} α l) (List.length_mapIdx.{u1, u2} α β l f)))), Eq.{succ u2} β (List.nthLe.{u2} β (List.mapIdx.{u1, u2} α β f l) i h') (f i (List.nthLe.{u1} α l i h))
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} (l : List.{u2} α) (f : Nat -> α -> β) (i : Nat) (h : LT.lt.{0} Nat instLTNat i (List.length.{u2} α l)) (h' : optParam.{0} (LT.lt.{0} Nat instLTNat i (List.length.{u1} β (List.mapIdx.{u2, u1} α β f l))) (LT.lt.trans_le.{0} Nat (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) i (List.length.{u2} α l) (List.length.{u1} β (List.mapIdx.{u2, u1} α β f l)) h (Eq.ge.{0} Nat (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) (List.length.{u1} β (List.mapIdx.{u2, u1} α β f l)) (List.length.{u2} α l) (List.length_mapIdx.{u1, u2} α β l f)))), Eq.{succ u1} β (List.nthLe.{u1} β (List.mapIdx.{u2, u1} α β f l) i h') (f i (List.nthLe.{u2} α l i h))
 Case conversion may be inaccurate. Consider using '#align list.nth_le_map_with_index List.nthLe_mapIdxₓ'. -/
Diff
@@ -231,7 +231,7 @@ variable {m : Type u → Type v} [Monad m]
 lean 3 declaration is
   forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Monad.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> α -> β -> (m β)) (b : β) (as : List.{u3} α), Eq.{succ u2} (m β) (List.foldrIdxM.{u1, u2, u3} (fun {β : Type.{u1}} => m β) _inst_1 α β f b as) (List.foldrM.{u1, u2, u3} m _inst_1 β (Prod.{0, u3} Nat α) (Function.uncurry.{0, u3, max u1 u2} Nat α (β -> (m β)) f) b (List.enum.{u3} α as))
 but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> (m β)) (b : β) (as : List.{u1} α) [inst._@.Mathlib.Data.List.Indexes._hyg.2615 : LawfulMonad.{u2, u3} m _inst_1], Eq.{succ u3} (m β) (List.foldrIdxM.{u2, u3, u1} m _inst_1 α β f b as) (List.foldrM.{u2, u3, u1} m _inst_1 β (Prod.{0, u1} Nat α) (Function.uncurry.{0, u1, max u3 u2} Nat α (β -> (m β)) f) b (List.enum.{u1} α as))
+  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> (m β)) (b : β) (as : List.{u1} α) [inst._@.Mathlib.Data.List.Indexes._hyg.2623 : LawfulMonad.{u2, u3} m _inst_1], Eq.{succ u3} (m β) (List.foldrIdxM.{u2, u3, u1} m _inst_1 α β f b as) (List.foldrM.{u2, u3, u1} m _inst_1 β (Prod.{0, u1} Nat α) (Function.uncurry.{0, u1, max u3 u2} Nat α (β -> (m β)) f) b (List.enum.{u1} α as))
 Case conversion may be inaccurate. Consider using '#align list.mfoldr_with_index_eq_mfoldr_enum List.foldrIdxM_eq_foldrM_enumₓ'. -/
 theorem foldrIdxM_eq_foldrM_enum {α β} (f : ℕ → α → β → m β) (b : β) (as : List α) :
     foldrIdxM f b as = foldrM (uncurry f) b (enum as) := by
@@ -270,7 +270,7 @@ def mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : ℕ) (as : List α
 lean 3 declaration is
   forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> α -> (m β)) (start : Nat) (a : α) (as : List.{u3} α), Eq.{succ u2} (m (List.{u1} β)) (List.mapIdxMAuxSpec.{u1, u2, u3} m _inst_1 α β f start (List.cons.{u3} α a as)) (Seq.seq.{u1, u2} m (Applicative.toHasSeq.{u1, u2} m _inst_1) (List.{u1} β) (List.{u1} β) (Functor.map.{u1, u2} m (Applicative.toFunctor.{u1, u2} m _inst_1) β ((List.{u1} β) -> (List.{u1} β)) (List.cons.{u1} β) (f start a)) (List.mapIdxMAuxSpec.{u1, u2, u3} m _inst_1 α β f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) start (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) as))
 but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> (m β)) (start : Nat) (a : α) (as : List.{u1} α), Eq.{succ u3} (m (List.{u2} β)) (List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 α β f start (List.cons.{u1} α a as)) (Seq.seq.{u2, u3} m (Applicative.toSeq.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} β) (List.{u2} β) (Functor.map.{u2, u3} m (Applicative.toFunctor.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) β ((List.{u2} β) -> (List.{u2} β)) (List.cons.{u2} β) (f start a)) (fun (x._@.Mathlib.Data.List.Indexes._hyg.2838 : Unit) => List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 α β f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) start (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) as))
+  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> (m β)) (start : Nat) (a : α) (as : List.{u1} α), Eq.{succ u3} (m (List.{u2} β)) (List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 α β f start (List.cons.{u1} α a as)) (Seq.seq.{u2, u3} m (Applicative.toSeq.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} β) (List.{u2} β) (Functor.map.{u2, u3} m (Applicative.toFunctor.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) β ((List.{u2} β) -> (List.{u2} β)) (List.cons.{u2} β) (f start a)) (fun (x._@.Mathlib.Data.List.Indexes._hyg.2846 : Unit) => List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 α β f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) start (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) as))
 Case conversion may be inaccurate. Consider using '#align list.mmap_with_index_aux_spec_cons List.mapIdxMAuxSpec_consₓ'. -/
 -- Note: `traverse` the class method would require a less universe-polymorphic
 -- `m : Type u → Type u`.
@@ -284,7 +284,7 @@ theorem mapIdxMAuxSpec_cons {α β} (f : ℕ → α → m β) (start : ℕ) (a :
 lean 3 declaration is
   forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}} (f : Nat -> α -> (m β)) (start : Nat) (as : List.{u3} α), Eq.{succ u2} (m (List.{u1} β)) (List.mmapWithIndexAux.{u1, u2, u3} m _inst_1 α β f start as) (List.mapIdxMAuxSpec.{u1, u2, u3} m _inst_1 α β f start as)
 but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [α : LawfulMonad.{u2, u3} m _inst_1] {β : Type.{u1}} {f : Type.{u2}} (start : Nat -> β -> (m f)) (as : Array.{u2} f) (as_1 : List.{u1} β), Eq.{succ u3} (m (List.{u2} f)) (List.mapIdxM.go.{u2, u3, u1} β f m _inst_1 start as_1 as) (Functor.map.{u2, u3} m (Applicative.toFunctor.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} f) (List.{u2} f) (fun (x._@.Mathlib.Data.List.Indexes._hyg.2890 : List.{u2} f) => HAppend.hAppend.{u2, u2, u2} (List.{u2} f) (List.{u2} f) (List.{u2} f) (instHAppend.{u2} (List.{u2} f) (List.instAppendList.{u2} f)) (Array.toList.{u2} f as) x._@.Mathlib.Data.List.Indexes._hyg.2890) (List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 β f start (Array.size.{u2} f as) as_1))
+  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [α : LawfulMonad.{u2, u3} m _inst_1] {β : Type.{u1}} {f : Type.{u2}} (start : Nat -> β -> (m f)) (as : Array.{u2} f) (as_1 : List.{u1} β), Eq.{succ u3} (m (List.{u2} f)) (List.mapIdxM.go.{u2, u3, u1} β f m _inst_1 start as_1 as) (Functor.map.{u2, u3} m (Applicative.toFunctor.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} f) (List.{u2} f) (fun (x._@.Mathlib.Data.List.Indexes._hyg.2898 : List.{u2} f) => HAppend.hAppend.{u2, u2, u2} (List.{u2} f) (List.{u2} f) (List.{u2} f) (instHAppend.{u2} (List.{u2} f) (List.instAppendList.{u2} f)) (Array.toList.{u2} f as) x._@.Mathlib.Data.List.Indexes._hyg.2898) (List.mapIdxMAuxSpec.{u2, u3, u1} m _inst_1 β f start (Array.size.{u2} f as) as_1))
 Case conversion may be inaccurate. Consider using '#align list.mmap_with_index_aux_eq_mmap_with_index_aux_spec List.mapIdxMGo_eq_mapIdxMAuxSpecₓ'. -/
 theorem mapIdxMGo_eq_mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (start : ℕ) (as : List α) :
     mmapWithIndexAux f start as = mapIdxMAuxSpec f start as :=
@@ -316,7 +316,7 @@ variable {m : Type u → Type v} [Applicative m] [LawfulApplicative m]
 lean 3 declaration is
   forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] [_inst_2 : LawfulApplicative.{u1, u2} m _inst_1] {α : Type.{u3}} (f : Nat -> α -> (m PUnit.{succ u1})) (start : Nat) (as : List.{u3} α), Eq.{succ u2} (m PUnit.{succ u1}) (List.mapIdxMAux'.{u1, u2, u3} m _inst_1 α f start as) (SeqRight.seqRight.{u1, u2} m (Applicative.toHasSeqRight.{u1, u2} m _inst_1) (List.{u1} PUnit.{succ u1}) PUnit.{succ u1} (List.mmapWithIndexAux.{u1, u2, u3} m _inst_1 α PUnit.{succ u1} f start as) (Pure.pure.{u1, u2} m (Applicative.toHasPure.{u1, u2} m _inst_1) PUnit.{succ u1} PUnit.unit.{succ u1}))
 but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [_inst_2 : LawfulMonad.{u2, u3} m _inst_1] {α : Type.{u1}} (f : Nat -> α -> (m PUnit.{succ u2})) (start : List.{u1} α) (as : Array.{u2} PUnit.{succ u2}), Eq.{succ u3} (m PUnit.{succ u2}) (List.mapIdxMAux'.{u2, u3, u1} m _inst_1 α f (Array.size.{u2} PUnit.{succ u2} as) start) (SeqRight.seqRight.{u2, u3} m (Applicative.toSeqRight.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} PUnit.{succ u2}) PUnit.{succ u2} (List.mapIdxM.go.{u2, u3, u1} α PUnit.{succ u2} m _inst_1 f start as) (fun (x._@.Mathlib.Data.List.Indexes._hyg.3196 : Unit) => Pure.pure.{u2, u3} m (Applicative.toPure.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) PUnit.{succ u2} PUnit.unit.{succ u2}))
+  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [_inst_2 : LawfulMonad.{u2, u3} m _inst_1] {α : Type.{u1}} (f : Nat -> α -> (m PUnit.{succ u2})) (start : List.{u1} α) (as : Array.{u2} PUnit.{succ u2}), Eq.{succ u3} (m PUnit.{succ u2}) (List.mapIdxMAux'.{u2, u3, u1} m _inst_1 α f (Array.size.{u2} PUnit.{succ u2} as) start) (SeqRight.seqRight.{u2, u3} m (Applicative.toSeqRight.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} PUnit.{succ u2}) PUnit.{succ u2} (List.mapIdxM.go.{u2, u3, u1} α PUnit.{succ u2} m _inst_1 f start as) (fun (x._@.Mathlib.Data.List.Indexes._hyg.3204 : Unit) => Pure.pure.{u2, u3} m (Applicative.toPure.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) PUnit.{succ u2} PUnit.unit.{succ u2}))
 Case conversion may be inaccurate. Consider using '#align list.mmap_with_index'_aux_eq_mmap_with_index_aux List.mapIdxMAux'_eq_mapIdxMGoₓ'. -/
 theorem mapIdxMAux'_eq_mapIdxMGo {α} (f : ℕ → α → m PUnit) (start : ℕ) (as : List α) :
     mapIdxMAux' f start as = mmapWithIndexAux f start as *> pure PUnit.unit := by
@@ -329,7 +329,7 @@ theorem mapIdxMAux'_eq_mapIdxMGo {α} (f : ℕ → α → m PUnit) (start : ℕ)
 lean 3 declaration is
   forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Applicative.{u1, u2} m] [_inst_2 : LawfulApplicative.{u1, u2} m _inst_1] {α : Type.{u3}} (f : Nat -> α -> (m PUnit.{succ u1})) (as : List.{u3} α), Eq.{succ u2} (m PUnit.{succ u1}) (List.mapIdxM'.{u1, u2, u3} m _inst_1 α f as) (SeqRight.seqRight.{u1, u2} m (Applicative.toHasSeqRight.{u1, u2} m _inst_1) (List.{u1} PUnit.{succ u1}) PUnit.{succ u1} (List.mapIdxM.{u1, u2, u3} m _inst_1 α PUnit.{succ u1} f as) (Pure.pure.{u1, u2} m (Applicative.toHasPure.{u1, u2} m _inst_1) PUnit.{succ u1} PUnit.unit.{succ u1}))
 but is expected to have type
-  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [_inst_2 : LawfulMonad.{u2, u3} m _inst_1] {α : Type.{u1}} (f : Nat -> α -> (m PUnit.{succ u2})) (as : List.{u1} α), Eq.{succ u3} (m PUnit.{succ u2}) (List.mapIdxM'.{u2, u3, u1} m _inst_1 α f as) (SeqRight.seqRight.{u2, u3} m (Applicative.toSeqRight.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} PUnit.{succ u2}) PUnit.{succ u2} (List.mapIdxM.{u2, u3, u1} α PUnit.{succ u2} m _inst_1 as f) (fun (x._@.Mathlib.Data.List.Indexes._hyg.3370 : Unit) => Pure.pure.{u2, u3} m (Applicative.toPure.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) PUnit.{succ u2} PUnit.unit.{succ u2}))
+  forall {m : Type.{u2} -> Type.{u3}} [_inst_1 : Monad.{u2, u3} m] [_inst_2 : LawfulMonad.{u2, u3} m _inst_1] {α : Type.{u1}} (f : Nat -> α -> (m PUnit.{succ u2})) (as : List.{u1} α), Eq.{succ u3} (m PUnit.{succ u2}) (List.mapIdxM'.{u2, u3, u1} m _inst_1 α f as) (SeqRight.seqRight.{u2, u3} m (Applicative.toSeqRight.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) (List.{u2} PUnit.{succ u2}) PUnit.{succ u2} (List.mapIdxM.{u2, u3, u1} α PUnit.{succ u2} m _inst_1 as f) (fun (x._@.Mathlib.Data.List.Indexes._hyg.3378 : Unit) => Pure.pure.{u2, u3} m (Applicative.toPure.{u2, u3} m (Monad.toApplicative.{u2, u3} m _inst_1)) PUnit.{succ u2} PUnit.unit.{succ u2}))
 Case conversion may be inaccurate. Consider using '#align list.mmap_with_index'_eq_mmap_with_index List.mapIdxM'_eq_mapIdxMₓ'. -/
 theorem mapIdxM'_eq_mapIdxM {α} (f : ℕ → α → m PUnit) (as : List α) :
     mapIdxM' f as = mapIdxM f as *> pure PUnit.unit := by
Diff
@@ -162,7 +162,7 @@ theorem foldrIdx_eq_foldrIdxSpec (f : ℕ → α → β → β) (start b as) :
 
 /- warning: list.foldr_with_index_eq_foldr_enum -> List.foldrIdx_eq_foldr_enum is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> β) (b : β) (as : List.{u1} α), Eq.{succ u2} β (List.foldrIdx.{u1, u2} α β f b as) (List.foldr.{u1, u2} (Prod.{0, u1} Nat α) β (Function.uncurry.{0, u1, u2} Nat α (β -> β) f) b (List.enum.{u1} α as))
+  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> β) (b : β) (as : List.{u1} α), Eq.{succ u2} β (List.foldrIdx.{u1, succ u2} α β f b as) (List.foldr.{u1, u2} (Prod.{0, u1} Nat α) β (Function.uncurry.{0, u1, u2} Nat α (β -> β) f) b (List.enum.{u1} α as))
 but is expected to have type
   forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> β) (b : β) (as : List.{u1} α), Eq.{succ u2} β (List.foldrIdx.{u1, succ u2} α β f b as (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (List.foldr.{u1, u2} (Prod.{0, u1} Nat α) β (Function.uncurry.{0, u1, u2} Nat α (β -> β) f) b (List.enum.{u1} α as))
 Case conversion may be inaccurate. Consider using '#align list.foldr_with_index_eq_foldr_enum List.foldrIdx_eq_foldr_enumₓ'. -/
@@ -211,7 +211,7 @@ theorem foldlIdx_eq_foldlIdxSpec (f : ℕ → α → β → α) (start a bs) :
 
 /- warning: list.foldl_with_index_eq_foldl_enum -> List.foldlIdx_eq_foldl_enum is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> α) (a : α) (bs : List.{u2} β), Eq.{succ u1} α (List.foldlIdx.{u1, u2} α β f a bs) (List.foldl.{u1, u2} α (Prod.{0, u2} Nat β) (fun (a : α) (p : Prod.{0, u2} Nat β) => f (Prod.fst.{0, u2} Nat β p) a (Prod.snd.{0, u2} Nat β p)) a (List.enum.{u2} β bs))
+  forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> α) (a : α) (bs : List.{u2} β), Eq.{succ u1} α (List.foldlIdx.{succ u1, u2} α β f a bs) (List.foldl.{u1, u2} α (Prod.{0, u2} Nat β) (fun (a : α) (p : Prod.{0, u2} Nat β) => f (Prod.fst.{0, u2} Nat β p) a (Prod.snd.{0, u2} Nat β p)) a (List.enum.{u2} β bs))
 but is expected to have type
   forall {α : Type.{u1}} {β : Type.{u2}} (f : Nat -> α -> β -> α) (a : α) (bs : List.{u2} β), Eq.{succ u1} α (List.foldlIdx.{succ u1, u2} α β f a bs (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (List.foldl.{u1, u2} α (Prod.{0, u2} Nat β) (fun (a : α) (p : Prod.{0, u2} Nat β) => f (Prod.fst.{0, u2} Nat β p) a (Prod.snd.{0, u2} Nat β p)) a (List.enum.{u2} β bs))
 Case conversion may be inaccurate. Consider using '#align list.foldl_with_index_eq_foldl_enum List.foldlIdx_eq_foldl_enumₓ'. -/

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 1 (#12338)

A PR accompanying #12339.

Zulip discussion

Diff
@@ -77,8 +77,14 @@ protected theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (
   generalize e : (l₁ ++ l₂).length = len
   revert n l₁ l₂
   induction' len with len ih <;> intros n l₁ l₂ h
-  · have l₁_nil : l₁ = [] := by cases l₁; rfl; contradiction
-    have l₂_nil : l₂ = [] := by cases l₂; rfl; rw [List.length_append] at h; contradiction
+  · have l₁_nil : l₁ = [] := by
+      cases l₁
+      · rfl
+      · contradiction
+    have l₂_nil : l₂ = [] := by
+      cases l₂
+      · rfl
+      · rw [List.length_append] at h; contradiction
     simp only [l₁_nil, l₂_nil]; rfl
   · cases' l₁ with head tail
     · rfl
@@ -105,8 +111,14 @@ theorem mapIdxGo_append : ∀ (f : ℕ → α → β) (l₁ l₂ : List α) (arr
   generalize e : (l₁ ++ l₂).length = len
   revert l₁ l₂ arr
   induction' len with len ih <;> intros l₁ l₂ arr h
-  · have l₁_nil : l₁ = [] := by cases l₁; rfl; contradiction
-    have l₂_nil : l₂ = [] := by cases l₂; rfl; rw [List.length_append] at h; contradiction
+  · have l₁_nil : l₁ = [] := by
+      cases l₁
+      · rfl
+      · contradiction
+    have l₂_nil : l₂ = [] := by
+      cases l₂
+      · rfl
+      · rw [List.length_append] at h; contradiction
     rw [l₁_nil, l₂_nil]; simp only [mapIdx.go, Array.toList_eq, Array.toArray_data]
   · cases' l₁ with head tail <;> simp only [mapIdx.go]
     · simp only [nil_append, Array.toList_eq, Array.toArray_data]
@@ -149,17 +161,20 @@ theorem map_enumFrom_eq_zipWith : ∀ (l : List α) (n : ℕ) (f : ℕ → α 
   generalize e : l.length = len
   revert l
   induction' len with len ih <;> intros l e n f
-  · have : l = [] := by cases l; rfl; contradiction
+  · have : l = [] := by
+      cases l
+      · rfl
+      · contradiction
     rw [this]; rfl
   · cases' l with head tail
     · contradiction
     · simp only [map, uncurry_apply_pair, range_succ_eq_map, zipWith, zero_add, zipWith_map_left]
       rw [ih]
-      suffices (fun i ↦ f (i + (n + 1))) = ((fun i ↦ f (i + n)) ∘ Nat.succ) by
-        rw [this]
-        rfl
-      funext n' a
-      simp only [comp, Nat.add_assoc, Nat.add_comm, Nat.add_succ]
+      · suffices (fun i ↦ f (i + (n + 1))) = ((fun i ↦ f (i + n)) ∘ Nat.succ) by
+          rw [this]
+          rfl
+        funext n' a
+        simp only [comp, Nat.add_assoc, Nat.add_comm, Nat.add_succ]
       simp only [length_cons, Nat.succ.injEq] at e; exact e
 
 theorem mapIdx_eq_enum_map (l : List α) (f : ℕ → α → β) :
@@ -386,7 +401,10 @@ theorem mapIdxMGo_eq_mapIdxMAuxSpec {α β} (f : ℕ → α → m β) (arr : Arr
   generalize e : as.length = len
   revert as arr
   induction' len with len ih <;> intro arr as h
-  · have : as = [] := by cases as; rfl; contradiction
+  · have : as = [] := by
+      cases as
+      · rfl
+      · contradiction
     simp only [this, mapIdxM.go, mapIdxMAuxSpec, List.traverse, map_pure, append_nil]
   · match as with
     | nil => contradiction
chore(Data/List): add dates to all deprecated lemmas (#12337)

Most of them go back to the port.

Diff
@@ -196,7 +196,7 @@ theorem length_mapIdx {α β} (l : List α) (f : ℕ → α → β) : (l.mapIdx
 theorem mapIdx_eq_nil {α β} {f : ℕ → α → β} {l : List α} : List.mapIdx f l = [] ↔ l = [] := by
   rw [List.mapIdx_eq_enum_map, List.map_eq_nil, List.enum_eq_nil]
 
-@[simp, deprecated]
+@[simp, deprecated] -- 2023-02-11
 theorem nthLe_mapIdx {α β} (l : List α) (f : ℕ → α → β) (i : ℕ) (h : i < l.length)
     (h' : i < (l.mapIdx f).length := h.trans_le (l.length_mapIdx f).ge) :
     (l.mapIdx f).nthLe i h' = f i (l.nthLe i h) := by
chore(*): drop porting notes about List.nthLeList.get (#12203)
Diff
@@ -203,12 +203,11 @@ theorem nthLe_mapIdx {α β} (l : List α) (f : ℕ → α → β) (i : ℕ) (h
   simp [mapIdx_eq_enum_map, enum_eq_zip_range]
 #align list.nth_le_map_with_index List.nthLe_mapIdx
 
--- Porting note: Changed the type to use `List.get` instead of deprecated `List.nthLe`.
 theorem mapIdx_eq_ofFn {α β} (l : List α) (f : ℕ → α → β) :
     l.mapIdx f = ofFn fun i : Fin l.length ↦ f (i : ℕ) (l.get i) := by
-  induction' l with hd tl IH generalizing f
-  · rfl
-  · simp [IH]
+  induction l generalizing f with
+  | nil => rfl
+  | cons _ _ IH => simp [IH]
 #align list.map_with_index_eq_of_fn List.mapIdx_eq_ofFn
 
 end MapIdx
feat: findIdx lemmas (#11808)

Split from #9781.

Diff
@@ -253,6 +253,73 @@ theorem findIdxs_eq_map_indexesValues (p : α → Prop) [DecidablePred p] (as :
     Bool.cond_decide]
 #align list.find_indexes_eq_map_indexes_values List.findIdxs_eq_map_indexesValues
 
+section FindIdx -- TODO: upstream to Std
+
+theorem findIdx_eq_length {p : α → Bool} {xs : List α} :
+    xs.findIdx p = xs.length ↔ ∀ x ∈ xs, ¬p x := by
+  induction xs with
+  | nil => simp_all
+  | cons x xs ih =>
+    rw [findIdx_cons, length_cons]
+    constructor <;> intro h
+    · have : ¬p x := by contrapose h; simp_all
+      simp_all
+    · simp_rw [h x (mem_cons_self x xs), cond_false, Nat.succ.injEq, ih]
+      exact fun y hy ↦ h y <| mem_cons.mpr (Or.inr hy)
+
+theorem findIdx_le_length (p : α → Bool) {xs : List α} : xs.findIdx p ≤ xs.length := by
+  by_cases e : ∃ x ∈ xs, p x
+  · exact (findIdx_lt_length_of_exists e).le
+  · push_neg at e; exact (findIdx_eq_length.mpr e).le
+
+theorem findIdx_lt_length {p : α → Bool} {xs : List α} :
+    xs.findIdx p < xs.length ↔ ∃ x ∈ xs, p x := by
+  rw [← not_iff_not, not_lt]
+  have := @le_antisymm_iff _ _ (xs.findIdx p) xs.length
+  simp only [findIdx_le_length, true_and] at this
+  rw [← this, findIdx_eq_length, not_exists]
+  simp only [Bool.not_eq_true, not_and]
+
+/-- `p` does not hold for elements with indices less than `xs.findIdx p`. -/
+theorem not_of_lt_findIdx {p : α → Bool} {xs : List α} {i : ℕ} (h : i < xs.findIdx p) :
+    ¬p (xs.get ⟨i, h.trans_le (findIdx_le_length p)⟩) := by
+  revert i
+  induction xs with
+  | nil => intro i h; rw [findIdx_nil] at h; omega
+  | cons x xs ih =>
+    intro i h
+    have ho := h
+    rw [findIdx_cons] at h
+    have npx : ¬p x := by by_contra y; rw [y, cond_true] at h; omega
+    simp_rw [npx, cond_false] at h
+    cases' i.eq_zero_or_pos with e e
+    · simpa only [e, Fin.zero_eta, get_cons_zero]
+    · have ipm := Nat.succ_pred_eq_of_pos e
+      have ilt := ho.trans_le (findIdx_le_length p)
+      rw [(Fin.mk_eq_mk (h' := ipm ▸ ilt)).mpr ipm.symm, get_cons_succ]
+      rw [← ipm, Nat.succ_lt_succ_iff] at h
+      exact ih h
+
+theorem le_findIdx_of_not {p : α → Bool} {xs : List α} {i : ℕ} (h : i < xs.length)
+    (h2 : ∀ j (hji : j < i), ¬p (xs.get ⟨j, hji.trans h⟩)) : i ≤ xs.findIdx p := by
+  by_contra! f
+  exact absurd (@findIdx_get _ p xs (f.trans h)) (h2 (xs.findIdx p) f)
+
+theorem lt_findIdx_of_not {p : α → Bool} {xs : List α} {i : ℕ} (h : i < xs.length)
+    (h2 : ∀ j (hji : j ≤ i), ¬p (xs.get ⟨j, hji.trans_lt h⟩)) : i < xs.findIdx p := by
+  by_contra! f
+  exact absurd (@findIdx_get _ p xs (f.trans_lt h)) (h2 (xs.findIdx p) f)
+
+theorem findIdx_eq {p : α → Bool} {xs : List α} {i : ℕ} (h : i < xs.length) :
+    xs.findIdx p = i ↔ p (xs.get ⟨i, h⟩) ∧ ∀ j (hji : j < i), ¬p (xs.get ⟨j, hji.trans h⟩) := by
+  refine' ⟨fun f ↦ ⟨f ▸ (@findIdx_get _ p xs (f ▸ h)), fun _ hji ↦ not_of_lt_findIdx (f ▸ hji)⟩,
+    fun ⟨h1, h2⟩ ↦ _⟩
+  apply Nat.le_antisymm _ (le_findIdx_of_not h h2)
+  contrapose! h1
+  exact not_of_lt_findIdx h1
+
+end FindIdx
+
 section FoldlIdx
 
 -- Porting note: Changed argument order of `foldlIdxSpec` to align better with `foldlIdx`.
chore: classify new theorem / theorem porting notes (#11432)

Classifies by adding issue number #10756 to porting notes claiming anything equivalent to:

  • "added theorem"
  • "added theorems"
  • "new theorem"
  • "new theorems"
  • "added lemma"
  • "new lemma"
  • "new lemmas"
Diff
@@ -42,7 +42,7 @@ theorem mapIdx_nil {α β} (f : ℕ → α → β) : mapIdx f [] = [] :=
   rfl
 #align list.map_with_index_nil List.mapIdx_nil
 
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 protected theorem oldMapIdxCore_eq (l : List α) (f : ℕ → α → β) (n : ℕ) :
     l.oldMapIdxCore f n = l.oldMapIdx fun i a ↦ f (i + n) a := by
   induction' l with hd tl hl generalizing f n
@@ -56,7 +56,7 @@ protected theorem oldMapIdxCore_eq (l : List α) (f : ℕ → α → β) (n : 
 --   1. Prove that `oldMapIdxCore f (l ++ [e]) = oldMapIdxCore f l ++ [f l.length e]`
 --   2. Prove that `oldMapIdx f (l ++ [e]) = oldMapIdx f l ++ [f l.length e]`
 --   3. Prove list induction using `∀ l e, p [] → (p l → p (l ++ [e])) → p l`
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 theorem list_reverse_induction (p : List α → Prop) (base : p [])
     (ind : ∀ (l : List α) (e : α), p l → p (l ++ [e])) : (∀ (l : List α), p l) := by
   let q := fun l ↦ p (reverse l)
@@ -69,7 +69,7 @@ theorem list_reverse_induction (p : List α → Prop) (base : p [])
   · apply pq; simp only [reverse_nil, base]
   · apply pq; simp only [reverse_cons]; apply ind; apply qp; rw [reverse_reverse]; exact ih
 
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 protected theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (l₁ l₂ : List α),
     List.oldMapIdxCore f n (l₁ ++ l₂) =
     List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂ := by
@@ -90,7 +90,7 @@ protected theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (
         simp only [length_append, h]
       rw [Nat.add_assoc]; simp only [Nat.add_comm]
 
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 protected theorem oldMapIdx_append : ∀ (f : ℕ → α → β) (l : List α) (e : α),
     List.oldMapIdx f (l ++ [e]) = List.oldMapIdx f l ++ [f l.length e] := by
   intros f l e
@@ -98,7 +98,7 @@ protected theorem oldMapIdx_append : ∀ (f : ℕ → α → β) (l : List α) (
   rw [List.oldMapIdxCore_append f 0 l [e]]
   simp only [zero_add, append_cancel_left_eq]; rfl
 
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 theorem mapIdxGo_append : ∀ (f : ℕ → α → β) (l₁ l₂ : List α) (arr : Array β),
     mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (List.toArray (mapIdx.go f l₁ arr)) := by
   intros f l₁ l₂ arr
@@ -115,7 +115,7 @@ theorem mapIdxGo_append : ∀ (f : ℕ → α → β) (l₁ l₂ : List α) (arr
       · simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
         simp only [length_append, h]
 
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 theorem mapIdxGo_length : ∀ (f : ℕ → α → β) (l : List α) (arr : Array β),
     length (mapIdx.go f l arr) = length l + arr.size := by
   intro f l
@@ -124,7 +124,7 @@ theorem mapIdxGo_length : ∀ (f : ℕ → α → β) (l : List α) (arr : Array
   · intro; simp only [mapIdx.go]; rw [ih]; simp only [Array.size_push, length_cons];
     simp only [Nat.add_succ, add_zero, Nat.add_comm]
 
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 theorem mapIdx_append_one : ∀ (f : ℕ → α → β) (l : List α) (e : α),
     mapIdx f (l ++ [e]) = mapIdx f l ++ [f l.length e] := by
   intros f l e
@@ -133,7 +133,7 @@ theorem mapIdx_append_one : ∀ (f : ℕ → α → β) (l : List α) (e : α),
   simp only [mapIdx.go, Array.size_toArray, mapIdxGo_length, length_nil, add_zero, Array.toList_eq,
     Array.push_data, Array.data_toArray]
 
--- Porting note: new theorem.
+-- Porting note (#10756): new theorem.
 protected theorem new_def_eq_old_def :
     ∀ (f : ℕ → α → β) (l : List α), l.mapIdx f = List.oldMapIdx f l := by
   intro f
chore: prepare Lean version bump with explicit simp (#10999)

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

Diff
@@ -60,8 +60,8 @@ protected theorem oldMapIdxCore_eq (l : List α) (f : ℕ → α → β) (n : 
 theorem list_reverse_induction (p : List α → Prop) (base : p [])
     (ind : ∀ (l : List α) (e : α), p l → p (l ++ [e])) : (∀ (l : List α), p l) := by
   let q := fun l ↦ p (reverse l)
-  have pq : ∀ l, p (reverse l) → q l := by simp only [reverse_reverse]; intro; exact id
-  have qp : ∀ l, q (reverse l) → p l := by simp only [reverse_reverse]; intro; exact id
+  have pq : ∀ l, p (reverse l) → q l := by simp only [q, reverse_reverse]; intro; exact id
+  have qp : ∀ l, q (reverse l) → p l := by simp only [q, reverse_reverse]; intro; exact id
   intro l
   apply qp
   generalize (reverse l) = l
feat: add List.enum_eq_nil and List.mapIdx_eq_nil (#8493)

Adds List.enum_eq_nil and List.mapIdx_eq_nil. These are analogous to List.map_eq_nil.

Diff
@@ -192,6 +192,10 @@ theorem length_mapIdx {α β} (l : List α) (f : ℕ → α → β) : (l.mapIdx
   · simp [IH]
 #align list.length_map_with_index List.length_mapIdx
 
+@[simp]
+theorem mapIdx_eq_nil {α β} {f : ℕ → α → β} {l : List α} : List.mapIdx f l = [] ↔ l = [] := by
+  rw [List.mapIdx_eq_enum_map, List.map_eq_nil, List.enum_eq_nil]
+
 @[simp, deprecated]
 theorem nthLe_mapIdx {α β} (l : List α) (f : ℕ → α → β) (i : ℕ) (h : i < l.length)
     (h' : i < (l.mapIdx f).length := h.trans_le (l.length_mapIdx f).ge) :
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
@@ -238,13 +238,15 @@ end FoldrIdx
 
 theorem indexesValues_eq_filter_enum (p : α → Prop) [DecidablePred p] (as : List α) :
     indexesValues p as = filter (p ∘ Prod.snd) (enum as) := by
-  simp [indexesValues, foldrIdx_eq_foldr_enum, uncurry, filter_eq_foldr]
+  simp (config := { unfoldPartialApp := true }) [indexesValues, foldrIdx_eq_foldr_enum, uncurry,
+    filter_eq_foldr]
 #align list.indexes_values_eq_filter_enum List.indexesValues_eq_filter_enum
 
 theorem findIdxs_eq_map_indexesValues (p : α → Prop) [DecidablePred p] (as : List α) :
     findIdxs p as = map Prod.fst (indexesValues p as) := by
-  simp only [indexesValues_eq_filter_enum, map_filter_eq_foldr, findIdxs, uncurry,
-    foldrIdx_eq_foldr_enum, decide_eq_true_eq, comp_apply, Bool.cond_decide]
+  simp (config := { unfoldPartialApp := true }) only [indexesValues_eq_filter_enum,
+    map_filter_eq_foldr, findIdxs, uncurry, foldrIdx_eq_foldr_enum, decide_eq_true_eq, comp_apply,
+    Bool.cond_decide]
 #align list.find_indexes_eq_map_indexes_values List.findIdxs_eq_map_indexesValues
 
 section FoldlIdx
@@ -281,7 +283,8 @@ variable {m : Type u → Type v} [Monad m]
 
 theorem foldrIdxM_eq_foldrM_enum {α β} (f : ℕ → α → β → m β) (b : β) (as : List α) [LawfulMonad m] :
     foldrIdxM f b as = foldrM (uncurry f) b (enum as) := by
-  simp only [foldrIdxM, foldrM_eq_foldr, foldrIdx_eq_foldr_enum, uncurry]
+  simp (config := { unfoldPartialApp := true }) only [foldrIdxM, foldrM_eq_foldr,
+    foldrIdx_eq_foldr_enum, uncurry]
 #align list.mfoldr_with_index_eq_mfoldr_enum List.foldrIdxM_eq_foldrM_enum
 
 theorem foldlIdxM_eq_foldlM_enum [LawfulMonad m] {α β} (f : ℕ → β → α → m β) (b : β) (as : List α) :
chore: bump std (#7694)

Some deleted lemmas have been upstreamed to Std.

Note that the statements of List.zipWith_map_left (and _right) have been changed, requiring slight changes here.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>

Diff
@@ -157,6 +157,7 @@ theorem map_enumFrom_eq_zipWith : ∀ (l : List α) (n : ℕ) (f : ℕ → α 
       rw [ih]
       suffices (fun i ↦ f (i + (n + 1))) = ((fun i ↦ f (i + n)) ∘ Nat.succ) by
         rw [this]
+        rfl
       funext n' a
       simp only [comp, Nat.add_assoc, Nat.add_comm, Nat.add_succ]
       simp only [length_cons, Nat.succ.injEq] at e; exact e
@@ -175,7 +176,6 @@ theorem mapIdx_cons {α β} (l : List α) (f : ℕ → α → β) (a : α) :
     mapIdx f (a :: l) = f 0 a :: mapIdx (fun i ↦ f (i + 1)) l := by
   simp [mapIdx_eq_enum_map, enum_eq_zip_range, map_uncurry_zip_eq_zipWith,
     range_succ_eq_map, zipWith_map_left]
-  rfl
 #align list.map_with_index_cons List.mapIdx_cons
 
 theorem mapIdx_append {α} (K L : List α) (f : ℕ → α → β) :
chore: bump to std#260 (#7134)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Alex Keizer <alex@keizer.dev>

Diff
@@ -167,7 +167,7 @@ theorem mapIdx_eq_enum_map (l : List α) (f : ℕ → α → β) :
   induction' l with hd tl hl generalizing f
   · rfl
   · rw [List.oldMapIdx, List.oldMapIdxCore, List.oldMapIdxCore_eq, hl]
-    simp [enum_eq_zip_range, map_uncurry_zip_eq_zipWith]
+    simp [map, enum_eq_zip_range, map_uncurry_zip_eq_zipWith]
 #align list.map_with_index_eq_enum_map List.mapIdx_eq_enum_map
 
 @[simp]
@@ -175,6 +175,7 @@ theorem mapIdx_cons {α β} (l : List α) (f : ℕ → α → β) (a : α) :
     mapIdx f (a :: l) = f 0 a :: mapIdx (fun i ↦ f (i + 1)) l := by
   simp [mapIdx_eq_enum_map, enum_eq_zip_range, map_uncurry_zip_eq_zipWith,
     range_succ_eq_map, zipWith_map_left]
+  rfl
 #align list.map_with_index_cons List.mapIdx_cons
 
 theorem mapIdx_append {α} (K L : List α) (f : ℕ → α → β) :
chore: avoid lean3 style have/suffices (#6964)

Many proofs use the "stream of consciousness" style from Lean 3, rather than have ... := or suffices ... from/by.

This PR updates a fraction of these to the preferred Lean 4 style.

I think a good goal would be to delete the "deferred" versions of have, suffices, and let at the bottom of Mathlib.Tactic.Have

(Anyone who would like to contribute more cleanup is welcome to push directly to this branch.)

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

Diff
@@ -83,12 +83,12 @@ protected theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (
   · cases' l₁ with head tail
     · rfl
     · simp only [List.oldMapIdxCore, List.append_eq, length_cons, cons_append,cons.injEq, true_and]
-      suffices : n + Nat.succ (length tail) = n + 1 + tail.length
-      { rw [this]
+      suffices n + Nat.succ (length tail) = n + 1 + tail.length by
+        rw [this]
         apply ih (n + 1) _ _ _
         simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
-        simp only [length_append, h] }
-      { rw [Nat.add_assoc]; simp only [Nat.add_comm] }
+        simp only [length_append, h]
+      rw [Nat.add_assoc]; simp only [Nat.add_comm]
 
 -- Porting note: new theorem.
 protected theorem oldMapIdx_append : ∀ (f : ℕ → α → β) (l : List α) (e : α),
@@ -155,8 +155,8 @@ theorem map_enumFrom_eq_zipWith : ∀ (l : List α) (n : ℕ) (f : ℕ → α 
     · contradiction
     · simp only [map, uncurry_apply_pair, range_succ_eq_map, zipWith, zero_add, zipWith_map_left]
       rw [ih]
-      suffices : (fun i ↦ f (i + (n + 1))) = ((fun i ↦ f (i + n)) ∘ Nat.succ)
-      rw [this]
+      suffices (fun i ↦ f (i + (n + 1))) = ((fun i ↦ f (i + n)) ∘ Nat.succ) by
+        rw [this]
       funext n' a
       simp only [comp, Nat.add_assoc, Nat.add_comm, Nat.add_succ]
       simp only [length_cons, Nat.succ.injEq] at e; exact e
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,15 +2,12 @@
 Copyright (c) 2020 Jannis Limperg. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jannis Limperg
-
-! This file was ported from Lean 3 source module data.list.indexes
-! leanprover-community/mathlib commit 8631e2d5ea77f6c13054d9151d82b83069680cb1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.List.OfFn
 import Mathlib.Data.List.Range
 
+#align_import data.list.indexes from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
+
 /-!
 # Lemmas about List.*Idx functions.
 
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -153,7 +153,7 @@ theorem map_enumFrom_eq_zipWith : ∀ (l : List α) (n : ℕ) (f : ℕ → α 
   revert l
   induction' len with len ih <;> intros l e n f
   · have : l = [] := by cases l; rfl; contradiction
-    rw [this] ; rfl
+    rw [this]; rfl
   · cases' l with head tail
     · contradiction
     · simp only [map, uncurry_apply_pair, range_succ_eq_map, zipWith, zero_add, zipWith_map_left]
feat: port Data.List.Indexes (#1812)

Co-authored-by: casavaca <96765450+casavaca@users.noreply.github.com>

Dependencies 2 + 128

129 files ported (98.5%)
60287 lines ported (99.8%)
Show graph

The unported dependencies are