AFTD Auto-Formalizing Theoretical Domains

iteratedDeriv_tanh_is_polynomial_of_tanh

theoremverifiedformalizationimported Lean

The nth derivative of Tanh(x) is a polynomial of Tanh(x)

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Real in
open NNReal in
open Field in
open scoped ContDiff in
lemma iteratedDeriv_tanh_is_polynomial_of_tanh (n : ℕ) : ∃ P : Polynomial ℝ, ∀ x,
    iteratedDeriv n Real.tanh x = P.eval (Real.tanh x)
Formalizes
Physlib, `iteratedDeriv_tanh_is_polynomial_of_tanh`
Lean proof
By Afiq Hatta, from github.com/leanprover-community/physlib at e411c6e89692 (Copyright (c) 2025 Afiq Hatta. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.34.1.
Verified
09 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • deriv_tanhThe derivative of tanh(x) is 1 - tanh(x)^2
Used by 1

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Real inopen NNReal inopen Field inopen scoped ContDiff in/-- The nth derivative of Tanh(x) is a polynomial of Tanh(x) -/lemma iteratedDeriv_tanh_is_polynomial_of_tanh (n : ℕ) : ∃ P : Polynomial ℝ, ∀ x,    iteratedDeriv n Real.tanh x = P.eval (Real.tanh x) := by  induction n with  | zero =>    rw [iteratedDeriv_zero]    use Polynomial.X    simp  | succ n ih =>    obtain ⟨P, h'⟩ := ih    rw [iteratedDeriv_succ]    have h'': iteratedDeriv n tanh = (fun x => Polynomial.eval (tanh x) P) := by      funext x      apply h'    have h_comp : (fun x => Polynomial.eval (tanh x) P) = (fun t => P.eval t) ∘ tanh := by      funext x      simp [Function.comp_apply]    rw [h'', h_comp]    use Polynomial.derivative P * (1 - Polynomial.X^2)    intro x    rw [deriv_comp, Polynomial.deriv, deriv_tanh]    simp only [Polynomial.eval_mul, Polynomial.eval_sub, Polynomial.eval_one, Polynomial.eval_pow,      Polynomial.eval_X]    case h.hh =>      have h': Real.tanh = (sinh / cosh) := by        funext x        rw [Pi.div_apply, tanh_eq_sinh_div_cosh]      rw [h']      apply DifferentiableAt.div      · apply Real.differentiable_sinh      · apply Real.differentiable_cosh      · exact ne_of_gt (Real.cosh_pos x)    case h.hh₂ =>      apply Polynomial.differentiableAt
See it in the graphDiscuss this resultChallenge it