Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 93b7e63

Browse files
feat(analysis/special_functions/trigonometric): range_{exp,cos,sin} (#4595)
Co-authored-by: Patrick Massot <patrickmassot@free.fr>
1 parent fee2dfa commit 93b7e63

File tree

5 files changed

+72
-6
lines changed

5 files changed

+72
-6
lines changed

src/algebra/ordered_ring.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,7 @@ begin
357357
end
358358

359359
lemma exists_le_mul_self (a : α) : ∃ x : α, a ≤ x * x :=
360-
begin
361-
obtain ⟨x, hx⟩ := exists_lt_mul_self a,
362-
exact ⟨x, le_of_lt hx⟩
363-
end
360+
let ⟨x, hx⟩ := exists_lt_mul_self a in ⟨x, le_of_lt hx⟩
364361

365362
@[priority 100] -- see Note [lower instance priority]
366363
instance linear_ordered_semiring.to_nontrivial {α : Type*} [linear_ordered_semiring α] :

src/algebra/quadratic_discriminant.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This file defines the discriminant of a quadratic and gives the solution to a qu
1818
## Main statements
1919
2020
- `quadratic_eq_zero_iff`: roots of a quadratic can be written as
21-
`(-b + s) / (2 * a)` or `(-b - s) / (2 * a)`, where `s` is the square root of the discriminant.
21+
`(-b + s) / (2 * a)` or `(-b - s) / (2 * a)`, where `s` is a square root of the discriminant.
2222
- `quadratic_ne_zero_of_discrim_ne_square`: if the discriminant has no square root,
2323
then the corresponding quadratic has no root.
2424
- `discrim_le_zero`: if a quadratic is always non-negative, then its discriminant is non-positive.

src/analysis/special_functions/exp_log.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,21 @@ by { rw [log, dif_pos hx], exact classical.some_spec (exists_exp_eq_of_pos ((abs
216216
lemma exp_log (hx : 0 < x) : exp (log x) = x :=
217217
by { rw exp_log_eq_abs (ne_of_gt hx), exact abs_of_pos hx }
218218

219+
lemma range_exp : set.range exp = {x | 0 < x} :=
220+
set.ext $ λ x, ⟨by { rintro ⟨x, rfl⟩, exact exp_pos x }, λ hx, ⟨log x, exp_log hx⟩⟩
221+
219222
lemma exp_log_of_neg (hx : x < 0) : exp (log x) = -x :=
220223
by { rw exp_log_eq_abs (ne_of_lt hx), exact abs_of_neg hx }
221224

222225
@[simp] lemma log_exp (x : ℝ) : log (exp x) = x :=
223226
exp_injective $ exp_log (exp_pos x)
224227

228+
lemma log_surjective : function.surjective log :=
229+
λ x, ⟨exp x, log_exp x⟩
230+
231+
@[simp] lemma range_log : set.range log = set.univ :=
232+
log_surjective.range_eq
233+
225234
@[simp] lemma log_zero : log 0 = 0 :=
226235
by simp [log]
227236

src/analysis/special_functions/trigonometric.lean

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Chris Hughes, Abhimanyu Pallavi Sudhir, Jean Lo, Calle Sönne, Benjamin Davidson
55
-/
66
import analysis.special_functions.exp_log
7+
import data.set.intervals.infinite
8+
import algebra.quadratic_discriminant
79

810
/-!
911
# Trigonometric functions
@@ -835,6 +837,12 @@ begin
835837
exact ⟨y, hy⟩ }
836838
end
837839

840+
lemma range_cos_infinite : (range real.cos).infinite :=
841+
by { rw real.range_cos, exact Icc.infinite (by norm_num) }
842+
843+
lemma range_sin_infinite : (range real.sin).infinite :=
844+
by { rw real.range_sin, exact Icc.infinite (by norm_num) }
845+
838846
lemma sin_lt {x : ℝ} (h : 0 < x) : sin x < x :=
839847
begin
840848
cases le_or_gt x 1 with h' h',
@@ -1632,6 +1640,9 @@ by rw [log, exp_add_mul_I, ← of_real_sin, sin_arg, ← of_real_cos, cos_arg hx
16321640
mul_div_cancel' _ (of_real_ne_zero.2 (mt abs_eq_zero.1 hx)), ← mul_assoc,
16331641
mul_div_cancel' _ (of_real_ne_zero.2 (mt abs_eq_zero.1 hx)), re_add_im]
16341642

1643+
lemma range_exp : range exp = {x | x ≠ 0} :=
1644+
set.ext $ λ x, ⟨by { rintro ⟨x, rfl⟩, exact exp_ne_zero x }, λ hx, ⟨log x, exp_log hx⟩⟩
1645+
16351646
lemma exp_inj_of_neg_pi_lt_of_le_pi {x y : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π)
16361647
(hy₁ : - π < y.im) (hy₂ : y.im ≤ π) (hxy : exp x = exp y) : x = y :=
16371648
by rw [exp_eq_exp_re_mul_sin_add_cos, exp_eq_exp_re_mul_sin_add_cos y] at hxy;
@@ -1664,6 +1675,21 @@ lemma log_I : log I = π / 2 * I := by simp [log]
16641675

16651676
lemma log_neg_I : log (-I) = -(π / 2) * I := by simp [log]
16661677

1678+
lemma exists_pow_nat_eq (x : ℂ) {n : ℕ} (hn : 0 < n) : ∃ z, z ^ n = x :=
1679+
begin
1680+
by_cases hx : x = 0,
1681+
{ use 0, simp only [hx, zero_pow_eq_zero, hn] },
1682+
{ use exp (log x / n),
1683+
rw [← exp_nat_mul, mul_div_cancel', exp_log hx],
1684+
exact_mod_cast (nat.pos_iff_ne_zero.mp hn) }
1685+
end
1686+
1687+
lemma exists_eq_mul_self (x : ℂ) : ∃ z, x = z * z :=
1688+
begin
1689+
obtain ⟨z, rfl⟩ := exists_pow_nat_eq x zero_lt_two,
1690+
exact ⟨z, pow_two z⟩
1691+
end
1692+
16671693
lemma two_pi_I_ne_zero : (2 * π * I : ℂ) ≠ 0 :=
16681694
by norm_num [real.pi_ne_zero, I_ne_zero]
16691695

@@ -1867,8 +1893,38 @@ continuous_on_sin.div continuous_on_cos $ λ x, id
18671893
lemma continuous_tan : continuous (λ x : {x | cos x ≠ 0}, tan x) :=
18681894
continuous_on_iff_continuous_restrict.1 continuous_on_tan
18691895

1870-
end complex
1896+
lemma cos_surjective : function.surjective cos :=
1897+
begin
1898+
intro x,
1899+
obtain ⟨w, hw⟩ : ∃ w, 1 * w * w + (-2 * x) * w + 1 = 0,
1900+
{ exact exists_quadratic_eq_zero one_ne_zero (exists_eq_mul_self _) },
1901+
have hw' : exp (log w / I * I) = w,
1902+
{ rw [div_mul_cancel _ I_ne_zero, exp_log],
1903+
rintro rfl,
1904+
simpa only [zero_add, one_ne_zero, mul_zero] using hw },
1905+
obtain ⟨z, hz⟩ : ∃ z : ℂ, (exp (z * I)) ^ 2 - 2 * x * exp (z * I) + 1 = 0,
1906+
{ use log w / I, rw [hw', ← hw], ring },
1907+
use z,
1908+
delta cos,
1909+
rw ← mul_left_inj' (exp_ne_zero (z * I)),
1910+
rw [sub_add_eq_add_sub, sub_eq_zero, pow_two, ← exp_add, mul_comm _ x, mul_right_comm] at hz,
1911+
field_simp [add_mul, ← exp_add, hz]
1912+
end
18711913

1914+
@[simp] lemma range_cos : range cos = set.univ :=
1915+
cos_surjective.range_eq
1916+
1917+
lemma sin_surjective : function.surjective sin :=
1918+
begin
1919+
intro x,
1920+
rcases cos_surjective x with ⟨z, rfl⟩,
1921+
exact ⟨z+π/2, sin_add_pi_div_two z⟩
1922+
end
1923+
1924+
@[simp] lemma range_sin : range sin = set.univ :=
1925+
sin_surjective.range_eq
1926+
1927+
end complex
18721928

18731929
namespace real
18741930
open_locale real

src/data/set/finite.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ by haveI := classical.dec_eq β; exact ⟨by apply_instance⟩
241241
theorem finite.image {s : set α} (f : α → β) : finite s → finite (f '' s)
242242
| ⟨h⟩ := ⟨@set.fintype_image _ _ (classical.dec_eq β) _ _ h⟩
243243

244+
theorem infinite_of_infinite_image (f : α → β) {s : set α} (hs : (f '' s).infinite) :
245+
s.infinite :=
246+
mt (finite.image f) hs
247+
244248
lemma finite.dependent_image {s : set α} (hs : finite s) {F : Π i ∈ s, β} {t : set β}
245249
(H : ∀ y ∈ t, ∃ x (hx : x ∈ s), y = F x hx) : set.finite t :=
246250
begin

0 commit comments

Comments
 (0)