norm_num extensions for factorials #
Extensions for norm_num that compute Nat.factorial, Nat.ascFactorial and Nat.descFactorial.
This is done by reducing each of these to ascFactorial, which is computed using a divide and
conquer strategy that improves performance and avoids exceeding the recursion depth.
theorem
Mathlib.Meta.NormNum.asc_factorial_aux
(n l m a b : β)
(hβ : n.ascFactorial l = a)
(hβ : (n + l).ascFactorial m = b)
:
Calculate n.ascFactorial l and return this value along with a proof of the result.
theorem
Mathlib.Meta.NormNum.isNat_factorial
{n x : β}
(hβ : IsNat n x)
(a : β)
(hβ : Nat.ascFactorial 1 x = a)
:
theorem
Mathlib.Meta.NormNum.isNat_ascFactorial
{n x l y : β}
(hβ : IsNat n x)
(hβ : IsNat l y)
(a : β)
(p : x.ascFactorial y = a)
:
IsNat (n.ascFactorial l) a
Evaluates the Nat.ascFactorial function.
Equations
Instances For
theorem
Mathlib.Meta.NormNum.isNat_descFactorial
{n x l y : β}
(z : β)
(hβ : IsNat n x)
(hβ : IsNat l y)
(hβ : x = z + y)
(a : β)
(p : (z + 1).ascFactorial y = a)
:
IsNat (n.descFactorial l) a
theorem
Mathlib.Meta.NormNum.isNat_descFactorial_zero
{n x l y : β}
(z : β)
(hβ : IsNat n x)
(hβ : IsNat l y)
(hβ : y = z + x + 1)
:
IsNat (n.descFactorial l) 0