Skip to content

feat(CategoryTheory): add typeclasses and API for chosen (co)representing objects - #46324

Open
robertmaxton42 wants to merge 9 commits into
leanprover-community:masterfrom
robertmaxton42:gav/pr/chosen-representation
Open

robertmaxton42 wants to merge 9 commits into
leanprover-community:masterfrom
robertmaxton42:gav/pr/chosen-representation

Conversation

@robertmaxton42

Copy link
Copy Markdown
Collaborator
  • Add the typeclasses ChosenRepresentation and ChosenCorepresentation following the similar chosen-limits design, carrying the data of a choice of (co)-representing objects and a natural choice of morphism for every element.
  • Add API paralleling CategoryTheory.homOfElement for convenient use of chosen (co)-representing objects to generate morphisms.
    • In particular, add API for the specific case of ConcreteCategory and its spellings of (forget C).obj, (forget C).map, etc.
  • Add the motivating example in TopCat.

AI was used to help organize the PR once complete. The PR otherwise contains no AI-generated code.


robertmaxton42 and others added 3 commits November 21, 2026 03:12
…ry.homOfElement`

The content was written by Robert Maxton; it was moved here (from his working files) and adapted to current Mathlib and its linters with Claude.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

PR summary 76e8f7d877

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Topology.Category.TopCat.Basic 894 898 +4 (+0.45%)
Import changes for all files
Files Import difference
126 files Mathlib.Algebra.Category.CommHopfAlgCat Mathlib.Algebra.Category.Grp.LeftExactFunctor Mathlib.AlgebraicGeometry.AffineSpace Mathlib.AlgebraicGeometry.AffineTransitionLimit Mathlib.AlgebraicGeometry.AlgClosed.Basic Mathlib.AlgebraicGeometry.AlgebraicCycle.Basic Mathlib.AlgebraicGeometry.Artinian Mathlib.AlgebraicGeometry.Birational.Birational Mathlib.AlgebraicGeometry.Birational.Composition Mathlib.AlgebraicGeometry.Birational.Dominant Mathlib.AlgebraicGeometry.Birational.RationalMap Mathlib.AlgebraicGeometry.ColimitsOver Mathlib.AlgebraicGeometry.Cover.Directed Mathlib.AlgebraicGeometry.Cover.Over Mathlib.AlgebraicGeometry.Cover.QuasiCompact Mathlib.AlgebraicGeometry.Cover.Sigma Mathlib.AlgebraicGeometry.EffectiveEpi Mathlib.AlgebraicGeometry.Fiber Mathlib.AlgebraicGeometry.FunctionField Mathlib.AlgebraicGeometry.Geometrically.Basic Mathlib.AlgebraicGeometry.Geometrically.Connected Mathlib.AlgebraicGeometry.Geometrically.Integral Mathlib.AlgebraicGeometry.Geometrically.Irreducible Mathlib.AlgebraicGeometry.Geometrically.Reduced Mathlib.AlgebraicGeometry.GluingOneHypercover Mathlib.AlgebraicGeometry.Group.Abelian Mathlib.AlgebraicGeometry.Group.Affine Mathlib.AlgebraicGeometry.Group.Smooth Mathlib.AlgebraicGeometry.IdealSheaf.Basic Mathlib.AlgebraicGeometry.IdealSheaf.Functorial Mathlib.AlgebraicGeometry.IdealSheaf.IrreducibleComponent Mathlib.AlgebraicGeometry.IdealSheaf.Subscheme Mathlib.AlgebraicGeometry.LimitsOver Mathlib.AlgebraicGeometry.Limits Mathlib.AlgebraicGeometry.Morphisms.AffineAnd Mathlib.AlgebraicGeometry.Morphisms.Affine Mathlib.AlgebraicGeometry.Morphisms.Basic Mathlib.AlgebraicGeometry.Morphisms.ClosedImmersion Mathlib.AlgebraicGeometry.Morphisms.Constructors Mathlib.AlgebraicGeometry.Morphisms.Descent Mathlib.AlgebraicGeometry.Morphisms.Etale Mathlib.AlgebraicGeometry.Morphisms.FinitePresentation Mathlib.AlgebraicGeometry.Morphisms.FiniteType Mathlib.AlgebraicGeometry.Morphisms.Finite Mathlib.AlgebraicGeometry.Morphisms.FlatDescent Mathlib.AlgebraicGeometry.Morphisms.FlatMono Mathlib.AlgebraicGeometry.Morphisms.FlatRank Mathlib.AlgebraicGeometry.Morphisms.Flat Mathlib.AlgebraicGeometry.Morphisms.FormallyUnramified Mathlib.AlgebraicGeometry.Morphisms.Immersion Mathlib.AlgebraicGeometry.Morphisms.Integral Mathlib.AlgebraicGeometry.Morphisms.IsIso Mathlib.AlgebraicGeometry.Morphisms.LocalClosure Mathlib.AlgebraicGeometry.Morphisms.LocalFlatDescent Mathlib.AlgebraicGeometry.Morphisms.LocalIso Mathlib.AlgebraicGeometry.Morphisms.OpenImmersion Mathlib.AlgebraicGeometry.Morphisms.Preimmersion Mathlib.AlgebraicGeometry.Morphisms.Proper Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact Mathlib.AlgebraicGeometry.Morphisms.QuasiFinite Mathlib.AlgebraicGeometry.Morphisms.QuasiSeparated Mathlib.AlgebraicGeometry.Morphisms.RingHomProperties Mathlib.AlgebraicGeometry.Morphisms.SchemeTheoreticallyDominant Mathlib.AlgebraicGeometry.Morphisms.Separated Mathlib.AlgebraicGeometry.Morphisms.SmoothFiber Mathlib.AlgebraicGeometry.Morphisms.Smooth Mathlib.AlgebraicGeometry.Morphisms.SurjectiveOnStalks Mathlib.AlgebraicGeometry.Morphisms.UnderlyingMap Mathlib.AlgebraicGeometry.Morphisms.UniversallyClosed Mathlib.AlgebraicGeometry.Morphisms.UniversallyInjective Mathlib.AlgebraicGeometry.Morphisms.UniversallyOpen Mathlib.AlgebraicGeometry.Morphisms.WeaklyEtale Mathlib.AlgebraicGeometry.Noetherian Mathlib.AlgebraicGeometry.Normalization Mathlib.AlgebraicGeometry.OrderOfVanishing.Basic Mathlib.AlgebraicGeometry.OrderOfVanishing.DVR Mathlib.AlgebraicGeometry.PointsPi Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Proper Mathlib.AlgebraicGeometry.Properties Mathlib.AlgebraicGeometry.PullbackCarrier Mathlib.AlgebraicGeometry.Pullbacks Mathlib.AlgebraicGeometry.QuasiAffine Mathlib.AlgebraicGeometry.RationalMap Mathlib.AlgebraicGeometry.RelativeGluing Mathlib.AlgebraicGeometry.ResidueField Mathlib.AlgebraicGeometry.Sites.AffineEtale Mathlib.AlgebraicGeometry.Sites.Affine Mathlib.AlgebraicGeometry.Sites.BigZariski Mathlib.AlgebraicGeometry.Sites.ConstantSheaf Mathlib.AlgebraicGeometry.Sites.ElladicCohomology Mathlib.AlgebraicGeometry.Sites.EtalePoint Mathlib.AlgebraicGeometry.Sites.Etale Mathlib.AlgebraicGeometry.Sites.Fpqc Mathlib.AlgebraicGeometry.Sites.Pretopology Mathlib.AlgebraicGeometry.Sites.Proetale Mathlib.AlgebraicGeometry.Sites.QuasiCompact Mathlib.AlgebraicGeometry.Sites.Representability Mathlib.AlgebraicGeometry.Sites.SheafQuasiCompact Mathlib.AlgebraicGeometry.Sites.SmallAffineZariski Mathlib.AlgebraicGeometry.Sites.Small Mathlib.AlgebraicGeometry.SpreadingOut Mathlib.AlgebraicGeometry.Stalk Mathlib.AlgebraicGeometry.ValuativeCriterion Mathlib.AlgebraicGeometry.ZariskisMainTheorem Mathlib.CategoryTheory.Abelian.FreydMitchell Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Indization Mathlib.CategoryTheory.Abelian.Indization Mathlib.CategoryTheory.ConcreteCategory.Representable Mathlib.CategoryTheory.Generator.Indization Mathlib.CategoryTheory.Monoidal.Cartesian.CommGrp_ Mathlib.CategoryTheory.Monoidal.Cartesian.CommMon_ Mathlib.CategoryTheory.Monoidal.Cartesian.GrpLimits Mathlib.CategoryTheory.Monoidal.Cartesian.Grp Mathlib.CategoryTheory.Monoidal.Cartesian.Mod Mathlib.CategoryTheory.Monoidal.Cartesian.Mon Mathlib.CategoryTheory.Monoidal.Cartesian.Normal Mathlib.CategoryTheory.Monoidal.Cartesian.Over Mathlib.CategoryTheory.Monoidal.Cartesian.Ring Mathlib.CategoryTheory.Monoidal.Cartesian.ShrinkYoneda Mathlib.CategoryTheory.Monoidal.CommGrp_ Mathlib.CategoryTheory.Monoidal.Grp Mathlib.CategoryTheory.Monoidal.Internal.Types.CommGrp_ Mathlib.CategoryTheory.Monoidal.Internal.Types.Grp Mathlib.CategoryTheory.Monoidal.Ring Mathlib.CategoryTheory.Preadditive.CommGrp_ Mathlib.CategoryTheory.Preadditive.Indization
1
297 files Mathlib.Algebra.Category.ModuleCat.Presheaf.Sheafification Mathlib.Algebra.Category.ModuleCat.Presheaf.Sheafify Mathlib.Algebra.Category.ModuleCat.Sheaf.Abelian Mathlib.Algebra.Category.ModuleCat.Sheaf.ChangeOfRings Mathlib.Algebra.Category.ModuleCat.Sheaf.Colimits Mathlib.Algebra.Category.ModuleCat.Sheaf.Free Mathlib.Algebra.Category.ModuleCat.Sheaf.Generators Mathlib.Algebra.Category.ModuleCat.Sheaf.Limits Mathlib.Algebra.Category.ModuleCat.Sheaf.Localization Mathlib.Algebra.Category.ModuleCat.Sheaf.LocallyFree Mathlib.Algebra.Category.ModuleCat.Sheaf.PullbackContinuous Mathlib.Algebra.Category.ModuleCat.Sheaf.PullbackFree Mathlib.Algebra.Category.ModuleCat.Sheaf.PushforwardContinuous Mathlib.Algebra.Category.ModuleCat.Sheaf.Quasicoherent Mathlib.Algebra.Category.ModuleCat.Sheaf.Submodule Mathlib.Algebra.Category.ModuleCat.Sheaf Mathlib.Algebra.Category.ModuleCat.Stalk Mathlib.Algebra.Category.ModuleCat.Topology.Basic Mathlib.Algebra.Category.ModuleCat.Topology.Homology Mathlib.AlgebraicGeometry.AffineScheme Mathlib.AlgebraicGeometry.Cover.MorphismProperty Mathlib.AlgebraicGeometry.Cover.Open Mathlib.AlgebraicGeometry.GammaSpecAdjunction Mathlib.AlgebraicGeometry.Gluing Mathlib.AlgebraicGeometry.Modules.Presheaf Mathlib.AlgebraicGeometry.Modules.Sheaf Mathlib.AlgebraicGeometry.Modules.Tilde Mathlib.AlgebraicGeometry.OpenImmersion Mathlib.AlgebraicGeometry.Over Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Basic Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Functor Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Scheme Mathlib.AlgebraicGeometry.ProjectiveSpectrum.StructureSheaf Mathlib.AlgebraicGeometry.Restrict Mathlib.AlgebraicGeometry.Scheme Mathlib.AlgebraicGeometry.Sites.MorphismProperty Mathlib.AlgebraicGeometry.Spec Mathlib.AlgebraicGeometry.StructureSheaf Mathlib.AlgebraicTopology.EilenbergSteenrod Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup Mathlib.AlgebraicTopology.FundamentalGroupoid.InducedMaps Mathlib.AlgebraicTopology.FundamentalGroupoid.PUnit Mathlib.AlgebraicTopology.FundamentalGroupoid.Product Mathlib.AlgebraicTopology.FundamentalGroupoid.SimplyConnected Mathlib.AlgebraicTopology.SimplicialSet.TopAdj Mathlib.AlgebraicTopology.SingularHomology.Basic Mathlib.AlgebraicTopology.SingularHomology.HomologyZero Mathlib.AlgebraicTopology.SingularHomology.HomotopyInvariance Mathlib.AlgebraicTopology.SingularSet Mathlib.AlgebraicTopology.TopologicalSimplex Mathlib.Analysis.Complex.BranchLogRoot Mathlib.Analysis.Complex.RiemannMapping Mathlib.Analysis.Convex.Birkhoff Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.SheafOfModules Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Sheaf Mathlib.CategoryTheory.Action.Continuous Mathlib.CategoryTheory.Adhesive.Basic Mathlib.CategoryTheory.Adhesive.Over Mathlib.CategoryTheory.Adhesive.PushoutProduct Mathlib.CategoryTheory.Adhesive.Subobject Mathlib.CategoryTheory.CofilteredSystem Mathlib.CategoryTheory.EffectiveEpi.Extensive Mathlib.CategoryTheory.Extensive Mathlib.CategoryTheory.Galois.Action Mathlib.CategoryTheory.Galois.ContAction Mathlib.CategoryTheory.Galois.Equivalence Mathlib.CategoryTheory.Galois.EssSurj Mathlib.CategoryTheory.Galois.Full Mathlib.CategoryTheory.Galois.IsFundamentalgroup Mathlib.CategoryTheory.Galois.Prorepresentability Mathlib.CategoryTheory.Galois.Topology Mathlib.CategoryTheory.MorphismProperty.CommaSites Mathlib.CategoryTheory.RegularCategory.Basic Mathlib.CategoryTheory.Sites.Abelian Mathlib.CategoryTheory.Sites.Coherent.Basic Mathlib.CategoryTheory.Sites.Coherent.CoherentSheaves Mathlib.CategoryTheory.Sites.Coherent.CoherentTopology Mathlib.CategoryTheory.Sites.Coherent.Comparison Mathlib.CategoryTheory.Sites.Coherent.Equivalence Mathlib.CategoryTheory.Sites.Coherent.ExtensiveColimits Mathlib.CategoryTheory.Sites.Coherent.ExtensiveSheaves Mathlib.CategoryTheory.Sites.Coherent.ExtensiveTopology Mathlib.CategoryTheory.Sites.Coherent.LocallySurjective Mathlib.CategoryTheory.Sites.Coherent.ReflectsPrecoherent Mathlib.CategoryTheory.Sites.Coherent.ReflectsPreregular Mathlib.CategoryTheory.Sites.Coherent.RegularSheaves Mathlib.CategoryTheory.Sites.Coherent.RegularTopology Mathlib.CategoryTheory.Sites.Coherent.SequentialLimit Mathlib.CategoryTheory.Sites.Coherent.SheafComparison Mathlib.CategoryTheory.Sites.ConstantSheaf Mathlib.CategoryTheory.Sites.CoversTop.Over Mathlib.CategoryTheory.Sites.DenseSubsite.Basic Mathlib.CategoryTheory.Sites.DenseSubsite.InducedTopology Mathlib.CategoryTheory.Sites.DenseSubsite.OneHypercoverDense Mathlib.CategoryTheory.Sites.DenseSubsite.SheafEquiv Mathlib.CategoryTheory.Sites.Descent.DescentDataPrime Mathlib.CategoryTheory.Sites.Descent.DescentData Mathlib.CategoryTheory.Sites.Descent.IsPrestack Mathlib.CategoryTheory.Sites.Descent.IsStack Mathlib.CategoryTheory.Sites.Descent.Precoverage Mathlib.CategoryTheory.Sites.EpiMono Mathlib.CategoryTheory.Sites.Equivalence Mathlib.CategoryTheory.Sites.GlobalSections Mathlib.CategoryTheory.Sites.LeftExact Mathlib.CategoryTheory.Sites.LocalProperties Mathlib.CategoryTheory.Sites.LocalSite Mathlib.CategoryTheory.Sites.LocallyBijective Mathlib.CategoryTheory.Sites.LocallyFullyFaithful Mathlib.CategoryTheory.Sites.LocallyInjective Mathlib.CategoryTheory.Sites.LocallySurjective Mathlib.CategoryTheory.Sites.MayerVietorisSquare Mathlib.CategoryTheory.Sites.Monoidal Mathlib.CategoryTheory.Sites.Over Mathlib.CategoryTheory.Sites.Point.Basic Mathlib.CategoryTheory.Sites.Point.Category Mathlib.CategoryTheory.Sites.Point.Comap Mathlib.CategoryTheory.Sites.Point.Conservative Mathlib.CategoryTheory.Sites.Point.IsMonoidalW Mathlib.CategoryTheory.Sites.Point.Map Mathlib.CategoryTheory.Sites.Point.Monoidal Mathlib.CategoryTheory.Sites.Point.OfIsCofiltered Mathlib.CategoryTheory.Sites.Point.Over Mathlib.CategoryTheory.Sites.Point.Presheaf Mathlib.CategoryTheory.Sites.Point.Skyscraper Mathlib.CategoryTheory.Sites.PreservesLocallyBijective Mathlib.CategoryTheory.Sites.PseudofunctorSheafOver Mathlib.CategoryTheory.Sites.Pullback Mathlib.CategoryTheory.Sites.RegularEpi Mathlib.CategoryTheory.Sites.SheafCohomology.Basic Mathlib.CategoryTheory.Sites.SheafCohomology.ExactSequences Mathlib.CategoryTheory.Sites.SheafCohomology.MayerVietoris Mathlib.CategoryTheory.Sites.SheafHom Mathlib.CategoryTheory.Sites.SubcanonicalOver Mathlib.CategoryTheory.Topos.Sheaf Mathlib.Combinatorics.Configuration Mathlib.Combinatorics.Hall.Basic Mathlib.Combinatorics.SimpleGraph.Ends.Defs Mathlib.Combinatorics.SimpleGraph.Ends.Properties Mathlib.Combinatorics.SimpleGraph.Finsubgraph Mathlib.Combinatorics.SimpleGraph.Hall Mathlib.Condensed.AB Mathlib.Condensed.Basic Mathlib.Condensed.Discrete.Basic Mathlib.Condensed.Discrete.Characterization Mathlib.Condensed.Discrete.Colimit Mathlib.Condensed.Discrete.LocallyConstant Mathlib.Condensed.Discrete.Module Mathlib.Condensed.EffectiveEpi Mathlib.Condensed.Epi Mathlib.Condensed.Equivalence Mathlib.Condensed.Explicit Mathlib.Condensed.Functors Mathlib.Condensed.Light.AB Mathlib.Condensed.Light.Basic Mathlib.Condensed.Light.EffectiveEpi Mathlib.Condensed.Light.Epi Mathlib.Condensed.Light.Explicit Mathlib.Condensed.Light.Functors Mathlib.Condensed.Light.Instances Mathlib.Condensed.Light.InternallyProjective Mathlib.Condensed.Light.Limits Mathlib.Condensed.Light.Module Mathlib.Condensed.Light.Monoidal Mathlib.Condensed.Light.Sequence Mathlib.Condensed.Light.Small Mathlib.Condensed.Light.TopCatAdjunction Mathlib.Condensed.Light.TopComparison Mathlib.Condensed.Limits Mathlib.Condensed.Module Mathlib.Condensed.Solid Mathlib.Condensed.TopCatAdjunction Mathlib.Condensed.TopComparison Mathlib.FieldTheory.Galois.Profinite Mathlib.Geometry.Manifold.Sheaf.Basic Mathlib.Geometry.Manifold.Sheaf.LocallyRingedSpace Mathlib.Geometry.Manifold.Sheaf.Smooth Mathlib.Geometry.RingedSpace.Basic Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits Mathlib.Geometry.RingedSpace.LocallyRingedSpace.ResidueField Mathlib.Geometry.RingedSpace.LocallyRingedSpace Mathlib.Geometry.RingedSpace.OpenImmersion Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing Mathlib.Geometry.RingedSpace.PresheafedSpace.HasColimits Mathlib.Geometry.RingedSpace.PresheafedSpace Mathlib.Geometry.RingedSpace.SheafedSpace Mathlib.Geometry.RingedSpace.Stalks Mathlib.MeasureTheory.Category.MeasCat Mathlib.RepresentationTheory.Continuous.TopRep Mathlib.RepresentationTheory.Homological.ContCohomology.Basic Mathlib.RepresentationTheory.Homological.ContCohomology.Functoriality Mathlib.RepresentationTheory.Homological.ContCohomology.LowDegree Mathlib.RepresentationTheory.Homological.ContCohomology.Sha Mathlib.RingTheory.Invariant.Profinite Mathlib.Topology.Algebra.Category.ProfiniteGrp.Basic Mathlib.Topology.Algebra.Category.ProfiniteGrp.Completion Mathlib.Topology.Algebra.Category.ProfiniteGrp.Limits Mathlib.Topology.CWComplex.Abstract.Basic Mathlib.Topology.Category.CompHaus.Basic Mathlib.Topology.Category.CompHaus.EffectiveEpi Mathlib.Topology.Category.CompHaus.Frm Mathlib.Topology.Category.CompHaus.Limits Mathlib.Topology.Category.CompHaus.Projective Mathlib.Topology.Category.CompHausLike.Basic Mathlib.Topology.Category.CompHausLike.Cartesian Mathlib.Topology.Category.CompHausLike.EffectiveEpi Mathlib.Topology.Category.CompHausLike.Limits Mathlib.Topology.Category.CompHausLike.SigmaComparison Mathlib.Topology.Category.CompactlyGenerated Mathlib.Topology.Category.Compactum Mathlib.Topology.Category.DeltaGenerated Mathlib.Topology.Category.FinTopCat Mathlib.Topology.Category.LightProfinite.AsLimit Mathlib.Topology.Category.LightProfinite.Basic Mathlib.Topology.Category.LightProfinite.Cartesian Mathlib.Topology.Category.LightProfinite.EffectiveEpi Mathlib.Topology.Category.LightProfinite.Extend Mathlib.Topology.Category.LightProfinite.Injective Mathlib.Topology.Category.LightProfinite.Limits Mathlib.Topology.Category.LightProfinite.Sequence Mathlib.Topology.Category.Locale Mathlib.Topology.Category.Profinite.AsLimit Mathlib.Topology.Category.Profinite.Basic Mathlib.Topology.Category.Profinite.CofilteredLimit Mathlib.Topology.Category.Profinite.EffectiveEpi Mathlib.Topology.Category.Profinite.Extend Mathlib.Topology.Category.Profinite.Limits Mathlib.Topology.Category.Profinite.Nobeling.Basic Mathlib.Topology.Category.Profinite.Nobeling.Induction Mathlib.Topology.Category.Profinite.Nobeling.Span Mathlib.Topology.Category.Profinite.Nobeling.Successor Mathlib.Topology.Category.Profinite.Nobeling.ZeroLimit Mathlib.Topology.Category.Profinite.Product Mathlib.Topology.Category.Profinite.Projective Mathlib.Topology.Category.Stonean.Adjunctions Mathlib.Topology.Category.Stonean.Basic Mathlib.Topology.Category.Stonean.EffectiveEpi Mathlib.Topology.Category.Stonean.Limits Mathlib.Topology.Category.TopCat.Adjunctions Mathlib.Topology.Category.TopCat.EffectiveEpi Mathlib.Topology.Category.TopCat.EpiMono Mathlib.Topology.Category.TopCat.GrothendieckTopology Mathlib.Topology.Category.TopCat.Limits.Basic Mathlib.Topology.Category.TopCat.Limits.Cofiltered Mathlib.Topology.Category.TopCat.Limits.Konig Mathlib.Topology.Category.TopCat.Limits.Products Mathlib.Topology.Category.TopCat.Limits.Pullbacks Mathlib.Topology.Category.TopCat.Monoidal Mathlib.Topology.Category.TopCat.OpenNhds Mathlib.Topology.Category.TopCat.Opens Mathlib.Topology.Category.TopCat.Sphere Mathlib.Topology.Category.TopCat.ULift Mathlib.Topology.Category.TopCat.Yoneda Mathlib.Topology.Category.TopPair Mathlib.Topology.Category.UniformSpace Mathlib.Topology.Compactness.CompactlyGeneratedSpace Mathlib.Topology.Convenient.Category Mathlib.Topology.Convenient.Localization Mathlib.Topology.Covering.FundamentalGroupCircle Mathlib.Topology.Gluing Mathlib.Topology.Homotopy.HomotopyGroup Mathlib.Topology.Homotopy.Lifting Mathlib.Topology.Homotopy.TopCat.Basic Mathlib.Topology.Homotopy.TopCat.Path Mathlib.Topology.Homotopy.TopCat.ToSSet Mathlib.Topology.Homotopy.TopCat.ZerothHomotopy Mathlib.Topology.Order.Category.FrameAdjunction Mathlib.Topology.Sheaves.Abelian Mathlib.Topology.Sheaves.AddCommGrpCat Mathlib.Topology.Sheaves.Alexandrov Mathlib.Topology.Sheaves.CommRingCat Mathlib.Topology.Sheaves.EtaleSpace Mathlib.Topology.Sheaves.Flasque Mathlib.Topology.Sheaves.Forget Mathlib.Topology.Sheaves.Functors Mathlib.Topology.Sheaves.KSheaf Mathlib.Topology.Sheaves.Limits Mathlib.Topology.Sheaves.LocalPredicate Mathlib.Topology.Sheaves.LocallySurjective Mathlib.Topology.Sheaves.MayerVietoris Mathlib.Topology.Sheaves.Module Mathlib.Topology.Sheaves.Over Mathlib.Topology.Sheaves.PUnit Mathlib.Topology.Sheaves.Points Mathlib.Topology.Sheaves.PresheafOfFunctions Mathlib.Topology.Sheaves.Presheaf Mathlib.Topology.Sheaves.SheafCondition.EqualizerProducts Mathlib.Topology.Sheaves.SheafCondition.OpensLeCover Mathlib.Topology.Sheaves.SheafCondition.PairwiseIntersections Mathlib.Topology.Sheaves.SheafCondition.Sites Mathlib.Topology.Sheaves.SheafCondition.UniqueGluing Mathlib.Topology.Sheaves.SheafOfFunctions Mathlib.Topology.Sheaves.Sheaf Mathlib.Topology.Sheaves.Sheafify Mathlib.Topology.Sheaves.Skyscraper Mathlib.Topology.Sheaves.Stalks Mathlib.Topology.Subpath
2
7 files Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Topology Mathlib.Geometry.Manifold.Category.MfldCat.OfModel Mathlib.Topology.Category.Sequential Mathlib.Topology.Category.TopCat.Basic Mathlib.Topology.Category.TopCommRingCat Mathlib.Topology.Order.Category.AlexDisc Mathlib.Topology.Specialization
4
Mathlib.CategoryTheory.ChosenRepresentation (new file) 557

Declarations diff (regex)

+ ChosenCorepresentation
+ ChosenCorepresentation.Simps.coreprObj
+ ChosenRepresentation
+ ChosenRepresentation.Simps.reprObj
+ Hom.continuous
+ apply_eq_iff_homOfElement_comp
+ coreprObj
+ couniv_eq
+ homFromElement
+ homFromElement_comp
+ homFromElement_inj
+ homFromElement_injective
+ homFromElement_univ
+ homOfElement_apply
+ homOfElement_apply'
+ homOfElement_couniv
+ homOfElement_ext
+ homOfElement_univ
+ hom_apply_eq_iff
+ hom_ext'
+ hom_ext_iff'
+ instance : (forget TopCat).ChosenCorepresentation
+ instance : Unique ((forget TopCat.{u}).coreprObj)
+ map_homFromElement_apply
+ map_homFromElement_apply'
+ map_homOfElement_apply
+ map_homOfElement_apply'
+ reprObj
+ univ
++ couniv
++ homOfElement
++ homOfElement_comp
++ homOfElement_inj
++ homOfElement_injective

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 76e8f7d).

  • +69 new declarations
  • −0 removed declarations
+CategoryTheory.ConcreteCategory.apply_eq_iff_homOfElement_comp
+CategoryTheory.ConcreteCategory.couniv
+CategoryTheory.ConcreteCategory.homOfElement
+CategoryTheory.ConcreteCategory.homOfElement_apply
+CategoryTheory.ConcreteCategory.homOfElement_apply'
+CategoryTheory.ConcreteCategory.homOfElement_comp
+CategoryTheory.ConcreteCategory.homOfElement_comp_apply
+CategoryTheory.ConcreteCategory.homOfElement_comp_assoc
+CategoryTheory.ConcreteCategory.homOfElement_couniv
+CategoryTheory.ConcreteCategory.homOfElement_ext
+CategoryTheory.ConcreteCategory.homOfElement_ext_iff
+CategoryTheory.ConcreteCategory.homOfElement_inj
+CategoryTheory.ConcreteCategory.homOfElement_injective
+CategoryTheory.ConcreteCategory.hom_apply_eq_iff
+CategoryTheory.ConcreteCategory.hom_ext'
+CategoryTheory.ConcreteCategory.hom_ext_iff'
+CategoryTheory.Functor.ChosenCorepresentation
+CategoryTheory.Functor.ChosenCorepresentation.Simps.coreprObj
+CategoryTheory.Functor.ChosenCorepresentation.casesOn
+CategoryTheory.Functor.ChosenCorepresentation.coreprBy
+CategoryTheory.Functor.ChosenCorepresentation.ctorIdx
+CategoryTheory.Functor.ChosenCorepresentation.mk
+CategoryTheory.Functor.ChosenCorepresentation.mk.noConfusion
+CategoryTheory.Functor.ChosenCorepresentation.noConfusion
+CategoryTheory.Functor.ChosenCorepresentation.noConfusionType
+CategoryTheory.Functor.ChosenCorepresentation.obj
+CategoryTheory.Functor.ChosenCorepresentation.rec
+CategoryTheory.Functor.ChosenCorepresentation.recOn
+CategoryTheory.Functor.ChosenRepresentation
+CategoryTheory.Functor.ChosenRepresentation.Simps.reprObj
+CategoryTheory.Functor.ChosenRepresentation.casesOn
+CategoryTheory.Functor.ChosenRepresentation.ctorIdx
+CategoryTheory.Functor.ChosenRepresentation.mk
+CategoryTheory.Functor.ChosenRepresentation.mk.noConfusion
+CategoryTheory.Functor.ChosenRepresentation.noConfusion
+CategoryTheory.Functor.ChosenRepresentation.noConfusionType
+CategoryTheory.Functor.ChosenRepresentation.obj
+CategoryTheory.Functor.ChosenRepresentation.rec
+CategoryTheory.Functor.ChosenRepresentation.recOn
+CategoryTheory.Functor.ChosenRepresentation.reprBy
+CategoryTheory.Functor.coreprObj
+CategoryTheory.Functor.couniv
+CategoryTheory.Functor.homFromElement
+CategoryTheory.Functor.homFromElement_comp
+CategoryTheory.Functor.homFromElement_comp_apply
+CategoryTheory.Functor.homFromElement_comp_assoc
+CategoryTheory.Functor.homFromElement_inj
+CategoryTheory.Functor.homFromElement_injective
+CategoryTheory.Functor.homFromElement_univ
+CategoryTheory.Functor.homOfElement
+CategoryTheory.Functor.homOfElement_comp
+CategoryTheory.Functor.homOfElement_comp_apply
+CategoryTheory.Functor.homOfElement_comp_assoc
+CategoryTheory.Functor.homOfElement_inj
+CategoryTheory.Functor.homOfElement_injective
+CategoryTheory.Functor.homOfElement_univ
+CategoryTheory.Functor.map_homFromElement_apply
+CategoryTheory.Functor.map_homFromElement_apply'
+CategoryTheory.Functor.map_homOfElement_apply
+CategoryTheory.Functor.map_homOfElement_apply'
+CategoryTheory.Functor.reprObj
+CategoryTheory.Functor.univ
+TopCat.Hom.continuous
+TopCat.coreprBy_homEquiv_apply
+TopCat.coreprBy_homEquiv_symm_apply
+TopCat.coreprObj_carrier
+TopCat.couniv_eq
+TopCat.instChosenCorepresentationForgetContinuousMapCarrier
+TopCat.instUniqueCarrierCoreprObjForgetContinuousMap

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
5156 1 exposed public sections

Current commit 76e8f7d877
Reference commit a495318fed

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@joelriou joelriou added the LLM-generated PRs with substantial input from LLMs - review accordingly label Nov 22, 2026
@joelriou

Copy link
Copy Markdown
Contributor

I am not convinced we need a new typeclass. We already have RepresentableBy and IsRepresentable. I think it is more than enough.

@robertmaxton42 robertmaxton42 left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, why are you applying the LLM-generated label? As I said, this has no AI generated code in it.

Also:

  • This specific use case is common, useful, and deserves convenience and automation.
  • RepresentableBy is not a typeclass, thus fails the convenience check: users would have to remember and call some FooCat.forget_corepresentableBy.homEquiv.symm every time -- both verbose and minimally distinct in terms of maintainance burden/API-duplication from per-category FooCat.homOfElement.
  • IsRepresentable is a Prop, which limits use of decide or cbv when reducing otherwise-trivial statements involving e.g. PUnit-as-TypeCat or TopCat objects or Discrete PUnit in Cat.
    • This is particularly important because there's so much def-eq-related friction in the ConcreteCategory design already -- quite often it is really nice to be able to cut through all of that with a simple "reduce, oh hey these things are functions out of/into unit and can be tested as such". That becomes impossible with a Prop.

There are already many definitions in the CategoryTheory library specifically that duplicate essentially this code that could be de-duplicated using this typeclass, while only increasing convenience and usability.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM-generated PRs with substantial input from LLMs - review accordingly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants