Skip to content

Commit 2e468db

Browse files
committed
feat: algebraic hierarchy on DirectLimit (#19893)
**Order/DirectedInverseSystem.lean**: define the DirectLimit of a DirectedSystem of types as a quotient (by a setoid (equivalence relation)) of the Sigma type (disjoint union). Provide the `induction` lemmas and `map`/`lift` constructions used to define algebraic operations on DirectLimit. New file **Algebra/Colimit/DirectLimit.lean**: the first 400 lines are boilerplate code that defines algebraic instances on DirectLImit from magma (Mul) to Field. To make everything "hom-polymorphic", the DirectedSystem consists of FunLikes rather than plain/unbundled functions, and we use algebraic hom typeclasses (e.g. LinearMapClass, RingHomClass) everywhere. The remaining 70 lines essentially shows that DirectLimit is the colimit in the categories of Module and Ring. **Algebra/DirectLimit.lean**: renamed to **Algebra/Colimit/ModuleRing.lean**. This file was originally added @kckennylau 5 years ago in [mathlib3#754](leanprover-community/mathlib3#754) and defines `Module.DirectLimit` and `Ring.DirectLimit` as quotients of the universal objects (DirectSum and FreeCommRing). This definition is more general and suitable for arbitrary colimits, but makes it very cumbersome to prove [`of.zero_exact`](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/DirectLimit.html#Ring.DirectLimit.of.zero_exact) lemmas (130+ lines!); for DirectLimit constructed as quotients of the disjoint union, these are just by definition. We golf these proofs by constructing isomorphisms between `Module/Ring.DirectLimit` and `_root_.DirectLimit`. I have more work done that generalizes most lemmas there to work for arbitrary colimits, that's why I put it under a new Colimit directory. **Data/Int/Cast/Lemmas.lean**: add `map_intCast'` **Data/Nat/Cast/Basic.lean**: golf a lemma **Order/Directed.lean**: add a lemma **ModelTheory/DirectLimit.lean**: change two lemmas to aliases of the general FunLike lemmas
1 parent 2c76114 commit 2e468db

File tree

12 files changed

+786
-280
lines changed

12 files changed

+786
-280
lines changed

Mathlib.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ import Mathlib.Algebra.CharZero.Defs
181181
import Mathlib.Algebra.CharZero.Infinite
182182
import Mathlib.Algebra.CharZero.Lemmas
183183
import Mathlib.Algebra.CharZero.Quotient
184+
import Mathlib.Algebra.Colimit.DirectLimit
185+
import Mathlib.Algebra.Colimit.ModuleRing
184186
import Mathlib.Algebra.ContinuedFractions.Basic
185187
import Mathlib.Algebra.ContinuedFractions.Computation.ApproximationCorollaries
186188
import Mathlib.Algebra.ContinuedFractions.Computation.Approximations
@@ -194,7 +196,6 @@ import Mathlib.Algebra.ContinuedFractions.Determinant
194196
import Mathlib.Algebra.ContinuedFractions.TerminatedStable
195197
import Mathlib.Algebra.ContinuedFractions.Translations
196198
import Mathlib.Algebra.CubicDiscriminant
197-
import Mathlib.Algebra.DirectLimit
198199
import Mathlib.Algebra.DirectSum.AddChar
199200
import Mathlib.Algebra.DirectSum.Algebra
200201
import Mathlib.Algebra.DirectSum.Basic

Mathlib/Algebra/Category/ModuleCat/Limits.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Kim Morrison
55
-/
66
import Mathlib.Algebra.Category.ModuleCat.Basic
77
import Mathlib.Algebra.Category.Grp.Limits
8-
import Mathlib.Algebra.DirectLimit
8+
import Mathlib.Algebra.Colimit.ModuleRing
99

1010
/-!
1111
# The category of R-modules has all limits
@@ -221,7 +221,7 @@ def directLimitDiagram : ι ⥤ ModuleCat R where
221221
map_comp hij hjk := by
222222
ext
223223
symm
224-
apply Module.DirectedSystem.map_map
224+
apply Module.DirectedSystem.map_map f
225225

226226
variable [DecidableEq ι]
227227

@@ -243,7 +243,7 @@ in the sense of `CategoryTheory`. -/
243243
@[simps]
244244
def directLimitIsColimit [IsDirected ι (· ≤ ·)] : IsColimit (directLimitCocone G f) where
245245
desc s := ofHom <|
246-
DirectLimit.lift R ι G f (fun i => (s.ι.app i).hom) fun i j h x => by
246+
Module.DirectLimit.lift R ι G f (fun i => (s.ι.app i).hom) fun i j h x => by
247247
simp only [Functor.const_obj_obj]
248248
rw [← s.w (homOfLE h)]
249249
rfl

0 commit comments

Comments
 (0)