Skip to content

Commit 70d200f

Browse files
committed
feat(Data/Setoid/Basic): add theorems about lifting a function to its kernel (#28818)
Currently `ker_lift_injective` and `quotientKerEquivOfRightInverse` lift `f` to `ker f` in their definition. This PR makes this function available as `Setoid.kerLift f` and adds a few more theorems about it.
1 parent 87e803a commit 70d200f

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

Counterexamples/AharoniKorman.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ theorem exists_partition_iff_nonempty_spinalMap
545545
· rintro ⟨f⟩
546546
refine ⟨_, (Setoid.ker f).isPartition_classes, ?_⟩
547547
rintro _ ⟨x, rfl⟩
548-
exact ⟨f.fibre_antichain _, f x, by simp [Setoid.ker, Function.onFun]
548+
exact ⟨f.fibre_antichain _, f x, by simp⟩
549549

550550
variable {f : SpinalMap C}
551551

Mathlib/Data/Setoid/Basic.lean

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ theorem ker_mk_eq (r : Setoid α) : ker (@Quotient.mk'' _ r) = r :=
7777
theorem ker_apply_mk_out {f : α → β} (a : α) : f (⟦a⟧ : Quotient (Setoid.ker f)).out = f a :=
7878
@Quotient.mk_out _ (Setoid.ker f) a
7979

80+
@[simp]
8081
theorem ker_def {f : α → β} {x y : α} : ker f x y ↔ f x = f y :=
8182
Iff.rfl
8283

@@ -314,38 +315,56 @@ theorem lift_unique {r : Setoid α} {f : α → β} (H : r ≤ ker f) (g : Quoti
314315
ext ⟨x⟩
315316
rw [← Quotient.mk, Quotient.lift_mk f H, Hg, Function.comp_apply, Quotient.mk''_eq_mk]
316317

318+
/-- Given a function `f`, lift it to the quotient by its kernel. -/
319+
def kerLift (f : α → β) : Quotient (ker f) → β :=
320+
Quotient.lift f fun _ _ ↦ id
321+
322+
@[simp]
323+
theorem kerLift_mk (f : α → β) (x : α) : kerLift f ⟦x⟧ = f x :=
324+
rfl
325+
317326
/-- Given a map f from α to β, the natural map from the quotient of α by the kernel of f is
318327
injective. -/
319-
theorem ker_lift_injective (f : α → β) : Injective (@Quotient.lift _ _ (ker f) f fun _ _ h => h) :=
328+
theorem kerLift_injective (f : α → β) : Injective <| kerLift f :=
320329
fun x y => Quotient.inductionOn₂' x y fun _ _ h => Quotient.sound' h
321330

331+
@[deprecated (since := "2025-10-11")] alias ker_lift_injective := kerLift_injective
332+
322333
/-- Given a map f from α to β, the kernel of f is the unique equivalence relation on α whose
323334
induced map from the quotient of α to β is injective. -/
324-
theorem ker_eq_lift_of_injective {r : Setoid α} (f : α → β) (H : ∀ x y, r x y → f x = f y)
335+
theorem ker_eq_lift_of_injective {r : Setoid α} (f : α → β) (H : r ≤ ker f)
325336
(h : Injective (Quotient.lift f H)) : ker f = r :=
326337
le_antisymm
327338
(fun x y hk =>
328339
Quotient.exact <| h <| show Quotient.lift f H ⟦x⟧ = Quotient.lift f H ⟦y⟧ from hk)
329340
H
330341

342+
theorem lift_injective_iff_ker_eq_of_le {r : Setoid α} {f : α → β}
343+
(hle : r ≤ ker f) : Injective (Quotient.lift f hle) ↔ ker f = r :=
344+
⟨ker_eq_lift_of_injective f hle, fun h ↦ h ▸ kerLift_injective _⟩
345+
331346
variable (r : Setoid α) (f : α → β)
332347

348+
/-- The image of `f` lifted to the quotient by its kernel is equal to the image of `f` itself. -/
349+
@[simp] theorem range_kerLift_eq_range : Set.range (kerLift f) = Set.range f :=
350+
Set.range_quotient_lift (s := ker f) _
351+
352+
/-- The quotient of `α` by the kernel of a function `f`
353+
bijects with the image of `f` lifted to the quotient. -/
354+
noncomputable def quotientKerEquivRangeKerLift : Quotient (ker f) ≃ Set.range (kerLift f) :=
355+
.ofInjective _ <| kerLift_injective _
356+
333357
/-- The first isomorphism theorem for sets: the quotient of α by the kernel of a function f
334358
bijects with f's image. -/
335359
noncomputable def quotientKerEquivRange : Quotient (ker f) ≃ Set.range f :=
336-
Equiv.ofBijective
337-
((@Quotient.lift _ (Set.range f) (ker f) fun x => ⟨f x, Set.mem_range_self x⟩) fun _ _ h =>
338-
Subtype.ext h)
339-
fun x y h => ker_lift_injective f <| by rcases x with ⟨⟩; rcases y with ⟨⟩; injections,
340-
fun ⟨_, z, hz⟩ =>
341-
⟨@Quotient.mk'' _ (ker f) z, Subtype.ext_iff.2 hz⟩⟩
360+
quotientKerEquivRangeKerLift _ |>.trans <| .setCongr <| range_kerLift_eq_range _
342361

343362
/-- If `f` has a computable right-inverse, then the quotient by its kernel is equivalent to its
344363
domain. -/
345364
@[simps]
346365
def quotientKerEquivOfRightInverse (g : β → α) (hf : Function.RightInverse g f) :
347366
Quotient (ker f) ≃ β where
348-
toFun a := (Quotient.liftOn' a f) fun _ _ => id
367+
toFun := kerLift f
349368
invFun b := Quotient.mk'' (g b)
350369
left_inv a := Quotient.inductionOn' a fun a => Quotient.sound' <| hf (f a)
351370
right_inv := hf

Mathlib/NumberTheory/NumberField/CanonicalEmbedding/FundamentalCone.lean

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,10 @@ def integerSetQuotEquivAssociates :
391391
Equiv.ofBijective
392392
(Quotient.lift (integerSetToAssociates K)
393393
fun _ _ h ↦ ((integerSetToAssociates_eq_iff _ _).mpr h).symm)
394-
by convert Setoid.ker_lift_injective (integerSetToAssociates K)
395-
all_goals
396-
· ext a b
397-
rw [Setoid.ker_def, eq_comm, integerSetToAssociates_eq_iff b a,
398-
MulAction.orbitRel_apply, MulAction.mem_orbit_iff],
394+
⟨Setoid.lift_injective_iff_ker_eq_of_le _ |>.mpr <| by
395+
ext a b
396+
rw [Setoid.ker_def, eq_comm, integerSetToAssociates_eq_iff b a,
397+
MulAction.orbitRel_apply, MulAction.mem_orbit_iff],
399398
(Quot.surjective_lift _).mpr (integerSetToAssociates_surjective K)⟩
400399

401400
@[simp]

Mathlib/Topology/Separation/Hausdorff.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ lemma compatible {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [T2Spac
445445
∀ (a b : X), a ≈ b → f a = f b := by
446446
change t2Setoid X ≤ Setoid.ker f
447447
exact sInf_le <| .of_injective_continuous
448-
(Setoid.ker_lift_injective _) (hf.quotient_lift fun _ _ ↦ id)
448+
(Setoid.kerLift_injective _) (hf.quotient_lift fun _ _ ↦ id)
449449

450450
/-- The universal property of the largest T2 quotient of a topological space `X`: any continuous
451451
map from `X` to a T2 space `Y` uniquely factors through `T2Quotient X`. This declaration builds the

0 commit comments

Comments
 (0)