Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(analysis/special_functions/trigonometric): Added lemmas for deriv of tan #3746

Closed
wants to merge 6 commits into from

Conversation

benjamindavidson
Copy link
Collaborator

I added lemmas for the derivative of the tangent function in both the complex and real namespaces. I also corrected two typos in comment lines.

@benjamindavidson benjamindavidson added the awaiting-review The author would like community review of the PR label Aug 12, 2020
@robertylewis robertylewis added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Aug 15, 2020
@benjamindavidson benjamindavidson added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 18, 2020
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PatrickMassot
Copy link
Member

I don't understand at all why you have this assumption of non-vanishing cosine everywhere. Why not

lemma has_deriv_at_tan {x:ℝ} (h : ∀ k : ℤ, x ≠ (2 * k + 1) * pi / 2) : has_deriv_at tan (1 / (cos x)^2) x :=
begin
  rw [← cos_ne_zero_iff, ← complex.of_real_ne_zero, complex.of_real_cos] at h,
  convert has_deriv_at_real_of_complex (complex.has_deriv_at_tan h),
  rw ← complex.of_real_re (1/((cos x)^2)),
  simp,
end

Even better would be to take the time to do cos_ne_zero_iff for complex cosine as well, and have this assumption in the complex version as well. If you really have an assumption about cos(x) then you can still use cos_ne_zero_iff before using it, but I think the lemma about tan should have the natural statement.

@sgouezel sgouezel added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Aug 21, 2020
@benjamindavidson
Copy link
Collaborator Author

benjamindavidson commented Sep 4, 2020

I made the changes that Patrick requested regarding the assumption in my lemmas, both in complex and in real. See the conversation in this Zulip chat.
I added complex.cos_eq_zero_iff and its corollary complex.cos_ne_zero_iff and rewrote real.cos_eq_zero_iff to be derived from the complex version.
Also added exp_pi_mul_I (Euler's identity).

@benjamindavidson benjamindavidson added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Sep 4, 2020
Copy link
Member

@PatrickMassot PatrickMassot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please make sure all lines are at most 100+epsilon columns long?

src/analysis/special_functions/trigonometric.lean Outdated Show resolved Hide resolved
src/analysis/special_functions/trigonometric.lean Outdated Show resolved Hide resolved
src/analysis/special_functions/trigonometric.lean Outdated Show resolved Hide resolved
lemma differentiable_at_tan_of_mem_Ioo {x:ℝ} (h : x ∈ set.Ioo (-(π/2):ℝ) (π/2)) : differentiable_at ℝ tan x :=
(has_deriv_at_tan_of_mem_Ioo h).differentiable_at

lemma deriv_tan_of_mem_Ioo {x:ℝ} (h : x ∈ set.Ioo (-(π/2):ℝ) (π/2)) : deriv tan x = 1 / (cos x)^2 :=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lemma doesn't need assumption h.

lemma differentiable_at_tan {x:ℂ} (h : ∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) : differentiable_at ℂ tan x :=
(has_deriv_at_tan h).differentiable_at

lemma deriv_tan {x:ℂ} (h : ∀ k : ℤ, x ≠ (2 * k + 1) * π / 2): deriv tan x = 1 / (cos x)^2 :=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lemma doesn't need assumption h (both sides of the equality vanish when x = (2 * k + 1) * π / 2).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to accomplish this and I managed to do it in part, but I think that there is not yet the infrastructure in mathlib supporting ¬differentiable_at for me to be able to complete the proof.
I think this is substantiated by the fact that the lemma deriv_inv uses the assumption x≠0, presumably for this very reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll fix this later. Thanks for your work on this PR!
bors merge

@PatrickMassot PatrickMassot added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Sep 4, 2020
@bors
Copy link

bors bot commented Sep 6, 2020

👎 Rejected by label

@benjamindavidson benjamindavidson added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-author A reviewer has asked the author a question or requested changes labels Sep 6, 2020
@robertylewis
Copy link
Member

bors merge

bors bot pushed a commit that referenced this pull request Sep 6, 2020
…v of tan (#3746)

I added lemmas for the derivative of the tangent function in both the complex and real namespaces. I also corrected two typos in comment lines.
<!-- put comments you want to keep out of the PR commit here -->
@bors
Copy link

bors bot commented Sep 6, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(analysis/special_functions/trigonometric): Added lemmas for deriv of tan [Merged by Bors] - feat(analysis/special_functions/trigonometric): Added lemmas for deriv of tan Sep 6, 2020
@bors bors bot closed this Sep 6, 2020
@bors bors bot deleted the tan_deriv branch September 6, 2020 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants