data.list.to_finsuppMathlib.Data.List.ToFinsupp

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -82,7 +82,7 @@ theorem toFinsupp_support :
 
 #print List.toFinsupp_apply_lt' /-
 theorem toFinsupp_apply_lt' (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn :=
-  getD_eq_nthLe _ _ _
+  getD_eq_get _ _ _
 #align list.to_finsupp_apply_lt List.toFinsupp_apply_lt'
 -/
 
Diff
@@ -177,6 +177,8 @@ theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
   · simp only [enum_append, map, enum_from_singleton, map_append, sum_append, sum_cons, sum_nil,
       add_zero]
     classical
+    convert to_finsupp_concat_eq_to_finsupp_add_single _ _
+    exact IH.symm
 #align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_single
 -/
 
Diff
@@ -177,8 +177,6 @@ theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
   · simp only [enum_append, map, enum_from_singleton, map_append, sum_append, sum_cons, sum_nil,
       add_zero]
     classical
-    convert to_finsupp_concat_eq_to_finsupp_add_single _ _
-    exact IH.symm
 #align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_single
 -/
 
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Yakov Pechersky. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yakov Pechersky
 -/
-import Mathbin.Data.Finsupp.Basic
+import Data.Finsupp.Basic
 
 #align_import data.list.to_finsupp from "leanprover-community/mathlib"@"25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e"
 
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2022 Yakov Pechersky. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yakov Pechersky
-
-! This file was ported from Lean 3 source module data.list.to_finsupp
-! leanprover-community/mathlib commit 25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Finsupp.Basic
 
+#align_import data.list.to_finsupp from "leanprover-community/mathlib"@"25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e"
+
 /-!
 
 # Lists as finsupp
Diff
@@ -132,6 +132,7 @@ theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print List.toFinsupp_cons_eq_single_add_embDomain /-
 theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
     [DecidablePred fun i => getD (x::xs) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] :
     toFinsupp (x::xs) =
@@ -148,7 +149,9 @@ theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x
     rw [finsupp.single_apply_eq_zero.mpr, zero_add, hi, Finsupp.embDomain_apply]
     simp
 #align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomain
+-/
 
+#print List.toFinsupp_concat_eq_toFinsupp_add_single /-
 theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
     [DecidablePred fun i => getD (xs ++ [x]) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] :
     toFinsupp (xs ++ [x]) = toFinsupp xs + Finsupp.single xs.length x :=
@@ -165,7 +168,9 @@ theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (
   · rw [to_finsupp_apply_lt _ _ hi, to_finsupp_apply_lt, if_neg hi.ne', add_zero, nth_le_append]
     simpa using Nat.lt_succ_of_lt hi
 #align list.to_finsupp_concat_eq_to_finsupp_add_single List.toFinsupp_concat_eq_toFinsupp_add_single
+-/
 
+#print List.toFinsupp_eq_sum_map_enum_single /-
 theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
     [DecidablePred fun i => getD l i 0 ≠ 0] :
     toFinsupp l = (l.enum.map fun nr : ℕ × R => Finsupp.single nr.1 nr.2).Sum :=
@@ -178,6 +183,7 @@ theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
     convert to_finsupp_concat_eq_to_finsupp_add_single _ _
     exact IH.symm
 #align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_single
+-/
 
 end List
 
Diff
@@ -175,8 +175,8 @@ theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
   · simp only [enum_append, map, enum_from_singleton, map_append, sum_append, sum_cons, sum_nil,
       add_zero]
     classical
-      convert to_finsupp_concat_eq_to_finsupp_add_single _ _
-      exact IH.symm
+    convert to_finsupp_concat_eq_to_finsupp_add_single _ _
+    exact IH.symm
 #align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_single
 
 end List
Diff
@@ -130,12 +130,6 @@ theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
 #align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ
 -/
 
-/- warning: list.to_finsupp_cons_eq_single_add_emb_domain -> List.toFinsupp_cons_eq_single_add_embDomain is a dubious translation:
-lean 3 declaration is
-  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (List.cons.{u1} R x xs) i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) (List.cons.{u1} R x xs) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3) (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) x) (Finsupp.embDomain.{0, 0, u1} Nat Nat R (AddZeroClass.toHasZero.{u1} R _inst_3) (Function.Embedding.mk.{1, 1} Nat Nat Nat.succ Nat.succ_injective) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a))))
-but is expected to have type
-  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (List.cons.{u1} R x xs) i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) (List.cons.{u1} R x xs) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) x) (Finsupp.embDomain.{0, 0, u1} Nat Nat R (AddZeroClass.toZero.{u1} R _inst_3) (Function.Embedding.mk.{1, 1} Nat Nat Nat.succ Nat.succ_injective) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a))))
-Case conversion may be inaccurate. Consider using '#align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomainₓ'. -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
@@ -155,12 +149,6 @@ theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x
     simp
 #align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomain
 
