@@ -156,6 +156,11 @@ protected def symm : local_equiv β α :=
156
156
157
157
instance : has_coe_to_fun (local_equiv α β) := ⟨_, local_equiv.to_fun⟩
158
158
159
+ /-- See Note [custom simps projection] -/
160
+ def simps.inv_fun (e : local_equiv α β) : β → α := e.symm
161
+
162
+ initialize_simps_projections local_equiv (to_fun → apply, inv_fun → symm_apply)
163
+
159
164
@[simp, mfld_simps] theorem coe_mk (f : α → β) (g s t ml mr il ir) :
160
165
(local_equiv.mk f g s t ml mr il ir : α → β) = f := rfl
161
166
@@ -200,6 +205,97 @@ protected def to_equiv : equiv (e.source) (e.target) :=
200
205
201
206
lemma image_source_eq_target : e '' e.source = e.target := e.bij_on.image_eq
202
207
208
+ /-- We say that `t : set β` is an image of `s : set α` under a local equivalence if
209
+ any of the following equivalent conditions hold:
210
+
211
+ * `e '' (e.source ∩ s) = e.target ∩ t`;
212
+ * `e.source ∩ e ⁻¹ t = e.source ∩ s`;
213
+ * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition).
214
+ -/
215
+ def is_image (s : set α) (t : set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s)
216
+
217
+ namespace is_image
218
+
219
+ variables {e} {s : set α} {t : set β} {x : α} {y : β}
220
+
221
+ lemma apply_mem_iff (h : e.is_image s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx
222
+
223
+ lemma symm_apply_mem_iff (h : e.is_image s t) : ∀ ⦃y⦄, y ∈ e.target → (e.symm y ∈ s ↔ y ∈ t) :=
224
+ by { rw [← e.image_source_eq_target, ball_image_iff], intros x hx, rw [e.left_inv hx, h hx] }
225
+
226
+ protected lemma symm (h : e.is_image s t) : e.symm.is_image t s := h.symm_apply_mem_iff
227
+
228
+ @[simp] lemma symm_iff : e.symm.is_image t s ↔ e.is_image s t := ⟨λ h, h.symm, λ h, h.symm⟩
229
+
230
+ protected lemma maps_to (h : e.is_image s t) : maps_to e (e.source ∩ s) (e.target ∩ t) :=
231
+ λ x hx, ⟨e.maps_to hx.1 , (h hx.1 ).2 hx.2 ⟩
232
+
233
+ lemma symm_maps_to (h : e.is_image s t) : maps_to e.symm (e.target ∩ t) (e.source ∩ s) :=
234
+ h.symm.maps_to
235
+
236
+ /-- Restrict a `local_equiv` to a pair of corresponding sets. -/
237
+ @[simps] def restr (h : e.is_image s t) : local_equiv α β :=
238
+ { to_fun := e,
239
+ inv_fun := e.symm,
240
+ source := e.source ∩ s,
241
+ target := e.target ∩ t,
242
+ map_source' := h.maps_to,
243
+ map_target' := h.symm_maps_to,
244
+ left_inv' := e.left_inv_on.mono (inter_subset_left _ _),
245
+ right_inv' := e.right_inv_on.mono (inter_subset_left _ _) }
246
+
247
+ lemma image_eq (h : e.is_image s t) : e '' (e.source ∩ s) = e.target ∩ t :=
248
+ h.restr.image_source_eq_target
249
+
250
+ lemma symm_image_eq (h : e.is_image s t) : e.symm '' (e.target ∩ t) = e.source ∩ s :=
251
+ h.symm.image_eq
252
+
253
+ lemma iff_preimage_eq : e.is_image s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s :=
254
+ by simp only [is_image, set.ext_iff, mem_inter_eq, and.congr_right_iff, mem_preimage]
255
+
256
+ alias iff_preimage_eq ↔ local_equiv.is_image.preimage_eq local_equiv.is_image.of_preimage_eq
257
+
258
+ lemma iff_symm_preimage_eq : e.is_image s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t :=
259
+ symm_iff.symm.trans iff_preimage_eq
260
+
261
+ alias iff_symm_preimage_eq ↔ local_equiv.is_image.symm_preimage_eq
262
+ local_equiv.is_image.of_symm_preimage_eq
263
+
264
+ lemma of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.is_image s t :=
265
+ of_symm_preimage_eq $ eq.trans (of_symm_preimage_eq rfl).image_eq.symm h
266
+
267
+ lemma of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.is_image s t :=
268
+ of_preimage_eq $ eq.trans (of_preimage_eq rfl).symm_image_eq.symm h
269
+
270
+ protected lemma compl (h : e.is_image s t) : e.is_image sᶜ tᶜ :=
271
+ λ x hx, not_congr (h hx)
272
+
273
+ protected lemma inter {s' t'} (h : e.is_image s t) (h' : e.is_image s' t') :
274
+ e.is_image (s ∩ s') (t ∩ t') :=
275
+ λ x hx, and_congr (h hx) (h' hx)
276
+
277
+ protected lemma union {s' t'} (h : e.is_image s t) (h' : e.is_image s' t') :
278
+ e.is_image (s ∪ s') (t ∪ t') :=
279
+ λ x hx, or_congr (h hx) (h' hx)
280
+
281
+ protected lemma diff {s' t'} (h : e.is_image s t) (h' : e.is_image s' t') :
282
+ e.is_image (s \ s') (t \ t') :=
283
+ h.inter h'.compl
284
+
285
+ lemma left_inv_on_piecewise {e' : local_equiv α β} [∀ i, decidable (i ∈ s)] [∀ i, decidable (i ∈ t)]
286
+ (h : e.is_image s t) (h' : e'.is_image s t) :
287
+ left_inv_on (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) :=
288
+ begin
289
+ rintro x (⟨he, hs⟩|⟨he, hs : x ∉ s⟩),
290
+ { rw [piecewise_eq_of_mem _ _ _ hs, piecewise_eq_of_mem _ _ _ ((h he).2 hs), e.left_inv he], },
291
+ { rw [piecewise_eq_of_not_mem _ _ _ hs, piecewise_eq_of_not_mem _ _ _ ((h'.compl he).2 hs),
292
+ e'.left_inv he] }
293
+ end
294
+
295
+ end is_image
296
+
297
+ lemma is_image_source_target : e.is_image e.source e.target := λ x hx, by simp [hx]
298
+
203
299
lemma image_source_inter_eq' (s : set α) :
204
300
e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s :=
205
301
by rw [inter_comm, e.left_inv_on.image_inter', image_source_eq_target, inter_comm]
257
353
258
354
/-- Restricting a local equivalence to e.source ∩ s -/
259
355
protected def restr (s : set α) : local_equiv α β :=
260
- { to_fun := e,
261
- inv_fun := e.symm,
262
- source := e.source ∩ s,
263
- target := e.target ∩ e.symm⁻¹' s,
264
- map_source' := λx hx, begin
265
- simp only with mfld_simps at hx,
266
- simp only [hx] with mfld_simps,
267
- end ,
268
- map_target' := λy hy, begin
269
- simp only with mfld_simps at hy,
270
- simp only [hy] with mfld_simps,
271
- end ,
272
- left_inv' := λx hx, e.left_inv hx.1 ,
273
- right_inv' := λy hy, e.right_inv hy.1 }
356
+ (@is_image.of_symm_preimage_eq α β e s _ rfl).restr
274
357
275
358
@[simp, mfld_simps] lemma restr_coe (s : set α) : (e.restr s : α → β) = e := rfl
276
359
@[simp, mfld_simps] lemma restr_coe_symm (s : set α) : ((e.restr s).symm : β → α) = e.symm := rfl
@@ -520,6 +603,62 @@ by ext x; simp [ext_iff]; tauto
520
603
521
604
end prod
522
605
606
+ /-- Combine two `local_equiv`s using `set.piecewise`. The source of the new `local_equiv` is
607
+ `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function
608
+ sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`,
609
+ and similarly for the inverse function. The definition assumes `e.is_image s t` and
610
+ `e'.is_image s t`. -/
611
+ @[simps] def piecewise (e e' : local_equiv α β) (s : set α) (t : set β)
612
+ [∀ x, decidable (x ∈ s)] [∀ y, decidable (y ∈ t)] (H : e.is_image s t) (H' : e'.is_image s t) :
613
+ local_equiv α β :=
614
+ { to_fun := s.piecewise e e',
615
+ inv_fun := t.piecewise e.symm e'.symm,
616
+ source := s.ite e.source e'.source,
617
+ target := t.ite e.target e'.target,
618
+ map_source' := H.maps_to.piecewise_ite H'.compl.maps_to,
619
+ map_target' := H.symm.maps_to.piecewise_ite H'.symm.compl.maps_to,
620
+ left_inv' := H.left_inv_on_piecewise H',
621
+ right_inv' := H.symm.left_inv_on_piecewise H'.symm }
622
+
623
+ lemma symm_piecewise (e e' : local_equiv α β) {s : set α} {t : set β}
624
+ [∀ x, decidable (x ∈ s)] [∀ y, decidable (y ∈ t)]
625
+ (H : e.is_image s t) (H' : e'.is_image s t) :
626
+ (e.piecewise e' s t H H').symm = e.symm.piecewise e'.symm t s H.symm H'.symm :=
627
+ rfl
628
+
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`. -/
631
+ @[simps] def disjoint_union (e e' : local_equiv α β) (hs : disjoint e.source e'.source)
632
+ (ht : disjoint e.target e'.target) [∀ x, decidable (x ∈ e.source)]
633
+ [∀ y, decidable (y ∈ e.target)] :
634
+ 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 }
661
+
523
662
section pi
524
663
525
664
variables {ι : Type *} {αi βi : ι → Type *} (ei : Π i, local_equiv (αi i) (βi i))
0 commit comments