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/arsinh): inverse hyperbolic sine function #3801

Closed
wants to merge 62 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
38ab7a0
Added sinh.lean
jamesa9283 Aug 15, 2020
ada137d
Rejigged some lemmas
jamesa9283 Aug 15, 2020
3bc5e7c
Removed `arsinh` from notation and added it to results
jamesa9283 Aug 15, 2020
dee5af0
Update src/data/complex/exponential.lean
jamesa9283 Aug 16, 2020
0c06846
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 16, 2020
1a06848
added @[pp_nodot] to log
jamesa9283 Aug 16, 2020
a312928
Removed .sqrt in favour of the sqrt (f x)
jamesa9283 Aug 16, 2020
24923cf
added def to arsinh docstring
jamesa9283 Aug 16, 2020
c1a06f3
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 16, 2020
f4bbe0d
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 16, 2020
238a190
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 16, 2020
8ecda92
Updated sinh/cosh_def to sinh/cosh_eq
jamesa9283 Aug 16, 2020
3d7a6a5
Added braces and commas to sinh/cosh_eq
jamesa9283 Aug 16, 2020
53e8231
removed braces after single command `have`s
jamesa9283 Aug 16, 2020
2071494
added extra tags
jamesa9283 Aug 16, 2020
79bb7b6
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 16, 2020
97555a6
Merge branch 'arsinh' of https://github.com/leanprover-community/math…
jamesa9283 Aug 16, 2020
a69e47e
replaced sinm with sinh
jamesa9283 Aug 16, 2020
c6a8bc8
updared aux_lemma to remove error
jamesa9283 Aug 16, 2020
0a3d084
moved real.cosh_sq_add_sinh_sq
jamesa9283 Aug 16, 2020
e643c7d
reduced imports
jamesa9283 Aug 16, 2020
457af70
added braces to aux_lemma
jamesa9283 Aug 16, 2020
9752231
added braces to b_lt_b_sq_add_one
jamesa9283 Aug 16, 2020
46486eb
updated sinh_surjective
jamesa9283 Aug 16, 2020
2eee37a
relocated real.cosh_sq_sub_sinh_sq
jamesa9283 Aug 16, 2020
2ed1a1a
relocated arsinh
jamesa9283 Aug 16, 2020
e8566a2
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
cf37673
Update src/data/complex/exponential.lean
jamesa9283 Aug 17, 2020
04bbe11
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
92666be
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
72c83b9
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
25a685f
moved defs
jamesa9283 Aug 17, 2020
ef483cf
Merge branch 'arsinh' of https://github.com/leanprover-community/math…
jamesa9283 Aug 17, 2020
78e5600
Trying to make lean happy
jamesa9283 Aug 17, 2020
d0df08b
removed real on cosh_sq_sih_sq
jamesa9283 Aug 17, 2020
fefc5bb
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
23e01e1
Update src/data/complex/exponential.lean
jamesa9283 Aug 17, 2020
13d337a
Update src/data/complex/exponential.lean
jamesa9283 Aug 17, 2020
beb7269
Update src/data/complex/exponential.lean
jamesa9283 Aug 17, 2020
7287108
removed docstring on cosh_sq_sub_sinh_sq
jamesa9283 Aug 17, 2020
41b05c8
Merge branch 'arsinh' of https://github.com/leanprover-community/math…
jamesa9283 Aug 17, 2020
827ae2c
Moved code into one rw on line 78
jamesa9283 Aug 17, 2020
8167571
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
d566198
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
5bb4ec4
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
a7b0f13
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
5fb85ac
Update src/analysis/special_functions/trigonometric.lean
jamesa9283 Aug 17, 2020
ffa53ea
Update src/analysis/special_functions/trigonometric.lean
jamesa9283 Aug 17, 2020
a2078af
Update src/data/complex/exponential.lean
jamesa9283 Aug 17, 2020
3a99cd6
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
c010972
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
1f9edf5
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
d15b088
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
3cf9ff0
Update src/data/complex/exponential.lean
jamesa9283 Aug 17, 2020
8851ea6
Update src/analysis/special_functions/arsinh.lean
jamesa9283 Aug 17, 2020
5dfa6d5
added Kenny's code
jamesa9283 Aug 17, 2020
b75ab5f
updated cosh_eq with a Kenny esc proof
jamesa9283 Aug 18, 2020
d9f645c
added full stops and spaces to docstrings
jamesa9283 Aug 18, 2020
745acc1
swapped the names of arinh_sinh and sinh_arsinh
jamesa9283 Aug 18, 2020
c8ec108
forgot to swap names
jamesa9283 Aug 18, 2020
04ffedd
Added `namespace real` and `@[pp_nodot]`
jamesa9283 Aug 20, 2020
694e47e
Update src/analysis/special_functions/arsinh.lean
robertylewis Aug 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
190 changes: 190 additions & 0 deletions src/analysis/special_functions/arsinh.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/-
Copyright (c) 2020 James Arthur. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: James Arthur, Chris Hughes, Shing Tak Lam.
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
-/
import analysis.special_functions.trigonometric
import data.real.basic
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
import analysis.special_functions.pow
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved

