data.nat.factorial.castMathlib.Data.Nat.Factorial.Cast

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -74,7 +74,7 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
   cases a
   · rw [zero_tsub, cast_zero, ascPochhammer_ne_zero_eval_zero _ two_ne_zero, MulZeroClass.zero_mul]
   ·
-    rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, ascPochhammer_succ_right,
+    rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel_right, ascPochhammer_succ_right,
       ascPochhammer_one, Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add,
       Polynomial.eval_X, cast_one, Polynomial.eval_one]
 #align nat.cast_desc_factorial_two Nat.cast_descFactorial_two
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2021 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 -/
-import Mathbin.RingTheory.Polynomial.Pochhammer
+import RingTheory.Polynomial.Pochhammer
 
 #align_import data.nat.factorial.cast from "leanprover-community/mathlib"@"69c6a5a12d8a2b159f20933e60115a4f2de62b58"
 
Diff
@@ -34,15 +34,15 @@ section Semiring
 variable [Semiring S] (a b : ℕ)
 
 #print Nat.cast_ascFactorial /-
-theorem cast_ascFactorial : (a.ascFactorial b : S) = (pochhammer S b).eval (a + 1) := by
-  rw [← pochhammer_nat_eq_ascFactorial, pochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
+theorem cast_ascFactorial : (a.ascFactorial b : S) = (ascPochhammer S b).eval (a + 1) := by
+  rw [← ascPochhammer_nat_eq_ascFactorial, ascPochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
 #align nat.cast_asc_factorial Nat.cast_ascFactorial
 -/
 
 #print Nat.cast_descFactorial /-
-theorem cast_descFactorial : (a.descFactorial b : S) = (pochhammer S b).eval (a - (b - 1) : ℕ) :=
+theorem cast_descFactorial : (a.descFactorial b : S) = (ascPochhammer S b).eval (a - (b - 1) : ℕ) :=
   by
-  rw [← pochhammer_eval_cast, pochhammer_nat_eq_descFactorial]
+  rw [← ascPochhammer_eval_cast, ascPochhammer_nat_eq_descFactorial]
   cases b
   · simp_rw [desc_factorial_zero]
   simp_rw [add_succ, succ_sub_one]
@@ -54,7 +54,7 @@ theorem cast_descFactorial : (a.descFactorial b : S) = (pochhammer S b).eval (a
 -/
 
 #print Nat.cast_factorial /-
-theorem cast_factorial : (a ! : S) = (pochhammer S a).eval 1 := by
+theorem cast_factorial : (a ! : S) = (ascPochhammer S a).eval 1 := by
   rw [← zero_asc_factorial, cast_asc_factorial, cast_zero, zero_add]
 #align nat.cast_factorial Nat.cast_factorial
 -/
@@ -72,11 +72,11 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
   by
   rw [cast_desc_factorial]
   cases a
-  · rw [zero_tsub, cast_zero, pochhammer_ne_zero_eval_zero _ two_ne_zero, MulZeroClass.zero_mul]
+  · rw [zero_tsub, cast_zero, ascPochhammer_ne_zero_eval_zero _ two_ne_zero, MulZeroClass.zero_mul]
   ·
-    rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, pochhammer_succ_right, pochhammer_one,
-      Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add, Polynomial.eval_X, cast_one,
-      Polynomial.eval_one]
+    rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, ascPochhammer_succ_right,
+      ascPochhammer_one, Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add,
+      Polynomial.eval_X, cast_one, Polynomial.eval_one]
 #align nat.cast_desc_factorial_two Nat.cast_descFactorial_two
 -/
 
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2021 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
-
-! This file was ported from Lean 3 source module data.nat.factorial.cast
-! leanprover-community/mathlib commit 69c6a5a12d8a2b159f20933e60115a4f2de62b58
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.Polynomial.Pochhammer
 
+#align_import data.nat.factorial.cast from "leanprover-community/mathlib"@"69c6a5a12d8a2b159f20933e60115a4f2de62b58"
+
 /-!
 # Cast of factorials
 
Diff
@@ -36,9 +36,11 @@ section Semiring
 
 variable [Semiring S] (a b : ℕ)
 
+#print Nat.cast_ascFactorial /-
 theorem cast_ascFactorial : (a.ascFactorial b : S) = (pochhammer S b).eval (a + 1) := by
   rw [← pochhammer_nat_eq_ascFactorial, pochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
 #align nat.cast_asc_factorial Nat.cast_ascFactorial
+-/
 
 #print Nat.cast_descFactorial /-
 theorem cast_descFactorial : (a.descFactorial b : S) = (pochhammer S b).eval (a - (b - 1) : ℕ) :=
@@ -66,6 +68,7 @@ section Ring
 
 variable [Ring S] (a b : ℕ)
 
+#print Nat.cast_descFactorial_two /-
 /-- Convenience lemma. The `a - 1` is not using truncated subtraction, as opposed to the definition
 of `nat.desc_factorial` as a natural. -/
 theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
@@ -78,6 +81,7 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
       Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add, Polynomial.eval_X, cast_one,
       Polynomial.eval_one]
 #align nat.cast_desc_factorial_two Nat.cast_descFactorial_two
+-/
 
 end Ring
 
Diff
@@ -26,7 +26,7 @@ to `↑a - 1`, the other factor is `0` anyway.
 -/
 
 
-open Nat
+open scoped Nat
 
 variable (S : Type _)
 
Diff
@@ -36,12 +36,6 @@ section Semiring
 
 variable [Semiring S] (a b : ℕ)
 
-/- warning: nat.cast_asc_factorial -> Nat.cast_ascFactorial is a dubious translation:
-lean 3 declaration is
-  forall (S : Type.{u1}) [_inst_1 : Semiring.{u1} S] (a : Nat) (b : Nat), Eq.{succ u1} S ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} S (NonAssocSemiring.toAddCommMonoidWithOne.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))))) (Nat.ascFactorial a b)) (Polynomial.eval.{u1} S _inst_1 (HAdd.hAdd.{u1, u1, u1} S S S (instHAdd.{u1} S (Distrib.toHasAdd.{u1} S (NonUnitalNonAssocSemiring.toDistrib.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} S (NonAssocSemiring.toAddCommMonoidWithOne.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))))) a) (OfNat.ofNat.{u1} S 1 (OfNat.mk.{u1} S 1 (One.one.{u1} S (AddMonoidWithOne.toOne.{u1} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} S (NonAssocSemiring.toAddCommMonoidWithOne.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1)))))))) (pochhammer.{u1} S _inst_1 b))
-but is expected to have type
-  forall (S : Type.{u1}) [_inst_1 : Semiring.{u1} S] (a : Nat) (b : Nat), Eq.{succ u1} S (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S _inst_1) (Nat.ascFactorial a b)) (Polynomial.eval.{u1} S _inst_1 (HAdd.hAdd.{u1, u1, u1} S S S (instHAdd.{u1} S (Distrib.toAdd.{u1} S (NonUnitalNonAssocSemiring.toDistrib.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))) (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S _inst_1) a) (OfNat.ofNat.{u1} S 1 (One.toOfNat1.{u1} S (Semiring.toOne.{u1} S _inst_1)))) (pochhammer.{u1} S _inst_1 b))
-Case conversion may be inaccurate. Consider using '#align nat.cast_asc_factorial Nat.cast_ascFactorialₓ'. -/
 theorem cast_ascFactorial : (a.ascFactorial b : S) = (pochhammer S b).eval (a + 1) := by
   rw [← pochhammer_nat_eq_ascFactorial, pochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
 #align nat.cast_asc_factorial Nat.cast_ascFactorial
@@ -72,12 +66,6 @@ section Ring
 
 variable [Ring S] (a b : ℕ)
 
-/- warning: nat.cast_desc_factorial_two -> Nat.cast_descFactorial_two is a dubious translation:
-lean 3 declaration is
-  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (Distrib.toHasMul.{u1} S (Ring.toDistrib.{u1} S _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (SubNegMonoid.toHasSub.{u1} S (AddGroup.toSubNegMonoid.{u1} S (AddGroupWithOne.toAddGroup.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) a) (OfNat.ofNat.{u1} S 1 (OfNat.mk.{u1} S 1 (One.one.{u1} S (AddMonoidWithOne.toOne.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1)))))))))
-but is expected to have type
-  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S (Ring.toSemiring.{u1} S _inst_1)) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (NonUnitalNonAssocRing.toMul.{u1} S (NonAssocRing.toNonUnitalNonAssocRing.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))) (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S (Ring.toSemiring.{u1} S _inst_1)) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (Ring.toSub.{u1} S _inst_1)) (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S (Ring.toSemiring.{u1} S _inst_1)) a) (OfNat.ofNat.{u1} S 1 (One.toOfNat1.{u1} S (Semiring.toOne.{u1} S (Ring.toSemiring.{u1} S _inst_1))))))
-Case conversion may be inaccurate. Consider using '#align nat.cast_desc_factorial_two Nat.cast_descFactorial_twoₓ'. -/
 /-- Convenience lemma. The `a - 1` is not using truncated subtraction, as opposed to the definition
 of `nat.desc_factorial` as a natural. -/
 theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
Diff
@@ -76,7 +76,7 @@ variable [Ring S] (a b : ℕ)
 lean 3 declaration is
   forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (Distrib.toHasMul.{u1} S (Ring.toDistrib.{u1} S _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (SubNegMonoid.toHasSub.{u1} S (AddGroup.toSubNegMonoid.{u1} S (AddGroupWithOne.toAddGroup.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) a) (OfNat.ofNat.{u1} S 1 (OfNat.mk.{u1} S 1 (One.one.{u1} S (AddMonoidWithOne.toOne.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1)))))))))
 but is expected to have type
-  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (NonUnitalNonAssocRing.toMul.{u1} S (NonAssocRing.toNonUnitalNonAssocRing.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))) (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (Ring.toSub.{u1} S _inst_1)) (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) a) (OfNat.ofNat.{u1} S 1 (One.toOfNat1.{u1} S (NonAssocRing.toOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))
+  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S (Ring.toSemiring.{u1} S _inst_1)) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (NonUnitalNonAssocRing.toMul.{u1} S (NonAssocRing.toNonUnitalNonAssocRing.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))) (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S (Ring.toSemiring.{u1} S _inst_1)) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (Ring.toSub.{u1} S _inst_1)) (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S (Ring.toSemiring.{u1} S _inst_1)) a) (OfNat.ofNat.{u1} S 1 (One.toOfNat1.{u1} S (Semiring.toOne.{u1} S (Ring.toSemiring.{u1} S _inst_1))))))
 Case conversion may be inaccurate. Consider using '#align nat.cast_desc_factorial_two Nat.cast_descFactorial_twoₓ'. -/
 /-- Convenience lemma. The `a - 1` is not using truncated subtraction, as opposed to the definition
 of `nat.desc_factorial` as a natural. -/
