ring_theory.polynomial.hermite.basicMathlib.RingTheory.Polynomial.Hermite.Basic

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2023 Luke Mantle. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
 -/
-import Data.Polynomial.Derivative
+import Algebra.Polynomial.Derivative
 import Data.Nat.Parity
 import Data.Nat.Factorial.DoubleFactorial
 
Diff
@@ -194,7 +194,7 @@ theorem coeff_hermite_explicit :
   | n + 1, 0 => by
     convert coeff_hermite_succ_zero (2 * n + 1) using 1
     rw [coeff_hermite_explicit n 1, (by ring_nf : 2 * (n + 1) - 1 = 2 * n + 1),
-      Nat.doubleFactorial_add_one, Nat.choose_zero_right, Nat.choose_one_right, pow_succ]
+      Nat.doubleFactorial_add_one, Nat.choose_zero_right, Nat.choose_one_right, pow_succ']
     push_cast
     ring
   | n + 1, k + 1 =>
@@ -211,7 +211,7 @@ theorem coeff_hermite_explicit :
       -- Factor out (-1)'s.
       rw [mul_comm (↑k + _), sub_eq_add_neg]
       nth_rw 3 [neg_eq_neg_one_mul]
-      simp only [mul_assoc, ← mul_add, pow_succ]
+      simp only [mul_assoc, ← mul_add, pow_succ']
       congr 2
       -- Factor out double factorials.
       norm_cast
Diff
@@ -168,14 +168,14 @@ theorem hermite_monic (n : ℕ) : (hermite n).Monic :=
 theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermite n) k = 0 :=
   by
   induction' n with n ih generalizing k
-  · rw [zero_add] at hnk 
+  · rw [zero_add] at hnk
     exact coeff_hermite_of_lt hnk.pos
   · cases k
-    · rw [Nat.succ_add_eq_add_succ] at hnk 
+    · rw [Nat.succ_add_eq_add_succ] at hnk
       rw [coeff_hermite_succ_zero, ih hnk, neg_zero]
     · rw [coeff_hermite_succ_succ, ih, ih, MulZeroClass.mul_zero, sub_zero]
-      · rwa [Nat.succ_add_eq_add_succ] at hnk 
-      · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk 
+      · rwa [Nat.succ_add_eq_add_succ] at hnk
+      · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk
         exact (nat.odd_add.mp hnk).mpr even_two
 #align polynomial.coeff_hermite_of_odd_add Polynomial.coeff_hermite_of_odd_add
 -/