open real
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
local attribute [pp_nodot] real.log
shingtaklam1324 marked this conversation as resolved.
Show resolved Hide resolved
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
noncomputable theory

/-!
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
# Inverse of the sinh function

In this file we prove that sinh is bijective and hence has an
inverse, arsinh.

## Main Results

- `sinm_injective`: The proof that `sinm` is injective
TwoFX marked this conversation as resolved.
Show resolved Hide resolved
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
- `sinm_surjective`: The proof that `sinm` is surjective
- `sinm_bijective`: The proof `sinm` is bijective

## Notation

- `arsinh`: The inverse function of `sinm`
jcommelin marked this conversation as resolved.
Show resolved Hide resolved

## Tags

arsinh, sinh injective, sinh bijective, sinh surjective
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
-/

/-- The real definition of `cosh`-/
lemma cosh_def (x : ℝ) : cosh x = (exp x + exp (-x)) / 2 :=
by simp only [cosh, complex.cosh, complex.div_re, complex.exp_of_real_re, complex.one_re,
bit0_zero, add_zero, complex.add_re, euclidean_domain.zero_div, complex.bit0_re,
complex.one_im, complex.bit0_im, mul_zero, ← complex.of_real_neg, complex.norm_sq];
ring

/-- The real definition of `sinh`-/
lemma sinh_def (x : ℝ) : sinh x = (exp x - exp (-x)) / 2 :=
by simp only [sinh, complex.sinh, complex.div_re, complex.exp_of_real_re, complex.one_re,
bit0_zero, add_zero, complex.sub_re, euclidean_domain.zero_div, complex.bit0_re,
complex.one_im, complex.bit0_im, mul_zero, ← complex.of_real_neg, complex.norm_sq];
ring

/-- `real.cosh` is positive-/
lemma cosh_pos (x : ℝ) : 0 < real.cosh x :=
(cosh_def x).symm ▸ half_pos (add_pos (exp_pos x) (exp_pos (-x)))

/-- `sinh` is strictly monotone-/
lemma sinh_strict_mono : strict_mono sinh :=
strict_mono_of_deriv_pos differentiable_sinh (by rw [real.deriv_sinh]; exact cosh_pos)

/-- `arsinh` is defined using a logarithm-/
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
def arsinh (x : ℝ) := log (x + sqrt(1 + x^2))
kckennylau marked this conversation as resolved.
Show resolved Hide resolved
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved

/-- `sinh` is injective, `∀ a b, sinh a = sinh b → a = b` -/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to add in the definition of injective here? (same for surjective below)

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 thought it'd be nice, just for people who can't remember the definition off the top of their heads. However I can remove it if you feel its superfluous.

lemma sinh_injective : function.injective sinh := sinh_strict_mono.injective