-/- warning: list.to_finsupp_concat_eq_to_finsupp_add_single -> List.toFinsupp_concat_eq_toFinsupp_add_single is a dubious translation:
-lean 3 declaration is
-  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (Append.append.{u1} (List.{u1} R) (List.hasAppend.{u1} R) xs (List.cons.{u1} R x (List.nil.{u1} R))) i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) (Append.append.{u1} (List.{u1} R) (List.hasAppend.{u1} R) xs (List.cons.{u1} R x (List.nil.{u1} R))) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3) (List.length.{u1} R xs) x))
-but is expected to have type
-  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (HAppend.hAppend.{u1, u1, u1} (List.{u1} R) (List.{u1} R) (List.{u1} R) (instHAppend.{u1} (List.{u1} R) (List.instAppendList.{u1} R)) xs (List.cons.{u1} R x (List.nil.{u1} R))) i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) (HAppend.hAppend.{u1, u1, u1} (List.{u1} R) (List.{u1} R) (List.{u1} R) (instHAppend.{u1} (List.{u1} R) (List.instAppendList.{u1} R)) xs (List.cons.{u1} R x (List.nil.{u1} R))) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3) (List.length.{u1} R xs) x))
-Case conversion may be inaccurate. Consider using '#align list.to_finsupp_concat_eq_to_finsupp_add_single List.toFinsupp_concat_eq_toFinsupp_add_singleₓ'. -/
 theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
     [DecidablePred fun i => getD (xs ++ [x]) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] :
     toFinsupp (xs ++ [x]) = toFinsupp xs + Finsupp.single xs.length x :=
