AFTD Auto-Formalizing Theoretical Domains

deriv_tanh

theoremverifiedformalizationimported Lean

The derivative of tanh(x) is 1 - tanh(x)^2

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 deriv_tanh : deriv Real.tanh = fun x => 1 - Real.tanh x ^ 2
Formalizes
Physlib, `deriv_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
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 derivative of tanh(x) is 1 - tanh(x)^2 -/lemma deriv_tanh : deriv Real.tanh = fun x => 1 - Real.tanh x ^ 2 := by  have h: deriv (sinh / cosh) = fun x => 1 - Real.tanh x ^ 2 := by    funext x    rw [deriv_div, Real.deriv_sinh, Real.deriv_cosh]    field_simp    rw [sq, sq, tanh_eq_sinh_div_cosh]    field_simp    · apply Real.differentiable_sinh    · apply Real.differentiable_cosh    · exact ne_of_gt (Real.cosh_pos x)  have h': Real.tanh = (sinh / cosh) := by    funext x    rw [Pi.div_apply, tanh_eq_sinh_div_cosh]  nth_rewrite 1 [h']  apply h
See it in the graphDiscuss this resultChallenge it