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

Commit ddeefb8

Browse files
committed
feat(topology/topological_structures,ennreal): show continuity of of_ennreal and of_real
1 parent 32f3f45 commit ddeefb8

File tree

6 files changed

+242
-39
lines changed

6 files changed

+242
-39
lines changed

data/set/basic.lean

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,18 @@ by finish [set_eq_def, iff_def, mem_image_eq]
543543
theorem image_empty (f : α → β) : f '' ∅ = ∅ :=
544544
by finish [set_eq_def, mem_image_eq]
545545

546-
lemma image_inter {f : α → β} {s t : set α} (h : ∀ x y, f x = f y → x = y) :
546+
lemma image_inter_on {f : α → β} {s t : set α} (h : ∀x∈t, ∀y∈s, f x = f y → x = y) :
547547
f '' s ∩ f '' t = f '' (s ∩ t) :=
548548
subset.antisymm
549549
(assume b ⟨⟨a₁, ha₁, h₁⟩, ⟨a₂, ha₂, h₂⟩⟩,
550-
have a₂ = a₁, from h a₂ a₁ $ h₁.symm ▸ h₂.symm ▸ rfl,
550+
have a₂ = a₁, from h _ ha₂ _ ha₁ (by simp *),
551551
⟨a₁, ⟨ha₁, this ▸ ha₂⟩, h₁⟩)
552552
(subset_inter (mono_image $ inter_subset_left _ _) (mono_image $ inter_subset_right _ _))
553553

554+
lemma image_inter {f : α → β} {s t : set α} (h : ∀ x y, f x = f y → x = y) :
555+
f '' s ∩ f '' t = f '' (s ∩ t) :=
556+
image_inter_on (assume x _ y _, h x y)
557+
554558
@[simp] lemma image_singleton {f : α → β} {a : α} : f '' {a} = {f a} :=
555559
set.ext $ λ x, by simp [image]; rw eq_comm
556560

@@ -664,7 +668,7 @@ This function is more flexiable as `f '' univ`, as the image requires that the d
664668
and not an arbitrary Sort. -/
665669
def range (f : ι → α) : set α := {x | ∃y, f y = x}
666670

667-
lemma mem_range {i : ι} : f i ∈ range f := ⟨i, rfl⟩
671+
lemma mem_range {i : ι} : f i ∈ range f := ⟨i, rfl⟩
668672

669673
lemma forall_range_iff {p : α → Prop} : (∀a∈range f, p a) ↔ (∀i, p (f i)) :=
670674
⟨assume h i, h (f i) mem_range, assume h a ⟨i, (hi : f i = a)⟩, hi ▸ h i⟩

order/filter.lean

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ f.upwards_sets hs $ assume x hx, ⟨x, hx, rfl⟩
454454

455455
@[simp] lemma map_id : filter.map id f = f :=
456456
filter_eq $ rfl
457-
457+
458458
@[simp] lemma map_compose : filter.map m' ∘ filter.map m = filter.map (m' ∘ m) :=
459459
funext $ assume _, filter_eq $ rfl
460460

@@ -537,6 +537,23 @@ le_antisymm
537537
(assume s ⟨t, (h₁ : preimage m t ∈ f.sets), (h₂ : preimage m t ⊆ s)⟩,
538538
f.upwards_sets h₁ h₂)
539539

