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

Commit f3835fa

Browse files
urkudmergify[bot]
authored andcommitted
feat(*): assorted simple lemmas, simplify some proofs (#1895)
* feat(*): assorted simple lemmas, simplify some proofs * +1 lemma, +1 simplified proof
1 parent d32c797 commit f3835fa

File tree

10 files changed

+34
-29
lines changed

10 files changed

+34
-29
lines changed

src/data/real/ennreal.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,10 @@ by rw [ennreal.of_real, ennreal.of_real, coe_le_coe, nnreal.of_real_le_of_real_i
870870
@[simp] lemma of_real_lt_of_real_iff {p q : ℝ} (h : 0 < q) : ennreal.of_real p < ennreal.of_real q ↔ p < q :=
871871
by rw [ennreal.of_real, ennreal.of_real, coe_lt_coe, nnreal.of_real_lt_of_real_iff h]
872872

873+
lemma of_real_lt_of_real_iff_of_nonneg {p q : ℝ} (hp : 0 ≤ p) :
874+
ennreal.of_real p < ennreal.of_real q ↔ p < q :=
875+
by rw [ennreal.of_real, ennreal.of_real, coe_lt_coe, nnreal.of_real_lt_of_real_iff_of_nonneg hp]
876+
873877
@[simp] lemma of_real_pos {p : ℝ} : 0 < ennreal.of_real p ↔ 0 < p :=
874878
by simp [ennreal.of_real]
875879

src/data/real/nnreal.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ lemma of_real_lt_of_real_iff {r p : ℝ} (h : 0 < p) :
294294
nnreal.of_real r < nnreal.of_real p ↔ r < p :=
295295
of_real_lt_of_real_iff'.trans (and_iff_left h)
296296

297+
lemma of_real_lt_of_real_iff_of_nonneg {r p : ℝ} (hr : 0 ≤ r) :
298+
nnreal.of_real r < nnreal.of_real p ↔ r < p :=
299+
of_real_lt_of_real_iff'.trans ⟨and.left, λ h, ⟨h, lt_of_le_of_lt hr h⟩⟩
300+
297301
@[simp] lemma of_real_add {r p : ℝ} (hr : 0 ≤ r) (hp : 0 ≤ p) :
298302
nnreal.of_real (r + p) = nnreal.of_real r + nnreal.of_real p :=
299303
nnreal.eq $ by simp [nnreal.of_real, hr, hp, add_nonneg]

src/data/set/basic.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,9 @@ by simp only [eq_empty_iff_forall_not_mem]; exact
990990
lemma inter_singleton_ne_empty {s : set α} {a : α} : s ∩ {a} ≠ ∅ ↔ a ∈ s :=
991991
by finish [set.inter_singleton_eq_empty]
992992

993+
lemma inter_singleton_nonempty {s : set α} {a : α} : (s ∩ {a}).nonempty ↔ a ∈ s :=
994+
ne_empty_iff_nonempty.symm.trans inter_singleton_ne_empty
995+
993996
theorem fix_set_compl (t : set α) : compl t = - t := rfl
994997

995998
-- TODO(Jeremy): there is an issue with - t unfolding to compl t

src/data/set/intervals/basic.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ set.ext $ λ x, and_comm _ _
109109
@[simp] lemma nonempty_Ioo [densely_ordered α] : (Ioo a b).nonempty ↔ a < b :=
110110
⟨λ ⟨x, ha, hb⟩, lt_trans ha hb, dense⟩
111111

112+
@[simp] lemma nonempty_Ioi [no_top_order α] : (Ioi a).nonempty := no_top a
113+
114+
@[simp] lemma nonempty_Iio [no_bot_order α] : (Iio a).nonempty := no_bot a
115+
112116
@[simp] lemma Ioo_eq_empty (h : b ≤ a) : Ioo a b = ∅ :=
113117
eq_empty_iff_forall_not_mem.2 $ λ x ⟨h₁, h₂⟩, not_le_of_lt (lt_trans h₁ h₂) h
114118

src/order/basic.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ theorem directed_mono {s : α → α → Prop} {ι} (f : ι → α)
578578
(H : ∀ a b, r a b → s a b) (h : directed r f) : directed s f :=
579579
λ a b, let ⟨c, h₁, h₂⟩ := h a b in ⟨c, H _ _ h₁, H _ _ h₂⟩
580580

581+
theorem directed.mono_comp {ι} {rb : β → β → Prop} {g : α → β} {f : ι → α}
582+
(hg : ∀ ⦃x y⦄, x ≼ y → rb (g x) (g y)) (hf : directed r f) :
583+
directed rb (g ∘ f) :=
584+
(directed_comp rb f g).2 $ directed_mono _ _ hg hf
585+
581586
section prio
582587
set_option default_priority 100 -- see Note [default priority]
583588
class directed_order (α : Type u) extends preorder α :=

src/order/bounded_lattice.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,10 @@ instance densely_ordered [partial_order α] [densely_ordered α] [no_top_order
716716
⟨a, coe_lt_coe.2 ha₁, coe_lt_coe.2 ha₂⟩
717717
end
718718

719+
lemma dense_coe [partial_order α] [densely_ordered α] [no_top_order α] {a b : with_top α}
720+
(h : a < b) : ∃ x : α, a < ↑x ∧ ↑x < b :=
721+
let ⟨y, hy⟩ := dense h, ⟨x, hx⟩ := (lt_iff_exists_coe _ _).1 hy.2 in ⟨x, hx.1 ▸ hy⟩
722+
719723
end with_top
720724

721725
namespace order_dual

src/order/filter/basic.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ by
407407
simp only [(@empty_in_sets_eq_bot α f).symm, ne.def];
408408
exact ⟨assume h hs, h _ hs rfl, assume h s hs eq, h $ eq ▸ hs⟩
409409

410+
lemma forall_sets_nonempty_iff_ne_bot {f : filter α} :
411+
(∀ (s : set α), s ∈ f → s.nonempty) ↔ f ≠ ⊥ :=
412+
by simpa only [ne_empty_iff_nonempty] using forall_sets_ne_empty_iff_ne_bot
413+
410414
lemma mem_sets_of_eq_bot {f : filter α} {s : set α} (h : f ⊓ principal (-s) = ⊥) : s ∈ f :=
411415
have ∅ ∈ f ⊓ principal (- s), from h.symm ▸ mem_bot_sets,
412416
let ⟨s₁, hs₁, s₂, (hs₂ : -s ⊆ s₂), (hs : s₁ ∩ s₂ ⊆ ∅)⟩ := this in
@@ -455,7 +459,7 @@ by simp only [infi_sets_eq h ne, mem_Union]
455459

456460
@[nolint] -- Intentional use of `≥`
457461
lemma binfi_sets_eq {f : β → filter α} {s : set β}
458-
(h : directed_on (f ⁻¹'o (≥)) s) (ne : ∃i, i ∈ s) :
462+
(h : directed_on (f ⁻¹'o (≥)) s) (ne : s.nonempty) :
459463
(⨅ i∈s, f i).sets = (⋃ i ∈ s, (f i).sets) :=
460464
let ⟨i, hi⟩ := ne in
461465
calc (⨅ i ∈ s, f i).sets = (⨅ t : {t // t ∈ s}, (f t.val)).sets : by rw [infi_subtype]; refl
@@ -466,7 +470,7 @@ calc (⨅ i ∈ s, f i).sets = (⨅ t : {t // t ∈ s}, (f t.val)).sets : by rw
466470

467471
@[nolint] -- Intentional use of `≥`
468472
lemma mem_binfi {f : β → filter α} {s : set β}
469-
(h : directed_on (f ⁻¹'o (≥)) s) (ne : ∃i, i ∈ s) {t : set α} :
473+
(h : directed_on (f ⁻¹'o (≥)) s) (ne : s.nonempty) {t : set α} :
470474
t ∈ (⨅ i∈s, f i) ↔ ∃ i ∈ s, t ∈ f i :=
471475
by simp only [binfi_sets_eq h ne, mem_bUnion_iff]
472476

src/topology/basic.lean

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,7 @@ by rw subset.antisymm subset_closure h; exact is_closed_closure
280280
closure_eq_of_is_closed is_closed_empty
281281

282282
lemma closure_empty_iff (s : set α) : closure s = ∅ ↔ s = ∅ :=
283-
begin
284-
split; intro h,
285-
{ rw set.eq_empty_iff_forall_not_mem,
286-
intros x H,
287-
simpa only [h] using subset_closure H },
288-
{ exact (eq.symm h) ▸ closure_empty },
289-
end
283+
⟨subset_eq_empty subset_closure, λ h, h.symm ▸ closure_empty⟩
290284

291285
@[simp] lemma closure_univ : closure (univ : set α) = univ :=
292286
closure_eq_of_is_closed is_closed_univ

src/topology/continuous_on.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ lemma mem_nhds_within_of_mem_nhds {s t : set α} {a : α} (h : s ∈ 𝓝 a) :
6565
mem_inf_sets_of_left h
6666

6767
theorem self_mem_nhds_within {a : α} {s : set α} : s ∈ nhds_within a s :=
68-
begin
69-
rw [nhds_within, mem_inf_principal],
70-
simp only [imp_self],
71-
exact univ_mem_sets
72-
end
68+
mem_inf_sets_of_right (mem_principal_self s)
7369

7470
theorem inter_mem_nhds_within (s : set α) {t : set α} {a : α} (h : t ∈ 𝓝 a) :
7571
s ∩ t ∈ nhds_within a s :=

src/topology/sequences.lean

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,8 @@ show A = sequential_closure A, from subset.antisymm
7474
/-- The sequential closure of a set is contained in the closure of that set.
7575
The converse is not true. -/
7676
lemma sequential_closure_subset_closure (M : set α) : sequential_closure M ⊆ closure M :=
77-
show ∀ p, p ∈ sequential_closure M → p ∈ closure M, from
78-
assume p,
79-
assume : ∃ x : ℕ → α, (∀ n : ℕ, ((x n) ∈ M)) ∧ (x ⟶ p),
80-
let ⟨x, ⟨_, _⟩⟩ := this in
81-
show p ∈ closure M, from
82-
-- we have to show that p is in the closure of M
83-
-- using mem_closure_iff, this is equivalent to proving that every open neighbourhood
84-
-- has nonempty intersection with M, but this is witnessed by our sequence x
85-
suffices ∀ O, is_open O → p ∈ O → O ∩ M ≠ ∅, from mem_closure_iff.mpr this,
86-
have ∀ (U : set α), p ∈ U → is_open U → (∃ n0, ∀ n, n ≥ n0 → x n ∈ U), by rwa[←topological_space.seq_tendsto_iff],
87-
assume O is_open_O p_in_O,
88-
let ⟨n0, _⟩ := this O ‹p ∈ O› ‹is_open O› in
89-
have (x n0) ∈ O, from ‹∀ n ≥ n0, x n ∈ O› n0 (show n0 ≥ n0, from le_refl n0),
90-
have (x n0) ∈ O ∩ M, fromthis, ‹∀n, x n ∈ M› n0⟩,
91-
set.ne_empty_of_mem this
77+
assume p ⟨x, xM, xp⟩,
78+
mem_closure_of_tendsto at_top_ne_bot xp (univ_mem_sets' xM)
9279

9380
/-- A set is sequentially closed if it is closed. -/
9481
lemma is_seq_closed_of_is_closed (M : set α) (_ : is_closed M) : is_seq_closed M :=

0 commit comments

Comments
 (0)