ring_theory.witt_vector.mul_coeff ⟷ Mathlib.RingTheory.WittVector.MulCoeff

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -87,7 +87,8 @@ theorem wittPolyProdRemainder_vars (n : β„•) : (wittPolyProdRemainder p n).vars
   apply subset.trans (vars_mul _ _)
   refine' union_subset _ _
   Β· apply subset.trans (vars_pow _ _)
-    have : (p : MvPolynomial (Fin 2 Γ— β„•) β„€) = C (p : β„€) := by simp only [Int.cast_ofNat, eq_intCast]
+    have : (p : MvPolynomial (Fin 2 Γ— β„•) β„€) = C (p : β„€) := by
+      simp only [Int.cast_natCast, eq_intCast]
     rw [this, vars_C]
     apply empty_subset
   Β· apply subset.trans (vars_pow _ _)
@@ -154,7 +155,7 @@ theorem mul_polyOfInterest_aux1 (n : β„•) :
       rw [Finsupp.support_eq_singleton]
       simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne.def]
       exact pow_ne_zero _ hp.out.ne_zero
-    simp only [bind₁_monomial, hsupp, Int.cast_ofNat, prod_singleton, eq_intCast,
+    simp only [bind₁_monomial, hsupp, Int.cast_natCast, prod_singleton, eq_intCast,
       Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true]
   Β· simp only [map_mul, bind₁_X_right]
 #align witt_vector.mul_poly_of_interest_aux1 WittVector.mul_polyOfInterest_aux1
@@ -181,7 +182,7 @@ theorem mul_polyOfInterest_aux3 (n : β„•) :
   by
   -- a useful auxiliary fact
   have mvpz : (p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) = MvPolynomial.C (↑p ^ (n + 1)) := by
-    simp only [Int.cast_ofNat, eq_intCast, C_pow, eq_self_iff_true]
+    simp only [Int.cast_natCast, eq_intCast, C_pow, eq_self_iff_true]
   -- unfold definitions and peel off the last entries of the sums.
   rw [witt_poly_prod, wittPolynomial, AlgHom.map_sum, AlgHom.map_sum, sum_range_succ]
   -- these are sums up to `n+2`, so be careful to only unfold to `n+1`.
@@ -197,7 +198,7 @@ theorem mul_polyOfInterest_aux3 (n : β„•) :
   conv_rhs => rw [sum_range_succ]
   -- the rest is equal with proper unfolding and `ring`
   simp only [rename_monomial, ← C_mul_X_pow_eq_monomial, map_mul, rename_C, pow_one, rename_X]
-  simp only [mvpz, Int.cast_ofNat, map_pow, eq_intCast, rename_X, pow_one, tsub_self, pow_zero]
+  simp only [mvpz, Int.cast_natCast, map_pow, eq_intCast, rename_X, pow_one, tsub_self, pow_zero]
   ring1
 #align witt_vector.mul_poly_of_interest_aux3 WittVector.mul_polyOfInterest_aux3
 -/
@@ -249,7 +250,7 @@ theorem polyOfInterest_vars_eq (n : β„•) :
             X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)))).vars :=
   by
   have : (p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) = C (p ^ (n + 1) : β„€) := by
-    simp only [Int.cast_ofNat, eq_intCast, C_pow, eq_self_iff_true]
+    simp only [Int.cast_natCast, eq_intCast, C_pow, eq_self_iff_true]
   rw [poly_of_interest, this, vars_C_mul]
   apply pow_ne_zero
   exact_mod_cast hp.out.ne_zero
@@ -274,7 +275,7 @@ theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
     Function.uncurry_apply_pair, aeval_X, Matrix.cons_val_one, map_mul, Matrix.cons_val_zero,
     map_sub]
   rw [sub_sub, add_comm (_ * _), ← sub_sub]