540+
lemma le_of_map_le_map_inj' {f g : filter α} {m : α → β} {s : set α}
541+
(hsf : s ∈ f.sets) (hsg : s ∈ g.sets) (hm : ∀x∈s, ∀y∈s, m x = m y → x = y)
542+
(h : map m f ≤ map m g) : f ≤ g :=
543+
assume t ht,
544+
have m ⁻¹' (m '' (s ∩ t)) ∈ f.sets, from h $ image_mem_map (inter_mem_sets hsg ht),
545+
f.upwards_sets (inter_mem_sets hsf this) $
546+
assume a ⟨has, b, ⟨hbs, hb⟩, h⟩,
547+
have b = a, from hm _ hbs _ has h,
548+
this ▸ hb
549+
550+
lemma eq_of_map_eq_map_inj' {f g : filter α} {m : α → β} {s : set α}
551+
(hsf : s ∈ f.sets) (hsg : s ∈ g.sets) (hm : ∀x∈s, ∀y∈s, m x = m y → x = y)
552+
(h : map m f = map m g) : f = g :=
553+
le_antisymm
554+
(le_of_map_le_map_inj' hsf hsg hm $ le_of_eq h)
555+
(le_of_map_le_map_inj' hsg hsf hm $ le_of_eq h.symm)
556+
540557
lemma map_inj {f g : filter α} {m : α → β} (hm : ∀ x y, m x = m y → x = y) (h : map m f = map m g) :
541558
f = g :=
542559
have vmap m (map m f) = vmap m (map m g), by rw h,
@@ -596,30 +613,43 @@ le_antisymm
596613
from infi_le_of_le i $ by simp; assumption,
597614
by simp at this; assumption)
598615

599-
lemma map_binfi_eq {ι : Type w} {f : ι → filter α} {m : α → β} {s : set ι}
600-
(h : directed_on (λx y, f x ≤ f y) s) (ne : ∃i, i ∈ s) : map m (⨅i∈s, f i) = (⨅i∈s, map m (f i)) :=
616+
lemma map_binfi_eq {ι : Type w} {f : ι → filter α} {m : α → β} {p : ι → Prop}
617+
(h : directed_on (λx y, f x ≤ f y) {x | p x}) (ne : ∃i, p i) :
618+
map m (⨅i (h : p i), f i) = (⨅i (h: p i), map m (f i)) :=
601619
let ⟨i, hi⟩ := ne in
602-
calc map m (⨅i∈s, f i) = map m (⨅i:{i // i ∈ s}, f i.val) : by simp [infi_subtype]
603-
... = (⨅i:{i // i ∈ s}, map m (f i.val)) : map_infi_eq
620+
calc map m (⨅i (h : p i), f i) = map m (⨅i:subtype p, f i.val) : by simp [infi_subtype]
621+
... = (⨅i:subtype p, map m (f i.val)) : map_infi_eq
604622
(assume ⟨x, hx⟩ ⟨y, hy⟩, match h x hx y hy with ⟨z, h₁, h₂, h₃⟩ := ⟨⟨z, h₁⟩, h₂, h₃⟩ end)
605623
⟨⟨i, hi⟩⟩
606-
... = (⨅i∈s, map m (f i)) : by simp [infi_subtype]
624+
... = (⨅i (h : p i), map m (f i)) : by simp [infi_subtype]
607625

608-
lemma map_inf {f g : filter α} {m : α → β} (h : ∀ x y, m x = m y → x = y) :
609-
map m (f ⊓ g) = map m f ⊓ map m g :=
626+
lemma map_inf' {f g : filter α} {m : α → β} {t : set α} (htf : t ∈ f.sets) (htg : t ∈ g.sets)
627+
(h : ∀x∈t, ∀y∈t, m x = m y → x = y) : map m (f ⊓ g) = map m f ⊓ map m g :=
610628
le_antisymm
611629
(le_inf (map_mono inf_le_left) (map_mono inf_le_right))
612630
(assume s hs,
613631
begin
614632
simp [map, mem_inf_sets] at hs,
615633
simp [map, mem_inf_sets],
616634
exact (let ⟨t₁, h₁, t₂, h₂, hs⟩ := hs in
617-
⟨m '' t₁, f.upwards_sets h₁ $ image_subset_iff_subset_preimage.mp $ subset.refl _,
618-
m '' t₂,
619-
by rwa [set.image_inter h, image_subset_iff_subset_preimage],
620-
g.upwards_sets h₂ $ image_subset_iff_subset_preimage.mp $ subset.refl _⟩)
635+
have m '' (t₁ ∩ t) ∩ m '' (t₂ ∩ t) ⊆ s,
636+
begin
637+
rw [image_inter_on],
638+
apply image_subset_iff_subset_preimage.mpr _,
639+
exact assume x ⟨⟨h₁, _⟩, h₂, _⟩, hs ⟨h₁, h₂⟩,
640+
exact assume x ⟨_, hx⟩ y ⟨_, hy⟩, h x hx y hy
641+
end,
642+
⟨m '' (t₁ ∩ t),
643+
f.upwards_sets (inter_mem_sets h₁ htf) $ image_subset_iff_subset_preimage.mp $ subset.refl _,
644+
m '' (t₂ ∩ t),
645+
this,
646+
g.upwards_sets (inter_mem_sets h₂ htg) $ image_subset_iff_subset_preimage.mp $ subset.refl _⟩)
621647
end)
622648

649+
lemma map_inf {f g : filter α} {m : α → β} (h : ∀ x y, m x = m y → x = y) :
650+
map m (f ⊓ g) = map m f ⊓ map m g :=
651+
map_inf' univ_mem_sets univ_mem_sets (assume x _ y _, h x y)
652+
623653
/- bind equations -/
624654

625655
lemma mem_bind_sets {β : Type u} {s : set β} {f : filter α} {m : α → filter β} :
@@ -734,6 +764,10 @@ lemma tendsto_infi' {f : α → β} {x : ι → filter α} {y : filter β} (i :
734764
(h : tendsto f (x i) y) : tendsto f (⨅i, x i) y :=
735765
le_trans (map_mono $ infi_le _ _) h
736766

767+
lemma tendsto_principal {f : α → β} {a : filter α} {s : set β}
768+
(h : {a | f a ∈ s} ∈ a.sets) : tendsto f a (principal s) :=
769+
by simp [tendsto]; exact h
770+
737771
lemma tendsto_principal_principal {f : α → β} {s : set α} {t : set β}
738772
(h : ∀a∈s, f a ∈ t) : tendsto f (principal s) (principal t) :=
739773
by simp [tendsto, image_subset_iff_subset_preimage]; exact h

order/lattice.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ theorem eq_top_iff : a = ⊤ ↔ ⊤ ≤ a :=
6060
@[simp] theorem top_le_iff : ⊤ ≤ a ↔ a = ⊤ :=
6161
⟨top_unique, λ h, h.symm ▸ le_refl ⊤⟩
6262

63+
@[simp] theorem not_top_lt : ¬ ⊤ < a :=
64+
assume h, lt_irrefl a (lt_of_le_of_lt le_top h)
65+
6366
end order_top
6467

6568
class order_bot (α : Type u) extends has_bot α, partial_order α :=
@@ -80,6 +83,9 @@ theorem eq_bot_iff : a = ⊥ ↔ a ≤ ⊥ :=
8083
@[simp] theorem le_bot_iff : a ≤ ⊥ ↔ a = ⊥ :=
8184
⟨bot_unique, assume h, h.symm ▸ le_refl ⊥⟩
8285

86+
@[simp] theorem not_lt_bot : ¬ a < ⊥ :=
87+
assume h, lt_irrefl a (lt_of_lt_of_le h bot_le)
88+
8389
theorem neq_bot_of_le_neq_bot {a b : α} (hb : b ≠ ⊥) (hab : b ≤ a) : a ≠ ⊥ :=
8490
assume ha, hb $ bot_unique $ ha ▸ hab
8591

topology/ennreal.lean

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ universe u
1515
lemma zero_le_mul {α : Type u} [ordered_semiring α] {a b : α} : 0 ≤ a → 0 ≤ b → 0 ≤ a * b :=
1616
mul_nonneg
1717

18+
instance linear_ordered_semiring.to_top_order {α : Type*} [linear_ordered_semiring α] :
19+
no_top_order α :=
20+
⟨assume a, ⟨a + 1, lt_add_of_pos_right _ zero_lt_one⟩⟩
21+
22+
instance linear_ordered_semiring.to_bot_order {α : Type*} [linear_ordered_ring α] :
23+
no_bot_order α :=
24+
⟨assume a, ⟨a - 1, sub_lt_iff.mpr $ lt_add_of_pos_right _ zero_lt_one⟩⟩
25+
1826
lemma inv_pos {α : Type*} [linear_ordered_field α] {r : α} : 0 < r → 0 < r⁻¹ :=
1927
by rw [inv_eq_one_div]; exact div_pos_of_pos_of_pos zero_lt_one
2028

@@ -523,35 +531,80 @@ instance : t2_space ennreal := by apply_instance
523531
lemma continuous_of_real : continuous of_real :=
524532
have ∀x:ennreal, is_open {a : ℝ | x < of_real a},
525533
from forall_ennreal.mpr ⟨assume r hr,
526-
begin
527-
simp [of_real_lt_of_real_iff_cases],
528-
exact is_open_and
529-
(is_open_lt continuous_const continuous_id)
530-
(is_open_lt continuous_const continuous_id)
531-
end,
534+
by simp [of_real_lt_of_real_iff_cases]; exact is_open_and (is_open_lt' r) (is_open_lt' 0),
532535
by simp⟩,
533536
have ∀x:ennreal, is_open {a : ℝ | of_real a < x},
534537
from forall_ennreal.mpr ⟨assume r hr,
535-
begin
536-
simp [of_real_lt_of_real_iff_cases],
537-
exact is_open_and (is_open_lt continuous_id continuous_const) is_open_const
538-
end,
538+
by simp [of_real_lt_of_real_iff_cases]; exact is_open_and (is_open_gt' r) is_open_const,
539539
by simp [is_open_const]⟩,
540540
continuous_generated_from $ begin simp [or_imp_distrib, *] {contextual := tt} end
541541

542-
/- TODO:
542+
lemma tendsto_of_real : tendsto of_real (nhds r) (nhds (of_real r)) :=
543+
continuous_iff_tendsto.mp continuous_of_real r
544+
545+
lemma tendsto_of_ennreal (hr : 0 ≤ r) : tendsto of_ennreal (nhds (of_real r)) (nhds r) :=
546+
tendsto_orderable_unbounded (no_top _) (no_bot _) $
547+
assume l u hl hu,
548+
by_cases
549+
(assume hr : r = 0,
550+
have hl : l < 0, by rw [hr] at hl; exact hl,
551+
have hu : 0 < u, by rw [hr] at hu; exact hu,
552+
have nhds (of_real r) = (⨅l (h₂ : 0 < l), principal {x | x < l}),
553+
from calc nhds (of_real r) = nhds ⊥ : by simp [hr]; refl
554+
... = (⨅u (h₂ : 0 < u), principal {x | x < u}) : nhds_bot_orderable,
555+
have {x | x < of_real u} ∈ (nhds (of_real r)).sets,
556+
by rw [this];
557+
from mem_infi_sets (of_real u) (mem_infi_sets (by simp *) (subset.refl _)),
558+
((nhds (of_real r)).upwards_sets this $ forall_ennreal.mpr $
559+
by simp [le_of_lt, hu, hl] {contextual := tt}; exact assume p hp _, lt_of_lt_of_le hl hp))
560+
(assume hr_ne : r ≠ 0,
561+
have hu0 : 0 < u, from lt_of_le_of_lt hr hu,
562+
have hu_nn: 0 ≤ u, from le_of_lt hu0,
563+
have hr' : 0 < r, from lt_of_le_of_ne hr hr_ne.symm,
564+
have hl' : ∃l, l < of_real r, from0, by simp [hr, hr']⟩,
565+
have hu' : ∃u, of_real r < u, from ⟨of_real u, by simp [hr, hu_nn, hu]⟩,
566+
begin
567+
rw [mem_nhds_lattice_unbounded hu' hl'],
568+
existsi (of_real l), existsi (of_real u),
569+
simp [*, of_real_lt_of_real_iff_cases, forall_ennreal] {contextual := tt}
570+
end)
571+
543572
lemma nhds_of_real_eq_map_of_real_nhds {r : ℝ} (hr : 0 ≤ r) :
544-
nhds (of_real r) = (nhds r ⊓ principal {x | 0 ≤ x}).map of_real :=
573+
nhds (of_real r) = (nhds r).map of_real :=
574+
have h₁ : {x | x < ∞} ∈ (nhds (of_real r)).sets,
575+
from mem_nhds_sets (is_open_gt' ∞) of_real_lt_infty,
576+
have h₂ : {x | x < ∞} ∈ ((nhds r).map of_real).sets,
577+
from mem_map.mpr $ univ_mem_sets' $ assume a, of_real_lt_infty,
578+
have h : ∀x<∞, ∀y<∞, of_ennreal x = of_ennreal y → x = y,
579+
by simp [forall_ennreal] {contextual:=tt},
545580
le_antisymm
546-
_
547-
_
548-
581+
(by_cases
582+
(assume (hr : r = 0) s (hs : {x | of_real x ∈ s} ∈ (nhds r).sets),
583+
have hs : {x | of_real x ∈ s} ∈ (nhds (0:ℝ)).sets, from hr ▸ hs,
584+
let ⟨l, u, hl, hu, h⟩ := (mem_nhds_lattice_unbounded (no_top 0) (no_bot 0)).mp hs in
585+
have nhds (of_real r) = nhds ⊥, by simp [hr]; refl,
586+
begin
587+
rw [this, nhds_bot_orderable],
588+
apply mem_infi_sets (of_real u) _,
589+
apply mem_infi_sets (zero_lt_of_real_iff.mpr hu) _,
590+
simp [set.subset_def],
591+
intro x, rw [lt_iff_exists_of_real],
592+
simp [le_of_lt hu] {contextual := tt},
593+
exact assume p _ hp hpu, h _ (lt_of_lt_of_le hl hp) hpu
594+
end)
595+
(assume : r ≠ 0,
596+
have hr' : 0 < r, from lt_of_le_of_ne hr this.symm,
597+
have h' : map (of_ennreal ∘ of_real) (nhds r) = map id (nhds r),
598+
from map_cong $ (nhds r).upwards_sets (mem_nhds_sets (is_open_lt' 0) hr') $
599+
assume r hr, by simp [le_of_lt hr, (∘)],
600+
le_of_map_le_map_inj' h₁ h₂ h $ le_trans (tendsto_of_ennreal hr) $ by simp [h']))
601+
tendsto_of_real
602+
603+
/- TODO
549604
instance : topological_add_monoid ennreal :=
550605
have ∀a₁ a₂ : ennreal, tendsto (λp:ennreal×ennreal, p.1 + p.2) (nhds (a₁, a₂)) (nhds (a₁ + a₂)),
551606
from forall_ennreal.mpr ⟨_, _⟩,
552-
⟨continuous_iff_tendsto.mpr $
553-
assume ⟨a₁, a₂⟩,
554-
begin simp [nhds_prod_eq] end⟩
607+
⟨continuous_iff_tendsto.mpr _⟩
555608
-/
556609

557610
end topological_space

topology/topological_space.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ lemma is_closed_imp [topological_space α] {p q : α → Prop}
117117
have {x | p x → q x} = (- {x | p x}) ∪ {x | q x}, from set.ext $ by finish,
118118
by rw [this]; exact is_closed_union (is_closed_compl_iff.mpr hp) hq
119119

120+
lemma is_open_neg : is_closed {a | p a} → is_open {a | ¬ p a} :=
121+
is_open_compl_iff.mpr
122+
120123
/- interior -/
121124
def interior (s : set α) : set α := ⋃₀ {t | is_open t ∧ t ⊆ s}
122125

0 commit comments

Comments
 (0)