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

Commit ad4aca0

Browse files
committed
feat(topology/local_homeomorph): add is_image, piecewise, and disjoint_union (#6804)
Also add `local_equiv.copy` and `local_homeomorph.replace_equiv` and use them for `local_equiv.disjoint_union` and `local_homeomorph.disjoint_union.
1 parent 50225da commit ad4aca0

File tree

7 files changed

+374
-79
lines changed

7 files changed

+374
-79
lines changed

src/data/equiv/local_equiv.lean

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,24 @@ protected lemma inj_on : inj_on e e.source := e.left_inv_on.inj_on
192192
protected lemma bij_on : bij_on e e.source e.target := e.inv_on.bij_on e.maps_to e.symm_maps_to
193193
protected lemma surj_on : surj_on e e.source e.target := e.bij_on.surj_on
194194

195+
/-- Create a copy of a `local_equiv` providing better definitional equalities. -/
196+
@[simps] def copy (e : local_equiv α β) (f : α → β) (hf : ⇑e = f) (g : β → α) (hg : ⇑e.symm = g)
197+
(s : set α) (hs : e.source = s) (t : set β) (ht : e.target = t) :
198+
local_equiv α β :=
199+
{ to_fun := f,
200+
inv_fun := g,
201+
source := s,
202+
target := t,
203+
map_source' := λ x, ht ▸ hs ▸ hf ▸ e.map_source,
204+
map_target' := λ y, hs ▸ ht ▸ hg ▸ e.map_target,
205+
left_inv' := λ x, hs ▸ hf ▸ hg ▸ e.left_inv,
206+
right_inv' := λ x, ht ▸ hf ▸ hg ▸ e.right_inv }
207+
208+
lemma copy_eq_self (e : local_equiv α β) (f : α → β) (hf : ⇑e = f) (g : β → α) (hg : ⇑e.symm = g)
209+
(s : set α) (hs : e.source = s) (t : set β) (ht : e.target = t) :
210+
e.copy f hf g hg s hs t ht = e :=
211+
by { substs f g s t, cases e, refl }
212+
195213
/-- Associating to a local_equiv an equiv between the source and the target -/
196214
protected def to_equiv : equiv (e.source) (e.target) :=
197215
{ to_fun := λ x, ⟨e x, e.map_source x.mem⟩,
@@ -292,10 +310,33 @@ begin
292310
e'.left_inv he] }
293311
end
294312

313+
lemma inter_eq_of_inter_eq_of_eq_on {e' : local_equiv α β} (h : e.is_image s t)
314+
(h' : e'.is_image s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : eq_on e e' (e.source ∩ s)) :
315+
e.target ∩ t = e'.target ∩ t :=
316+
by rw [← h.image_eq, ← h'.image_eq, ← hs, Heq.image_eq]
317+
318+
lemma symm_eq_on_of_inter_eq_of_eq_on {e' : local_equiv α β} (h : e.is_image s t)
319+
(hs : e.source ∩ s = e'.source ∩ s) (Heq : eq_on e e' (e.source ∩ s)) :
320+
eq_on e.symm e'.symm (e.target ∩ t) :=
321+
begin
322+
rw [← h.image_eq],
323+
rintros y ⟨x, hx, rfl⟩,
324+
have hx' := hx, rw hs at hx',
325+
rw [e.left_inv hx.1, Heq hx, e'.left_inv hx'.1]
326+
end
327+
295328
end is_image
296329

297330
lemma is_image_source_target : e.is_image e.source e.target := λ x hx, by simp [hx]
298331

332+
lemma is_image_source_target_of_disjoint (e' : local_equiv α β) (hs : disjoint e.source e'.source)
333+
(ht : disjoint e.target e'.target) :
334+
e.is_image e'.source e'.target :=
335+
assume x hx,
336+
have x ∉ e'.source, from λ hx', hs ⟨hx, hx'⟩,
337+
have e x ∉ e'.target, from λ hx', ht ⟨e.maps_to hx, hx'⟩,
338+
by simp only *
339+
299340
lemma image_source_inter_eq' (s : set α) :
300341
e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s :=
301342
by rw [inter_comm, e.left_inv_on.image_inter', image_source_eq_target, inter_comm]
@@ -353,7 +394,7 @@ end
353394

354395
/-- Restricting a local equivalence to e.source ∩ s -/
355396
protected def restr (s : set α) : local_equiv α β :=
356-
(@is_image.of_symm_preimage_eq α β e s _ rfl).restr
397+
(@is_image.of_symm_preimage_eq α β e s (e.symm ⁻¹' s) rfl).restr
357398

358399
@[simp, mfld_simps] lemma restr_coe (s : set α) : (e.restr s : α → β) = e := rfl
359400
@[simp, mfld_simps] lemma restr_coe_symm (s : set α) : ((e.restr s).symm : β → α) = e.symm := rfl
@@ -626,38 +667,23 @@ lemma symm_piecewise (e e' : local_equiv α β) {s : set α} {t : set β}
626667
(e.piecewise e' s t H H').symm = e.symm.piecewise e'.symm t s H.symm H'.symm :=
627668
rfl
628669

629-
/-- Combine two `local_equiv`s with disjoint sources and disjoint targets. We do not reuse
630-
`local_equiv.piecewise` here to provide better formulas for `source` and `target`. -/
670+
/-- Combine two `local_equiv`s with disjoint sources and disjoint targets. We reuse
671+
`local_equiv.piecewise`, then override `source` and `target` to ensure better definitional
672+
equalities. -/
631673
@[simps] def disjoint_union (e e' : local_equiv α β) (hs : disjoint e.source e'.source)
632674
(ht : disjoint e.target e'.target) [∀ x, decidable (x ∈ e.source)]
633675
[∀ y, decidable (y ∈ e.target)] :
634676
local_equiv α β :=
635-
{ to_fun := e.source.piecewise e e',
636-
inv_fun := e.target.piecewise e.symm e'.symm,
637-
source := e.source ∪ e'.source,
638-
target := e.target ∪ e'.target,
639-
map_source' := λ x,
640-
have x ∈ e'.source → x ∉ e.source, from λ h' h, hs ⟨h, h'⟩,
641-
by rintro (he|he'); simp *,
642-
map_target' := λ y,
643-
have y ∈ e'.target → y ∉ e.target, from λ h' h, ht ⟨h, h'⟩,
644-
by rintro (he|he'); simp *,
645-
left_inv' := λ x,
646-
begin
647-
rintro (he|he'),
648-
{ simp * },
649-
{ have : x ∉ e.source ∧ e' x ∉ e.target,
650-
from ⟨λ h, hs ⟨h, he'⟩, λ h, ht ⟨h, e'.map_source he'⟩⟩,
651-
simp * }
652-
end,
653-
right_inv' := λ y,
654-
begin
655-
rintro (he|he'),
656-
{ simp * },
657-
{ have : y ∉ e.target ∧ e'.symm y ∉ e.source,
658-
from ⟨λ h, ht ⟨h, he'⟩, λ h, hs ⟨h, e'.map_target he'⟩⟩,
659-
simp * }
660-
end }
677+
(e.piecewise e' e.source e.target e.is_image_source_target $
678+
e'.is_image_source_target_of_disjoint _ hs.symm ht.symm).copy
679+
_ rfl _ rfl (e.source ∪ e'.source) (ite_left _ _) (e.target ∪ e'.target) (ite_left _ _)
680+
681+
lemma disjoint_union_eq_piecewise (e e' : local_equiv α β) (hs : disjoint e.source e'.source)
682+
(ht : disjoint e.target e'.target) [∀ x, decidable (x ∈ e.source)]
683+
[∀ y, decidable (y ∈ e.target)] :
684+
e.disjoint_union e' hs ht = e.piecewise e' e.source e.target e.is_image_source_target
685+
(e'.is_image_source_target_of_disjoint _ hs.symm ht.symm) :=
686+
copy_eq_self _ _ _ _ _ _ _ _ _
661687

662688
section pi
663689

src/data/set/basic.lean

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,10 +960,10 @@ lemma insert_diff_self_of_not_mem {a : α} {s : set α} (h : a ∉ s) :
960960
insert a s \ {a} = s :=
961961
by { ext, simp [and_iff_left_of_imp (λ hx : x ∈ s, show x ≠ a, from λ hxa, h $ hxa ▸ hx)] }
962962

963-
theorem union_diff_self {s t : set α} : s ∪ (t \ s) = s ∪ t :=
963+
@[simp] theorem union_diff_self {s t : set α} : s ∪ (t \ s) = s ∪ t :=
964964
by finish [ext_iff, iff_def]
965965

966-
theorem diff_union_self {s t : set α} : (s \ t) ∪ t = s ∪ t :=
966+
@[simp] theorem diff_union_self {s t : set α} : (s \ t) ∪ t = s ∪ t :=
967967
by rw [union_comm, union_diff_self, union_comm]
968968

969969
theorem diff_inter_self {a b : set α} : (b \ a) ∩ a = ∅ :=
@@ -1043,6 +1043,10 @@ ite_inter_compl_self t s s'
10431043

10441044
@[simp] lemma ite_same (t s : set α) : t.ite s s = s := inter_union_diff _ _
10451045

1046+
@[simp] lemma ite_left (s t : set α) : s.ite s t = s ∪ t := by simp [set.ite]
1047+
1048+
@[simp] lemma ite_right (s t : set α) : s.ite t s = t ∩ s := by simp [set.ite]
1049+
10461050
@[simp] lemma ite_empty (s s' : set α) : set.ite ∅ s s' = s' :=
10471051
by simp [set.ite]
10481052

@@ -1073,6 +1077,17 @@ lemma ite_inter (t s₁ s₂ s : set α) :
10731077
t.ite (s₁ ∩ s) (s₂ ∩ s) = t.ite s₁ s₂ ∩ s :=
10741078
by rw [ite_inter_inter, ite_same]
10751079

1080+
lemma ite_inter_of_inter_eq (t : set α) {s₁ s₂ s : set α} (h : s₁ ∩ s = s₂ ∩ s) :
1081+
t.ite s₁ s₂ ∩ s = s₁ ∩ s :=
1082+
by rw [← ite_inter, ← h, ite_same]
1083+
1084+
lemma subset_ite {t s s' u : set α} : u ⊆ t.ite s s' ↔ u ∩ t ⊆ s ∧ u \ t ⊆ s' :=
1085+
begin
1086+
simp only [subset_def, ← forall_and_distrib],
1087+
refine forall_congr (λ x, _),
1088+
by_cases hx : x ∈ t; simp [*, set.ite]
1089+
end
1090+
10761091
/-! ### Inverse image -/
10771092

10781093
/-- The preimage of `s : set β` by `f : α → β`, written `f ⁻¹' s`,
@@ -1107,6 +1122,10 @@ theorem subset_preimage_univ {s : set α} : s ⊆ f ⁻¹' univ := subset_univ _
11071122
@[simp] theorem preimage_diff (f : α → β) (s t : set β) :
11081123
f ⁻¹' (s \ t) = f ⁻¹' s \ f ⁻¹' t := rfl
11091124

1125+
@[simp] theorem preimage_ite (f : α → β) (s t₁ t₂ : set β) :
1126+
f ⁻¹' (s.ite t₁ t₂) = (f ⁻¹' s).ite (f ⁻¹' t₁) (f ⁻¹' t₂) :=
1127+
rfl
1128+
11101129
@[simp] theorem preimage_set_of_eq {p : α → Prop} {f : β → α} : f ⁻¹' {a | p a} = {a | p (f a)} :=
11111130
rfl
11121131

