Zulip Chat Archive

Stream: new members

Topic: Q/Z as colimit of Z/nZ


Edison Xie (Aug 10 2025 at 17:25):

(I'm a new member to category theory in lean so I'll post it here)
I want to prove that ℚ ⧸ (Algebra.ofId ℤ ℚ).range.toSubmodule is isomorphic to limit of `Zmod i. The proof I found is in here and here's some (dumb) question:

  • Do we have this in mathlib?
  • Do we have a subtype of natural saying that n ≤ m ↔ n ∣ m?
  • I'm currently constructing this from scratch but is this the best way?
    Thanks!

Kenny Lau (Aug 10 2025 at 17:27):

just make sure you don't include 0

Kenny Lau (Aug 10 2025 at 17:27):

how "from scratch" is your construction?

Edison Xie (Aug 10 2025 at 17:29):

Kenny Lau said:

just make sure you don't include 0

I've noticed :-)

Edison Xie (Aug 10 2025 at 17:29):

Kenny Lau said:

how "from scratch" is your construction?

from constructing the functor, etc.

Kenny Lau (Aug 10 2025 at 17:29):

I think we've noticed that we're missing a predicate "is direct limit" in mathlib

Kenny Lau (Aug 10 2025 at 17:29):

Edison Xie said:

Kenny Lau said:

how "from scratch" is your construction?

from constructing the functor, etc.

you're using DirectLimit right

Edison Xie (Aug 10 2025 at 17:30):

oh no I'm using CategoryTheory.Limits.colimit but second thought may be a bad idea

Kenny Lau (Aug 10 2025 at 17:30):

yeah we're also missing API to connect DirectLimit with colimit

Kenny Lau (Aug 10 2025 at 17:31):

ModuleCat.directLimitIsColimit

Kenny Lau (Aug 10 2025 at 17:31):

we have it for modules tho

Kenny Lau (Aug 10 2025 at 17:31):

it looks like they did it skipping the AddCommGroup step

Kenny Lau (Aug 10 2025 at 17:31):

it's also a bit messy if you use Z-Mod / N-Mod because of diamonds

Edison Xie (Aug 10 2025 at 17:32):

The reason I don't wanna use module is that I don't wanna be find myself in this M.isModule = AddCommGroup.toIntModule M horror again

Kenny Lau (Aug 10 2025 at 17:32):

so I would first construct a type WithDvd M where the preorder is dvd

Edison Xie (Aug 10 2025 at 17:32):

yeah

Kenny Lau (Aug 10 2025 at 17:33):

and use PNat which is a CancelCommMonoid

Kenny Lau (Aug 10 2025 at 17:33):

and then i would define the "IsDirectLimit" predicate

Kenny Lau (Aug 10 2025 at 17:33):

(compare IsLocalization)

Aaron Liu (Aug 10 2025 at 17:36):

I would just state it with docs#CategoryTheory.Limits.IsColimit

Kenny Lau (Aug 10 2025 at 17:36):

Kenny Lau said:

and then i would define the "IsDirectLimit" predicate

a "direct cone" of F at R is a collection of add homs phi from F i to R so that phi commutes with f.

a "direct cone" at R is a direct limit iff:

  1. forall y : R exists i x, phi i x = y
  2. forall i j xi xj, phi i xi = phi j xj implies there is k above i and j such that f hik xi = f hjk xj

Kenny Lau (Aug 10 2025 at 17:37):

then you can show that these conditions are equivalent to the category conditions Aaron linked to

Kenny Lau (Aug 10 2025 at 17:37):

you might not even need to define direct cone separately

Kenny Lau (Aug 10 2025 at 17:38):

as in, you can just use Cocone

Kenny Lau (Aug 10 2025 at 17:41):

well this is awkward

Kenny Lau (Aug 10 2025 at 17:41):

AddCommGrp.FilteredColimits.colimit exists but is not defined using DirectLimit?

Kenny Lau (Aug 10 2025 at 17:42):

i don't think nullifies anything i said above

Aaron Liu (Aug 10 2025 at 17:43):

Kenny Lau said:

AddCommGrp.FilteredColimits.colimit exists but is not defined using DirectLimit?

Well yeah

Aaron Liu (Aug 10 2025 at 17:43):

It's giving an object in the category of add comm groups

Aaron Liu (Aug 10 2025 at 17:43):

So of course it's using the category theory language

Wuyang (Aug 11 2025 at 15:56):

The gap between DirectLimit and colimit APIs seems a bit tricky. WithDvd + PNat and a direct limit predicate could be a clean bridge.

Might be worth a quick search on LeanFinder to see if any hidden gems in mathlib or prior work match your needs.

Wuyang (Aug 11 2025 at 15:57):

(deleted)

leanfinder (Aug 11 2025 at 15:57):

Failure! Bot is unavailable

Wuyang (Aug 11 2025 at 15:58):

@leanfinder Q/Z as colimit of Zmod n in Lean mathlib, using DirectLimit vs colimit, missing API connections and direct limit predicates

leanfinder (Aug 11 2025 at 15:58):

Here’s what I found:

  • abbrev DirectLimit : Type _ := Quotient (setoid f) "Given a directed system consisting of:
  • A directed poset (I,)(I, \leq)
  • A family of objects {Fi}iI\{F_i\}_{i \in I}
  • A family of morphisms fij:FiFjf_{ij} : F_i \to F_j for each iji \leq j satisfying:

    1. fii=idFif_{ii} = \text{id}_{F_i} (identity)
    2. fjkfij=fikf_{jk} \circ f_{ij} = f_{ik} for ijki \leq j \leq k (composition)

The direct limit limF\varinjlim F is defined as the quotient of the disjoint union iIFi\bigsqcup_{i \in I} F_i by the equivalence relation:
(i,x)(j,y)    ki,j, fik(x)=fjk(y)(i, x) \sim (j, y) \iff \exists k \geq i,j,\ f_{ik}(x) = f_{jk}(y)" (score: 0.721)

This means that for any other cocone ss over the diagram directLimitDiagram G f, there exists a unique RR-linear map from the direct limit to the vertex of ss that makes all the relevant diagrams commute.

The construction uses:

  • The canonical maps ιi ⁣:GiDirectLimitGf\iota_i \colon G_i \to \text{DirectLimit} G f for each iιi \in \iota
  • The universal property of the direct limit, which provides a unique lift of any compatible family of maps from the GiG_i to another module" (score: 0.695)
  • definition ZMod : ℕ → Type | 0 => ℤ | n + 1 => Fin (n + 1) "The integers modulo nn, denoted Z/nZ\mathbb{Z}/n\mathbb{Z}, is defined as:

  • The integers Z\mathbb{Z} when n=0n = 0

  • The finite type with nn elements (represented as Fin(n)\text{Fin}(n)) when n>0n > 0

This construction provides the commutative ring structure on Z/nZ\mathbb{Z}/n\mathbb{Z}." (score: 0.693)

In symbols:
n=[i,n] in limG.n = [\langle i, n \rangle] \text{ in } \varinjlim G." (score: 0.691)

Kevin Buzzard (Aug 12 2025 at 14:25):

@Madison Crim did you PR anything about direct limits of abelian groups?


Last updated: Dec 20 2025 at 21:32 UTC