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
Show file tree
Hide file tree
Changes from 57 commits
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
80 changes: 80 additions & 0 deletions src/analysis/special_functions/arsinh.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/-
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
-/
import analysis.special_functions.trigonometric

open real
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

- `sinh_injective`: The proof that `sinh` is injective
- `sinh_surjective`: The proof that `sinh` is surjective
- `sinh_bijective`: The proof `sinh` is bijective
- `arsinh`: The inverse function of `sinh`

## Tags

arsinh, arcsinh, argsinh, asinh, sinh injective, sinh bijective, sinh surjective
-/


/-- `arsinh` is defined using a logarithm, `arsinh x = log (x + sqrt(1 + x^2))` -/
def arsinh (x : ℝ) := log (x + sqrt (1 + x^2))

/-- `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 + sqrt (1 + x ^ 2)) = -x + sqrt (1 + x ^ 2) :=
begin
refine (eq_one_div_of_mul_eq_one _).symm,
have : 0 ≤ 1 + x ^ 2 := add_nonneg zero_le_one (pow_two_nonneg x),
rw [add_comm, ← sub_eq_neg_add, ← mul_self_sub_mul_self,
mul_self_sqrt this, pow_two, add_sub_cancel]
end

private lemma b_lt_sqrt_b_one_add_sq (b : ℝ) : b < sqrt (1 + b ^ 2) :=
calc b
≤ sqrt (b ^ 2) : le_sqrt_of_sqr_le $ le_refl _
... < sqrt (1 + b ^ 2) : (sqrt_lt (pow_two_nonneg _) (add_nonneg zero_le_one (pow_two_nonneg _))).2
(lt_one_add _)

private lemma add_sqrt_one_add_pow_two_pos (b : ℝ) : 0 < b + sqrt (1 + b ^ 2) :=
by { rw [← neg_neg b, ← sub_eq_neg_add, sub_pos, pow_two, neg_mul_neg, ← pow_two],
exact b_lt_sqrt_b_one_add_sq (-b) }

/-- `arsinh` is the right inverse of `sinh`-/
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
lemma arsinh_sinh (x : ℝ) : sinh (arsinh x) = x :=
jamesa9283 marked this conversation as resolved.
Show resolved Hide resolved
by rw [sinh_eq, arsinh, ← log_inv, exp_log (add_sqrt_one_add_pow_two_pos x),
exp_log (inv_pos.2 (add_sqrt_one_add_pow_two_pos x)),
inv_eq_one_div, aux_lemma x, sub_eq_add_neg, neg_add, neg_neg, ← sub_eq_add_neg,
add_add_sub_cancel, add_self_div_two]

/-- `sinh` is surjective, `∀ b, ∃ a, sinh a = b`. In this case, we use `a = arsinh b` -/
lemma sinh_surjective : function.surjective sinh := function.left_inverse.surjective arsinh_sinh

/-- `sinh` is bijective, both injective and surjective. -/
lemma sinh_bijective : function.bijective sinh :=
⟨sinh_injective, sinh_surjective⟩

/-- 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,
rw sub_add_cancel at G,
rw [←G, sqrt_sqr],
exact le_of_lt (cosh_pos x),
end

/-- `arsinh` is the left inverse of `sinh` -/
lemma sinh_arsinh (x : ℝ) : arsinh (sinh x) = x :=
function.right_inverse_of_injective_of_left_inverse sinh_injective arsinh_sinh x
2 changes: 1 addition & 1 deletion src/analysis/special_functions/exp_log.lean
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ end
to `log |x|` for `x < 0`, and to `0` for `0`. We use this unconventional extension to
`(-∞, 0]` as it gives the formula `log (x * y) = log x + log y` for all nonzero `x` and `y`, and
the derivative of `log` is `1/x` away from `0`. -/
noncomputable def log (x : ℝ) : ℝ :=
@[pp_nodot] noncomputable def log (x : ℝ) : ℝ :=
if hx : x ≠ 0 then classical.some (exists_exp_eq_of_pos (abs_pos_iff.mpr hx)) else 0

lemma exp_log_eq_abs (hx : x ≠ 0) : exp (log x) = abs x :=
Expand Down
4 changes: 4 additions & 0 deletions src/analysis/special_functions/trigonometric.lean
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ funext $ λ x, (has_deriv_at_cosh x).deriv
lemma continuous_cosh : continuous cosh :=
differentiable_cosh.continuous

/-- `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 })

end real

section
Expand Down
24 changes: 24 additions & 0 deletions src/data/complex/exponential.lean
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,11 @@ of_real_inj.1 $ by simpa using cos_square x
lemma sin_square : sin x ^ 2 = 1 - cos x ^ 2 :=
eq_sub_iff_add_eq.2 $ sin_sq_add_cos_sq _

/-- The definition of `sinh` in terms of `exp` -/
lemma sinh_eq (x : ℝ) : sinh x = (exp x - exp (-x)) / 2 :=
eq_div_of_mul_eq two_ne_zero $ by rw [sinh, exp, exp, complex.of_real_neg, complex.sinh, mul_two,
← complex.add_re, ← mul_two, div_mul_cancel _ (two_ne_zero' : (2 : ℂ) ≠ 0), complex.sub_re]

@[simp] lemma sinh_zero : sinh 0 = 0 := by simp [sinh]

@[simp] lemma sinh_neg : sinh (-x) = -sinh x :=
Expand All @@ -870,6 +875,11 @@ by simp [sinh, exp_neg, (neg_div _ _).symm, add_mul]
lemma sinh_add : sinh (x + y) = sinh x * cosh y + cosh x * sinh y :=
by rw ← of_real_inj; simp [sinh_add]

/-- The definition of `cosh` in terms of `exp`. -/
lemma cosh_eq (x : ℝ) : cosh x = (exp x + exp (-x)) / 2 :=
eq_div_of_mul_eq two_ne_zero $ by rw [cosh, exp, exp, complex.of_real_neg, complex.cosh, mul_two,
← complex.add_re, ← mul_two, div_mul_cancel _ (two_ne_zero' : (2 : ℂ) ≠ 0), complex.add_re]

@[simp] lemma cosh_zero : cosh 0 = 1 := by simp [cosh]

@[simp] lemma cosh_neg : cosh (-x) = cosh x :=
Expand All @@ -884,6 +894,16 @@ by simp [sub_eq_add_neg, sinh_add, sinh_neg, cosh_neg]
lemma cosh_sub : cosh (x - y) = cosh x * cosh y - sinh x * sinh y :=
by simp [sub_eq_add_neg, cosh_add, sinh_neg, cosh_neg]

lemma cosh_sq_sub_sinh_sq (x : ℝ) : cosh x ^ 2 - sinh x ^ 2 = 1 :=
begin
rw [sinh, cosh],
have := congr_arg complex.re (complex.cosh_sq_sub_sinh_sq x),
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, mul_zero, sub_zero, sub_zero] at this,
rwa [pow_two, pow_two],
end

lemma tanh_eq_sinh_div_cosh : tanh x = sinh x / cosh x :=
of_real_inj.1 $ by simp [tanh_eq_sinh_div_cosh]

Expand Down Expand Up @@ -944,6 +964,10 @@ by rw [← exp_zero, exp_lt_exp]
lemma exp_lt_one_iff {x : ℝ} : exp x < 1 ↔ x < 0 :=
by rw [← exp_zero, exp_lt_exp]

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

end real

namespace complex
Expand Down