-  have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.C ↑p := by rw [eq_intCast, Int.cast_ofNat]
+  have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.C ↑p := by rw [eq_intCast, Int.cast_natCast]
   have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p := by intros;
     rw [mvpz, MvPolynomial.evalβ‚‚_C]
   simp [wittPolynomial_eq_sum_C_mul_X_pow, aeval, evalβ‚‚_rename, this, mul_coeff, peval, map_natCast,
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Robert Y. Lewis, Heather Macbeth
 -/
 import RingTheory.WittVector.Truncated
-import Data.MvPolynomial.Supported
+import Algebra.MvPolynomial.Supported
 
 #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"9240e8be927a0955b9a82c6c85ef499ee3a626b8"
 
Diff
@@ -328,7 +328,7 @@ theorem nth_mul_coeff' (n : β„•) :
     rintro ⟨a, ha⟩
     apply Function.uncurry ![x, y]
     simp only [true_and_iff, Multiset.mem_cons, range_val, product_val, Multiset.mem_range,
-      Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha 
+      Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha
     refine' ⟨a.fst, ⟨a.snd, _⟩⟩
     cases' ha with ha ha <;> linarith only [ha]
   use f
@@ -341,7 +341,7 @@ theorem nth_mul_coeff' (n : β„•) :
   cases' a with a ha
   cases' a with i m
   simp only [true_and_iff, Multiset.mem_cons, range_val, product_val, Multiset.mem_range,
-    Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha 
+    Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha
   have ha' : m < n + 1 := by cases' ha with ha ha <;> linarith only [ha]
   fin_cases i <;>-- surely this case split is not necessary
     · simpa only using x.coeff_truncate_fun ⟨m, ha'⟩
Diff
@@ -294,7 +294,7 @@ theorem peval_polyOfInterest' (n : β„•) (x y : π•Ž k) :
   rw [peval_poly_of_interest]
   have : (p : k) = 0 := CharP.cast_eq_zero k p
   simp only [this, add_zero, MulZeroClass.zero_mul, Nat.succ_ne_zero, Ne.def, not_false_iff,
-    zero_pow']
+    zero_pow]
   have sum_zero_pow_mul_pow_p :
     βˆ€ y : π•Ž k,
       βˆ‘ x : β„• in range (n + 1 + 1), 0 ^ x * y.coeff x ^ p ^ (n + 1 - x) = y.coeff 0 ^ p ^ (n + 1) :=
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2022 Robert Y. Lewis. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Robert Y. Lewis, Heather Macbeth
 -/
-import Mathbin.RingTheory.WittVector.Truncated
-import Mathbin.Data.MvPolynomial.Supported
+import RingTheory.WittVector.Truncated
+import Data.MvPolynomial.Supported
 
 #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"9240e8be927a0955b9a82c6c85ef499ee3a626b8"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Robert Y. Lewis. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Robert Y. Lewis, Heather Macbeth
-
-! This file was ported from Lean 3 source module ring_theory.witt_vector.mul_coeff
-! leanprover-community/mathlib commit 9240e8be927a0955b9a82c6c85ef499ee3a626b8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.WittVector.Truncated
 import Mathbin.Data.MvPolynomial.Supported
 
+#align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"9240e8be927a0955b9a82c6c85ef499ee3a626b8"
+
 /-!
 # Leading terms of Witt vector multiplication
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Robert Y. Lewis, Heather Macbeth
 
 ! This file was ported from Lean 3 source module ring_theory.witt_vector.mul_coeff
-! leanprover-community/mathlib commit 2f5b500a507264de86d666a5f87ddb976e2d8de4
+! leanprover-community/mathlib commit 9240e8be927a0955b9a82c6c85ef499ee3a626b8
 ! 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.MvPolynomial.Supported
 /-!
 # Leading terms of Witt vector multiplication
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 The goal of this file is to study the leading terms of the formula for the `n+1`st coefficient
 of a product of Witt vectors `x` and `y` over a ring of characteristic `p`.
 We aim to isolate the `n+1`st coefficients of `x` and `y`, and express the rest of the product
Diff
@@ -45,6 +45,7 @@ open Finset MvPolynomial
 
 open scoped BigOperators
 
+#print WittVector.wittPolyProd /-
 /-- ```
 (βˆ‘ i in range n, (y.coeff i)^(p^(n-i)) * p^i.val) *
   (βˆ‘ i in range n, (y.coeff i)^(p^(n-i)) * p^i.val)
@@ -54,8 +55,10 @@ def wittPolyProd (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
   rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ n) *
     rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ n)
 #align witt_vector.witt_poly_prod WittVector.wittPolyProd
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print WittVector.wittPolyProd_vars /-
 theorem wittPolyProd_vars (n : β„•) : (wittPolyProd p n).vars βŠ† univ Γ—Λ’ range (n + 1) :=
   by
   rw [witt_poly_prod]
@@ -64,13 +67,17 @@ theorem wittPolyProd_vars (n : β„•) : (wittPolyProd p n).vars βŠ† univ Γ—Λ’ rang
     Β· refine' subset.trans (vars_rename _ _) _
       simp [wittPolynomial_vars, image_subset_iff]
 #align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars
+-/
 
+#print WittVector.wittPolyProdRemainder /-
 /-- The "remainder term" of `witt_vector.witt_poly_prod`. See `mul_poly_of_interest_aux2`. -/
 def wittPolyProdRemainder (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
   βˆ‘ i in range n, p ^ i * wittMul p i ^ p ^ (n - i)
 #align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print WittVector.wittPolyProdRemainder_vars /-
 theorem wittPolyProdRemainder_vars (n : β„•) : (wittPolyProdRemainder p n).vars βŠ† univ Γ—Λ’ range n :=
   by
   rw [witt_poly_prod_remainder]
@@ -89,7 +96,9 @@ theorem wittPolyProdRemainder_vars (n : β„•) : (wittPolyProdRemainder p n).vars
     simp only [mem_range, range_subset] at hx ⊒
     exact hx
 #align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars
+-/
 
+#print WittVector.remainder /-
 /-- `remainder p n` represents the remainder term from `mul_poly_of_interest_aux3`.
 `witt_poly_prod p (n+1)` will have variables up to `n+1`,
 but `remainder` will only have variables up to `n`.
@@ -100,8 +109,10 @@ def remainder (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
     βˆ‘ x : β„• in range (n + 1),
       (rename (Prod.mk 1)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) (↑p ^ x))
 #align witt_vector.remainder WittVector.remainder
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print WittVector.remainder_vars /-
 theorem remainder_vars (n : β„•) : (remainder p n).vars βŠ† univ Γ—Λ’ range (n + 1) :=
   by
   rw [remainder]
@@ -116,15 +127,19 @@ theorem remainder_vars (n : β„•) : (remainder p n).vars βŠ† univ Γ—Λ’ range (n +
       Β· apply pow_ne_zero
         exact_mod_cast hp.out.ne_zero
 #align witt_vector.remainder_vars WittVector.remainder_vars
+-/
 
+#print WittVector.polyOfInterest /-
 /-- This is the polynomial whose degree we want to get a handle on. -/
 def polyOfInterest (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
   wittMul p (n + 1) + p ^ (n + 1) * X (0, n + 1) * X (1, n + 1) -
       X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) -
     X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1))
 #align witt_vector.poly_of_interest WittVector.polyOfInterest
+-/
 
-theorem mul_poly_of_interest_aux1 (n : β„•) :
+#print WittVector.mul_polyOfInterest_aux1 /-
+theorem mul_polyOfInterest_aux1 (n : β„•) :
     (βˆ‘ i in range (n + 1), p ^ i * wittMul p i ^ p ^ (n - i) : MvPolynomial (Fin 2 Γ— β„•) β„€) =
       wittPolyProd p n :=
   by
@@ -142,18 +157,22 @@ theorem mul_poly_of_interest_aux1 (n : β„•) :
     simp only [bind₁_monomial, hsupp, Int.cast_ofNat, prod_singleton, eq_intCast,
       Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true]
   Β· simp only [map_mul, bind₁_X_right]
-#align witt_vector.mul_poly_of_interest_aux1 WittVector.mul_poly_of_interest_aux1
+#align witt_vector.mul_poly_of_interest_aux1 WittVector.mul_polyOfInterest_aux1
+-/
 
-theorem mul_poly_of_interest_aux2 (n : β„•) :
+#print WittVector.mul_polyOfInterest_aux2 /-
+theorem mul_polyOfInterest_aux2 (n : β„•) :
     (p ^ n * wittMul p n : MvPolynomial (Fin 2 Γ— β„•) β„€) + wittPolyProdRemainder p n =
       wittPolyProd p n :=
   by
   convert mul_poly_of_interest_aux1 p n
   rw [sum_range_succ, add_comm, Nat.sub_self, pow_zero, pow_one]
   rfl
-#align witt_vector.mul_poly_of_interest_aux2 WittVector.mul_poly_of_interest_aux2
+#align witt_vector.mul_poly_of_interest_aux2 WittVector.mul_polyOfInterest_aux2
+-/
 
-theorem mul_poly_of_interest_aux3 (n : β„•) :
+#print WittVector.mul_polyOfInterest_aux3 /-
+theorem mul_polyOfInterest_aux3 (n : β„•) :
     wittPolyProd p (n + 1) =
       -(p ^ (n + 1) * X (0, n + 1)) * (p ^ (n + 1) * X (1, n + 1)) +
             p ^ (n + 1) * X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
@@ -180,9 +199,11 @@ theorem mul_poly_of_interest_aux3 (n : β„•) :
   simp only [rename_monomial, ← C_mul_X_pow_eq_monomial, map_mul, rename_C, pow_one, rename_X]
   simp only [mvpz, Int.cast_ofNat, map_pow, eq_intCast, rename_X, pow_one, tsub_self, pow_zero]
   ring1
-#align witt_vector.mul_poly_of_interest_aux3 WittVector.mul_poly_of_interest_aux3
+#align witt_vector.mul_poly_of_interest_aux3 WittVector.mul_polyOfInterest_aux3
+-/
 
-theorem mul_poly_of_interest_aux4 (n : β„•) :
+#print WittVector.mul_polyOfInterest_aux4 /-
+theorem mul_polyOfInterest_aux4 (n : β„•) :
     (p ^ (n + 1) * wittMul p (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) =
       -(p ^ (n + 1) * X (0, n + 1)) * (p ^ (n + 1) * X (1, n + 1)) +
             p ^ (n + 1) * X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
@@ -191,8 +212,10 @@ theorem mul_poly_of_interest_aux4 (n : β„•) :
   by
   rw [← add_sub_assoc, eq_sub_iff_add_eq, mul_poly_of_interest_aux2]
   exact mul_poly_of_interest_aux3 _ _
-#align witt_vector.mul_poly_of_interest_aux4 WittVector.mul_poly_of_interest_aux4
+#align witt_vector.mul_poly_of_interest_aux4 WittVector.mul_polyOfInterest_aux4
+-/
 
+#print WittVector.mul_polyOfInterest_aux5 /-
 theorem mul_polyOfInterest_aux5 (n : β„•) :
     (p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) * polyOfInterest p n =
       remainder p n - wittPolyProdRemainder p (n + 1) :=
@@ -201,8 +224,10 @@ theorem mul_polyOfInterest_aux5 (n : β„•) :
   rw [mul_poly_of_interest_aux4 p n]
   ring
 #align witt_vector.mul_poly_of_interest_aux5 WittVector.mul_polyOfInterest_aux5
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print WittVector.mul_polyOfInterest_vars /-
 theorem mul_polyOfInterest_vars (n : β„•) :
     ((p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) * polyOfInterest p n).vars βŠ†
       univ Γ—Λ’ range (n + 1) :=
@@ -213,7 +238,9 @@ theorem mul_polyOfInterest_vars (n : β„•) :
   Β· apply remainder_vars
   Β· apply witt_poly_prod_remainder_vars
 #align witt_vector.mul_poly_of_interest_vars WittVector.mul_polyOfInterest_vars
+-/
 
+#print WittVector.polyOfInterest_vars_eq /-
 theorem polyOfInterest_vars_eq (n : β„•) :
     (polyOfInterest p n).vars =
       ((p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) *
@@ -227,12 +254,16 @@ theorem polyOfInterest_vars_eq (n : β„•) :
   apply pow_ne_zero
   exact_mod_cast hp.out.ne_zero
 #align witt_vector.poly_of_interest_vars_eq WittVector.polyOfInterest_vars_eq
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print WittVector.polyOfInterest_vars /-
 theorem polyOfInterest_vars (n : β„•) : (polyOfInterest p n).vars βŠ† univ Γ—Λ’ range (n + 1) := by
   rw [poly_of_interest_vars_eq] <;> apply mul_poly_of_interest_vars
 #align witt_vector.poly_of_interest_vars WittVector.polyOfInterest_vars
+-/
 
+#print WittVector.peval_polyOfInterest /-
 theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
     peval (polyOfInterest p n) ![fun i => x.coeff i, fun i => y.coeff i] =
       (x * y).coeff (n + 1) + p ^ (n + 1) * x.coeff (n + 1) * y.coeff (n + 1) -
@@ -246,14 +277,16 @@ theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
   have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.C ↑p := by rw [eq_intCast, Int.cast_ofNat]
   have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p := by intros;
     rw [mvpz, MvPolynomial.evalβ‚‚_C]
-  simp [wittPolynomial_eq_sum_c_mul_x_pow, aeval, evalβ‚‚_rename, this, mul_coeff, peval, map_natCast,
+  simp [wittPolynomial_eq_sum_C_mul_X_pow, aeval, evalβ‚‚_rename, this, mul_coeff, peval, map_natCast,
     map_add, map_pow, map_mul]
 #align witt_vector.peval_poly_of_interest WittVector.peval_polyOfInterest
+-/
 
 variable [CharP k p]
 
+#print WittVector.peval_polyOfInterest' /-
 /-- The characteristic `p` version of `peval_poly_of_interest` -/
-theorem peval_poly_of_interest' (n : β„•) (x y : π•Ž k) :
+theorem peval_polyOfInterest' (n : β„•) (x y : π•Ž k) :
     peval (polyOfInterest p n) ![fun i => x.coeff i, fun i => y.coeff i] =
       (x * y).coeff (n + 1) - y.coeff (n + 1) * x.coeff 0 ^ p ^ (n + 1) -
         x.coeff (n + 1) * y.coeff 0 ^ p ^ (n + 1) :=
@@ -273,10 +306,12 @@ theorem peval_poly_of_interest' (n : β„•) (x y : π•Ž k) :
     Β· intro j _ hj
       simp [zero_pow (zero_lt_iff.mpr hj)]
   congr <;> apply sum_zero_pow_mul_pow_p
-#align witt_vector.peval_poly_of_interest' WittVector.peval_poly_of_interest'
+#align witt_vector.peval_poly_of_interest' WittVector.peval_polyOfInterest'
+-/
 
 variable (k)
 
+#print WittVector.nth_mul_coeff' /-
 theorem nth_mul_coeff' (n : β„•) :
     βˆƒ f : TruncatedWittVector p (n + 1) k β†’ TruncatedWittVector p (n + 1) k β†’ k,
       βˆ€ x y : π•Ž k,
@@ -311,7 +346,9 @@ theorem nth_mul_coeff' (n : β„•) :
   fin_cases i <;>-- surely this case split is not necessary
     · simpa only using x.coeff_truncate_fun ⟨m, ha'⟩
 #align witt_vector.nth_mul_coeff' WittVector.nth_mul_coeff'
+-/
 
+#print WittVector.nth_mul_coeff /-
 theorem nth_mul_coeff (n : β„•) :
     βˆƒ f : TruncatedWittVector p (n + 1) k β†’ TruncatedWittVector p (n + 1) k β†’ k,
       βˆ€ x y : π•Ž k,
@@ -325,22 +362,27 @@ theorem nth_mul_coeff (n : β„•) :
   rw [hf x y]
   ring
 #align witt_vector.nth_mul_coeff WittVector.nth_mul_coeff
+-/
 
 variable {k}
 
+#print WittVector.nthRemainder /-
 /--
 Produces the "remainder function" of the `n+1`st coefficient, which does not depend on the `n+1`st
 coefficients of the inputs. -/
 def nthRemainder (n : β„•) : (Fin (n + 1) β†’ k) β†’ (Fin (n + 1) β†’ k) β†’ k :=
   Classical.choose (nth_mul_coeff p k n)
 #align witt_vector.nth_remainder WittVector.nthRemainder
+-/
 
+#print WittVector.nthRemainder_spec /-
 theorem nthRemainder_spec (n : β„•) (x y : π•Ž k) :
     (x * y).coeff (n + 1) =
       x.coeff (n + 1) * y.coeff 0 ^ p ^ (n + 1) + y.coeff (n + 1) * x.coeff 0 ^ p ^ (n + 1) +
         nthRemainder p n (truncateFun (n + 1) x) (truncateFun (n + 1) y) :=
   Classical.choose_spec (nth_mul_coeff p k n) _ _
 #align witt_vector.nth_remainder_spec WittVector.nthRemainder_spec
+-/
 
 end WittVector
 
Diff
@@ -39,7 +39,6 @@ variable (p : β„•) [hp : Fact p.Prime]
 
 variable {k : Type _} [CommRing k]
 
--- mathport name: exprπ•Ž
 local notation "π•Ž" => WittVector p
 
 open Finset MvPolynomial
@@ -56,8 +55,6 @@ def wittPolyProd (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
     rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ n)
 #align witt_vector.witt_poly_prod WittVector.wittPolyProd
 
-include hp
-
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 theorem wittPolyProd_vars (n : β„•) : (wittPolyProd p n).vars βŠ† univ Γ—Λ’ range (n + 1) :=
   by
@@ -93,8 +90,6 @@ theorem wittPolyProdRemainder_vars (n : β„•) : (wittPolyProdRemainder p n).vars
     exact hx
 #align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars
 
-omit hp
-
 /-- `remainder p n` represents the remainder term from `mul_poly_of_interest_aux3`.
 `witt_poly_prod p (n+1)` will have variables up to `n+1`,
 but `remainder` will only have variables up to `n`.
@@ -106,8 +101,6 @@ def remainder (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
       (rename (Prod.mk 1)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) (↑p ^ x))
 #align witt_vector.remainder WittVector.remainder
 
-include hp
-
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 theorem remainder_vars (n : β„•) : (remainder p n).vars βŠ† univ Γ—Λ’ range (n + 1) :=
   by
@@ -160,8 +153,6 @@ theorem mul_poly_of_interest_aux2 (n : β„•) :
   rfl
 #align witt_vector.mul_poly_of_interest_aux2 WittVector.mul_poly_of_interest_aux2
 
-omit hp
-
 theorem mul_poly_of_interest_aux3 (n : β„•) :
     wittPolyProd p (n + 1) =
       -(p ^ (n + 1) * X (0, n + 1)) * (p ^ (n + 1) * X (1, n + 1)) +
@@ -191,8 +182,6 @@ theorem mul_poly_of_interest_aux3 (n : β„•) :
   ring1
 #align witt_vector.mul_poly_of_interest_aux3 WittVector.mul_poly_of_interest_aux3
 
-include hp
-
 theorem mul_poly_of_interest_aux4 (n : β„•) :
     (p ^ (n + 1) * wittMul p (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) =
       -(p ^ (n + 1) * X (0, n + 1)) * (p ^ (n + 1) * X (1, n + 1)) +
Diff
@@ -246,8 +246,8 @@ theorem polyOfInterest_vars (n : β„•) : (polyOfInterest p n).vars βŠ† univ Γ—Λ’
 
 theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
     peval (polyOfInterest p n) ![fun i => x.coeff i, fun i => y.coeff i] =
-      ((x * y).coeff (n + 1) + p ^ (n + 1) * x.coeff (n + 1) * y.coeff (n + 1) -
-          y.coeff (n + 1) * βˆ‘ i in range (n + 1 + 1), p ^ i * x.coeff i ^ p ^ (n + 1 - i)) -
+      (x * y).coeff (n + 1) + p ^ (n + 1) * x.coeff (n + 1) * y.coeff (n + 1) -
+          y.coeff (n + 1) * βˆ‘ i in range (n + 1 + 1), p ^ i * x.coeff i ^ p ^ (n + 1 - i) -
         x.coeff (n + 1) * βˆ‘ i in range (n + 1 + 1), p ^ i * y.coeff i ^ p ^ (n + 1 - i) :=
   by
   simp only [poly_of_interest, peval, map_natCast, Matrix.head_cons, map_pow,
@@ -275,8 +275,7 @@ theorem peval_poly_of_interest' (n : β„•) (x y : π•Ž k) :
     zero_pow']
   have sum_zero_pow_mul_pow_p :
     βˆ€ y : π•Ž k,
-      (βˆ‘ x : β„• in range (n + 1 + 1), 0 ^ x * y.coeff x ^ p ^ (n + 1 - x)) =
-        y.coeff 0 ^ p ^ (n + 1) :=
+      βˆ‘ x : β„• in range (n + 1 + 1), 0 ^ x * y.coeff x ^ p ^ (n + 1 - x) = y.coeff 0 ^ p ^ (n + 1) :=
     by
     intro y
     rw [Finset.sum_eq_single_of_mem 0]
Diff
@@ -89,7 +89,7 @@ theorem wittPolyProdRemainder_vars (n : β„•) : (wittPolyProdRemainder p n).vars
   Β· apply subset.trans (vars_pow _ _)
     apply subset.trans (witt_mul_vars _ _)
     apply product_subset_product (subset.refl _)
-    simp only [mem_range, range_subset] at hx⊒
+    simp only [mem_range, range_subset] at hx ⊒
     exact hx
 #align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars
 
@@ -255,7 +255,7 @@ theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
     map_sub]
   rw [sub_sub, add_comm (_ * _), ← sub_sub]
   have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.C ↑p := by rw [eq_intCast, Int.cast_ofNat]
-  have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p := by intros ;
+  have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p := by intros;
     rw [mvpz, MvPolynomial.evalβ‚‚_C]
   simp [wittPolynomial_eq_sum_c_mul_x_pow, aeval, evalβ‚‚_rename, this, mul_coeff, peval, map_natCast,
     map_add, map_pow, map_mul]
@@ -305,7 +305,7 @@ theorem nth_mul_coeff' (n : β„•) :
     rintro ⟨a, ha⟩
     apply Function.uncurry ![x, y]
     simp only [true_and_iff, Multiset.mem_cons, range_val, product_val, Multiset.mem_range,
-      Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha
+      Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha 
     refine' ⟨a.fst, ⟨a.snd, _⟩⟩
     cases' ha with ha ha <;> linarith only [ha]
   use f
@@ -318,7 +318,7 @@ theorem nth_mul_coeff' (n : β„•) :
   cases' a with a ha
   cases' a with i m
   simp only [true_and_iff, Multiset.mem_cons, range_val, product_val, Multiset.mem_range,
-    Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha
+    Multiset.mem_product, Multiset.range_succ, mem_univ_val] at ha 
   have ha' : m < n + 1 := by cases' ha with ha ha <;> linarith only [ha]
   fin_cases i <;>-- surely this case split is not necessary
     · simpa only using x.coeff_truncate_fun ⟨m, ha'⟩
Diff
@@ -44,7 +44,7 @@ local notation "π•Ž" => WittVector p
 
 open Finset MvPolynomial
 
-open BigOperators
+open scoped BigOperators
 
 /-- ```
 (βˆ‘ i in range n, (y.coeff i)^(p^(n-i)) * p^i.val) *
Diff
@@ -255,9 +255,7 @@ theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
     map_sub]
   rw [sub_sub, add_comm (_ * _), ← sub_sub]
   have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.C ↑p := by rw [eq_intCast, Int.cast_ofNat]
-  have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p :=
-    by
-    intros
+  have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p := by intros ;
     rw [mvpz, MvPolynomial.evalβ‚‚_C]
   simp [wittPolynomial_eq_sum_c_mul_x_pow, aeval, evalβ‚‚_rename, this, mul_coeff, peval, map_natCast,
     map_add, map_pow, map_mul]
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Robert Y. Lewis, Heather Macbeth
 
 ! This file was ported from Lean 3 source module ring_theory.witt_vector.mul_coeff
-! leanprover-community/mathlib commit 43a289b563d533cfb00f58b812d222371f6f6fac
+! leanprover-community/mathlib commit 2f5b500a507264de86d666a5f87ddb976e2d8de4
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -63,8 +63,8 @@ theorem wittPolyProd_vars (n : β„•) : (wittPolyProd p n).vars βŠ† univ Γ—Λ’ rang
   by
   rw [witt_poly_prod]
   apply subset.trans (vars_mul _ _)
-  apply union_subset <;>
-    Β· apply subset.trans (vars_rename _ _)
+  refine' union_subset _ _ <;>
+    Β· refine' subset.trans (vars_rename _ _) _
       simp [wittPolynomial_vars, image_subset_iff]
 #align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars
 
@@ -77,11 +77,11 @@ def wittPolyProdRemainder (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
 theorem wittPolyProdRemainder_vars (n : β„•) : (wittPolyProdRemainder p n).vars βŠ† univ Γ—Λ’ range n :=
   by
   rw [witt_poly_prod_remainder]
-  apply subset.trans (vars_sum_subset _ _)
+  refine' subset.trans (vars_sum_subset _ _) _
   rw [bUnion_subset]
   intro x hx
   apply subset.trans (vars_mul _ _)
-  apply union_subset
+  refine' union_subset _ _
   Β· apply subset.trans (vars_pow _ _)
     have : (p : MvPolynomial (Fin 2 Γ— β„•) β„€) = C (p : β„€) := by simp only [Int.cast_ofNat, eq_intCast]
     rw [this, vars_C]
@@ -113,8 +113,8 @@ theorem remainder_vars (n : β„•) : (remainder p n).vars βŠ† univ Γ—Λ’ range (n +
   by
   rw [remainder]
   apply subset.trans (vars_mul _ _)
-  apply union_subset <;>
-    Β· apply subset.trans (vars_sum_subset _ _)
+  refine' union_subset _ _ <;>
+    Β· refine' subset.trans (vars_sum_subset _ _) _
       rw [bUnion_subset]
       intro x hx
       rw [rename_monomial, vars_monomial, Finsupp.mapDomain_single]
@@ -220,7 +220,7 @@ theorem mul_polyOfInterest_vars (n : β„•) :
   by
   rw [mul_poly_of_interest_aux5]
   apply subset.trans (vars_sub_subset _ _)
-  apply union_subset
+  refine' union_subset _ _
   Β· apply remainder_vars
   Β· apply witt_poly_prod_remainder_vars
 #align witt_vector.mul_poly_of_interest_vars WittVector.mul_polyOfInterest_vars
Diff
@@ -126,9 +126,9 @@ theorem remainder_vars (n : β„•) : (remainder p n).vars βŠ† univ Γ—Λ’ range (n +
 
 /-- This is the polynomial whose degree we want to get a handle on. -/
 def polyOfInterest (n : β„•) : MvPolynomial (Fin 2 Γ— β„•) β„€ :=
-  wittMul p (n + 1) + p ^ (n + 1) * x (0, n + 1) * x (1, n + 1) -
-      x (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) -
-    x (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1))
+  wittMul p (n + 1) + p ^ (n + 1) * X (0, n + 1) * X (1, n + 1) -
+      X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) -
+    X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1))
 #align witt_vector.poly_of_interest WittVector.polyOfInterest
 
 theorem mul_poly_of_interest_aux1 (n : β„•) :
@@ -164,13 +164,13 @@ omit hp
 
 theorem mul_poly_of_interest_aux3 (n : β„•) :
     wittPolyProd p (n + 1) =
-      -(p ^ (n + 1) * x (0, n + 1)) * (p ^ (n + 1) * x (1, n + 1)) +
-            p ^ (n + 1) * x (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
-          p ^ (n + 1) * x (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
+      -(p ^ (n + 1) * X (0, n + 1)) * (p ^ (n + 1) * X (1, n + 1)) +
+            p ^ (n + 1) * X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
+          p ^ (n + 1) * X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
         remainder p n :=
   by
   -- a useful auxiliary fact
-  have mvpz : (p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) = MvPolynomial.c (↑p ^ (n + 1)) := by
+  have mvpz : (p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) = MvPolynomial.C (↑p ^ (n + 1)) := by
     simp only [Int.cast_ofNat, eq_intCast, C_pow, eq_self_iff_true]
   -- unfold definitions and peel off the last entries of the sums.
   rw [witt_poly_prod, wittPolynomial, AlgHom.map_sum, AlgHom.map_sum, sum_range_succ]
@@ -195,9 +195,9 @@ include hp
 
 theorem mul_poly_of_interest_aux4 (n : β„•) :
     (p ^ (n + 1) * wittMul p (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) =
-      -(p ^ (n + 1) * x (0, n + 1)) * (p ^ (n + 1) * x (1, n + 1)) +
-            p ^ (n + 1) * x (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
-          p ^ (n + 1) * x (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
+      -(p ^ (n + 1) * X (0, n + 1)) * (p ^ (n + 1) * X (1, n + 1)) +
+            p ^ (n + 1) * X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
+          p ^ (n + 1) * X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
         (remainder p n - wittPolyProdRemainder p (n + 1)) :=
   by
   rw [← add_sub_assoc, eq_sub_iff_add_eq, mul_poly_of_interest_aux2]
@@ -228,9 +228,9 @@ theorem mul_polyOfInterest_vars (n : β„•) :
 theorem polyOfInterest_vars_eq (n : β„•) :
     (polyOfInterest p n).vars =
       ((p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) *
-          (wittMul p (n + 1) + p ^ (n + 1) * x (0, n + 1) * x (1, n + 1) -
-              x (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) -
-            x (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)))).vars :=
+          (wittMul p (n + 1) + p ^ (n + 1) * X (0, n + 1) * X (1, n + 1) -
+              X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) -
+            X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)))).vars :=
   by
   have : (p ^ (n + 1) : MvPolynomial (Fin 2 Γ— β„•) β„€) = C (p ^ (n + 1) : β„€) := by
     simp only [Int.cast_ofNat, eq_intCast, C_pow, eq_self_iff_true]
@@ -254,11 +254,11 @@ theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
     Function.uncurry_apply_pair, aeval_X, Matrix.cons_val_one, map_mul, Matrix.cons_val_zero,
     map_sub]
   rw [sub_sub, add_comm (_ * _), ← sub_sub]