private lemma aux_lemma (x : ℝ) : 1/(x + (1 + x^2).sqrt) = - x + (1 + x^2).sqrt :=
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
begin
have H : (x - (1 + x^2).sqrt)/((x - (1 + x^2).sqrt) * (x + (1 + x^2).sqrt)) = -x + (1 + x^2).sqrt,
{ have G : (x - (1 + x^2).sqrt) * (x + (1 + x^2).sqrt) = -1,
{ ring,
rw sqr_sqrt,
{ ring },
{ linarith [pow_two_nonneg x]} },
rw G,
ring },
rw [division_def, mul_inv', ←mul_assoc, mul_comm (x - sqrt (1 + x ^ 2)), inv_mul_cancel] at H,
rw one_mul at H,
rw [division_def, one_mul],
exact H,
{ intros fx,
rw sub_eq_zero at fx,
have fx_sq : x^2 = (sqrt (1 + x ^ 2)) ^ 2 := by { rw fx.symm },
rw sqr_sqrt at fx_sq,
linarith,
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
have G : 0 ≤ x^2 := by {apply pow_two_nonneg},
linarith }
end

private lemma b_lt_sqrt_b_sq_add_one (b : ℝ) : b < sqrt(b^2 + 1) :=
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
begin
by_cases hb : 0 ≤ b,
conv { to_lhs, rw ← sqrt_sqr hb },
rw sqrt_lt,
linarith,
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
apply pow_two_nonneg,
have F : 0 ≤ b^2 := by { apply pow_two_nonneg },
linarith,
rw not_le at hb,
apply lt_of_lt_of_le hb,
apply sqrt_nonneg,
end

/-- `sinh` is surjective, `∀ b, ∃ a, sinh a = b`. In this case, we use `a = arsinh b` -/
lemma sinh_surjective : function.surjective sinh :=
begin
intro b,
use (arsinh b),
rw sinh_def,
unfold arsinh,
rw ←log_inv,
rw [exp_log, exp_log],
{ rw [← one_mul ((b + sqrt (1 + b ^ 2))⁻¹), ←division_def, aux_lemma],
ring },
{ rw [← one_mul ((b + sqrt (1 + b ^ 2))⁻¹), ←division_def, aux_lemma],
ring,
rw [neg_add_eq_sub, sub_pos],
have H : b^2 < sqrt (b ^ 2 + 1)^2,
{ rw sqr_sqrt,
linarith,
have F : 0 ≤ b^2 := by {apply pow_two_nonneg},
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
linarith },
exact b_lt_sqrt_b_sq_add_one b,
},
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
{ have H := b_lt_sqrt_b_sq_add_one (-b),
rw [neg_square, add_comm (b^2)] at H,
linarith },
end

/-- `sinh` is bijective, both injective and surjective-/
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
lemma sinh_bijective : function.bijective sinh :=
⟨sinh_injective, sinh_surjective⟩

/-- A real version of `complex.cosh_sq_sub_sinh_sq`-/
lemma real.cosh_sq_sub_sinh_sq (x : ℝ) : cosh x ^ 2 - sinh x ^ 2 = 1 :=
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
begin
rw [sinh, cosh],
have := complex.cosh_sq_sub_sinh_sq x,
apply_fun complex.re at this,
rw [pow_two, pow_two] at this,
change (⟨_, _⟩ : ℂ).re - (⟨_, _⟩ : ℂ).re = 1 at this,
rw [complex.cosh_of_real_im x, complex.sinh_of_real_im x] at this,
norm_num at this,
rwa [pow_two, pow_two],
end

/-- A rearrangment and `sqrt` of `real.cosh_sq_sub_sinh_sq` -/
lemma sqrt_one_add_sinh_sq (x : ℝ): sqrt (1 + sinh x ^ 2) = cosh x :=
begin
have H := real.cosh_sq_sub_sinh_sq x,
have G : cosh x ^ 2 - sinh x ^ 2 + sinh x ^ 2 = 1 + sinh x ^ 2 := by {rw H},
TwoFX marked this conversation as resolved.
Show resolved Hide resolved
ring at G,
rw add_comm at G,
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
rw [G.symm, sqrt_sqr],
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
exact le_of_lt (cosh_pos x),
end

/-- `arsinh` is a left inverse of `sinh` -/
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
lemma sinh_arsinh (x : ℝ) : arsinh (sinh x) = x :=
begin
unfold arsinh,
rw sinh_def,
apply exp_injective,
rw exp_log,
{ rw [← sinh_def, sqrt_one_add_sinh_sq, cosh_def, sinh_def],
ring },
{ rw [← sinh_def, sqrt_one_add_sinh_sq, cosh_def, sinh_def],
ring,
exact exp_pos x },
end

/-- `arsinh` is the right inverse of `sinh`-/
lemma arsinh_sinh (x : ℝ) : sinh (arsinh x) = x :=
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
begin
rw sinh_def,
unfold arsinh,
rw ←log_inv,
rw [exp_log, exp_log],
{ rw [← one_mul ((x + sqrt (1 + x ^ 2))⁻¹), ←division_def, aux_lemma],
ring },
{ rw [← one_mul ((x + sqrt (1 + x ^ 2))⁻¹), ←division_def, aux_lemma],
ring,
rw [neg_add_eq_sub, sub_pos],
have H : x^2 < sqrt (x ^ 2 + 1)^2,
{ rw sqr_sqrt,
linarith,
have F : 0 ≤ x^2 := by {apply pow_two_nonneg},
TwoFX marked this conversation as resolved.
Show resolved Hide resolved
linarith },
exact b_lt_sqrt_b_sq_add_one x,
},
{ have H := b_lt_sqrt_b_sq_add_one (-x),
rw [neg_square, add_comm (x^2)] at H,
linarith },
end