File: Mathlib/Data/Nat/Factorial/Basic.lean

full_name: Nat.factorial
code: /-- `Nat.factorial n` is the factorial of `n`. -/
def factorial : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: Nat._aux_Mathlib_Data_Nat_Factorial_Basic___unexpand_Nat_factorial_1
code: /-- factorial notation `n!` -/
scoped notation:10000 n "!" => Nat.factorial n
goal: Lean.PrettyPrinter.Unexpander

full_name: Nat._aux_Mathlib_Data_Nat_Factorial_Basic___macroRules_Nat_term_!_1
code: /-- factorial notation `n!` -/
scoped notation:10000 n "!" => Nat.factorial n
goal: Lean.Macro

full_name: Nat.factorial_zero
code: @[simp] theorem factorial_zero : 0! = 1 
goal: Nat.factorial 0 = 1

full_name: Nat.factorial_succ
code: theorem factorial_succ (n : ℕ) : (n + 1)! = (n + 1) * n ! 
goal: (n + 1).factorial = (n + 1) * n.factorial

full_name: Nat.factorial_one
code: @[simp] theorem factorial_one : 1! = 1 
goal: Nat.factorial 1 = 1

full_name: Nat.factorial_two
code: @[simp] theorem factorial_two : 2! = 2 
goal: Nat.factorial 2 = 2

full_name: Nat.mul_factorial_pred
code: theorem mul_factorial_pred (hn : 0 < n) : n * (n - 1)! = n ! 
goal: n * (n - 1).factorial = n.factorial

full_name: Nat.factorial_pos
code: theorem factorial_pos : ∀ n, 0 < n !
  
goal: 0 < n.factorial

full_name: Nat.factorial_ne_zero
code: theorem factorial_ne_zero (n : ℕ) : n ! ≠ 0 
goal: n.factorial ≠ 0

full_name: Nat.factorial_dvd_factorial
code: theorem factorial_dvd_factorial {m n} (h : m ≤ n) : m ! ∣ n ! 
goal: m.factorial ∣ n.factorial

full_name: Nat.dvd_factorial
code: theorem dvd_factorial : ∀ {m n}, 0 < m → m ≤ n → m ∣ n !
  
goal: 0 < m → m ≤ n → m ∣ n.factorial

full_name: Nat.factorial_le
code: @[mono, gcongr]
theorem factorial_le {m n} (h : m ≤ n) : m ! ≤ n ! 
goal: m.factorial ≤ n.factorial

full_name: Nat.factorial_mul_pow_le_factorial
code: theorem factorial_mul_pow_le_factorial : ∀ {m n : ℕ}, m ! * (m + 1) ^ n ≤ (m + n)!
  
goal: m.factorial * (m + 1) ^ n ≤ (m + n).factorial

full_name: Nat.factorial_lt
code: theorem factorial_lt (hn : 0 < n) : n ! < m ! ↔ n < m 
goal: n.factorial < m.factorial ↔ n < m

full_name: Nat.factorial_lt_of_lt
code: @[gcongr]
lemma factorial_lt_of_lt {m n : ℕ} (hn : 0 < n) (h : n < m) : n ! < m ! 
goal: n.factorial < m.factorial

full_name: Nat.one_lt_factorial
code: @[simp] lemma one_lt_factorial : 1 < n ! ↔ 1 < n 
goal: 1 < n.factorial ↔ 1 < n

full_name: Nat.factorial_eq_one
code: @[simp]
theorem factorial_eq_one : n ! = 1 ↔ n ≤ 1 
goal: n.factorial = 1 ↔ n ≤ 1

full_name: Nat.factorial_inj
code: theorem factorial_inj (hn : 1 < n) : n ! = m ! ↔ n = m 
goal: n.factorial = m.factorial ↔ n = m

full_name: Nat.factorial_inj'
code: theorem factorial_inj' (h : 1 < n ∨ 1 < m) : n ! = m ! ↔ n = m 
goal: n.factorial = m.factorial ↔ n = m

full_name: Nat.self_le_factorial
code: theorem self_le_factorial : ∀ n : ℕ, n ≤ n !
  
goal: n ≤ n.factorial

full_name: Nat.lt_factorial_self
code: theorem lt_factorial_self {n : ℕ} (hi : 3 ≤ n) : n < n ! 
goal: n < n.factorial

