-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Moritz Firsching <firsching@google.com>
- Loading branch information
1 parent
24d2683
commit 244639c
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/- | ||
Copyright (c) 2023 Moritz Firsching. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Moritz Firsching | ||
-/ | ||
import Mathlib.Data.Nat.Factorial.Basic | ||
|
||
/-! | ||
# Superfactorial | ||
This file defines the [superfactorial](https://en.wikipedia.org/wiki/Superfactorial) | ||
`sf n = 1! * 2! * 3! * ...* n!`. | ||
## Main declarations | ||
* `Nat.superFactorial`: The superfactorial, denoted by `sf`. | ||
-/ | ||
|
||
|
||
namespace Nat | ||
|
||
/-- `Nat.superFactorial n` is the superfactorial of `n`. -/ | ||
def superFactorial : ℕ → ℕ | ||
| 0 => 1 | ||
| succ n => factorial n.succ * superFactorial n | ||
|
||
/-- `sf` notation for superfactorial -/ | ||
scoped notation "sf" n:60 => Nat.superFactorial n | ||
|
||
section SuperFactorial | ||
|
||
variable {n : ℕ} | ||
|
||
@[simp] | ||
theorem superFactorial_zero : sf 0 = 1 := | ||
rfl | ||
|
||
theorem superFactorial_succ (n : ℕ) : (sf n.succ) = (n + 1)! * sf n := | ||
rfl | ||
|
||
@[simp] | ||
theorem superFactorial_one : sf 1 = 1 := | ||
rfl | ||
|
||
@[simp] | ||
theorem superFactorial_two : sf 2 = 2 := | ||
rfl | ||
|
||
end SuperFactorial | ||
|
||
end Nat |