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

Commit db712d5

Browse files
committed
chore(*): simp lemmas for tendsto, Ixx, and coe (#5296)
* For `(f : α → β) (l : filter β)`, simplify `tendsto (λ a : Ixx*, f x) at_top l` to `tendsto f _ l`, and similarly for `at_bot`. * For `(f : α → Ixx*) (l : filter α)`, simplify `tendsto f l at_top` to `tendsto (λ x, (f x : β)) l _`, and similarly for `at_bot`. Here `Ixx*` is one of the intervals `Ici a`, `Ioi a`, `Ioo a b` etc, and `_` is a filter that depends on the choice of `Ixx` and `at_top`/`at_bot`. * Drop some “nontriviality” assumptions like `no_top_order` for lemmas about `Ioi a`.
1 parent a372dfc commit db712d5

File tree

6 files changed

+171
-83
lines changed

6 files changed

+171
-83
lines changed

src/analysis/special_functions/exp_log.lean

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ exp, log
3030

3131
noncomputable theory
3232

33-
open finset filter metric asymptotics
33+
open finset filter metric asymptotics set function
3434
open_locale classical topological_space
3535

3636
namespace complex
@@ -41,11 +41,9 @@ begin
4141
rw has_deriv_at_iff_is_o_nhds_zero,
4242
have : (1 : ℕ) < 2 := by norm_num,
4343
refine (is_O.of_bound (∥exp x∥) _).trans_is_o (is_o_pow_id this),
44-
have : metric.ball (0 : ℂ) 1 ∈ nhds (0 : ℂ) := metric.ball_mem_nhds 0 zero_lt_one,
45-
apply filter.mem_sets_of_superset this (λz hz, _),
46-
simp only [metric.mem_ball, dist_zero_right] at hz,
47-
simp only [exp_zero, mul_one, one_mul, add_comm, normed_field.norm_pow,
48-
zero_add, set.mem_set_of_eq],
44+
filter_upwards [metric.ball_mem_nhds (0 : ℂ) zero_lt_one],
45+
simp only [metric.mem_ball, dist_zero_right, normed_field.norm_pow],
46+
intros z hz,
4947
calc ∥exp (x + z) - exp x - z * exp x∥
5048
= ∥exp x * (exp z - 1 - z)∥ : by { congr, rw [exp_add], ring }
5149
... = ∥exp x∥ * ∥exp z - 1 - z∥ : normed_field.norm_mul _ _
@@ -64,7 +62,7 @@ funext $ λ x, (has_deriv_at_exp x).deriv
6462

6563
@[simp] lemma iter_deriv_exp : ∀ n : ℕ, (deriv^[n] exp) = exp
6664
| 0 := rfl
67-
| (n+1) := by rw [function.iterate_succ_apply, deriv_exp, iter_deriv_exp n]
65+
| (n+1) := by rw [iterate_succ_apply, deriv_exp, iter_deriv_exp n]
6866

6967
lemma continuous_exp : continuous exp :=
7068
differentiable_exp.continuous
@@ -177,7 +175,7 @@ funext $ λ x, (has_deriv_at_exp x).deriv
177175

178176
@[simp] lemma iter_deriv_exp : ∀ n : ℕ, (deriv^[n] exp) = exp
179177
| 0 := rfl
180-
| (n+1) := by rw [function.iterate_succ_apply, deriv_exp, iter_deriv_exp n]
178+
| (n+1) := by rw [iterate_succ_apply, deriv_exp, iter_deriv_exp n]
181179

182180
lemma continuous_exp : continuous exp :=
183181
differentiable_exp.continuous
@@ -305,26 +303,25 @@ lemma tendsto_exp_at_bot : tendsto exp at_bot (𝓝 0) :=
305303
(tendsto_exp_neg_at_top_nhds_0.comp tendsto_neg_at_bot_at_top).congr $
306304
λ x, congr_arg exp $ neg_neg x
307305

308-
lemma tendsto_exp_at_bot_nhds_within : tendsto exp at_bot (𝓝[set.Ioi 0] 0) :=
306+
lemma tendsto_exp_at_bot_nhds_within : tendsto exp at_bot (𝓝[Ioi 0] 0) :=
309307
tendsto_inf.2 ⟨tendsto_exp_at_bot, tendsto_principal.2 $ eventually_of_forall exp_pos⟩
310308

311-
lemma range_exp : set.range exp = set.Ioi 0 :=
312-
set.ext $ λ y, ⟨λ ⟨x, hx⟩, hx ▸ exp_pos x,
313-
λ hy, mem_range_of_exists_le_of_exists_ge continuous_exp
314-
(tendsto_exp_at_bot.eventually (ge_mem_nhds hy)).exists
315-
(tendsto_exp_at_top.eventually (eventually_ge_at_top y)).exists⟩
316-
317309
/-- `real.exp` as an order isomorphism between `ℝ` and `(0, +∞)`. -/
318-
def exp_order_iso : ℝ ≃o set.Ioi (0 : ℝ) :=
319-
(exp_strict_mono.order_iso _).trans $ order_iso.set_congr _ _ range_exp
310+
def exp_order_iso : ℝ ≃o Ioi (0 : ℝ) :=
311+
strict_mono.order_iso_of_surjective _ (exp_strict_mono.cod_restrict exp_pos) $
312+
surjective_of_continuous (continuous_subtype_mk _ continuous_exp)
313+
(by simp only [tendsto_Ioi_at_top, coe_cod_restrict_apply, tendsto_exp_at_top])
314+
(by simp [tendsto_exp_at_bot_nhds_within])
320315

321316
@[simp] lemma coe_exp_order_iso_apply (x : ℝ) : (exp_order_iso x : ℝ) = exp x := rfl
322317

323318
@[simp] lemma coe_comp_exp_order_iso : coe ∘ exp_order_iso = exp := rfl
324319

320+
@[simp] lemma range_exp : range exp = Ioi 0 :=
321+
by rw [← coe_comp_exp_order_iso, range_comp, exp_order_iso.range_eq, image_univ, subtype.range_coe]
322+
325323
@[simp] lemma map_exp_at_top : map exp at_top = at_top :=
326-
by rw [← coe_comp_exp_order_iso, ← filter.map_map, order_iso.map_at_top,
327-
map_coe_Ioi_at_top]
324+
by rw [← coe_comp_exp_order_iso, ← filter.map_map, order_iso.map_at_top, map_coe_Ioi_at_top]
328325

329326
@[simp] lemma comap_exp_at_top : comap exp at_top = at_top :=
330327
by rw [← map_exp_at_top, comap_map exp_injective, map_exp_at_top]
@@ -337,15 +334,14 @@ lemma tendsto_comp_exp_at_top {α : Type*} {l : filter α} {f : ℝ → α} :
337334
tendsto (λ x, f (exp x)) at_top l ↔ tendsto f at_top l :=
338335
by rw [← tendsto_map'_iff, map_exp_at_top]
339336

340-
@[simp] lemma map_exp_at_bot : map exp at_bot = 𝓝[set.Ioi 0] 0 :=
341-
by rw [← coe_comp_exp_order_iso, ← filter.map_map, order_iso.map_at_bot,
342-
← map_coe_Ioi_at_bot]
337+
@[simp] lemma map_exp_at_bot : map exp at_bot = 𝓝[Ioi 0] 0 :=
338+
by rw [← coe_comp_exp_order_iso, ← filter.map_map, exp_order_iso.map_at_bot, ← map_coe_Ioi_at_bot]
343339

344-
lemma comap_exp_nhds_within_Ioi_zero : comap exp (𝓝[set.Ioi 0] 0) = at_bot :=
340+
lemma comap_exp_nhds_within_Ioi_zero : comap exp (𝓝[Ioi 0] 0) = at_bot :=
345341
by rw [← map_exp_at_bot, comap_map exp_injective]
346342

347343
lemma tendsto_comp_exp_at_bot {α : Type*} {l : filter α} {f : ℝ → α} :
348-
tendsto (λ x, f (exp x)) at_bot l ↔ tendsto f (𝓝[set.Ioi 0] 0) l :=
344+
tendsto (λ x, f (exp x)) at_bot l ↔ tendsto f (𝓝[Ioi 0] 0) l :=
349345
by rw [← map_exp_at_bot, tendsto_map'_iff]
350346

351347
/-- The real logarithm function, equal to the inverse of the exponential for `x > 0`,
@@ -372,17 +368,16 @@ by { rw exp_log_eq_abs (ne_of_lt hx), exact abs_of_neg hx }
372368
@[simp] lemma log_exp (x : ℝ) : log (exp x) = x :=
373369
exp_injective $ exp_log (exp_pos x)
374370

375-
lemma surj_on_log : set.surj_on log (set.Ioi 0) set.univ :=
371+
lemma surj_on_log : surj_on log (Ioi 0) univ :=
376372
λ x _, ⟨exp x, exp_pos x, log_exp x⟩
377373

378-
lemma log_surjective : function.surjective log :=
374+
lemma log_surjective : surjective log :=
379375
λ x, ⟨exp x, log_exp x⟩
380376

381-
@[simp] lemma range_log : set.range log = set.univ :=
377+
@[simp] lemma range_log : range log = univ :=
382378
log_surjective.range_eq
383379

384-
@[simp] lemma log_zero : log 0 = 0 :=
385-
by simp [log]
380+
@[simp] lemma log_zero : log 0 = 0 := dif_pos rfl
386381

387382
@[simp] lemma log_one : log 1 = 0 :=
388383
exp_injective $ by rw [exp_log zero_lt_one, exp_zero]
@@ -397,7 +392,7 @@ end
397392
@[simp] lemma log_neg_eq_log (x : ℝ) : log (-x) = log x :=
398393
by rw [← log_abs x, ← log_abs (-x), abs_neg]
399394

400-
lemma surj_on_log' : set.surj_on log (set.Iio 0) set.univ :=
395+
lemma surj_on_log' : surj_on log (Iio 0) univ :=
401396
λ x _, ⟨-exp x, neg_lt_zero.2 $ exp_pos x, by rw [log_neg_eq_log, log_exp]⟩
402397

403398
lemma log_mul (hx : x ≠ 0) (hy : y ≠ 0) : log (x * y) = log x + log y :=
@@ -420,13 +415,13 @@ lemma log_lt_log_iff (hx : 0 < x) (hy : 0 < y) : log x < log y ↔ x < y :=
420415
by { rw [← exp_lt_exp, exp_log hx, exp_log hy] }
421416

422417
lemma log_pos_iff (hx : 0 < x) : 0 < log x ↔ 1 < x :=
423-
by { rw ← log_one, exact log_lt_log_iff (by norm_num) hx }
418+
by { rw ← log_one, exact log_lt_log_iff zero_lt_one hx }
424419

425420
lemma log_pos (hx : 1 < x) : 0 < log x :=
426421
(log_pos_iff (lt_trans zero_lt_one hx)).2 hx
427422

428423
lemma log_neg_iff (h : 0 < x) : log x < 0 ↔ x < 1 :=
429-
by { rw ← log_one, exact log_lt_log_iff h (by norm_num) }
424+
by { rw ← log_one, exact log_lt_log_iff h zero_lt_one }
430425

431426
lemma log_neg (h0 : 0 < x) (h1 : x < 1) : log x < 0 := (log_neg_iff h0).2 h1
432427

@@ -467,15 +462,15 @@ tendsto_comp_exp_at_top.1 $ by simpa only [log_exp] using tendsto_id
467462
lemma tendsto_log_nhds_within_zero : tendsto log (𝓝[{0}ᶜ] 0) at_bot :=
468463
begin
469464
rw [← (show _ = log, from funext log_abs)],
470-
refine tendsto.comp (_ : tendsto log (𝓝[set.Ioi 0] (abs 0)) at_bot)
465+
refine tendsto.comp (_ : tendsto log (𝓝[Ioi 0] (abs 0)) at_bot)
471466
((continuous_abs.tendsto 0).inf (tendsto_principal_principal.2 $ λ a, abs_pos.2)),
472467
rw [abs_zero, ← tendsto_comp_exp_at_bot],
473468
simpa using tendsto_id
474469
end
475470

476471
lemma continuous_on_log : continuous_on log {0}ᶜ :=
477472
begin
478-
rw [continuous_on_iff_continuous_restrict, set.restrict],
473+
rw [continuous_on_iff_continuous_restrict, restrict],
479474
conv in (log _) { rw [log_of_ne_zero (show (x : ℝ) ≠ 0, from x.2)] },
480475
exact exp_order_iso.symm.continuous.comp (continuous_subtype_mk _ continuous_subtype_coe.norm)
481476
end
@@ -686,7 +681,7 @@ end
686681
/-- The function `x^n * exp(-x)` tends to `0` at `+∞`, for any natural number `n`. -/
687682
lemma tendsto_pow_mul_exp_neg_at_top_nhds_0 (n : ℕ) : tendsto (λx, x^n * exp (-x)) at_top (𝓝 0) :=
688683
(tendsto_inv_at_top_zero.comp (tendsto_exp_div_pow_at_top n)).congr $ λx,
689-
by rw [function.comp_app, inv_eq_one_div, div_div_eq_mul_div, one_mul, div_eq_mul_inv, exp_neg]
684+
by rw [comp_app, inv_eq_one_div, div_div_eq_mul_div, one_mul, div_eq_mul_inv, exp_neg]
690685

691686
/-- The function `(b * exp x + c) / (x ^ n)` tends to `+∞` at `+∞`, for any positive natural number
692687
`n` and any real numbers `b` and `c` such that `b` is positive. -/
@@ -733,7 +728,7 @@ begin
733728
and then apply the mean value inequality. -/
734729
let F : ℝ → ℝ := λ x, ∑ i in range n, x^(i+1)/(i+1) + log (1-x),
735730
-- First step: compute the derivative of `F`
736-
have A : ∀ y ∈ set.Ioo (-1 : ℝ) 1, deriv F y = - (y^n) / (1 - y),
731+
have A : ∀ y ∈ Ioo (-1 : ℝ) 1, deriv F y = - (y^n) / (1 - y),
737732
{ assume y hy,
738733
have : (∑ i in range n, (↑i + 1) * y ^ i / (↑i + 1)) = (∑ i in range n, y ^ i),
739734
{ congr' with i,
@@ -743,9 +738,9 @@ begin
743738
sub_ne_zero_of_ne (ne_of_gt hy.2), sub_ne_zero_of_ne (ne_of_lt hy.2)],
744739
ring },
745740
-- second step: show that the derivative of `F` is small
746-
have B : ∀ y ∈ set.Icc (-abs x) (abs x), abs (deriv F y) ≤ (abs x)^n / (1 - abs x),
741+
have B : ∀ y ∈ Icc (-abs x) (abs x), abs (deriv F y) ≤ (abs x)^n / (1 - abs x),
747742
{ assume y hy,
748-
have : y ∈ set.Ioo (-(1 : ℝ)) 1 := ⟨lt_of_lt_of_le (neg_lt_neg h) hy.1, lt_of_le_of_lt hy.2 h⟩,
743+
have : y ∈ Ioo (-(1 : ℝ)) 1 := ⟨lt_of_lt_of_le (neg_lt_neg h) hy.1, lt_of_le_of_lt hy.2 h⟩,
749744
calc abs (deriv F y) = abs (-(y^n) / (1 - y)) : by rw [A y this]
750745
... ≤ (abs x)^n / (1 - abs x) :
751746
begin
@@ -757,7 +752,7 @@ begin
757752
end },
758753
-- third step: apply the mean value inequality
759754
have C : ∥F x - F 0∥ ≤ ((abs x)^n / (1 - abs x)) * ∥x - 0∥,
760-
{ have : ∀ y ∈ set.Icc (- abs x) (abs x), differentiable_at ℝ F y,
755+
{ have : ∀ y ∈ Icc (- abs x) (abs x), differentiable_at ℝ F y,
761756
{ assume y hy,
762757
have : 1 - y ≠ 0 := sub_ne_zero_of_ne (ne_of_gt (lt_of_le_of_lt hy.2 h)),
763758
simp [F, this] },

src/order/filter/at_top_bot.lean

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,13 @@ end
722722

723723
/-- The `at_top` filter for an open interval `Ioi a` comes from the `at_top` filter in the ambient
724724
order. -/
725-
lemma at_top_Ioi_eq [semilattice_sup α] [no_top_order α] (a : α) :
725+
lemma at_top_Ioi_eq [semilattice_sup α] (a : α) :
726726
at_top = comap (coe : Ioi a → α) at_top :=
727-
by rw [← map_coe_Ioi_at_top a, comap_map subtype.coe_injective]
727+
begin
728+
nontriviality,
729+
rcases nontrivial_iff_nonempty.1 ‹_› with ⟨b, hb⟩,
730+
rw [← map_coe_at_top_of_Ici_subset (Ici_subset_Ioi.2 hb), comap_map subtype.coe_injective]
731+
end
728732

729733
/-- The `at_top` filter for an open interval `Ici a` comes from the `at_top` filter in the ambient
730734
order. -/
@@ -740,9 +744,9 @@ order. -/
740744

741745
/-- The `at_bot` filter for an open interval `Iio a` comes from the `at_bot` filter in the ambient
742746
order. -/
743-
lemma at_bot_Iio_eq [semilattice_inf α] [no_bot_order α] (a : α) :
747+
lemma at_bot_Iio_eq [semilattice_inf α] (a : α) :
744748
at_bot = comap (coe : Iio a → α) at_bot :=
745-
@at_top_Ioi_eq (order_dual α) _ _ _
749+
@at_top_Ioi_eq (order_dual α) _ _
746750

747751
/-- The `at_bot` filter for an open interval `Iic a` comes from the `at_bot` filter in the ambient
748752
order. -/
@@ -756,6 +760,44 @@ lemma at_bot_Iic_eq [semilattice_inf α] (a : α) :
756760
at_bot = comap (coe : Iic a → α) at_bot :=
757761
@at_top_Ici_eq (order_dual α) _ _
758762

763+
lemma tendsto_Ioi_at_top [semilattice_sup α] {a : α} {f : β → Ioi a}
764+
{l : filter β} :
765+
tendsto f l at_top ↔ tendsto (λ x, (f x : α)) l at_top :=
766+
by rw [at_top_Ioi_eq, tendsto_comap_iff]
767+
768+
lemma tendsto_Iio_at_bot [semilattice_inf α] {a : α} {f : β → Iio a}
769+
{l : filter β} :
770+
tendsto f l at_bot ↔ tendsto (λ x, (f x : α)) l at_bot :=
771+
by rw [at_bot_Iio_eq, tendsto_comap_iff]
772+
773+
lemma tendsto_Ici_at_top [semilattice_sup α] {a : α} {f : β → Ici a} {l : filter β} :
774+
tendsto f l at_top ↔ tendsto (λ x, (f x : α)) l at_top :=
775+
by rw [at_top_Ici_eq, tendsto_comap_iff]
776+
777+
lemma tendsto_Iic_at_bot [semilattice_inf α] {a : α} {f : β → Iic a} {l : filter β} :
778+
tendsto f l at_bot ↔ tendsto (λ x, (f x : α)) l at_bot :=
779+
by rw [at_bot_Iic_eq, tendsto_comap_iff]
780+
781+
@[simp] lemma tendsto_comp_coe_Ioi_at_top [semilattice_sup α] [no_top_order α] {a : α}
782+
{f : α → β} {l : filter β} :
783+
tendsto (λ x : Ioi a, f x) at_top l ↔ tendsto f at_top l :=
784+
by rw [← map_coe_Ioi_at_top a, tendsto_map'_iff]
785+
786+
@[simp] lemma tendsto_comp_coe_Ici_at_top [semilattice_sup α] {a : α}
787+
{f : α → β} {l : filter β} :
788+
tendsto (λ x : Ici a, f x) at_top l ↔ tendsto f at_top l :=
789+
by rw [← map_coe_Ici_at_top a, tendsto_map'_iff]
790+
791+
@[simp] lemma tendsto_comp_coe_Iio_at_bot [semilattice_inf α] [no_bot_order α] {a : α}
792+
{f : α → β} {l : filter β} :
793+
tendsto (λ x : Iio a, f x) at_bot l ↔ tendsto f at_bot l :=
794+
by rw [← map_coe_Iio_at_bot a, tendsto_map'_iff]
795+
796+
@[simp] lemma tendsto_comp_coe_Iic_at_bot [semilattice_inf α] {a : α}
797+
{f : α → β} {l : filter β} :
798+
tendsto (λ x : Iic a, f x) at_bot l ↔ tendsto f at_bot l :=
799+
by rw [← map_coe_Iic_at_bot a, tendsto_map'_iff]
800+
759801
lemma map_add_at_top_eq_nat (k : ℕ) : map (λa, a + k) at_top = at_top :=
760802
map_at_top_eq_of_gc (λa, a - k) k
761803
(assume a b h, add_le_add_right h k)

src/order/filter/basic.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,12 @@ lemma forall_sets_nonempty_iff_ne_bot {f : filter α} :
522522
(∀ (s : set α), s ∈ f → s.nonempty) ↔ ne_bot f :=
523523
⟨λ h hf, empty_not_nonempty (h ∅ $ hf.symm ▸ mem_bot_sets), @nonempty_of_mem_sets _ _⟩
524524

525+
lemma nontrivial_iff_nonempty : nontrivial (filter α) ↔ nonempty α :=
526+
⟨λ ⟨⟨f, g, hfg⟩⟩, by_contra $
527+
λ h, hfg $ (filter_eq_bot_of_not_nonempty f h).trans (filter_eq_bot_of_not_nonempty g h).symm,
528+
λ ⟨x⟩, ⟨⟨⊤, ⊥, forall_sets_nonempty_iff_ne_bot.1 $ λ s hs,
529+
by rwa [mem_top_sets.1 hs, ← nonempty_iff_univ_nonempty]⟩⟩⟩
530+
525531
lemma mem_sets_of_eq_bot {f : filter α} {s : set α} (h : f ⊓ 𝓟 sᶜ = ⊥) : s ∈ f :=
526532
have ∅ ∈ f ⊓ 𝓟 sᶜ, from h.symm ▸ mem_bot_sets,
527533
let ⟨s₁, hs₁, s₂, (hs₂ : sᶜ ⊆ s₂), (hs : s₁ ∩ s₂ ⊆ ∅)⟩ := this in

src/order/rel_iso.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ protected lemma bijective (e : r ≃r s) : bijective e := e.to_equiv.bijective
413413
protected lemma injective (e : r ≃r s) : injective e := e.to_equiv.injective
414414
protected lemma surjective (e : r ≃r s) : surjective e := e.to_equiv.surjective
415415

416+
@[simp] lemma range_eq (e : r ≃r s) : set.range e = set.univ := e.surjective.range_eq
417+
416418
/-- Any equivalence lifts to a relation isomorphism between `s` and its preimage. -/
417419
protected def preimage (f : α ≃ β) (s : β → β → Prop) : f ⁻¹'o s ≃r s := ⟨f, λ a b, iff.rfl⟩
418420

@@ -502,6 +504,8 @@ protected lemma bijective (e : α ≃o β) : bijective e := e.to_equiv.bijective
502504
protected lemma injective (e : α ≃o β) : injective e := e.to_equiv.injective
503505
protected lemma surjective (e : α ≃o β) : surjective e := e.to_equiv.surjective
504506

507+
@[simp] lemma range_eq (e : α ≃o β) : set.range e = set.univ := e.surjective.range_eq
508+
505509
@[simp] lemma apply_eq_iff_eq (e : α ≃o β) {x y : α} : e x = e y ↔ x = y :=
506510
e.to_equiv.apply_eq_iff_eq
507511

0 commit comments

Comments
 (0)