full_name: Nat.add_factorial_succ_lt_factorial_add_succ
code: theorem add_factorial_succ_lt_factorial_add_succ {i : ℕ} (n : ℕ) (hi : 2 ≤ i) :
    i + (n + 1)! < (i + n + 1)! 
goal: i + (n + 1).factorial < (i + n + 1).factorial

full_name: Nat.add_factorial_lt_factorial_add
code: theorem add_factorial_lt_factorial_add {i n : ℕ} (hi : 2 ≤ i) (hn : 1 ≤ n) :
    i + n ! < (i + n)! 
goal: i + n.factorial < (i + n).factorial

full_name: Nat.add_factorial_succ_le_factorial_add_succ
code: theorem add_factorial_succ_le_factorial_add_succ (i : ℕ) (n : ℕ) :
    i + (n + 1)! ≤ (i + (n + 1))! 
goal: i + (n + 1).factorial ≤ (i + (n + 1)).factorial

full_name: Nat.add_factorial_le_factorial_add
code: theorem add_factorial_le_factorial_add (i : ℕ) {n : ℕ} (n1 : 1 ≤ n) : i + n ! ≤ (i + n)! 
goal: i + n.factorial ≤ (i + n).factorial

full_name: Nat.factorial_mul_pow_sub_le_factorial
code: theorem factorial_mul_pow_sub_le_factorial {n m : ℕ} (hnm : n ≤ m) : n ! * n ^ (m - n) ≤ m ! 
goal: n.factorial * n ^ (m - n) ≤ m.factorial

full_name: Nat.factorial_le_pow
code: lemma factorial_le_pow : ∀ n, n ! ≤ n ^ n
  
goal: n.factorial ≤ n ^ n

full_name: Nat.ascFactorial
code: /-- `n.ascFactorial k = n (n + 1) ⋯ (n + k - 1)`. This is closely related to `ascPochhammer`, but
much less general. -/
def ascFactorial (n : ℕ) : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: Nat.ascFactorial_zero
code: @[simp]
theorem ascFactorial_zero (n : ℕ) : n.ascFactorial 0 = 1 
goal: n.ascFactorial 0 = 1

full_name: Nat.ascFactorial_succ
code: theorem ascFactorial_succ {n k : ℕ} : n.ascFactorial k.succ = (n + k) * n.ascFactorial k 
goal: n.ascFactorial k.succ = (n + k) * n.ascFactorial k

full_name: Nat.zero_ascFactorial
code: theorem zero_ascFactorial : ∀ (k : ℕ), (0 : ℕ).ascFactorial k.succ = 0
  
goal: Nat.ascFactorial 0 k.succ = 0

full_name: Nat.one_ascFactorial
code: @[simp]
theorem one_ascFactorial : ∀ (k : ℕ), (1 : ℕ).ascFactorial k = k.factorial
  
goal: Nat.ascFactorial 1 k = k.factorial

full_name: Nat.succ_ascFactorial
code: theorem succ_ascFactorial (n : ℕ) :
    ∀ k, n * n.succ.ascFactorial k = (n + k) * n.ascFactorial k
  
goal: n * n.succ.ascFactorial k = (n + k) * n.ascFactorial k

full_name: Nat.factorial_mul_ascFactorial
code: /-- `(n + 1).ascFactorial k = (n + k) ! / n !` but without ℕ-division. See
`Nat.ascFactorial_eq_div` for the version with ℕ-division. -/
theorem factorial_mul_ascFactorial (n : ℕ) : ∀ k, n ! * (n + 1).ascFactorial k = (n + k)!
  
goal: n.factorial * (n + 1).ascFactorial k = (n + k).factorial

full_name: Nat.factorial_mul_ascFactorial'
code: /-- `n.ascFactorial k = (n + k - 1)! / (n - 1)!` for `n > 0` but without ℕ-division. See
`Nat.ascFactorial_eq_div` for the version with ℕ-division. Consider using
`factorial_mul_ascFactorial` to avoid complications of ℕ-subtraction. -/
theorem factorial_mul_ascFactorial' (n k : ℕ) (h : 0 < n) :
    (n - 1) ! * n.ascFactorial k = (n + k - 1)! 
goal: (n - 1).factorial * n.ascFactorial k = (n + k - 1).factorial