@@ -238,7 +238,7 @@ theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
     coeff (hermite n) k = (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k :=
   by
   cases' le_or_lt k n with h_le h_lt
-  · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk 
+  · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk
     obtain ⟨m, hm⟩ := hnk
     rw [(by linarith : n = 2 * m + k), Nat.add_sub_cancel,
       Nat.mul_div_cancel_left _ (Nat.succ_pos 1), coeff_hermite_explicit]
Diff
@@ -171,10 +171,10 @@ theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermit
   · rw [zero_add] at hnk 
     exact coeff_hermite_of_lt hnk.pos
   · cases k
-    · rw [Nat.succ_add_eq_succ_add] at hnk 
+    · rw [Nat.succ_add_eq_add_succ] at hnk 
       rw [coeff_hermite_succ_zero, ih hnk, neg_zero]
     · rw [coeff_hermite_succ_succ, ih, ih, MulZeroClass.mul_zero, sub_zero]
-      · rwa [Nat.succ_add_eq_succ_add] at hnk 
+      · rwa [Nat.succ_add_eq_add_succ] at hnk 
       · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk 
         exact (nat.odd_add.mp hnk).mpr even_two
 #align polynomial.coeff_hermite_of_odd_add Polynomial.coeff_hermite_of_odd_add
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2023 Luke Mantle. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
 -/
-import Mathbin.Data.Polynomial.Derivative
-import Mathbin.Data.Nat.Parity
-import Mathbin.Data.Nat.Factorial.DoubleFactorial
+import Data.Polynomial.Derivative
+import Data.Nat.Parity
+import Data.Nat.Factorial.DoubleFactorial
 
 #align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"d07a9c875ed7139abfde6a333b2be205c5bd404e"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2023 Luke Mantle. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
-
-! This file was ported from Lean 3 source module ring_theory.polynomial.hermite.basic
-! leanprover-community/mathlib commit d07a9c875ed7139abfde6a333b2be205c5bd404e
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Polynomial.Derivative
 import Mathbin.Data.Nat.Parity
 import Mathbin.Data.Nat.Factorial.DoubleFactorial
 
+#align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"d07a9c875ed7139abfde6a333b2be205c5bd404e"
+
 /-!
 # Hermite polynomials
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
 
 ! This file was ported from Lean 3 source module ring_theory.polynomial.hermite.basic
-! leanprover-community/mathlib commit 938d3db9c278f8a52c0f964a405806f0f2b09b74
+! leanprover-community/mathlib commit d07a9c875ed7139abfde6a333b2be205c5bd404e
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.Data.Nat.Factorial.DoubleFactorial
 /-!
 # Hermite polynomials
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file defines `polynomial.hermite n`, the nth probabilist's Hermite polynomial.
 
 ## Main definitions
Diff
@@ -47,36 +47,46 @@ open Polynomial
 
 namespace Polynomial
 
+#print Polynomial.hermite /-
 /-- the nth probabilist's Hermite polynomial -/
 noncomputable def hermite : ℕ → Polynomial ℤ
   | 0 => 1
   | n + 1 => X * hermite n - (hermite n).derivative
 #align polynomial.hermite Polynomial.hermite
+-/
 
+#print Polynomial.hermite_succ /-
 /-- The recursion `hermite (n+1) = (x - d/dx) (hermite n)` -/
 @[simp]
 theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - (hermite n).derivative := by
   rw [hermite]
 #align polynomial.hermite_succ Polynomial.hermite_succ
+-/
 
+#print Polynomial.hermite_eq_iterate /-
 theorem hermite_eq_iterate (n : ℕ) : hermite n = ((fun p => X * p - p.derivative)^[n]) 1 :=
   by
   induction' n with n ih
   · rfl
   · rw [Function.iterate_succ_apply', ← ih, hermite_succ]
 #align polynomial.hermite_eq_iterate Polynomial.hermite_eq_iterate
+-/
 
+#print Polynomial.hermite_zero /-
 @[simp]
 theorem hermite_zero : hermite 0 = C 1 :=
   rfl
 #align polynomial.hermite_zero Polynomial.hermite_zero
+-/
 
+#print Polynomial.hermite_one /-
 @[simp]
 theorem hermite_one : hermite 1 = X :=
   by
   rw [hermite_succ, hermite_zero]
   simp only [map_one, mul_one, derivative_one, sub_zero]
 #align polynomial.hermite_one Polynomial.hermite_one
+-/
 
 /-! ### Lemmas about `polynomial.coeff` -/
 
@@ -148,9 +158,11 @@ theorem leadingCoeff_hermite (n : ℕ) : (hermite n).leadingCoeff = 1 := by
 #align polynomial.leading_coeff_hermite Polynomial.leadingCoeff_hermite
 -/
 
+#print Polynomial.hermite_monic /-
 theorem hermite_monic (n : ℕ) : (hermite n).Monic :=
   leadingCoeff_hermite n
 #align polynomial.hermite_monic Polynomial.hermite_monic
+-/
 
 #print Polynomial.coeff_hermite_of_odd_add /-
 theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermite n) k = 0 :=
@@ -174,6 +186,7 @@ section CoeffExplicit
 
 open scoped Nat
 
+#print Polynomial.coeff_hermite_explicit /-
 /-- Because of `coeff_hermite_of_odd_add`, every nonzero coefficient is described as follows. -/
 theorem coeff_hermite_explicit :
     ∀ n k : ℕ, coeff (hermite (2 * n + k)) k = (-1) ^ n * (2 * n - 1)‼ * Nat.choose (2 * n + k) k
@@ -218,7 +231,9 @@ theorem coeff_hermite_explicit :
     · rw [coeff_hermite_explicit (n + 1) k]
     · rw [(by ring : 2 * (n + 1) + k = 2 * n + (k + 2)), coeff_hermite_explicit n (k + 2)]
 #align polynomial.coeff_hermite_explicit Polynomial.coeff_hermite_explicit
+-/
 
+#print Polynomial.coeff_hermite_of_even_add /-
 theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
     coeff (hermite n) k = (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k :=
   by
@@ -229,7 +244,9 @@ theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
       Nat.mul_div_cancel_left _ (Nat.succ_pos 1), coeff_hermite_explicit]
   · simp [Nat.choose_eq_zero_of_lt h_lt, coeff_hermite_of_lt h_lt]
 #align polynomial.coeff_hermite_of_even_add Polynomial.coeff_hermite_of_even_add
+-/
 
+#print Polynomial.coeff_hermite /-
 theorem coeff_hermite (n k : ℕ) :
     coeff (hermite n) k =
       if Even (n + k) then (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k else 0 :=
@@ -238,6 +255,7 @@ theorem coeff_hermite (n k : ℕ) :
   exact coeff_hermite_of_even_add h
   exact coeff_hermite_of_odd_add (nat.odd_iff_not_even.mpr h)
 #align polynomial.coeff_hermite Polynomial.coeff_hermite
+-/
 
 end CoeffExplicit
 
Diff
@@ -83,17 +83,22 @@ theorem hermite_one : hermite 1 = X :=
 
 section Coeff
 
+#print Polynomial.coeff_hermite_succ_zero /-
 theorem coeff_hermite_succ_zero (n : ℕ) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by
   simp [coeff_derivative]
 #align polynomial.coeff_hermite_succ_zero Polynomial.coeff_hermite_succ_zero
+-/
 
+#print Polynomial.coeff_hermite_succ_succ /-
 theorem coeff_hermite_succ_succ (n k : ℕ) :
     coeff (hermite (n + 1)) (k + 1) = coeff (hermite n) k - (k + 2) * coeff (hermite n) (k + 2) :=
   by
   rw [hermite_succ, coeff_sub, coeff_X_mul, coeff_derivative, mul_comm]
   norm_cast
 #align polynomial.coeff_hermite_succ_succ Polynomial.coeff_hermite_succ_succ
+-/
 
+#print Polynomial.coeff_hermite_of_lt /-
 theorem coeff_hermite_of_lt {n k : ℕ} (hnk : n < k) : coeff (hermite n) k = 0 :=
   by
   obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_lt hnk
@@ -104,7 +109,9 @@ theorem coeff_hermite_of_lt {n k : ℕ} (hnk : n < k) : coeff (hermite n) k = 0
     rw [Nat.succ_eq_add_one, coeff_hermite_succ_succ, add_right_comm, this, ih k, ih (k + 2),
       MulZeroClass.mul_zero, sub_zero]
 #align polynomial.coeff_hermite_of_lt Polynomial.coeff_hermite_of_lt
+-/
 
+#print Polynomial.coeff_hermite_self /-
 @[simp]
 theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 :=
   by
@@ -113,7 +120,9 @@ theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 :=
   · rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, MulZeroClass.mul_zero, sub_zero]
     simp
 #align polynomial.coeff_hermite_self Polynomial.coeff_hermite_self
+-/
 
+#print Polynomial.degree_hermite /-
 @[simp]
 theorem degree_hermite (n : ℕ) : (hermite n).degree = n :=
   by
@@ -123,21 +132,27 @@ theorem degree_hermite (n : ℕ) : (hermite n).degree = n :=
     exact coeff_hermite_of_lt
   · simp [coeff_hermite_self n]
 #align polynomial.degree_hermite Polynomial.degree_hermite
+-/
 
+#print Polynomial.natDegree_hermite /-
 @[simp]
 theorem natDegree_hermite {n : ℕ} : (hermite n).natDegree = n :=
   natDegree_eq_of_degree_eq_some (degree_hermite n)
 #align polynomial.nat_degree_hermite Polynomial.natDegree_hermite
+-/
 
+#print Polynomial.leadingCoeff_hermite /-
 @[simp]
 theorem leadingCoeff_hermite (n : ℕ) : (hermite n).leadingCoeff = 1 := by
   rw [← coeff_nat_degree, nat_degree_hermite, coeff_hermite_self]
 #align polynomial.leading_coeff_hermite Polynomial.leadingCoeff_hermite
+-/
 
 theorem hermite_monic (n : ℕ) : (hermite n).Monic :=
   leadingCoeff_hermite n
 #align polynomial.hermite_monic Polynomial.hermite_monic
 
+#print Polynomial.coeff_hermite_of_odd_add /-
 theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermite n) k = 0 :=
   by
   induction' n with n ih generalizing k