@@ -178,12 +166,6 @@ theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (
     simpa using Nat.lt_succ_of_lt hi
 #align list.to_finsupp_concat_eq_to_finsupp_add_single List.toFinsupp_concat_eq_toFinsupp_add_single
 
-/- warning: list.to_finsupp_eq_sum_map_enum_single -> List.toFinsupp_eq_sum_map_enum_single is a dubious translation:
-lean 3 declaration is
-  forall {R : Type.{u1}} [_inst_3 : AddMonoid.{u1} R] (l : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R l i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3)))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) l (fun (a : Nat) => _inst_4 a)) (List.sum.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (Finsupp.add.{0, u1} Nat R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) (Finsupp.zero.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (List.map.{u1, u1} (Prod.{0, u1} Nat R) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (fun (nr : Prod.{0, u1} Nat R) => Finsupp.single.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) (Prod.fst.{0, u1} Nat R nr) (Prod.snd.{0, u1} Nat R nr)) (List.enum.{u1} R l)))
-but is expected to have type
-  forall {R : Type.{u1}} [_inst_3 : AddMonoid.{u1} R] (l : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R l i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddMonoid.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddMonoid.toZero.{u1} R _inst_3))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddMonoid.toZero.{u1} R _inst_3) l (fun (a : Nat) => _inst_4 a)) (List.sum.{u1} (Finsupp.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) (Finsupp.zero.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (List.map.{u1, u1} (Prod.{0, u1} Nat R) (Finsupp.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (fun (nr : Prod.{0, u1} Nat R) => Finsupp.single.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3) (Prod.fst.{0, u1} Nat R nr) (Prod.snd.{0, u1} Nat R nr)) (List.enum.{u1} R l)))
-Case conversion may be inaccurate. Consider using '#align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_singleₓ'. -/
 theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
     [DecidablePred fun i => getD l i 0 ≠ 0] :
     toFinsupp l = (l.enum.map fun nr : ℕ × R => Finsupp.single nr.1 nr.2).Sum :=
Diff
@@ -98,9 +98,7 @@ theorem toFinsupp_apply_le (hn : l.length ≤ n) : l.toFinsupp n = 0 :=
 #print List.toFinsupp_nil /-
 @[simp]
 theorem toFinsupp_nil [DecidablePred fun i => getD ([] : List M) i 0 ≠ 0] :
-    toFinsupp ([] : List M) = 0 := by
-  ext
-  simp
+    toFinsupp ([] : List M) = 0 := by ext; simp
 #align list.to_finsupp_nil List.toFinsupp_nil
 -/
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yakov Pechersky
 
 ! This file was ported from Lean 3 source module data.list.to_finsupp
-! leanprover-community/mathlib commit 06a655b5fcfbda03502f9158bbf6c0f1400886f9
+! leanprover-community/mathlib commit 25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.Data.Finsupp.Basic
 
 # Lists as finsupp
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 # Main definitions
 
 - `list.to_finsupp`: Interpret a list as a finitely supported function, where the indexing type
Diff
@@ -41,6 +41,7 @@ namespace List
 
 variable {M : Type _} [Zero M] (l : List M) [DecidablePred fun i => getD l i 0 ≠ 0] (n : ℕ)
 
+#print List.toFinsupp /-
 /-- Indexing into a `l : list M`, as a finitely-supported function,
 where the support are all the indices within the length of the list
 that index to a non-zero value. Indices beyond the end of the list are sent to 0.
@@ -56,59 +57,84 @@ def toFinsupp : ℕ →₀ M where
     contrapose!
     exact nthd_eq_default _ _
 #align list.to_finsupp List.toFinsupp
+-/
 
+#print List.coe_toFinsupp /-
 @[norm_cast]
 theorem coe_toFinsupp : (l.toFinsupp : ℕ → M) = fun i => l.getD i 0 :=
   rfl
 #align list.coe_to_finsupp List.coe_toFinsupp
+-/
 
+#print List.toFinsupp_apply /-
 @[simp, norm_cast]
 theorem toFinsupp_apply (i : ℕ) : (l.toFinsupp : ℕ → M) i = l.getD i 0 :=
   rfl
 #align list.to_finsupp_apply List.toFinsupp_apply
+-/
 
+#print List.toFinsupp_support /-
 theorem toFinsupp_support :
     l.toFinsupp.support = (Finset.range l.length).filterₓ fun i => getD l i 0 ≠ 0 :=
   rfl
 #align list.to_finsupp_support List.toFinsupp_support
+-/
 
-theorem toFinsupp_apply_lt (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn :=
+#print List.toFinsupp_apply_lt' /-
+theorem toFinsupp_apply_lt' (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn :=
   getD_eq_nthLe _ _ _
-#align list.to_finsupp_apply_lt List.toFinsupp_apply_lt
+#align list.to_finsupp_apply_lt List.toFinsupp_apply_lt'
+-/
 
+#print List.toFinsupp_apply_le /-
 theorem toFinsupp_apply_le (hn : l.length ≤ n) : l.toFinsupp n = 0 :=
   getD_eq_default _ _ hn
 #align list.to_finsupp_apply_le List.toFinsupp_apply_le
+-/
 
+#print List.toFinsupp_nil /-
 @[simp]
 theorem toFinsupp_nil [DecidablePred fun i => getD ([] : List M) i 0 ≠ 0] :
     toFinsupp ([] : List M) = 0 := by
   ext
   simp
 #align list.to_finsupp_nil List.toFinsupp_nil
+-/
 
+#print List.toFinsupp_singleton /-
 theorem toFinsupp_singleton (x : M) [DecidablePred fun i => getD [x] i 0 ≠ 0] :
     toFinsupp [x] = Finsupp.single 0 x := by
   ext ⟨_ | i⟩ <;> simp [Finsupp.single_apply, (Nat.zero_lt_succ _).Ne]
 #align list.to_finsupp_singleton List.toFinsupp_singleton
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print List.toFinsupp_cons_apply_zero /-
 @[simp]
 theorem toFinsupp_cons_apply_zero (x : M) (xs : List M)
     [DecidablePred fun i => getD (x::xs) i 0 ≠ 0] : (x::xs).toFinsupp 0 = x :=
   rfl
 #align list.to_finsupp_cons_apply_zero List.toFinsupp_cons_apply_zero
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print List.toFinsupp_cons_apply_succ /-
 @[simp]
 theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
     [DecidablePred fun i => getD (x::xs) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] :
     (x::xs).toFinsupp n.succ = xs.toFinsupp n :=
   rfl
 #align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ
+-/
 
+/- warning: list.to_finsupp_cons_eq_single_add_emb_domain -> List.toFinsupp_cons_eq_single_add_embDomain is a dubious translation:
+lean 3 declaration is
+  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (List.cons.{u1} R x xs) i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) (List.cons.{u1} R x xs) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3) (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) x) (Finsupp.embDomain.{0, 0, u1} Nat Nat R (AddZeroClass.toHasZero.{u1} R _inst_3) (Function.Embedding.mk.{1, 1} Nat Nat Nat.succ Nat.succ_injective) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a))))
+but is expected to have type
+  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (List.cons.{u1} R x xs) i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) (List.cons.{u1} R x xs) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) x) (Finsupp.embDomain.{0, 0, u1} Nat Nat R (AddZeroClass.toZero.{u1} R _inst_3) (Function.Embedding.mk.{1, 1} Nat Nat Nat.succ Nat.succ_injective) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a))))
+Case conversion may be inaccurate. Consider using '#align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomainₓ'. -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
@@ -128,6 +154,12 @@ theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x
     simp
 #align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomain
 