Diff
@@ -74,7 +74,7 @@ variable [Ring S] (a b : ℕ)
 
 /- warning: nat.cast_desc_factorial_two -> Nat.cast_descFactorial_two is a dubious translation:
 lean 3 declaration is
-  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (Distrib.toHasMul.{u1} S (Ring.toDistrib.{u1} S _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (SubNegMonoid.toHasSub.{u1} S (AddGroup.toSubNegMonoid.{u1} S (AddGroupWithOne.toAddGroup.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))) a) (OfNat.ofNat.{u1} S 1 (OfNat.mk.{u1} S 1 (One.one.{u1} S (AddMonoidWithOne.toOne.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))))))))
+  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (Distrib.toHasMul.{u1} S (Ring.toDistrib.{u1} S _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (SubNegMonoid.toHasSub.{u1} S (AddGroup.toSubNegMonoid.{u1} S (AddGroupWithOne.toAddGroup.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1))))))) a) (OfNat.ofNat.{u1} S 1 (OfNat.mk.{u1} S 1 (One.one.{u1} S (AddMonoidWithOne.toOne.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (AddCommGroupWithOne.toAddGroupWithOne.{u1} S (Ring.toAddCommGroupWithOne.{u1} S _inst_1)))))))))
 but is expected to have type
   forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (NonUnitalNonAssocRing.toMul.{u1} S (NonAssocRing.toNonUnitalNonAssocRing.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))) (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (Ring.toSub.{u1} S _inst_1)) (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) a) (OfNat.ofNat.{u1} S 1 (One.toOfNat1.{u1} S (NonAssocRing.toOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))
 Case conversion may be inaccurate. Consider using '#align nat.cast_desc_factorial_two Nat.cast_descFactorial_twoₓ'. -/
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 
 ! This file was ported from Lean 3 source module data.nat.factorial.cast
-! leanprover-community/mathlib commit d50b12ae8e2bd910d08a94823976adae9825718b
+! leanprover-community/mathlib commit 69c6a5a12d8a2b159f20933e60115a4f2de62b58
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.RingTheory.Polynomial.Pochhammer
 /-!
 # Cast of factorials
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file allows calculating factorials (including ascending and descending ones) as elements of a
 semiring.
 
Diff
@@ -33,10 +33,17 @@ section Semiring
 
 variable [Semiring S] (a b : ℕ)
 
+/- warning: nat.cast_asc_factorial -> Nat.cast_ascFactorial is a dubious translation:
+lean 3 declaration is
+  forall (S : Type.{u1}) [_inst_1 : Semiring.{u1} S] (a : Nat) (b : Nat), Eq.{succ u1} S ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} S (NonAssocSemiring.toAddCommMonoidWithOne.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))))) (Nat.ascFactorial a b)) (Polynomial.eval.{u1} S _inst_1 (HAdd.hAdd.{u1, u1, u1} S S S (instHAdd.{u1} S (Distrib.toHasAdd.{u1} S (NonUnitalNonAssocSemiring.toDistrib.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} S (NonAssocSemiring.toAddCommMonoidWithOne.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))))) a) (OfNat.ofNat.{u1} S 1 (OfNat.mk.{u1} S 1 (One.one.{u1} S (AddMonoidWithOne.toOne.{u1} S (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} S (NonAssocSemiring.toAddCommMonoidWithOne.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1)))))))) (pochhammer.{u1} S _inst_1 b))
+but is expected to have type
+  forall (S : Type.{u1}) [_inst_1 : Semiring.{u1} S] (a : Nat) (b : Nat), Eq.{succ u1} S (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S _inst_1) (Nat.ascFactorial a b)) (Polynomial.eval.{u1} S _inst_1 (HAdd.hAdd.{u1, u1, u1} S S S (instHAdd.{u1} S (Distrib.toAdd.{u1} S (NonUnitalNonAssocSemiring.toDistrib.{u1} S (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} S (Semiring.toNonAssocSemiring.{u1} S _inst_1))))) (Nat.cast.{u1} S (Semiring.toNatCast.{u1} S _inst_1) a) (OfNat.ofNat.{u1} S 1 (One.toOfNat1.{u1} S (Semiring.toOne.{u1} S _inst_1)))) (pochhammer.{u1} S _inst_1 b))
+Case conversion may be inaccurate. Consider using '#align nat.cast_asc_factorial Nat.cast_ascFactorialₓ'. -/
 theorem cast_ascFactorial : (a.ascFactorial b : S) = (pochhammer S b).eval (a + 1) := by
   rw [← pochhammer_nat_eq_ascFactorial, pochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
 #align nat.cast_asc_factorial Nat.cast_ascFactorial
 
+#print Nat.cast_descFactorial /-
 theorem cast_descFactorial : (a.descFactorial b : S) = (pochhammer S b).eval (a - (b - 1) : ℕ) :=
   by
   rw [← pochhammer_eval_cast, pochhammer_nat_eq_descFactorial]
@@ -48,10 +55,13 @@ theorem cast_descFactorial : (a.descFactorial b : S) = (pochhammer S b).eval (a
     rw [tsub_eq_zero_iff_le.mpr h, zero_add]
   · rw [tsub_add_cancel_of_le h]
 #align nat.cast_desc_factorial Nat.cast_descFactorial
+-/
 
+#print Nat.cast_factorial /-
 theorem cast_factorial : (a ! : S) = (pochhammer S a).eval 1 := by
   rw [← zero_asc_factorial, cast_asc_factorial, cast_zero, zero_add]
 #align nat.cast_factorial Nat.cast_factorial
+-/
 
 end Semiring
 
@@ -59,6 +69,12 @@ section Ring
 
 variable [Ring S] (a b : ℕ)
 
+/- warning: nat.cast_desc_factorial_two -> Nat.cast_descFactorial_two is a dubious translation:
+lean 3 declaration is
+  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (Distrib.toHasMul.{u1} S (Ring.toDistrib.{u1} S _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (SubNegMonoid.toHasSub.{u1} S (AddGroup.toSubNegMonoid.{u1} S (AddGroupWithOne.toAddGroup.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat S (HasLiftT.mk.{1, succ u1} Nat S (CoeTCₓ.coe.{1, succ u1} Nat S (Nat.castCoe.{u1} S (AddMonoidWithOne.toNatCast.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))) a) (OfNat.ofNat.{u1} S 1 (OfNat.mk.{u1} S 1 (One.one.{u1} S (AddMonoidWithOne.toOne.{u1} S (AddGroupWithOne.toAddMonoidWithOne.{u1} S (NonAssocRing.toAddGroupWithOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))))))))
+but is expected to have type
+  forall (S : Type.{u1}) [_inst_1 : Ring.{u1} S] (a : Nat), Eq.{succ u1} S (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) (Nat.descFactorial a (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (HMul.hMul.{u1, u1, u1} S S S (instHMul.{u1} S (NonUnitalNonAssocRing.toMul.{u1} S (NonAssocRing.toNonUnitalNonAssocRing.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)))) (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) a) (HSub.hSub.{u1, u1, u1} S S S (instHSub.{u1} S (Ring.toSub.{u1} S _inst_1)) (Nat.cast.{u1} S (NonAssocRing.toNatCast.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1)) a) (OfNat.ofNat.{u1} S 1 (One.toOfNat1.{u1} S (NonAssocRing.toOne.{u1} S (Ring.toNonAssocRing.{u1} S _inst_1))))))
+Case conversion may be inaccurate. Consider using '#align nat.cast_desc_factorial_two Nat.cast_descFactorial_twoₓ'. -/
 /-- Convenience lemma. The `a - 1` is not using truncated subtraction, as opposed to the definition
 of `nat.desc_factorial` as a natural. -/
 theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
Diff
@@ -65,7 +65,7 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
   by
   rw [cast_desc_factorial]
   cases a
-  · rw [zero_tsub, cast_zero, pochhammer_ne_zero_eval_zero _ two_ne_zero, zero_mul]
+  · rw [zero_tsub, cast_zero, pochhammer_ne_zero_eval_zero _ two_ne_zero, MulZeroClass.zero_mul]
   ·
     rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, pochhammer_succ_right, pochhammer_one,
       Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add, Polynomial.eval_X, cast_one,
Diff
@@ -68,7 +68,7 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
   · rw [zero_tsub, cast_zero, pochhammer_ne_zero_eval_zero _ two_ne_zero, zero_mul]
   ·
     rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, pochhammer_succ_right, pochhammer_one,
-      Polynomial.X_mul, Polynomial.eval_mul_x, Polynomial.eval_add, Polynomial.eval_x, cast_one,
+      Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add, Polynomial.eval_X, cast_one,
       Polynomial.eval_one]
 #align nat.cast_desc_factorial_two Nat.cast_descFactorial_two
 
Diff
@@ -68,7 +68,7 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) :=
   · rw [zero_tsub, cast_zero, pochhammer_ne_zero_eval_zero _ two_ne_zero, zero_mul]
   ·
     rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, pochhammer_succ_right, pochhammer_one,
-      Polynomial.x_mul, Polynomial.eval_mul_x, Polynomial.eval_add, Polynomial.eval_x, cast_one,
+      Polynomial.X_mul, Polynomial.eval_mul_x, Polynomial.eval_add, Polynomial.eval_x, cast_one,
       Polynomial.eval_one]
 #align nat.cast_desc_factorial_two Nat.cast_descFactorial_two
 

Changes in mathlib4

mathlib3
mathlib4
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -64,7 +64,7 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) := by
   rw [cast_descFactorial]
   cases a
   · simp