@@ -151,6 +166,7 @@ theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermit
       · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk 
         exact (nat.odd_add.mp hnk).mpr even_two
 #align polynomial.coeff_hermite_of_odd_add Polynomial.coeff_hermite_of_odd_add
+-/
 
 end Coeff
 
Diff
@@ -141,14 +141,14 @@ theorem hermite_monic (n : ℕ) : (hermite n).Monic :=
 theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermite n) k = 0 :=
   by
   induction' n with n ih generalizing k
-  · rw [zero_add] at hnk
+  · rw [zero_add] at hnk 
     exact coeff_hermite_of_lt hnk.pos
   · cases k
-    · rw [Nat.succ_add_eq_succ_add] at hnk
+    · rw [Nat.succ_add_eq_succ_add] at hnk 
       rw [coeff_hermite_succ_zero, ih hnk, neg_zero]
     · rw [coeff_hermite_succ_succ, ih, ih, MulZeroClass.mul_zero, sub_zero]
-      · rwa [Nat.succ_add_eq_succ_add] at hnk
-      · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk
+      · rwa [Nat.succ_add_eq_succ_add] at hnk 
+      · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk 
         exact (nat.odd_add.mp hnk).mpr even_two
 #align polynomial.coeff_hermite_of_odd_add Polynomial.coeff_hermite_of_odd_add
 
