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

Commit b932a51

Browse files
committed
feat(data/set/function): add lemmas about semiconj (#3007)
Also redefine `set.maps_to` to avoid unfolding `mem_preimage`.
1 parent 836c0a2 commit b932a51

File tree

3 files changed

+73
-10
lines changed

3 files changed

+73
-10
lines changed

src/analysis/calculus/inverse.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ lemma inverse_approx_map_maps_to (hf : approximates_linear_on f (f' : E →L[
247247
maps_to g (closed_ball b ε) (closed_ball b ε) :=
248248
begin
249249
cases hc with hE hc,
250-
{ exactI λ x hx, mem_preimage.2 (subsingleton.elim x (g x) ▸ hx) },
250+
{ exactI λ x hx, subsingleton.elim x (g x) ▸ hx },
251251
assume x hx,
252-
simp only [subset_def, mem_closed_ball, mem_preimage] at hx hy ⊢,
252+
simp only [mem_closed_ball] at hx hy ⊢,
253253
rw [dist_comm] at hy,
254254
calc dist (inverse_approx_map f f' y x) b ≤
255255
dist (inverse_approx_map f f' y x) (inverse_approx_map f f' y b) +

src/data/set/function.lean

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Author: Jeremy Avigad, Andrew Zipperer, Haitao Zhang, Minchao Wu, Yury Kudryashov
55
-/
66
import data.set.basic
7-
import logic.function.basic
7+
import logic.function.conjugate
88

99
/-!
1010
# Functions over sets
@@ -91,7 +91,7 @@ lemma eq_on.mono (hs : s₁ ⊆ s₂) (hf : eq_on f₁ f₂ s₂) : eq_on f₁ f
9191
/-! ### maps to -/
9292

9393
/-- `maps_to f a b` means that the image of `a` is contained in `b`. -/
94-
@[reducible] def maps_to (f : α → β) (s : set α) (t : set β) : Prop := s ⊆ f ⁻¹' t
94+
@[reducible] def maps_to (f : α → β) (s : set α) (t : set β) : Prop := ∀ ⦃x⦄, x ∈ s → f x ∈ t
9595

9696
/-- Given a map `f` sending `s : set α` into `t : set β`, restrict domain of `f` to `s`
9797
and the codomain to `t`. Same as `subtype.map`. -/
@@ -112,7 +112,7 @@ maps_to'.1 h
112112

113113
theorem maps_to.congr (h₁ : maps_to f₁ s t) (h : eq_on f₁ f₂ s) :
114114
maps_to f₂ s t :=
115-
λ x hx, by rw [mem_preimage, ← h hx]; exact h₁ hx
115+
λ x hx, h hx h₁ hx
116116

117117
theorem eq_on.maps_to_iff (H : eq_on f₁ f₂ s) : maps_to f₁ s t ↔ maps_to f₂ s t :=
118118
⟨λ h, h.congr H, λ h, h.congr H.symm⟩
@@ -353,7 +353,8 @@ left_inv_on g f s ∧ right_inv_on g f t
353353

354354
lemma inv_on.symm (h : inv_on f' f s t) : inv_on f f' t s := ⟨h.right, h.left⟩
355355

356-
theorem inv_on.bij_on (h : inv_on f' f s t) (hf : maps_to f s t) (hf' : maps_to f' t s) : bij_on f s t :=
356+
theorem inv_on.bij_on (h : inv_on f' f s t) (hf : maps_to f s t) (hf' : maps_to f' t s) :
357+
bij_on f s t :=
357358
⟨hf, h.left.inj_on, h.right.surj_on hf'⟩
358359

359360
/-! ### `inv_fun_on` is a left/right inverse -/
@@ -387,7 +388,7 @@ theorem surj_on.bij_on_subset [nonempty α] (h : surj_on f s t) :
387388
begin
388389
refine h.inv_on_inv_fun_on.bij_on _ (maps_to_image _ _),
389390
rintros _ ⟨y, hy, rfl⟩,
390-
rwa [mem_preimage, h.right_inv_on_inv_fun_on hy]
391+
rwa [h.right_inv_on_inv_fun_on hy]
391392
end
392393

393394
theorem surj_on_iff_exists_bij_on_subset :
@@ -453,7 +454,7 @@ namespace function
453454

454455
open set
455456

456-
variables {f : α → β} {g : β → γ} {s : set α}
457+
variables {fa : α → α} {fb : β → β} {f : α → β} {g : β → γ} {s t : set α}
457458

458459
lemma injective.inj_on (h : injective f) (s : set α) : s.inj_on f :=
459460
λ _ _ _ _ heq, h heq
@@ -465,6 +466,68 @@ lemma surjective.surj_on (hf : surjective f) (s : set β) :
465466
surj_on f univ s :=
466467
(surjective_iff_surj_on_univ.1 hf).mono (subset.refl _) (subset_univ _)
467468

469+
namespace semiconj
470+
471+
lemma maps_to_image (h : semiconj f fa fb) (ha : maps_to fa s t) :
472+
maps_to fb (f '' s) (f '' t) :=
473+
λ y ⟨x, hx, hy⟩, hy ▸ ⟨fa x, ha hx, h x⟩
474+
475+
lemma maps_to_range (h : semiconj f fa fb) : maps_to fb (range f) (range f) :=
476+
λ y ⟨x, hy⟩, hy ▸ ⟨fa x, h x⟩
477+
478+
lemma surj_on_image (h : semiconj f fa fb) (ha : surj_on fa s t) :
479+
surj_on fb (f '' s) (f '' t) :=
480+
begin
481+
rintros y ⟨x, hxt, rfl⟩,
482+
rcases ha hxt with ⟨x, hxs, rfl⟩,
483+
rw [h x],
484+
exact mem_image_of_mem _ (mem_image_of_mem _ hxs)
485+
end
486+
487+
lemma surj_on_range (h : semiconj f fa fb) (ha : surjective fa) :
488+
surj_on fb (range f) (range f) :=
489+
by { rw ← image_univ, exact h.surj_on_image (ha.surj_on univ) }
490+
491+
lemma inj_on_image (h : semiconj f fa fb) (ha : inj_on fa s) (hf : inj_on f (fa '' s)) :
492+
inj_on fb (f '' s) :=
493+
begin
494+
rintros _ _ ⟨x, hx, rfl⟩ ⟨y, hy, rfl⟩ H,
495+
simp only [← h.eq] at H,
496+
exact congr_arg f (ha hx hy $ hf (mem_image_of_mem fa hx) (mem_image_of_mem fa hy) H)
497+
end
498+
499+
lemma inj_on_range (h : semiconj f fa fb) (ha : injective fa) (hf : inj_on f (range fa)) :
500+
inj_on fb (range f) :=
501+
by { rw ← image_univ at *, exact h.inj_on_image (ha.inj_on univ) hf }
502+
503+
lemma bij_on_image (h : semiconj f fa fb) (ha : bij_on fa s t) (hf : inj_on f t) :
504+
bij_on fb (f '' s) (f '' t) :=
505+
⟨h.maps_to_image ha.maps_to, h.inj_on_image ha.inj_on (ha.image_eq.symm ▸ hf),
506+
h.surj_on_image ha.surj_on⟩
507+
508+
lemma bij_on_range (h : semiconj f fa fb) (ha : bijective fa) (hf : injective f) :
509+
bij_on fb (range f) (range f) :=
510+
begin
511+
rw [← image_univ],
512+
exact h.bij_on_image (bijective_iff_bij_on_univ.1 ha) (hf.inj_on univ)
513+
end
514+
515+
lemma maps_to_preimage (h : semiconj f fa fb) {s t : set β} (hb : maps_to fb s t) :
516+
maps_to fa (f ⁻¹' s) (f ⁻¹' t) :=
517+
λ x hx, by simp only [mem_preimage, h x, hb hx]
518+
519+
lemma inj_on_preimage (h : semiconj f fa fb) {s : set β} (hb : inj_on fb s)
520+
(hf : inj_on f (f ⁻¹' s)) :
521+
inj_on fa (f ⁻¹' s) :=
522+
begin
523+
intros x y hx hy H,
524+
have := congr_arg f H,
525+
rw [h.eq, h.eq] at this,
526+
exact hf hx hy (hb hx hy this)
527+
end
528+
529+
end semiconj
530+
468531
lemma update_comp_eq_of_not_mem_range [decidable_eq β]
469532
(g : β → γ) {f : α → β} {i : β} (a : γ) (h : i ∉ set.range f) :
470533
(function.update g i a) ∘ f = g ∘ f :=

src/linear_algebra/basis.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ begin
182182
{ intros h l hl₁ hl₂,
183183
have h_bij : bij_on subtype.val (subtype.val ⁻¹' ↑l.support : set s) ↑l.support,
184184
{ apply bij_on.mk,
185-
{ unfold maps_to },
185+
{ apply maps_to_preimage },
186186
{ apply subtype.val_injective.inj_on },
187187
intros i hi,
188188
rw [image_preimage_eq_inter_range, subtype.range_val],
@@ -240,7 +240,7 @@ begin
240240
intros l hl₁ hl₂,
241241
have h_bij : bij_on v (v ⁻¹' ↑l.support) ↑l.support,
242242
{ apply bij_on.mk,
243-
{ unfold maps_to },
243+
{ apply maps_to_preimage },
244244
{ apply (linear_independent.injective zero_eq_one hv).inj_on },
245245
intros x hx,
246246
rcases mem_range.1 (((finsupp.mem_supported _ _).1 hl₁ : ↑(l.support) ⊆ range v) hx)

0 commit comments

Comments
 (0)