src/data/set/function.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ variables {s s₁ s₂ : set α} {t t₁ t₂ : set β} {p : set γ} {f f₁ f
7373
@[reducible] def eq_on (f₁ f₂ : α → β) (s : set α) : Prop :=
7474
∀ ⦃x⦄, x ∈ s → f₁ x = f₂ x
7575

76+
@[simp] lemma eq_on_empty (f₁ f₂ : α → β) : eq_on f₁ f₂ ∅ := λ x, false.elim
77+
7678
@[symm] lemma eq_on.symm (h : eq_on f₁ f₂ s) : eq_on f₂ f₁ s :=
7779
λ x hx, (h hx).symm
7880

@@ -649,12 +651,10 @@ begin
649651
end
650652

651653
@[simp, priority 990]
652-
lemma piecewise_eq_of_mem {i : α} (hi : i ∈ s) : s.piecewise f g i = f i :=
653-
by simp [piecewise, hi]
654+
lemma piecewise_eq_of_mem {i : α} (hi : i ∈ s) : s.piecewise f g i = f i := if_pos hi
654655

655656
@[simp, priority 990]
656-
lemma piecewise_eq_of_not_mem {i : α} (hi : i ∉ s) : s.piecewise f g i = g i :=
657-
by simp [piecewise, hi]
657+
lemma piecewise_eq_of_not_mem {i : α} (hi : i ∉ s) : s.piecewise f g i = g i := if_neg hi
658658

659659
lemma piecewise_singleton (x : α) [Π y, decidable (y ∈ ({x} : set α))] [decidable_eq α]
660660
(f g : α → β) : piecewise {x} f g = function.update g x (f x) :=

src/geometry/manifold/charted_space.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ begin
433433
rintros e ⟨s, hs, hes⟩,
434434
refine G.eq_on_source _ hes,
435435
convert closed_under_restriction' G.id_mem hs,
436+
change s = _ ∩ _,
436437
rw hs.interior_eq,
437438
simp only with mfld_simps },
438439
{ intros h,

src/topology/basic.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ lemma frontier_eq_closure_inter_closure {s : set α} :
438438
frontier s = closure s ∩ closure sᶜ :=
439439
by rw [closure_compl, frontier, diff_eq]
440440

441+
lemma frontier_subset_closure {s : set α} : frontier s ⊆ closure s := diff_subset _ _
442+
441443
/-- The complement of a set has the same frontier as the original set. -/
442444
@[simp] lemma frontier_compl (s : set α) : frontier sᶜ = frontier s :=
443445
by simp only [frontier_eq_closure_inter_closure, compl_compl, inter_comm]
@@ -467,6 +469,9 @@ by rw [frontier, hs.closure_eq]
467469
lemma is_open.frontier_eq {s : set α} (hs : is_open s) : frontier s = closure s \ s :=
468470
by rw [frontier, hs.interior_eq]
469471

472+
lemma is_open.inter_frontier_eq {s : set α} (hs : is_open s) : s ∩ frontier s = ∅ :=
473+
by rw [hs.frontier_eq, inter_diff_self]
474+
470475
/-- The frontier of a set is closed. -/
471476
lemma is_closed_frontier {s : set α} : is_closed (frontier s) :=
472477
by rw frontier_eq_closure_inter_closure; exact is_closed_inter is_closed_closure is_closed_closure
@@ -488,6 +493,15 @@ lemma closure_eq_interior_union_frontier (s : set α) : closure s = interior s
488493
lemma closure_eq_self_union_frontier (s : set α) : closure s = s ∪ frontier s :=
489494
(union_diff_cancel' interior_subset subset_closure).symm
490495

496+
lemma is_open.inter_frontier_eq_empty_of_disjoint {s t : set α} (ht : is_open t)
497+
(hd : disjoint s t) :
498+
t ∩ frontier s = ∅ :=
499+
begin
500+
rw [inter_comm, ← subset_compl_iff_disjoint],
501+
exact subset.trans frontier_subset_closure (closure_minimal (λ _, disjoint_left.1 hd)
502+
(is_closed_compl_iff.2 ht))
503+
end
504+
491505
/-!
492506
### Neighborhoods
493507
-/

src/topology/continuous_on.lean

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,35 @@ lemma is_open.ite {s s' t : set α} (hs : is_open s) (hs' : is_open s')
926926
is_open (t.ite s s') :=
927927
hs.ite' hs' $ λ x hx, by simpa [hx] using ext_iff.1 ht x
928928

929+
lemma ite_inter_closure_eq_of_inter_frontier_eq {s s' t : set α}
930+
(ht : s ∩ frontier t = s' ∩ frontier t) :
931+
t.ite s s' ∩ closure t = s ∩ closure t :=
932+
by rw [closure_eq_self_union_frontier, inter_union_distrib_left, inter_union_distrib_left,
933+
ite_inter_self, ite_inter_of_inter_eq _ ht]
934+
935+
lemma ite_inter_closure_compl_eq_of_inter_frontier_eq {s s' t : set α}
936+
(ht : s ∩ frontier t = s' ∩ frontier t) :
937+
t.ite s s' ∩ closure tᶜ = s' ∩ closure tᶜ :=
938+
by { rw [← ite_compl, ite_inter_closure_eq_of_inter_frontier_eq], rwa [frontier_compl, eq_comm] }
939+
940+
lemma continuous_on_piecewise_ite' {s s' t : set α} {f f' : α → β} [∀ x, decidable (x ∈ t)]
941+
(h : continuous_on f (s ∩ closure t)) (h' : continuous_on f' (s' ∩ closure tᶜ))
942+
(H : s ∩ frontier t = s' ∩ frontier t) (Heq : eq_on f f' (s ∩ frontier t)) :
943+
continuous_on (t.piecewise f f') (t.ite s s') :=
944+
begin
945+
apply continuous_on.piecewise,
946+
{ rwa ite_inter_of_inter_eq _ H },
947+
{ rwa ite_inter_closure_eq_of_inter_frontier_eq H },
948+
{ rwa ite_inter_closure_compl_eq_of_inter_frontier_eq H }
949+
end
950+
951+
lemma continuous_on_piecewise_ite {s s' t : set α} {f f' : α → β} [∀ x, decidable (x ∈ t)]
952+
(h : continuous_on f s) (h' : continuous_on f' s')
953+
(H : s ∩ frontier t = s' ∩ frontier t) (Heq : eq_on f f' (s ∩ frontier t)) :
954+
continuous_on (t.piecewise f f') (t.ite s s') :=
955+
continuous_on_piecewise_ite' (h.mono (inter_subset_left _ _)) (h'.mono (inter_subset_left _ _))
956+
H Heq
957+
929958
lemma continuous_on_fst {s : set (α × β)} : continuous_on prod.fst s :=
930959
continuous_fst.continuous_on
931960

0 commit comments

Comments
 (0)