-  have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.c ↑p := by rw [eq_intCast, Int.cast_ofNat]
+  have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.C ↑p := by rw [eq_intCast, Int.cast_ofNat]
   have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p :=
     by
     intros
-    rw [mvpz, MvPolynomial.evalβ‚‚_c]
+    rw [mvpz, MvPolynomial.evalβ‚‚_C]
   simp [wittPolynomial_eq_sum_c_mul_x_pow, aeval, evalβ‚‚_rename, this, mul_coeff, peval, map_natCast,
     map_add, map_pow, map_mul]
 #align witt_vector.peval_poly_of_interest WittVector.peval_polyOfInterest
Diff
@@ -273,7 +273,8 @@ theorem peval_poly_of_interest' (n : β„•) (x y : π•Ž k) :
   by
   rw [peval_poly_of_interest]
   have : (p : k) = 0 := CharP.cast_eq_zero k p
-  simp only [this, add_zero, zero_mul, Nat.succ_ne_zero, Ne.def, not_false_iff, zero_pow']
+  simp only [this, add_zero, MulZeroClass.zero_mul, Nat.succ_ne_zero, Ne.def, not_false_iff,
+    zero_pow']
   have sum_zero_pow_mul_pow_p :
     βˆ€ y : π•Ž k,
       (βˆ‘ x : β„• in range (n + 1 + 1), 0 ^ x * y.coeff x ^ p ^ (n + 1 - x)) =

Changes in mathlib4

mathlib3
mathlib4
chore(Data/Int/Cast): fix confusion between OfNat and Nat.cast lemmas (#11861)

This renames

  • Int.cast_ofNat to Int.cast_natCast
  • Int.int_cast_ofNat to Int.cast_ofNat

I think the history here is that this lemma was previously about Int.ofNat, before we globally fixed the simp-normal form to be Nat.cast.

Since the Int.cast_ofNat name is repurposed, it can't be deprecated. Int.int_cast_ofNat is such a wonky name that it was probably never used.

Diff
@@ -77,7 +77,7 @@ theorem wittPolyProdRemainder_vars (n : β„•) :
   apply Subset.trans (vars_mul _ _)
   refine' union_subset _ _
   Β· apply Subset.trans (vars_pow _ _)
-    have : (p : 𝕄) = C (p : β„€) := by simp only [Int.cast_ofNat, eq_intCast]
+    have : (p : 𝕄) = C (p : β„€) := by simp only [Int.cast_natCast, eq_intCast]
     rw [this, vars_C]
     apply empty_subset
   Β· apply Subset.trans (vars_pow _ _)
@@ -131,7 +131,7 @@ theorem mul_polyOfInterest_aux1 (n : β„•) :
       rw [Finsupp.support_eq_singleton]
       simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne]
       exact pow_ne_zero _ hp.out.ne_zero
-    simp only [bind₁_monomial, hsupp, Int.cast_ofNat, prod_singleton, eq_intCast,
+    simp only [bind₁_monomial, hsupp, Int.cast_natCast, prod_singleton, eq_intCast,
       Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true,
       Int.cast_pow]
   Β· simp only [map_mul, bind₁_X_right]
move(Polynomial): Move out of Data (#11751)

Polynomial and MvPolynomial are algebraic objects, hence should be under Algebra (or at least not under Data)

Diff
@@ -3,8 +3,8 @@ Copyright (c) 2022 Robert Y. Lewis. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Robert Y. Lewis, Heather Macbeth
 -/
+import Mathlib.Algebra.MvPolynomial.Supported
 import Mathlib.RingTheory.WittVector.Truncated
-import Mathlib.Data.MvPolynomial.Supported
 
 #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
 
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11813)
Diff
@@ -129,7 +129,7 @@ theorem mul_polyOfInterest_aux1 (n : β„•) :
     congr 1
     have hsupp : (Finsupp.single i (p ^ (n - i))).support = {i} := by
       rw [Finsupp.support_eq_singleton]
-      simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne.def]
+      simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne]
       exact pow_ne_zero _ hp.out.ne_zero
     simp only [bind₁_monomial, hsupp, Int.cast_ofNat, prod_singleton, eq_intCast,
       Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true,
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -33,7 +33,6 @@ noncomputable section
 namespace WittVector
 
 variable (p : β„•) [hp : Fact p.Prime]
-
 variable {k : Type*} [CommRing k]
 
 local notation "π•Ž" => WittVector p
refactor: optimize proofs with omega (#11093)

I ran tryAtEachStep on all files under Mathlib to find all locations where omega succeeds. For each that was a linarith without an only, I tried replacing it with omega, and I verified that elaboration time got smaller. (In almost all cases, there was a noticeable speedup.) I also replaced some slow aesops along the way.

Diff
@@ -267,7 +267,7 @@ theorem nth_mul_coeff' (n : β„•) :
     simp_rw [product_val, this, Multiset.mem_product, mem_univ_val, true_and_iff, range_val,
       Multiset.range_succ, Multiset.mem_cons, Multiset.mem_range] at ha
     refine' ⟨a.fst, ⟨a.snd, _⟩⟩
-    cases' ha with ha ha <;> linarith only [ha]
+    cases' ha with ha ha <;> omega
   use f
   intro x y
   dsimp [f, peval]
chore: more backporting of simp changes from #10995 (#11001)

Co-authored-by: Patrick Massot <patrickmassot@free.fr> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -270,7 +270,7 @@ theorem nth_mul_coeff' (n : β„•) :
     cases' ha with ha ha <;> linarith only [ha]
   use f
   intro x y
-  dsimp [peval]
+  dsimp [f, peval]
   rw [← hfβ‚€]
   congr
   ext a
feat: The support of f ^ n (#9617)

This involves moving lemmas from Algebra.GroupPower.Ring to Algebra.GroupWithZero.Basic and changing some 0 < n assumptions to n β‰  0.

From LeanAPAP

Diff
@@ -241,16 +241,11 @@ theorem peval_polyOfInterest' (n : β„•) (x y : π•Ž k) :
         x.coeff (n + 1) * y.coeff 0 ^ p ^ (n + 1) := by
   rw [peval_polyOfInterest]
   have : (p : k) = 0 := CharP.cast_eq_zero k p
-  simp only [this, Nat.cast_pow, ne_eq, add_eq_zero, and_false, zero_pow', zero_mul, add_zero,
+  simp only [this, Nat.cast_pow, ne_eq, add_eq_zero, and_false, zero_pow, zero_mul, add_zero,
     not_false_eq_true]
-  have sum_zero_pow_mul_pow_p : βˆ€ y : π•Ž k, βˆ‘ x : β„• in range (n + 1 + 1),
+  have sum_zero_pow_mul_pow_p (y : π•Ž k) : βˆ‘ x : β„• in range (n + 1 + 1),
       (0 : k) ^ x * y.coeff x ^ p ^ (n + 1 - x) = y.coeff 0 ^ p ^ (n + 1) := by
-    intro y
-    rw [Finset.sum_eq_single_of_mem 0]
-    Β· simp
-    Β· simp
-    Β· intro j _ hj
-      simp [zero_pow (zero_lt_iff.mpr hj)]
+    rw [Finset.sum_eq_single_of_mem 0] <;> simp (config := { contextual := true })
   congr <;> apply sum_zero_pow_mul_pow_p
 #align witt_vector.peval_poly_of_interest' WittVector.peval_polyOfInterest'
 
chore: replace exact_mod_cast tactic with mod_cast elaborator where possible (#8404)

We still have the exact_mod_cast tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast are the ones that don't work using the term elaborator by itself.

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

Diff
@@ -110,7 +110,7 @@ theorem remainder_vars (n : β„•) : (remainder p n).vars βŠ† univ Γ—Λ’ range (n +
     Β· apply Subset.trans Finsupp.support_single_subset
       simpa using mem_range.mp hx
     Β· apply pow_ne_zero
-      exact_mod_cast hp.out.ne_zero
+      exact mod_cast hp.out.ne_zero
 #align witt_vector.remainder_vars WittVector.remainder_vars
 
 /-- This is the polynomial whose degree we want to get a handle on. -/
@@ -212,7 +212,7 @@ theorem polyOfInterest_vars_eq (n : β„•) : (polyOfInterest p n).vars =
   have : (p : 𝕄) ^ (n + 1) = C ((p : β„€) ^ (n + 1)) := by norm_cast
   rw [polyOfInterest, this, vars_C_mul]
   apply pow_ne_zero
-  exact_mod_cast hp.out.ne_zero
+  exact mod_cast hp.out.ne_zero
 #align witt_vector.poly_of_interest_vars_eq WittVector.polyOfInterest_vars_eq
 
 theorem polyOfInterest_vars (n : β„•) : (polyOfInterest p n).vars βŠ† univ Γ—Λ’ range (n + 1) := by
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
@@ -30,8 +30,6 @@ that needs to happen in characteristic 0.
 
 noncomputable section
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 namespace WittVector
 
 variable (p : β„•) [hp : Fact p.Prime]
@@ -243,7 +241,8 @@ theorem peval_polyOfInterest' (n : β„•) (x y : π•Ž k) :
         x.coeff (n + 1) * y.coeff 0 ^ p ^ (n + 1) := by
   rw [peval_polyOfInterest]
   have : (p : k) = 0 := CharP.cast_eq_zero k p
-  simp only [this, Nat.cast_pow, ne_eq, add_eq_zero, and_false, zero_pow', zero_mul, add_zero]
+  simp only [this, Nat.cast_pow, ne_eq, add_eq_zero, and_false, zero_pow', zero_mul, add_zero,
+    not_false_eq_true]
   have sum_zero_pow_mul_pow_p : βˆ€ y : π•Ž k, βˆ‘ x : β„• in range (n + 1 + 1),
       (0 : k) ^ x * y.coeff x ^ p ^ (n + 1 - x) = y.coeff 0 ^ p ^ (n + 1) := by
     intro y
perf(FunLike.Basic): beta reduce CoeFun.coe (#7905)

This eliminates (fun a ↦ Ξ²) Ξ± in the type when applying a FunLike.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -153,7 +153,7 @@ theorem mul_polyOfInterest_aux3 (n : β„•) : wittPolyProd p (n + 1) =
     (p : 𝕄) ^ (n + 1) * X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)) +
     remainder p n := by
   -- a useful auxiliary fact
-  have mvpz : (p : 𝕄) ^ (n + 1) = MvPolynomial.C ((p : β„€) ^ (n + 1)) := by simp only; norm_cast
+  have mvpz : (p : 𝕄) ^ (n + 1) = MvPolynomial.C ((p : β„€) ^ (n + 1)) := by norm_cast
   -- Porting note: the original proof applies `sum_range_succ` through a non-`conv` rewrite,
   -- but this does not work in Lean 4; the whole proof also times out very badly. The proof has been
   -- nearly totally rewritten here and now finishes quite fast.
@@ -211,7 +211,7 @@ theorem polyOfInterest_vars_eq (n : β„•) : (polyOfInterest p n).vars =
     ((p : 𝕄) ^ (n + 1) * (wittMul p (n + 1) + (p : 𝕄) ^ (n + 1) * X (0, n + 1) * X (1, n + 1) -
       X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β„€ (n + 1)) -
       X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β„€ (n + 1)))).vars := by
-  have : (p : 𝕄) ^ (n + 1) = C ((p : β„€) ^ (n + 1)) := by simp only; norm_cast
+  have : (p : 𝕄) ^ (n + 1) = C ((p : β„€) ^ (n + 1)) := by norm_cast
   rw [polyOfInterest, this, vars_C_mul]
   apply pow_ne_zero
   exact_mod_cast hp.out.ne_zero
chore: mark map_prod/map_sum as simp (#7481)
Diff
@@ -230,10 +230,7 @@ theorem peval_polyOfInterest (n : β„•) (x y : π•Ž k) :
     Function.uncurry_apply_pair, aeval_X, Matrix.cons_val_one, map_mul, Matrix.cons_val_zero,
     map_sub]
   rw [sub_sub, add_comm (_ * _), ← sub_sub]
-  have mvpz : (p : MvPolynomial β„• β„€) = MvPolynomial.C ↑p := by rw [eq_intCast, Int.cast_ofNat]
-  have : βˆ€ (f : β„€ β†’+* k) (g : β„• β†’ k), evalβ‚‚ f g p = f p := by
-    intros; rw [mvpz, MvPolynomial.evalβ‚‚_C]
-  simp [wittPolynomial_eq_sum_C_mul_X_pow, aeval, evalβ‚‚_rename, this, mul_coeff, peval, map_natCast,
+  simp [wittPolynomial_eq_sum_C_mul_X_pow, aeval, evalβ‚‚_rename, mul_coeff, peval, map_natCast,
     map_add, map_pow, map_mul]
 #align witt_vector.peval_poly_of_interest WittVector.peval_polyOfInterest
 
chore: remove unused simps (#6632)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -281,7 +281,6 @@ theorem nth_mul_coeff' (n : β„•) :
   intro x y
   dsimp [peval]
   rw [← hfβ‚€]
-  simp only [Function.uncurry_apply_pair]
   congr
   ext a
   cases' a with a ha
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
@@ -36,7 +36,7 @@ namespace WittVector
 
 variable (p : β„•) [hp : Fact p.Prime]
 
-variable {k : Type _} [CommRing k]
+variable {k : Type*} [CommRing k]
 
 local notation "π•Ž" => WittVector p
 
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -30,7 +30,7 @@ that needs to happen in characteristic 0.
 
 noncomputable section
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 namespace WittVector
 
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) 2022 Robert Y. Lewis. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Robert Y. Lewis, Heather Macbeth
-
-! This file was ported from Lean 3 source module ring_theory.witt_vector.mul_coeff
-! leanprover-community/mathlib commit 2f5b500a507264de86d666a5f87ddb976e2d8de4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.WittVector.Truncated
 import Mathlib.Data.MvPolynomial.Supported
 
+#align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
+
 /-!
 # Leading terms of Witt vector multiplication
 
feat: port RingTheory.WittVector.MulCoeff (#5554)

Dependencies 10 + 678

679 files ported (98.5%)
279849 lines ported (98.8%)
Show graph

The unported dependencies are