mathlib3 documentation


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.

This is particularly crucial for nat.desc_factorial as subtraction on does not correspond to subtraction on a general semiring. For example, we can't rely on existing cast lemmas to prove ↑(a.desc_factorial 2) = ↑a * (↑a - 1). We must use the fact that, whenever ↑(a - 1) is not equal to ↑a - 1, the other factor is 0 anyway.

theorem nat.cast_asc_factorial (S : Type u_1) [semiring S] (a b : ) :
theorem nat.cast_desc_factorial (S : Type u_1) [semiring S] (a b : ) :
theorem nat.cast_factorial (S : Type u_1) [semiring S] (a : ) :
theorem nat.cast_desc_factorial_two (S : Type u_1) [ring S] (a : ) :

Convenience lemma. The a - 1 is not using truncated subtraction, as opposed to the definition of nat.desc_factorial as a natural.