Mathlib v3 is deprecated. Go to Mathlib v4

Commit 2020-04-16 11:10 846cbabb

View on Github →

feat(analysis/calculus): let simp compute derivatives (#2422) After this PR:

example (x : ℝ) : deriv (λ x, cos (sin x) * exp x) x = (cos(sin(x))-sin(sin(x))*cos(x))*exp(x) :=
by { simp, ring }

Excerpts from the docstrings: The simplifier is set up to prove automatically that some functions are differentiable, or differentiable at a point (but not differentiable on a set or within a set at a point, as checking automatically that the good domains are mapped one to the other when using composition is not something the simplifier can easily do). This means that one can write example (x : ℝ) : differentiable ℝ (λ x, sin (exp (3 + x^2)) - 5 * cos x) := by simp. If there are divisions, one needs to supply to the simplifier proofs that the denominators do not vanish, as in

example (x : ℝ) (h : 1 + sin x ≠ 0) : differentiable_at ℝ (λ x, exp x / (1 + sin x)) x :=
by simp [h]

The simplifier is not set up to compute the Fréchet derivative of maps (as these are in general complicated multidimensional linear maps), but it will compute one-dimensional derivatives. To make sure that the simplifier can prove automatically that functions are differentiable, we tag many lemmas with the simp attribute, for instance those saying that the sum of differentiable functions is differentiable, as well as their product, their cartesian product, and so on. A notable exception is the chain rule: we do not mark as a simp lemma the fact that, if f and g are differentiable, then their composition also is: simp would always be able to match this lemma, by taking f or g to be the identity. Instead, for every reasonable function (say, exp), we add a lemma that if f is differentiable then so is (λ x, exp (f x)). This means adding some boilerplate lemmas, but these can also be useful in their own right. Tests for this ability of the simplifier (with more examples) are provided in tests/differentiable.lean.

Estimated changes

modified theorem deriv_add
modified theorem deriv_div
added theorem deriv_id''
added theorem deriv_inv'
modified theorem deriv_mul
added theorem deriv_pow''
modified theorem deriv_sub
added theorem deriv_within_inv'
added theorem deriv_within_pow'
modified theorem differentiable.div
added theorem differentiable.inv
added theorem differentiable.pow
modified theorem differentiable_at.div
added theorem differentiable_at.inv
added theorem differentiable_at.pow
added theorem differentiable_on.inv
added theorem differentiable_on.pow
added theorem has_deriv_at.inv
added theorem has_deriv_at.pow
added theorem has_deriv_at_id'
modified theorem differentiable.add
modified theorem differentiable.fst
modified theorem differentiable.mul
modified theorem differentiable.neg
modified theorem differentiable.smul
modified theorem differentiable.snd
modified theorem differentiable.sub
modified theorem differentiable_at.add
modified theorem differentiable_at.fst
modified theorem differentiable_at.mul
modified theorem differentiable_at.neg
modified theorem differentiable_at.prod_map
modified theorem differentiable_at.smul
modified theorem differentiable_at.snd
modified theorem differentiable_at.sub
modified theorem differentiable_at_const
added theorem differentiable_at_id'
modified theorem differentiable_at_id
modified theorem differentiable_const
added theorem differentiable_id'
modified theorem differentiable_id
added theorem deriv_ccos
added theorem deriv_ccosh
added theorem deriv_cexp
added theorem deriv_cos
added theorem deriv_cosh
added theorem deriv_csin
added theorem deriv_csinh
added theorem deriv_exp
added theorem deriv_sin
added theorem deriv_sinh
added theorem deriv_within_ccos
added theorem deriv_within_ccosh
added theorem deriv_within_cexp
added theorem deriv_within_cos
added theorem deriv_within_cosh
added theorem deriv_within_csin
added theorem deriv_within_csinh
added theorem deriv_within_exp
added theorem deriv_within_sin
added theorem deriv_within_sinh
added theorem differentiable.ccos
added theorem differentiable.ccosh
added theorem differentiable.cexp
added theorem differentiable.cos
added theorem differentiable.cosh
added theorem differentiable.csin
added theorem differentiable.csinh
added theorem differentiable.exp
added theorem differentiable.sin
added theorem differentiable.sinh
added theorem differentiable_at.ccos
added theorem differentiable_at.cexp
added theorem differentiable_at.cos
added theorem differentiable_at.cosh
added theorem differentiable_at.csin
added theorem differentiable_at.exp
added theorem differentiable_at.sin
added theorem differentiable_at.sinh
added theorem differentiable_on.ccos
added theorem differentiable_on.cexp
added theorem differentiable_on.cos
added theorem differentiable_on.cosh
added theorem differentiable_on.csin
added theorem differentiable_on.exp
added theorem differentiable_on.sin
added theorem differentiable_on.sinh
added theorem has_deriv_at.ccos
added theorem has_deriv_at.ccosh
modified theorem has_deriv_at.cexp
added theorem has_deriv_at.cos
added theorem has_deriv_at.cosh
added theorem has_deriv_at.csin
added theorem has_deriv_at.csinh
added theorem has_deriv_at.exp
added theorem has_deriv_at.sin
added theorem has_deriv_at.sinh
modified theorem has_deriv_within_at.cexp