full_name: Nat.ascFactorial_eq_div
code: /-- Avoid in favor of `Nat.factorial_mul_ascFactorial` if you can. ℕ-division isn't worth it. -/
theorem ascFactorial_eq_div (n k : ℕ) : (n + 1).ascFactorial k = (n + k)! / n ! 
goal: (n + 1).ascFactorial k = (n + k).factorial / n.factorial

full_name: Nat.ascFactorial_eq_div'
code: /-- Avoid in favor of `Nat.factorial_mul_ascFactorial'` if you can. ℕ-division isn't worth it. -/
theorem ascFactorial_eq_div' (n k : ℕ) (h : 0 < n) :
    n.ascFactorial k = (n + k - 1)! / (n - 1) ! 
goal: n.ascFactorial k = (n + k - 1).factorial / (n - 1).factorial

full_name: Nat.ascFactorial_of_sub
code: theorem ascFactorial_of_sub {n k : ℕ} :
    (n - k) * (n - k + 1).ascFactorial k = (n - k).ascFactorial (k + 1) 
goal: (n - k) * (n - k + 1).ascFactorial k = (n - k).ascFactorial (k + 1)

full_name: Nat.pow_succ_le_ascFactorial
code: theorem pow_succ_le_ascFactorial (n : ℕ) : ∀ k : ℕ, n ^ k ≤ n.ascFactorial k
  
goal: n ^ k ≤ n.ascFactorial k

full_name: Nat.pow_lt_ascFactorial'
code: theorem pow_lt_ascFactorial' (n k : ℕ) : (n + 1) ^ (k + 2) < (n + 1).ascFactorial (k + 2) 
goal: (n + 1) ^ (k + 2) < (n + 1).ascFactorial (k + 2)

full_name: Nat.pow_lt_ascFactorial
code: theorem pow_lt_ascFactorial (n : ℕ) : ∀ {k : ℕ}, 2 ≤ k → (n + 1) ^ k < (n + 1).ascFactorial k
  
goal: 2 ≤ k → (n + 1) ^ k < (n + 1).ascFactorial k

full_name: Nat.ascFactorial_le_pow_add
code: theorem ascFactorial_le_pow_add (n : ℕ) : ∀ k : ℕ, (n+1).ascFactorial k ≤ (n + k) ^ k
  
goal: (n + 1).ascFactorial k ≤ (n + k) ^ k

full_name: Nat.ascFactorial_lt_pow_add
code: theorem ascFactorial_lt_pow_add (n : ℕ) : ∀ {k : ℕ}, 2 ≤ k → (n + 1).ascFactorial k < (n + k) ^ k
  
goal: 2 ≤ k → (n + 1).ascFactorial k < (n + k) ^ k

full_name: Nat.ascFactorial_pos
code: theorem ascFactorial_pos (n k : ℕ) : 0 < (n + 1).ascFactorial k 
goal: 0 < (n + 1).ascFactorial k

full_name: Nat.descFactorial
code: /-- `n.descFactorial k = n! / (n - k)!` (as seen in `Nat.descFactorial_eq_div`), but
implemented recursively to allow for "quick" computation when using `norm_num`. This is closely
related to `descPochhammer`, but much less general. -/
def descFactorial (n : ℕ) : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: Nat.descFactorial_zero
code: @[simp]
theorem descFactorial_zero (n : ℕ) : n.descFactorial 0 = 1 
goal: n.descFactorial 0 = 1

full_name: Nat.descFactorial_succ
code: @[simp]
theorem descFactorial_succ (n k : ℕ) : n.descFactorial (k + 1) = (n - k) * n.descFactorial k 
goal: n.descFactorial (k + 1) = (n - k) * n.descFactorial k

full_name: Nat.zero_descFactorial_succ
code: theorem zero_descFactorial_succ (k : ℕ) : (0 : ℕ).descFactorial (k + 1) = 0 
goal: Nat.descFactorial 0 (k + 1) = 0

full_name: Nat.descFactorial_one
code: theorem descFactorial_one (n : ℕ) : n.descFactorial 1 = n 
goal: n.descFactorial 1 = n

full_name: Nat.succ_descFactorial_succ
code: theorem succ_descFactorial_succ (n : ℕ) :
    ∀ k : ℕ, (n + 1).descFactorial (k + 1) = (n + 1) * n.descFactorial k
  
goal: (n + 1).descFactorial (k + 1) = (n + 1) * n.descFactorial k

