Zulip Chat Archive

Stream: PR reviews

Topic: !4#4653 Trigonometric.Deriv


Scott Morrison (Jun 04 2023 at 23:20):

This is the last of the files @Patrick Massot wants ready for the MSRI summer school. It is ready for review.

Eric Wieser (Jun 04 2023 at 23:53):

Mind if I push a rebase to clean up the history so the diff is easier to see?

Eric Wieser (Jun 04 2023 at 23:59):

Ah, a merge was enough (see this diff)

Eric Wieser (Jun 05 2023 at 00:01):

@Mario Carneiro, it's pretty annoying how many times we seem to have to replace h.DifferentiableAt with h.differentiableAt in these PRs; is this an easy mathport fix, or a really hard one?

Mario Carneiro (Jun 05 2023 at 00:36):

a relatively hard one, it involves lean 3 fixes

Eric Wieser (Jun 05 2023 at 00:43):

Can we do a heuristic fix of "if dot notation translates to CamelCase and there is no Foo.CamelCase for any Foo, use .camelCase instead?"

Mario Carneiro (Jun 05 2023 at 00:57):

my understanding is that the reason for the camel case translation is because there is some Foo.CamelCase

Patrick Massot (Jun 05 2023 at 01:27):

Thanks a lot @Scott Morrison ! I just landed in SFO and it's great to see all this ported! I'll update MIL as soon as I'll reach my hotel.

Patrick Massot (Jun 05 2023 at 04:42):

I'm now settled in Berkeley and trying those brand new calculus files. Unfortunately the discussion of calculus in MIL started with showing how simp could do easy differentiation and it seems a lot less true in Lean 4.

Patrick Massot (Jun 05 2023 at 04:46):

Specifically, the following worked in Lean 3:

import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv

open  Real

example (x₀ : ) (h₀ : x₀  0) : deriv (fun x :   1 / x) x₀ = -(x₀ ^ 2)⁻¹ := by simp

example (x₀ : ) (h : x₀  0) :
    deriv (fun x :   exp (x ^ 2) / x ^ 5) x₀ = (2 * x₀ ^ 2 - 5) * exp (x₀ ^ 2) / x₀ ^ 6 := by
  have : x₀ ^ 5  0 := pow_ne_zero 5 h
  field_simp
  ring

example (y : ) : deriv (fun x :   2 * x + 5) y = 2 := by simp

Patrick Massot (Jun 05 2023 at 04:47):

The Lean 3 code was:

import analysis.special_functions.trigonometric.deriv
import tactic.field_simp

open real

example (x₀ : ) (h₀ : x₀  0) : deriv (fun x : , 1 / x) x₀ = -(x₀ ^ 2)⁻¹ := by simp

example (x₀ : ) (h : x₀  0) :
    deriv (fun x : , exp (x ^ 2) / x ^ 5) x₀ = (2 * x₀ ^ 2 - 5) * exp (x₀ ^ 2) / x₀ ^ 6 :=
begin
  have : x₀ ^ 5  0 := pow_ne_zero 5 h,
  field_simp,
  ring
end

example (y : ) : deriv (fun x : , 2 * x + 5) y = 2 := by simp

Scott Morrison (Jun 05 2023 at 08:41):

Presumably related: https://github.com/leanprover-community/mathlib4/pull/4669/files#diff-053757072a2ee1ebf0332832076b953a360d7977b76c6f82885b630ec0d16cadR236

Eric Wieser (Jun 05 2023 at 08:47):

Mario Carneiro said:

my understanding is that the reason for the camel case translation is because there is some Foo.CamelCase

I don't think that's true in this case except for Foo = _root_


Last updated: Dec 20 2023 at 11:08 UTC