+/- warning: list.to_finsupp_concat_eq_to_finsupp_add_single -> List.toFinsupp_concat_eq_toFinsupp_add_single is a dubious translation:
+lean 3 declaration is
+  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (Append.append.{u1} (List.{u1} R) (List.hasAppend.{u1} R) xs (List.cons.{u1} R x (List.nil.{u1} R))) i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3)))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) (Append.append.{u1} (List.{u1} R) (List.hasAppend.{u1} R) xs (List.cons.{u1} R x (List.nil.{u1} R))) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R _inst_3) (List.length.{u1} R xs) x))
+but is expected to have type
+  forall {R : Type.{u1}} [_inst_3 : AddZeroClass.{u1} R] (x : R) (xs : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R (HAppend.hAppend.{u1, u1, u1} (List.{u1} R) (List.{u1} R) (List.{u1} R) (instHAppend.{u1} (List.{u1} R) (List.instAppendList.{u1} R)) xs (List.cons.{u1} R x (List.nil.{u1} R))) i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))] [_inst_5 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R xs i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddZeroClass.toZero.{u1} R _inst_3))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) (HAppend.hAppend.{u1, u1, u1} (List.{u1} R) (List.{u1} R) (List.{u1} R) (instHAppend.{u1} (List.{u1} R) (List.instAppendList.{u1} R)) xs (List.cons.{u1} R x (List.nil.{u1} R))) (fun (a : Nat) => _inst_4 a)) (HAdd.hAdd.{u1, u1, u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (instHAdd.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R _inst_3)) (List.toFinsupp.{u1} R (AddZeroClass.toZero.{u1} R _inst_3) xs (fun (a : Nat) => _inst_5 a)) (Finsupp.single.{0, u1} Nat R (AddZeroClass.toZero.{u1} R _inst_3) (List.length.{u1} R xs) x))
+Case conversion may be inaccurate. Consider using '#align list.to_finsupp_concat_eq_to_finsupp_add_single List.toFinsupp_concat_eq_toFinsupp_add_singleₓ'. -/
 theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
     [DecidablePred fun i => getD (xs ++ [x]) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] :
     toFinsupp (xs ++ [x]) = toFinsupp xs + Finsupp.single xs.length x :=
