Skip to content

Commit ec37b92

Browse files
committed
feat(Data/Setoid/Basic): add theorems about lifting a function to its kernel
1 parent a2df56f commit ec37b92

4 files changed

Lines changed: 27 additions & 13 deletions

File tree

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: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Amelia Livingston, Bryan Gin-ge Chen
66
import Mathlib.Logic.Relation
77
import Mathlib.Order.CompleteLattice.Basic
88
import Mathlib.Order.GaloisConnection.Defs
9+
import Mathlib.Tactic.NthRewrite
910

1011
/-!
1112
# Equivalence relations
@@ -77,6 +78,7 @@ theorem ker_mk_eq (r : Setoid α) : ker (@Quotient.mk'' _ r) = r :=
7778
theorem ker_apply_mk_out {f : α → β} (a : α) : f (⟦a⟧ : Quotient (Setoid.ker f)).out = f a :=
7879
@Quotient.mk_out _ (Setoid.ker f) a
7980

81+
@[simp]
8082
theorem ker_def {f : α → β} {x y : α} : ker f x y ↔ f x = f y :=
8183
Iff.rfl
8284

@@ -314,14 +316,22 @@ theorem lift_unique {r : Setoid α} {f : α → β} (H : r ≤ ker f) (g : Quoti
314316
ext ⟨x⟩
315317
rw [← Quotient.mk, Quotient.lift_mk f H, Hg, Function.comp_apply, Quotient.mk''_eq_mk]
316318

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

330+
@[deprecated (since := "2025-10-11")] alias ker_lift_injective := injective_kerLift
331+
322332
/-- Given a map f from α to β, the kernel of f is the unique equivalence relation on α whose
323333
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)
334+
theorem ker_eq_lift_of_injective {r : Setoid α} (f : α → β) (H : r ≤ ker f)
325335
(h : Injective (Quotient.lift f H)) : ker f = r :=
326336
le_antisymm
327337
(fun x y hk =>
@@ -330,23 +340,27 @@ theorem ker_eq_lift_of_injective {r : Setoid α} (f : α → β) (H : ∀ x y, r
330340

331341
variable (r : Setoid α) (f : α → β)
332342

343+
/-- The image of `f` lifted to the quotient by its kernel is equal to the image of `f` itself. -/
344+
theorem range_kerLift_eq_range : Set.range (kerLift f) = Set.range f :=
345+
Set.range_quotient_lift (s := ker f) _
346+
347+
/-- The quotient of `α` by the kernel of a function `f`
348+
bijects with the image of `f` lifted to the quotient. -/
349+
noncomputable def quotientKerEquivRangeKerLift : Quotient (ker f) ≃ Set.range (kerLift f) :=
350+
.ofInjective _ <| injective_kerLift _
351+
333352
/-- The first isomorphism theorem for sets: the quotient of α by the kernel of a function f
334353
bijects with f's image. -/
335354
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⟩⟩
355+
quotientKerEquivRangeKerLift _ |>.trans <| .setCongr <| range_kerLift_eq_range _
342356

343357
/-- If `f` has a computable right-inverse, then the quotient by its kernel is equivalent to its
344358
domain. -/
345359
@[simps]
346360
def quotientKerEquivOfRightInverse (g : β → α) (hf : Function.RightInverse g f) :
347361
Quotient (ker f) ≃ β where
348-
toFun a := (Quotient.liftOn' a f) fun _ _ => id
349-
invFun b := Quotient.mk'' (g b)
362+
toFun := kerLift f
363+
invFun := Quotient.mk'' ∘ g
350364
left_inv a := Quotient.inductionOn' a fun a => Quotient.sound' <| hf (f a)
351365
right_inv := hf
352366

Mathlib/NumberTheory/NumberField/CanonicalEmbedding/FundamentalCone.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ 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)
394+
by convert Setoid.injective_kerLift (integerSetToAssociates K)
395395
all_goals
396396
· ext a b
397397
rw [Setoid.ker_def, eq_comm, integerSetToAssociates_eq_iff b a,

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.injective_kerLift _) (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)