-  · rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, ascPochhammer_succ_right,
+  · rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel_right, ascPochhammer_succ_right,
       ascPochhammer_one, Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add,
       Polynomial.eval_X, cast_one, Polynomial.eval_one]
 #align nat.cast_desc_factorial_two Nat.cast_descFactorial_two
chore: shift Nat.ascFactorial down by one (#7965)

change ascending factorial function Nat.ascFactorial to agree with mathematical literature. This means Nat.ascFactorial n k becomes n (n + 1) ⋯ (n + k - 1) instead of (n + 1) ⋯ (n + k)

Co-authored-by: Johan Commelin <johan@commelin.net>

Diff
@@ -31,8 +31,8 @@ section Semiring
 variable [Semiring S] (a b : ℕ)
 
 -- Porting note: added type ascription around a + 1
-theorem cast_ascFactorial : (a.ascFactorial b : S) = (ascPochhammer S b).eval (a + 1 : S) := by
-  rw [← ascPochhammer_nat_eq_ascFactorial, ascPochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
+theorem cast_ascFactorial : (a.ascFactorial b : S) = (ascPochhammer S b).eval (a : S) := by
+  rw [← ascPochhammer_nat_eq_ascFactorial, ascPochhammer_eval_cast]
 #align nat.cast_asc_factorial Nat.cast_ascFactorial
 
 -- Porting note: added type ascription around a - (b - 1)
@@ -49,7 +49,7 @@ theorem cast_descFactorial :
 #align nat.cast_desc_factorial Nat.cast_descFactorial
 
 theorem cast_factorial : (a ! : S) = (ascPochhammer S a).eval 1 := by
-  rw [← zero_ascFactorial, cast_ascFactorial, cast_zero, zero_add]
+  rw [← one_ascFactorial, cast_ascFactorial, cast_one]
 #align nat.cast_factorial Nat.cast_factorial
 
 end Semiring
fix: patch for std4#203 (more sub lemmas for Nat) (#6216)
Diff
@@ -41,7 +41,7 @@ theorem cast_descFactorial :
   rw [← ascPochhammer_eval_cast, ascPochhammer_nat_eq_descFactorial]
   induction' b with b
   · simp
-  · simp_rw [add_succ, succ_sub_one]
+  · simp_rw [add_succ, Nat.add_one_sub_one]
     obtain h | h := le_total a b
     · rw [descFactorial_of_lt (lt_succ_of_le h), descFactorial_of_lt (lt_succ_of_le _)]
       rw [tsub_eq_zero_iff_le.mpr h, zero_add]
chore: rename pochhammer (#6917)

We rename pochhammer to ascPochhammer to prepare adding descPochhammer.

Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -31,13 +31,14 @@ section Semiring
 variable [Semiring S] (a b : ℕ)
 
 -- Porting note: added type ascription around a + 1
-theorem cast_ascFactorial : (a.ascFactorial b : S) = (pochhammer S b).eval (a + 1 : S) := by
-  rw [← pochhammer_nat_eq_ascFactorial, pochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
+theorem cast_ascFactorial : (a.ascFactorial b : S) = (ascPochhammer S b).eval (a + 1 : S) := by
+  rw [← ascPochhammer_nat_eq_ascFactorial, ascPochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
 #align nat.cast_asc_factorial Nat.cast_ascFactorial
 
 -- Porting note: added type ascription around a - (b - 1)
-theorem cast_descFactorial : (a.descFactorial b : S) = (pochhammer S b).eval (a - (b - 1) : S) := by
-  rw [← pochhammer_eval_cast, pochhammer_nat_eq_descFactorial]
+theorem cast_descFactorial :
+    (a.descFactorial b : S) = (ascPochhammer S b).eval (a - (b - 1) : S) := by
+  rw [← ascPochhammer_eval_cast, ascPochhammer_nat_eq_descFactorial]
   induction' b with b
   · simp
   · simp_rw [add_succ, succ_sub_one]
@@ -47,7 +48,7 @@ theorem cast_descFactorial : (a.descFactorial b : S) = (pochhammer S b).eval (a
     · rw [tsub_add_cancel_of_le h]
 #align nat.cast_desc_factorial Nat.cast_descFactorial
 
-theorem cast_factorial : (a ! : S) = (pochhammer S a).eval 1 := by
+theorem cast_factorial : (a ! : S) = (ascPochhammer S a).eval 1 := by
   rw [← zero_ascFactorial, cast_ascFactorial, cast_zero, zero_add]
 #align nat.cast_factorial Nat.cast_factorial
 
@@ -63,9 +64,9 @@ theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1) := by
   rw [cast_descFactorial]
   cases a
   · simp
-  · rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, pochhammer_succ_right, pochhammer_one,
-      Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add, Polynomial.eval_X, cast_one,
-      Polynomial.eval_one]
+  · rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, ascPochhammer_succ_right,
+      ascPochhammer_one, Polynomial.X_mul, Polynomial.eval_mul_X, Polynomial.eval_add,
+      Polynomial.eval_X, cast_one, Polynomial.eval_one]
 #align nat.cast_desc_factorial_two Nat.cast_descFactorial_two
 
 end Ring
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
@@ -22,7 +22,7 @@ to `↑a - 1`, the other factor is `0` anyway.
 
 open Nat
 
-variable (S : Type _)
+variable (S : Type*)
 
 namespace Nat
 
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) 2021 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
-
-! This file was ported from Lean 3 source module data.nat.factorial.cast
-! leanprover-community/mathlib commit d50b12ae8e2bd910d08a94823976adae9825718b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.Polynomial.Pochhammer
 
+#align_import data.nat.factorial.cast from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b"
+
 /-!
 # Cast of factorials
 
feat: port Data.Nat.Factorial.Cast (#2801)

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com> Co-authored-by: Johan Commelin <johan@commelin.net>

Dependencies 8 + 396

397 files ported (98.0%)
164161 lines ported (98.1%)
Show graph

The unported dependencies are