@@ -145,6 +177,12 @@ theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (
     simpa using Nat.lt_succ_of_lt hi
 #align list.to_finsupp_concat_eq_to_finsupp_add_single List.toFinsupp_concat_eq_toFinsupp_add_single
 
+/- warning: list.to_finsupp_eq_sum_map_enum_single -> List.toFinsupp_eq_sum_map_enum_single is a dubious translation:
+lean 3 declaration is
+  forall {R : Type.{u1}} [_inst_3 : AddMonoid.{u1} R] (l : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R l i (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3)))))) (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (List.toFinsupp.{u1} R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) l (fun (a : Nat) => _inst_4 a)) (List.sum.{u1} (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (Finsupp.add.{0, u1} Nat R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) (Finsupp.zero.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (List.map.{u1, u1} (Prod.{0, u1} Nat R) (Finsupp.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3))) (fun (nr : Prod.{0, u1} Nat R) => Finsupp.single.{0, u1} Nat R (AddZeroClass.toHasZero.{u1} R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) (Prod.fst.{0, u1} Nat R nr) (Prod.snd.{0, u1} Nat R nr)) (List.enum.{u1} R l)))
+but is expected to have type
+  forall {R : Type.{u1}} [_inst_3 : AddMonoid.{u1} R] (l : List.{u1} R) [_inst_4 : DecidablePred.{1} Nat (fun (i : Nat) => Ne.{succ u1} R (List.getD.{u1} R l i (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddMonoid.toZero.{u1} R _inst_3)))) (OfNat.ofNat.{u1} R 0 (Zero.toOfNat0.{u1} R (AddMonoid.toZero.{u1} R _inst_3))))], Eq.{succ u1} (Finsupp.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (List.toFinsupp.{u1} R (AddMonoid.toZero.{u1} R _inst_3) l (fun (a : Nat) => _inst_4 a)) (List.sum.{u1} (Finsupp.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (Finsupp.add.{0, u1} Nat R (AddMonoid.toAddZeroClass.{u1} R _inst_3)) (Finsupp.zero.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (List.map.{u1, u1} (Prod.{0, u1} Nat R) (Finsupp.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3)) (fun (nr : Prod.{0, u1} Nat R) => Finsupp.single.{0, u1} Nat R (AddMonoid.toZero.{u1} R _inst_3) (Prod.fst.{0, u1} Nat R nr) (Prod.snd.{0, u1} Nat R nr)) (List.enum.{u1} R l)))
+Case conversion may be inaccurate. Consider using '#align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_singleₓ'. -/
 theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
     [DecidablePred fun i => getD l i 0 ≠ 0] :
     toFinsupp l = (l.enum.map fun nr : ℕ × R => Finsupp.single nr.1 nr.2).Sum :=

Changes in mathlib4

mathlib3
mathlib4
chore(Data/List): add dates to all deprecated lemmas (#12337)

Most of them go back to the port.

Diff
@@ -73,7 +73,7 @@ theorem toFinsupp_apply_fin (n : Fin l.length) : l.toFinsupp n = l.get n :=
   getD_eq_get _ _ _
 
 set_option linter.deprecated false in
-@[deprecated]
+@[deprecated] -- 2023-04-10
 theorem toFinsupp_apply_lt' (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn :=
   getD_eq_get _ _ _
 #align list.to_finsupp_apply_lt List.toFinsupp_apply_lt'
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11801)
Diff
@@ -46,7 +46,7 @@ def toFinsupp : ℕ →₀ M where
   toFun i := getD l i 0
   support := (Finset.range l.length).filter fun i => getD l i 0 ≠ 0
   mem_support_toFun n := by
-    simp only [Ne.def, Finset.mem_filter, Finset.mem_range, and_iff_right_iff_imp]
+    simp only [Ne, Finset.mem_filter, Finset.mem_range, and_iff_right_iff_imp]
     contrapose!
     exact getD_eq_default _ _
 #align list.to_finsupp List.toFinsupp
feat: lemmas about List.reverseRecOn (#11257)

This renames the arguments to the eliminators to be more ergonomic when using the induction tactic.

I also changed the definition in an attempt to make the proof easier.

Diff
@@ -151,8 +151,8 @@ theorem toFinsupp_eq_sum_map_enum_single {R : Type*} [AddMonoid R] (l : List R)
   `[DecidablePred (getD l · 0 ≠ 0)]`, so we manually do some `revert`/`intro` as a workaround -/
   revert l; intro l
   induction l using List.reverseRecOn with
-  | H0 => exact toFinsupp_nil
-  | H1 x xs ih =>
+  | nil => exact toFinsupp_nil
+  | append_singleton x xs ih =>
     classical simp [toFinsupp_concat_eq_toFinsupp_add_single, enum_append, ih]
 #align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_single
 
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
@@ -107,7 +107,7 @@ theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
   rfl
 #align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ
 
--- Porting note: new theorem
+-- Porting note (#10756): new theorem
 theorem toFinsupp_append {R : Type*} [AddZeroClass R] (l₁ l₂ : List R)
     [DecidablePred (getD (l₁ ++ l₂) · 0 ≠ 0)] [DecidablePred (getD l₁ · 0 ≠ 0)]
     [DecidablePred (getD l₂ · 0 ≠ 0)] :
chore: classify todo porting notes (#11216)

Classifies by adding issue number #11215 to porting notes claiming "TODO".

Diff
@@ -147,7 +147,7 @@ theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type*} [AddZeroClass R] (x
 theorem toFinsupp_eq_sum_map_enum_single {R : Type*} [AddMonoid R] (l : List R)
     [DecidablePred (getD l · 0 ≠ 0)] :
     toFinsupp l = (l.enum.map fun nr : ℕ × R => Finsupp.single nr.1 nr.2).sum := by
-  /- porting note: todo: `induction` fails to substitute `l = []` in
+  /- Porting note (#11215): TODO: `induction` fails to substitute `l = []` in
   `[DecidablePred (getD l · 0 ≠ 0)]`, so we manually do some `revert`/`intro` as a workaround -/
   revert l; intro l
   induction l using List.reverseRecOn with
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -107,7 +107,7 @@ theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
   rfl
 #align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ
 
--- porting note: new theorem
+-- Porting note: new theorem
 theorem toFinsupp_append {R : Type*} [AddZeroClass R] (l₁ l₂ : List R)
     [DecidablePred (getD (l₁ ++ l₂) · 0 ≠ 0)] [DecidablePred (getD l₁ · 0 ≠ 0)]
     [DecidablePred (getD l₂ · 0 ≠ 0)] :
@@ -157,4 +157,3 @@ theorem toFinsupp_eq_sum_map_enum_single {R : Type*} [AddMonoid R] (l : List R)
 #align list.to_finsupp_eq_sum_map_enum_single List.toFinsupp_eq_sum_map_enum_single
 
 end List
-
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Yakov Pechersky. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yakov Pechersky
 -/
-import Mathlib.Data.Finsupp.Basic
+import Mathlib.Data.Finsupp.Defs
 
 #align_import data.list.to_finsupp from "leanprover-community/mathlib"@"06a655b5fcfbda03502f9158bbf6c0f1400886f9"
 
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
@@ -34,7 +34,7 @@ elements are beyond the dec-eq terms of casted values from `ℕ, ℤ, ℚ`.
 
 namespace List
 
-variable {M : Type _} [Zero M] (l : List M) [DecidablePred (getD l · 0 ≠ 0)] (n : ℕ)
+variable {M : Type*} [Zero M] (l : List M) [DecidablePred (getD l · 0 ≠ 0)] (n : ℕ)
 
 /-- Indexing into a `l : List M`, as a finitely-supported function,
 where the support are all the indices within the length of the list
@@ -108,7 +108,7 @@ theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
 #align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ
 
 -- porting note: new theorem
-theorem toFinsupp_append {R : Type _} [AddZeroClass R] (l₁ l₂ : List R)
+theorem toFinsupp_append {R : Type*} [AddZeroClass R] (l₁ l₂ : List R)
     [DecidablePred (getD (l₁ ++ l₂) · 0 ≠ 0)] [DecidablePred (getD l₁ · 0 ≠ 0)]
     [DecidablePred (getD l₂ · 0 ≠ 0)] :
     toFinsupp (l₁ ++ l₂) =
@@ -125,7 +125,7 @@ theorem toFinsupp_append {R : Type _} [AddZeroClass R] (l₁ l₂ : List R)
     rw [getD_append_right _ _ _ _ h, add_tsub_cancel_left, getD_eq_default _ _ h, zero_add]
     exact Eq.symm (Finsupp.embDomain_apply _ _ _)
 
-theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
+theorem toFinsupp_cons_eq_single_add_embDomain {R : Type*} [AddZeroClass R] (x : R) (xs : List R)
     [DecidablePred (getD (x::xs) · 0 ≠ 0)] [DecidablePred (getD xs · 0 ≠ 0)] :
     toFinsupp (x::xs) =
       Finsupp.single 0 x + (toFinsupp xs).embDomain ⟨Nat.succ, Nat.succ_injective⟩ := by
@@ -136,7 +136,7 @@ theorem toFinsupp_cons_eq_single_add_embDomain {R : Type _} [AddZeroClass R] (x
       exact add_comm n 1
 #align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomain
 
-theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (x : R) (xs : List R)
+theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type*} [AddZeroClass R] (x : R) (xs : List R)
     [DecidablePred fun i => getD (xs ++ [x]) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] :
     toFinsupp (xs ++ [x]) = toFinsupp xs + Finsupp.single xs.length x := by
   classical rw [toFinsupp_append, toFinsupp_singleton, Finsupp.embDomain_single,
@@ -144,7 +144,7 @@ theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type _} [AddZeroClass R] (
 #align list.to_finsupp_concat_eq_to_finsupp_add_single List.toFinsupp_concat_eq_toFinsupp_add_single
 
 
-theorem toFinsupp_eq_sum_map_enum_single {R : Type _} [AddMonoid R] (l : List R)
+theorem toFinsupp_eq_sum_map_enum_single {R : Type*} [AddMonoid R] (l : List R)
     [DecidablePred (getD l · 0 ≠ 0)] :
     toFinsupp l = (l.enum.map fun nr : ℕ × R => Finsupp.single nr.1 nr.2).sum := by
   /- porting note: todo: `induction` fails to substitute `l = []` in
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) 2022 Yakov Pechersky. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yakov Pechersky
-
-! This file was ported from Lean 3 source module data.list.to_finsupp
-! leanprover-community/mathlib commit 06a655b5fcfbda03502f9158bbf6c0f1400886f9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Finsupp.Basic
 
+#align_import data.list.to_finsupp from "leanprover-community/mathlib"@"06a655b5fcfbda03502f9158bbf6c0f1400886f9"
+
 /-!
 
 # Lists as finsupp
feat: port Data.List.ToFinsupp (#3350)

Dependencies 8 + 287

288 files ported (97.3%)
120479 lines ported (97.5%)
Show graph

The unported dependencies are