Theorem: Nat.exists_pow_lt_factorial
File: Mathlib/Data/Nat/Prime.lean

tactic: refine ⟨2 * (c ^ 2 + 1), ?_, ?_⟩
state_before: n c : ℕ
⊢ ∃ n0 > 1, ∀ n ≥ n0, c ^ n < (n - 1)!
state_after: case refine_1
n c : ℕ
⊢ 2 * (c ^ 2 + 1) > 1

case refine_2
n c : ℕ
⊢ ∀ n ≥ 2 * (c ^ 2 + 1), c ^ n < (n - 1)!

tactic: intro n hn
state_before: case refine_2
n c : ℕ
⊢ ∀ n ≥ 2 * (c ^ 2 + 1), c ^ n < (n - 1)!
state_after: case refine_2
n✝ c n : ℕ
hn : n ≥ 2 * (c ^ 2 + 1)
⊢ c ^ n < (n - 1)!

tactic: obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_le hn
state_before: case refine_2
n✝ c n : ℕ
hn : n ≥ 2 * (c ^ 2 + 1)
⊢ c ^ n < (n - 1)!
state_after: case refine_2.intro
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
⊢ c ^ (2 * (c ^ 2 + 1) + d) < (2 * (c ^ 2 + 1) + d - 1)!

tactic: obtain (rfl | c0) := c.eq_zero_or_pos
state_before: case refine_2.intro
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
⊢ c ^ (2 * (c ^ 2 + 1) + d) < (2 * (c ^ 2 + 1) + d - 1)!
state_after: case refine_2.intro.inl
n d : ℕ
hn : 2 * (0 ^ 2 + 1) + d ≥ 2 * (0 ^ 2 + 1)
⊢ 0 ^ (2 * (0 ^ 2 + 1) + d) < (2 * (0 ^ 2 + 1) + d - 1)!

case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d) < (2 * (c ^ 2 + 1) + d - 1)!

tactic: refine (Nat.le_mul_of_pos_right _ (pow_pos c0 d)).trans_lt ?_
state_before: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d) < (2 * (c ^ 2 + 1) + d - 1)!
state_after: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d) * c ^ d < (2 * (c ^ 2 + 1) + d - 1)!

tactic: convert_to (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2 + (c ^ 2 + d + 1))!
state_before: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d) * c ^ d < (2 * (c ^ 2 + 1) + d - 1)!
state_after: case h.e'_3
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d) * c ^ d = (c ^ 2) ^ (c ^ 2 + d + 1)

case h.e'_4
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ (2 * (c ^ 2 + 1) + d - 1)! = (c ^ 2 + (c ^ 2 + d + 1))!

case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2 + (c ^ 2 + d + 1))!

tactic: refine lt_of_lt_of_le ?_ Nat.factorial_mul_pow_le_factorial
state_before: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2 + (c ^ 2 + d + 1))!
state_after: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2)! * (c ^ 2 + 1) ^ (c ^ 2 + d + 1)

tactic: rw [← one_mul (_ ^ _ : ℕ)]
state_before: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2)! * (c ^ 2 + 1) ^ (c ^ 2 + d + 1)
state_after: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ 1 * (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2)! * (c ^ 2 + 1) ^ (c ^ 2 + d + 1)

tactic: exact Nat.mul_lt_mul_of_le_of_lt (Nat.one_le_of_lt (Nat.factorial_pos _))
  (Nat.pow_lt_pow_left (Nat.lt_succ_self _) (Nat.succ_ne_zero _)) (Nat.factorial_pos _)
state_before: case refine_2.intro.inr
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ 1 * (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2)! * (c ^ 2 + 1) ^ (c ^ 2 + d + 1)
state_after: no goals

tactic: omega
state_before: case refine_1
n c : ℕ
⊢ 2 * (c ^ 2 + 1) > 1
state_after: no goals

tactic: simp [Nat.factorial_pos]
state_before: case refine_2.intro.inl
n d : ℕ
hn : 2 * (0 ^ 2 + 1) + d ≥ 2 * (0 ^ 2 + 1)
⊢ 0 ^ (2 * (0 ^ 2 + 1) + d) < (2 * (0 ^ 2 + 1) + d - 1)!
state_after: no goals

tactic: rw [← pow_mul, ← pow_add]
state_before: case h.e'_3
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d) * c ^ d = (c ^ 2) ^ (c ^ 2 + d + 1)
state_after: case h.e'_3
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d + d) = c ^ (2 * (c ^ 2 + d + 1))

tactic: congr 1
state_before: case h.e'_3
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ c ^ (2 * (c ^ 2 + 1) + d + d) = c ^ (2 * (c ^ 2 + d + 1))
state_after: case h.e'_3.e_a
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ 2 * (c ^ 2 + 1) + d + d = 2 * (c ^ 2 + d + 1)

tactic: omega
state_before: case h.e'_3.e_a
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ 2 * (c ^ 2 + 1) + d + d = 2 * (c ^ 2 + d + 1)
state_after: no goals

tactic: congr
state_before: case h.e'_4
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ (2 * (c ^ 2 + 1) + d - 1)! = (c ^ 2 + (c ^ 2 + d + 1))!
state_after: case h.e'_4.e_a
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ 2 * (c ^ 2 + 1) + d - 1 = c ^ 2 + (c ^ 2 + d + 1)

tactic: omega
state_before: case h.e'_4.e_a
n c d : ℕ
hn : 2 * (c ^ 2 + 1) + d ≥ 2 * (c ^ 2 + 1)
c0 : c > 0
⊢ 2 * (c ^ 2 + 1) + d - 1 = c ^ 2 + (c ^ 2 + d + 1)
state_after: no goals