Skip to content

Commit 2d51f60

Browse files
b-mehtaReemMelamed
authored andcommitted
feat(Data/Set/Restrict): extend is injective on the range (leanprover-community#39856)
These lemmas are placed here since that puts them close to the other `extend` lemmas, but they can't be in Logic/Function/Basic since InjOn and Set.range aren't defined there yet
1 parent 3b8def4 commit 2d51f60

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Mathlib/Data/Set/Restrict.lean

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,21 @@ theorem range_extend {f : α → β} (hf : Injective f) (g : α → γ) (g' : β
129129
rintro z (⟨x, rfl⟩ | ⟨y, hy, rfl⟩)
130130
exacts [⟨f x, hf.extend_apply _ _ _⟩, ⟨y, extend_apply' _ _ _ hy⟩]
131131

132+
/-- If `g` factors through `f` and `g` is injective, then `extend f g j` is injective on the
133+
range of `f`. -/
134+
lemma _root_.Function.FactorsThrough.extend_injOn {f : α → β} {g : α → γ} {j : β → γ}
135+
(hf : g.FactorsThrough f) (hg : g.Injective) :
136+
(range f).InjOn (extend f g j) := by
137+
rintro _ ⟨x, rfl⟩ _ ⟨y, rfl⟩ heq
138+
rw [hf.extend_apply, hf.extend_apply] at heq
139+
rw [hg heq]
140+
141+
/-- If `f` and `g` are injective, then `extend f g j` is injective on the range of `f`. -/
142+
lemma _root_.Function.Injective.extend_injOn {f : α → β} {g : α → γ} {j : β → γ}
143+
(hf : f.Injective) (hg : g.Injective) :
144+
(range f).InjOn (extend f g j) :=
145+
(hf.factorsThrough g).extend_injOn hg
146+
132147
/-- Restrict codomain of a function `f` to a set `s`. Same as `Subtype.coind` but this version
133148
has codomain `↥s` instead of `Subtype s`. -/
134149
def codRestrict (f : ι → α) (s : Set α) (h : ∀ x, f x ∈ s) : ι → s := fun x => ⟨f x, h x⟩

0 commit comments

Comments
 (0)