@@ -207,7 +207,7 @@ theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
     coeff (hermite n) k = (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k :=
   by
   cases' le_or_lt k n with h_le h_lt
-  · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk
+  · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk 
     obtain ⟨m, hm⟩ := hnk
     rw [(by linarith : n = 2 * m + k), Nat.add_sub_cancel,
       Nat.mul_div_cancel_left _ (Nat.succ_pos 1), coeff_hermite_explicit]
Diff
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
 
 ! This file was ported from Lean 3 source module ring_theory.polynomial.hermite.basic
-! leanprover-community/mathlib commit 066ecdb4834c7a4693e0f0e5154935a6f3d3f90c
+! leanprover-community/mathlib commit 938d3db9c278f8a52c0f964a405806f0f2b09b74
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Data.Polynomial.Derivative
 import Mathbin.Data.Nat.Parity
+import Mathbin.Data.Nat.Factorial.DoubleFactorial
 
 /-!
 # Hermite polynomials
@@ -24,9 +25,14 @@ This file defines `polynomial.hermite n`, the nth probabilist's Hermite polynomi
 ## Results
 
 * `polynomial.hermite_succ`: the recursion `hermite (n+1) = (x - d/dx) (hermite n)`
+* `polynomial.coeff_hermite_explicit`: a closed formula for (nonvanishing) coefficients in terms
+  of binomial coefficients and double factorials.
 * `polynomial.coeff_hermite_of_odd_add`: for `n`,`k` where `n+k` is odd, `(hermite n).coeff k` is
   zero.
+* `polynomial.coeff_hermite_of_even_add`: a closed formula for `(hermite n).coeff k` when `n+k` is
+  even, equivalent to `polynomial.coeff_hermite_explicit`.
 * `polynomial.monic_hermite`: for all `n`, `hermite n` is monic.
+* `polynomial.degree_hermite`: for all `n`, `hermite n` has degree `n`.
 
 ## References
 
@@ -148,5 +154,76 @@ theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermit
 
 end Coeff
 
+section CoeffExplicit
+
+open scoped Nat
+
+/-- Because of `coeff_hermite_of_odd_add`, every nonzero coefficient is described as follows. -/
+theorem coeff_hermite_explicit :
+    ∀ n k : ℕ, coeff (hermite (2 * n + k)) k = (-1) ^ n * (2 * n - 1)‼ * Nat.choose (2 * n + k) k
+  | 0, _ => by simp
+  | n + 1, 0 => by
+    convert coeff_hermite_succ_zero (2 * n + 1) using 1
+    rw [coeff_hermite_explicit n 1, (by ring_nf : 2 * (n + 1) - 1 = 2 * n + 1),
+      Nat.doubleFactorial_add_one, Nat.choose_zero_right, Nat.choose_one_right, pow_succ]
+    push_cast
+    ring
+  | n + 1, k + 1 =>
+    by
+    let hermite_explicit : ℕ → ℕ → ℤ := fun n k =>
+      (-1) ^ n * (2 * n - 1)‼ * Nat.choose (2 * n + k) k
+    have hermite_explicit_recur :
+      ∀ n k : ℕ,
+        hermite_explicit (n + 1) (k + 1) =
+          hermite_explicit (n + 1) k - (k + 2) * hermite_explicit n (k + 2) :=
+      by
+      intro n k
+      simp only [hermite_explicit]
+      -- Factor out (-1)'s.
+      rw [mul_comm (↑k + _), sub_eq_add_neg]
+      nth_rw 3 [neg_eq_neg_one_mul]
+      simp only [mul_assoc, ← mul_add, pow_succ]
+      congr 2
+      -- Factor out double factorials.
+      norm_cast
+      rw [(by ring_nf : 2 * (n + 1) - 1 = 2 * n + 1), Nat.doubleFactorial_add_one,
+        mul_comm (2 * n + 1)]
+      simp only [mul_assoc, ← mul_add]
+      congr 1
+      -- Match up binomial coefficients using `nat.choose_succ_right_eq`.
+      rw [(by ring : 2 * (n + 1) + (k + 1) = 2 * n + 1 + (k + 1) + 1),
+        (by ring : 2 * (n + 1) + k = 2 * n + 1 + (k + 1)),
+        (by ring : 2 * n + (k + 2) = 2 * n + 1 + (k + 1))]
+      rw [Nat.choose, Nat.choose_succ_right_eq (2 * n + 1 + (k + 1)) (k + 1), Nat.add_sub_cancel]
+      ring
+    change _ = hermite_explicit _ _
+    rw [← add_assoc, coeff_hermite_succ_succ, hermite_explicit_recur]
+    congr
+    · rw [coeff_hermite_explicit (n + 1) k]
+    · rw [(by ring : 2 * (n + 1) + k = 2 * n + (k + 2)), coeff_hermite_explicit n (k + 2)]
+#align polynomial.coeff_hermite_explicit Polynomial.coeff_hermite_explicit
+
+theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
+    coeff (hermite n) k = (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k :=
+  by
+  cases' le_or_lt k n with h_le h_lt
+  · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk
+    obtain ⟨m, hm⟩ := hnk
+    rw [(by linarith : n = 2 * m + k), Nat.add_sub_cancel,
+      Nat.mul_div_cancel_left _ (Nat.succ_pos 1), coeff_hermite_explicit]
+  · simp [Nat.choose_eq_zero_of_lt h_lt, coeff_hermite_of_lt h_lt]
+#align polynomial.coeff_hermite_of_even_add Polynomial.coeff_hermite_of_even_add
+
+theorem coeff_hermite (n k : ℕ) :
+    coeff (hermite n) k =
+      if Even (n + k) then (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k else 0 :=
+  by
+  split_ifs with h
+  exact coeff_hermite_of_even_add h
+  exact coeff_hermite_of_odd_add (nat.odd_iff_not_even.mpr h)
+#align polynomial.coeff_hermite Polynomial.coeff_hermite
+
+end CoeffExplicit
+
 end Polynomial
 
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2023 Luke Mantle. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
 
-! This file was ported from Lean 3 source module ring_theory.polynomial.hermite
-! leanprover-community/mathlib commit b17e272059b7ba6d9ba850e274b08d2a2cde3ccf
+! This file was ported from Lean 3 source module ring_theory.polynomial.hermite.basic
+! leanprover-community/mathlib commit 066ecdb4834c7a4693e0f0e5154935a6f3d3f90c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -23,6 +23,7 @@ This file defines `polynomial.hermite n`, the nth probabilist's Hermite polynomi
 
 ## Results
 
+* `polynomial.hermite_succ`: the recursion `hermite (n+1) = (x - d/dx) (hermite n)`
 * `polynomial.coeff_hermite_of_odd_add`: for `n`,`k` where `n+k` is odd, `(hermite n).coeff k` is
   zero.
 * `polynomial.monic_hermite`: for all `n`, `hermite n` is monic.
@@ -46,6 +47,7 @@ noncomputable def hermite : ℕ → Polynomial ℤ
   | n + 1 => X * hermite n - (hermite n).derivative
 #align polynomial.hermite Polynomial.hermite
 
+/-- The recursion `hermite (n+1) = (x - d/dx) (hermite n)` -/
 @[simp]
 theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - (hermite n).derivative := by
   rw [hermite]

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 3 (#12372)

A PR analogous to #12338 and #12361: reformatting proofs following the multiple goals linter of #12339.

Diff
@@ -110,8 +110,8 @@ theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 := by
 @[simp]
 theorem degree_hermite (n : ℕ) : (hermite n).degree = n := by
   rw [degree_eq_of_le_of_coeff_ne_zero]
-  simp_rw [degree_le_iff_coeff_zero, Nat.cast_lt]
-  · rintro m hnm
+  · simp_rw [degree_le_iff_coeff_zero, Nat.cast_lt]
+    rintro m hnm
     exact coeff_hermite_of_lt hnm
   · simp [coeff_hermite_self n]
 #align polynomial.degree_hermite Polynomial.degree_hermite
@@ -210,8 +210,8 @@ theorem coeff_hermite (n k : ℕ) :
     coeff (hermite n) k =
       if Even (n + k) then (-1 : ℤ) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k else 0 := by
   split_ifs with h
-  exact coeff_hermite_of_even_add h
-  exact coeff_hermite_of_odd_add (Nat.odd_iff_not_even.mpr h)
+  · exact coeff_hermite_of_even_add h
+  · exact coeff_hermite_of_odd_add (Nat.odd_iff_not_even.mpr h)
 #align polynomial.coeff_hermite Polynomial.coeff_hermite
 
 end CoeffExplicit
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,7 +3,7 @@ Copyright (c) 2023 Luke Mantle. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
 -/
-import Mathlib.Data.Polynomial.Derivative
+import Mathlib.Algebra.Polynomial.Derivative
 import Mathlib.Data.Nat.Parity
 import Mathlib.Data.Nat.Factorial.DoubleFactorial
 
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -173,7 +173,7 @@ theorem coeff_hermite_explicit :
       -- Factor out (-1)'s.
       rw [mul_comm (↑k + _ : ℤ), sub_eq_add_neg]
       nth_rw 3 [neg_eq_neg_one_mul]
-      simp only [mul_assoc, ← mul_add, pow_succ]
+      simp only [mul_assoc, ← mul_add, pow_succ']
       congr 2
       -- Factor out double factorials.
       norm_cast
chore: remove unneeded decreasing_by and termination_by (#11386)

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

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

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

Diff
@@ -193,8 +193,6 @@ theorem coeff_hermite_explicit :
     congr
     · rw [coeff_hermite_explicit (n + 1) k]
     · rw [(by ring : 2 * (n + 1) + k = 2 * n + (k + 2)), coeff_hermite_explicit n (k + 2)]
--- Porting note: Lean 3 worked this out automatically
-termination_by n k => (n, k)
 #align polynomial.coeff_hermite_explicit Polynomial.coeff_hermite_explicit
 
 theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
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
@@ -155,7 +155,7 @@ theorem coeff_hermite_explicit :
   | 0, _ => by simp
   | n + 1, 0 => by
     convert coeff_hermite_succ_zero (2 * n + 1) using 1
-    -- porting note: ring_nf did not solve the goal on line 165
+    -- Porting note: ring_nf did not solve the goal on line 165
     rw [coeff_hermite_explicit n 1, (by rw [Nat.left_distrib, mul_one, Nat.add_one_sub_one] :
       2 * (n + 1) - 1 = 2 * n + 1), Nat.doubleFactorial_add_one, Nat.choose_zero_right,
       Nat.choose_one_right, pow_succ]
@@ -177,7 +177,7 @@ theorem coeff_hermite_explicit :
       congr 2
       -- Factor out double factorials.
       norm_cast
-      -- porting note: ring_nf did not solve the goal on line 186
+      -- Porting note: ring_nf did not solve the goal on line 186
       rw [(by rw [Nat.left_distrib, mul_one, Nat.add_one_sub_one] : 2 * (n + 1) - 1 = 2 * n + 1),
         Nat.doubleFactorial_add_one, mul_comm (2 * n + 1)]
       simp only [mul_assoc, ← mul_add]
@@ -193,7 +193,7 @@ theorem coeff_hermite_explicit :
     congr
     · rw [coeff_hermite_explicit (n + 1) k]
     · rw [(by ring : 2 * (n + 1) + k = 2 * n + (k + 2)), coeff_hermite_explicit n (k + 2)]
--- porting note: Lean 3 worked this out automatically
+-- Porting note: Lean 3 worked this out automatically
 termination_by n k => (n, k)
 #align polynomial.coeff_hermite_explicit Polynomial.coeff_hermite_explicit
 
@@ -202,7 +202,7 @@ theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
   rcases le_or_lt k n with h_le | h_lt
   · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk
     obtain ⟨m, hm⟩ := hnk
-    -- porting note: linarith failed to find a contradiction by itself
+    -- Porting note: linarith failed to find a contradiction by itself
     rw [(by omega : n = 2 * m + k),
       Nat.add_sub_cancel, Nat.mul_div_cancel_left _ (Nat.succ_pos 1), coeff_hermite_explicit]
   · simp [Nat.choose_eq_zero_of_lt h_lt, coeff_hermite_of_lt h_lt]
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
@@ -203,7 +203,7 @@ theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
   · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk
     obtain ⟨m, hm⟩ := hnk
     -- porting note: linarith failed to find a contradiction by itself
-    rw [(by linarith [by rwa [Nat.sub_eq_iff_eq_add h_le] at hm] : n = 2 * m + k),
+    rw [(by omega : n = 2 * m + k),
       Nat.add_sub_cancel, Nat.mul_div_cancel_left _ (Nat.succ_pos 1), coeff_hermite_explicit]
   · simp [Nat.choose_eq_zero_of_lt h_lt, coeff_hermite_of_lt h_lt]
 #align polynomial.coeff_hermite_of_even_add Polynomial.coeff_hermite_of_even_add
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
@@ -169,7 +169,7 @@ theorem coeff_hermite_explicit :
         hermite_explicit (n + 1) (k + 1) =
           hermite_explicit (n + 1) k - (k + 2) * hermite_explicit n (k + 2) := by
       intro n k
-      simp only
+      simp only [hermite_explicit]
       -- Factor out (-1)'s.
       rw [mul_comm (↑k + _ : ℤ), sub_eq_add_neg]
       nth_rw 3 [neg_eq_neg_one_mul]
chore: classify simp can do this porting notes (#10619)

Classify by adding issue number (#10618) to porting notes claiming anything semantically equivalent to simp can prove this or simp can simplify this.

Diff
@@ -67,7 +67,7 @@ theorem hermite_zero : hermite 0 = C 1 :=
   rfl
 #align polynomial.hermite_zero Polynomial.hermite_zero
 
--- Porting note: There was initially @[simp] on this line but it was removed
+-- Porting note (#10618): There was initially @[simp] on this line but it was removed
 -- because simp can prove this theorem
 theorem hermite_one : hermite 1 = X := by
   rw [hermite_succ, hermite_zero]
chore: move to v4.6.0-rc1, merging adaptations from bump/v4.6.0 (#10176)

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

Diff
@@ -186,20 +186,15 @@ theorem coeff_hermite_explicit :
       rw [(by ring : 2 * (n + 1) + (k + 1) = 2 * n + 1 + (k + 1) + 1),
         (by ring : 2 * (n + 1) + k = 2 * n + 1 + (k + 1)),
         (by ring : 2 * n + (k + 2) = 2 * n + 1 + (k + 1))]
-      rw [Nat.choose, Nat.choose_succ_right_eq (2 * n + 1 + (k + 1)) (k + 1), Nat.add_sub_cancel,
-        Int.negSucc_eq]
-      -- porting note: ring could not solve the goal so the lines 195, 198-200 were added.
-      ring_nf
-      simp only [sub_eq_add_neg, ← neg_mul, ← right_distrib _ _ ((-(1 : ℤ)) ^ n), ← neg_add]
-      norm_cast
-      simp only [← add_assoc, add_comm]
+      rw [Nat.choose, Nat.choose_succ_right_eq (2 * n + 1 + (k + 1)) (k + 1), Nat.add_sub_cancel]
+      ring
     change _ = hermite_explicit _ _
     rw [← add_assoc, coeff_hermite_succ_succ, hermite_explicit_recur]
     congr
     · rw [coeff_hermite_explicit (n + 1) k]
     · rw [(by ring : 2 * (n + 1) + k = 2 * n + (k + 2)), coeff_hermite_explicit n (k + 2)]
 -- porting note: Lean 3 worked this out automatically
-termination_by _ n k => (n, k)
+termination_by n k => (n, k)
 #align polynomial.coeff_hermite_explicit Polynomial.coeff_hermite_explicit
 
 theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
chore: remove uses of cases' (#9171)

I literally went through and regex'd some uses of cases', replacing them with rcases; this is meant to be a low effort PR as I hope that tools can do this in the future.

rcases is an easier replacement than cases, though with better tools we could in future do a second pass converting simple rcases added here (and existing ones) to cases.

Diff
@@ -204,7 +204,7 @@ termination_by _ n k => (n, k)
 
 theorem coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) :
     coeff (hermite n) k = (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k := by
-  cases' le_or_lt k n with h_le h_lt
+  rcases le_or_lt k n with h_le | h_lt
   · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk
     obtain ⟨m, hm⟩ := hnk
     -- porting note: linarith failed to find a contradiction by itself
fix: patch for std4#197 (More add lemmas for Nat) (#6202)
Diff
@@ -135,10 +135,10 @@ theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermit
   · rw [Nat.zero_eq, zero_add k] at hnk
     exact coeff_hermite_of_lt hnk.pos
   · cases' k with k
-    · rw [Nat.succ_add_eq_succ_add] at hnk
+    · rw [Nat.succ_add_eq_add_succ] at hnk
       rw [coeff_hermite_succ_zero, ih hnk, neg_zero]
     · rw [coeff_hermite_succ_succ, ih, ih, mul_zero, sub_zero]
-      · rwa [Nat.succ_add_eq_succ_add] at hnk
+      · rwa [Nat.succ_add_eq_add_succ] at hnk
       · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk
         exact (Nat.odd_add.mp hnk).mpr even_two
 #align polynomial.coeff_hermite_of_odd_add Polynomial.coeff_hermite_of_odd_add
fix: patch for std4#203 (more sub lemmas for Nat) (#6216)
Diff
@@ -156,7 +156,7 @@ theorem coeff_hermite_explicit :
   | n + 1, 0 => by
     convert coeff_hermite_succ_zero (2 * n + 1) using 1
     -- porting note: ring_nf did not solve the goal on line 165
-    rw [coeff_hermite_explicit n 1, (by rw [Nat.left_distrib, mul_one, Nat.succ_sub_one] :
+    rw [coeff_hermite_explicit n 1, (by rw [Nat.left_distrib, mul_one, Nat.add_one_sub_one] :
       2 * (n + 1) - 1 = 2 * n + 1), Nat.doubleFactorial_add_one, Nat.choose_zero_right,
       Nat.choose_one_right, pow_succ]
     push_cast
@@ -178,7 +178,7 @@ theorem coeff_hermite_explicit :
       -- Factor out double factorials.
       norm_cast
       -- porting note: ring_nf did not solve the goal on line 186
-      rw [(by rw [Nat.left_distrib, mul_one, Nat.succ_sub_one] : 2 * (n + 1) - 1 = 2 * n + 1),
+      rw [(by rw [Nat.left_distrib, mul_one, Nat.add_one_sub_one] : 2 * (n + 1) - 1 = 2 * n + 1),
         Nat.doubleFactorial_add_one, mul_comm (2 * n + 1)]
       simp only [mul_assoc, ← mul_add]
       congr 1
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -96,14 +96,14 @@ theorem coeff_hermite_of_lt {n k : ℕ} (hnk : n < k) : coeff (hermite n) k = 0
   · apply coeff_C
   · have : n + k + 1 + 2 = n + (k + 2) + 1 := by ring
     rw [Nat.succ_eq_add_one, coeff_hermite_succ_succ, add_right_comm, this, ih k, ih (k + 2),
-      MulZeroClass.mul_zero, sub_zero]
+      mul_zero, sub_zero]
 #align polynomial.coeff_hermite_of_lt Polynomial.coeff_hermite_of_lt
 
 @[simp]
 theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 := by
   induction' n with n ih
   · apply coeff_C
-  · rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, MulZeroClass.mul_zero, sub_zero]
+  · rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, mul_zero, sub_zero]
     simp
 #align polynomial.coeff_hermite_self Polynomial.coeff_hermite_self
 
@@ -137,7 +137,7 @@ theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermit
   · cases' k with k
     · rw [Nat.succ_add_eq_succ_add] at hnk
       rw [coeff_hermite_succ_zero, ih hnk, neg_zero]
-    · rw [coeff_hermite_succ_succ, ih, ih, MulZeroClass.mul_zero, sub_zero]
+    · rw [coeff_hermite_succ_succ, ih, ih, mul_zero, sub_zero]
       · rwa [Nat.succ_add_eq_succ_add] at hnk
       · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk
         exact (Nat.odd_add.mp hnk).mpr even_two
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,16 +2,13 @@
 Copyright (c) 2023 Luke Mantle. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Luke Mantle
-
-! This file was ported from Lean 3 source module ring_theory.polynomial.hermite.basic
-! leanprover-community/mathlib commit 938d3db9c278f8a52c0f964a405806f0f2b09b74
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Polynomial.Derivative
 import Mathlib.Data.Nat.Parity
 import Mathlib.Data.Nat.Factorial.DoubleFactorial
 
+#align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"938d3db9c278f8a52c0f964a405806f0f2b09b74"
+
 /-!
 # Hermite polynomials
 
fix precedence of Nat.iterate (#5589)
Diff
@@ -59,7 +59,7 @@ theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - derivative (h
   rw [hermite]
 #align polynomial.hermite_succ Polynomial.hermite_succ
 
-theorem hermite_eq_iterate (n : ℕ) : hermite n = ((fun p => X * p - derivative p)^[n]) 1 := by
+theorem hermite_eq_iterate (n : ℕ) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by
   induction' n with n ih
   · rfl
   · rw [Function.iterate_succ_apply', ← ih, hermite_succ]
feat: make CI fail if there are stdout lines (#5396)

https://github.com/leanprover-community/mathlib4/actions/runs/5349279420/jobs/9700275999 shows this working successfully (i.e. the action failing as there were ring's that should be ring_nf's

We then clean up the noisy lines in mathlib

Diff
@@ -80,7 +80,7 @@ theorem hermite_one : hermite 1 = X := by
 /-! ### Lemmas about `Polynomial.coeff` -/
 
 
-section Coeff
+section coeff
 
 theorem coeff_hermite_succ_zero (n : ℕ) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by
   simp [coeff_derivative]
@@ -146,7 +146,7 @@ theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermit
         exact (Nat.odd_add.mp hnk).mpr even_two
 #align polynomial.coeff_hermite_of_odd_add Polynomial.coeff_hermite_of_odd_add
 
-end Coeff
+end coeff
 
 section CoeffExplicit
 
@@ -190,9 +190,9 @@ theorem coeff_hermite_explicit :
         (by ring : 2 * (n + 1) + k = 2 * n + 1 + (k + 1)),
         (by ring : 2 * n + (k + 2) = 2 * n + 1 + (k + 1))]
       rw [Nat.choose, Nat.choose_succ_right_eq (2 * n + 1 + (k + 1)) (k + 1), Nat.add_sub_cancel,
-      Int.negSucc_eq]
+        Int.negSucc_eq]
       -- porting note: ring could not solve the goal so the lines 195, 198-200 were added.
-      ring
+      ring_nf
       simp only [sub_eq_add_neg, ← neg_mul, ← right_distrib _ _ ((-(1 : ℤ)) ^ n), ← neg_add]
       norm_cast
       simp only [← add_assoc, add_comm]
chore: reviewing porting notes about rw/simp/simp_rw (#5244)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -113,11 +113,9 @@ theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 := by
 @[simp]
 theorem degree_hermite (n : ℕ) : (hermite n).degree = n := by
   rw [degree_eq_of_le_of_coeff_ne_zero]
-  simp_rw [degree_le_iff_coeff_zero]
-   -- porting note: mathlib3 also had `simp_rw [WithBot.coe_lt_coe]` but it's not firing
-   -- so we add it manually later
+  simp_rw [degree_le_iff_coeff_zero, Nat.cast_lt]
   · rintro m hnm
-    exact coeff_hermite_of_lt (WithBot.coe_lt_coe.1 hnm)
+    exact coeff_hermite_of_lt hnm
   · simp [coeff_hermite_self n]
 #align polynomial.degree_hermite Polynomial.degree_hermite
 
feat: port RingTheory.Polynomial.Hermite.Basic (#3967)

Co-authored-by: Emilie Uthaiwat <emiliepathum@gmail.com> Co-authored-by: EmilieUthaiwat <102412311+EmilieUthaiwat@users.noreply.github.com>

Dependencies 8 + 400

401 files ported (98.0%)
166134 lines ported (98.2%)
Show graph

The unported dependencies are