full_name: Nat.succ_descFactorial
code: theorem succ_descFactorial (n : ℕ) :
    ∀ k, (n + 1 - k) * (n + 1).descFactorial k = (n + 1) * n.descFactorial k
  
goal: (n + 1 - k) * (n + 1).descFactorial k = (n + 1) * n.descFactorial k

full_name: Nat.descFactorial_self
code: theorem descFactorial_self : ∀ n : ℕ, n.descFactorial n = n !
  
goal: n.descFactorial n = n.factorial

full_name: Nat.descFactorial_eq_zero_iff_lt
code: @[simp]
theorem descFactorial_eq_zero_iff_lt {n : ℕ} : ∀ {k : ℕ}, n.descFactorial k = 0 ↔ n < k
  
goal: n.descFactorial k = 0 ↔ n < k

full_name: Nat.add_descFactorial_eq_ascFactorial
code: theorem add_descFactorial_eq_ascFactorial (n : ℕ) : ∀ k : ℕ,
    (n + k).descFactorial k = (n + 1).ascFactorial k
  
goal: (n + k).descFactorial k = (n + 1).ascFactorial k

full_name: Nat.add_descFactorial_eq_ascFactorial'
code: theorem add_descFactorial_eq_ascFactorial' (n : ℕ) :
    ∀ k : ℕ, (n + k - 1).descFactorial k = n.ascFactorial k
  
goal: (n + k - 1).descFactorial k = n.ascFactorial k

full_name: Nat.factorial_mul_descFactorial
code: /-- `n.descFactorial k = n! / (n - k)!` but without ℕ-division. See `Nat.descFactorial_eq_div`
for the version using ℕ-division. -/
theorem factorial_mul_descFactorial : ∀ {n k : ℕ}, k ≤ n → (n - k)! * n.descFactorial k = n !
  
goal: k ≤ n → (n - k).factorial * n.descFactorial k = n.factorial

full_name: Nat.descFactorial_eq_div
code: /-- Avoid in favor of `Nat.factorial_mul_descFactorial` if you can. ℕ-division isn't worth it. -/
theorem descFactorial_eq_div {n k : ℕ} (h : k ≤ n) : n.descFactorial k = n ! / (n - k)! 
goal: n.descFactorial k = n.factorial / (n - k).factorial

full_name: Nat.pow_sub_le_descFactorial
code: theorem pow_sub_le_descFactorial (n : ℕ) : ∀ k : ℕ, (n + 1 - k) ^ k ≤ n.descFactorial k
  
goal: (n + 1 - k) ^ k ≤ n.descFactorial k

full_name: Nat.pow_sub_lt_descFactorial'
code: theorem pow_sub_lt_descFactorial' {n : ℕ} :
    ∀ {k : ℕ}, k + 2 ≤ n → (n - (k + 1)) ^ (k + 2) < n.descFactorial (k + 2)
  
goal: k + 2 ≤ n → (n - (k + 1)) ^ (k + 2) < n.descFactorial (k + 2)

full_name: Nat.pow_sub_lt_descFactorial
code: theorem pow_sub_lt_descFactorial {n : ℕ} :
    ∀ {k : ℕ}, 2 ≤ k → k ≤ n → (n + 1 - k) ^ k < n.descFactorial k
  
goal: 2 ≤ k → k ≤ n → (n + 1 - k) ^ k < n.descFactorial k

full_name: Nat.descFactorial_le_pow
code: theorem descFactorial_le_pow (n : ℕ) : ∀ k : ℕ, n.descFactorial k ≤ n ^ k
  
goal: n.descFactorial k ≤ n ^ k

full_name: Nat.descFactorial_lt_pow
code: theorem descFactorial_lt_pow {n : ℕ} (hn : 1 ≤ n) : ∀ {k : ℕ}, 2 ≤ k → n.descFactorial k < n ^ k
  
goal: 2 ≤ k → n.descFactorial k < n ^ k

full_name: Nat.factorial_two_mul_le
code: lemma factorial_two_mul_le (n : ℕ) : (2 * n)! ≤ (2 * n) ^ n * n ! 
goal: (2 * n).factorial ≤ (2 * n) ^ n * n.factorial

full_name: Nat.two_pow_mul_factorial_le_factorial_two_mul
code: lemma two_pow_mul_factorial_le_factorial_two_mul (n : ℕ) : 2 ^ n * n ! ≤ (2 * n) ! 
goal: 2 ^ n * n.factorial ≤ (2 * n).factorial