Skip to content

[Merged by Bors] - feat(GroupWithZero): monoid with zero homs to (co)products#25466

Closed
pechersky wants to merge 25 commits intomasterfrom
pechersky/g-w-zero-prod
Closed

[Merged by Bors] - feat(GroupWithZero): monoid with zero homs to (co)products#25466
pechersky wants to merge 25 commits intomasterfrom
pechersky/g-w-zero-prod

Conversation

@pechersky
Copy link
Copy Markdown
Contributor

Factored out from #22420


Open in Gitpod

@github-actions github-actions bot added t-algebra Algebra (groups, rings, fields, etc) large-import Automatically added label for PRs with a significant increase in transitive imports labels Jun 5, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 5, 2025

PR summary 8b8fe2fa63

Import changes exceeding 2%

% File
+52.51% Mathlib.Algebra.GroupWithZero.Prod

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Algebra.GroupWithZero.Prod 219 334 +115 (+52.51%)
Import changes for all files
Files Import difference
252 files Mathlib.Algebra.Algebra.Basic Mathlib.Algebra.Algebra.Bilinear Mathlib.Algebra.Algebra.Equiv Mathlib.Algebra.Algebra.Hom.Rat Mathlib.Algebra.Algebra.Hom Mathlib.Algebra.Algebra.NonUnitalHom Mathlib.Algebra.Algebra.NonUnitalSubalgebra Mathlib.Algebra.Algebra.Operations Mathlib.Algebra.Algebra.Opposite Mathlib.Algebra.Algebra.Pi Mathlib.Algebra.Algebra.Prod Mathlib.Algebra.Algebra.RestrictScalars Mathlib.Algebra.Algebra.Subalgebra.Basic Mathlib.Algebra.Algebra.Subalgebra.Directed Mathlib.Algebra.Algebra.Subalgebra.Lattice Mathlib.Algebra.Algebra.Subalgebra.MulOpposite Mathlib.Algebra.Algebra.Subalgebra.Order Mathlib.Algebra.Algebra.Subalgebra.Pi Mathlib.Algebra.Algebra.Subalgebra.Pointwise Mathlib.Algebra.Algebra.Subalgebra.Prod Mathlib.Algebra.Algebra.Subalgebra.Tower Mathlib.Algebra.Algebra.Subalgebra.Unitization Mathlib.Algebra.Algebra.Tower Mathlib.Algebra.Algebra.Unitization Mathlib.Algebra.Category.AlgCat.Basic Mathlib.Algebra.Category.AlgCat.Monoidal Mathlib.Algebra.Category.AlgCat.Symmetric Mathlib.Algebra.Category.AlgebraCat.Symmetric Mathlib.Algebra.Category.Grp.Biproducts Mathlib.Algebra.Category.Grp.CartesianMonoidal Mathlib.Algebra.Category.Grp.ChosenFiniteProducts Mathlib.Algebra.Category.Grp.Colimits Mathlib.Algebra.Category.Grp.LeftExactFunctor Mathlib.Algebra.Category.Grp.Limits Mathlib.Algebra.Category.Grp.ZModuleEquivalence Mathlib.Algebra.Category.ModuleCat.Algebra Mathlib.Algebra.Category.ModuleCat.Basic Mathlib.Algebra.Category.ModuleCat.Colimits Mathlib.Algebra.Category.ModuleCat.FilteredColimits Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed Mathlib.Algebra.Category.ModuleCat.Monoidal.Symmetric Mathlib.Algebra.Category.ModuleCat.Tannaka Mathlib.Algebra.Category.MonCat.Limits Mathlib.Algebra.Category.Ring.Limits Mathlib.Algebra.Central.Basic Mathlib.Algebra.Central.Defs Mathlib.Algebra.Central.Matrix Mathlib.Algebra.DirectSum.AddChar Mathlib.Algebra.DualNumber Mathlib.Algebra.Equiv.TransferInstance Mathlib.Algebra.Field.Subfield.Basic Mathlib.Algebra.FreeAlgebra Mathlib.Algebra.FreeNonUnitalNonAssocAlgebra Mathlib.Algebra.Group.AddChar Mathlib.Algebra.Homology.ExactSequence Mathlib.Algebra.Homology.Factorizations.Basic Mathlib.Algebra.Homology.GrothendieckAbelian Mathlib.Algebra.Homology.HomologicalComplexAbelian Mathlib.Algebra.Homology.ShortComplex.ExactFunctor Mathlib.Algebra.Homology.ShortComplex.Exact Mathlib.Algebra.Homology.ShortComplex.Linear Mathlib.Algebra.Homology.ShortComplex.Preadditive Mathlib.Algebra.Homology.ShortComplex.ShortExact Mathlib.Algebra.Homology.ShortComplex.SnakeLemma Mathlib.Algebra.Lie.Basic Mathlib.Algebra.Lie.NonUnitalNonAssocAlgebra Mathlib.Algebra.Module.Bimodule Mathlib.Algebra.Module.Injective Mathlib.Algebra.Module.Submodule.Invariant Mathlib.Algebra.Module.Submodule.Pointwise Mathlib.Algebra.MonoidAlgebra.Basic Mathlib.Algebra.MonoidAlgebra.Defs Mathlib.Algebra.MonoidAlgebra.Degree Mathlib.Algebra.MonoidAlgebra.Division Mathlib.Algebra.MonoidAlgebra.MapDomain Mathlib.Algebra.MonoidAlgebra.NoZeroDivisors Mathlib.Algebra.MonoidAlgebra.Support Mathlib.Algebra.Order.Star.Prod Mathlib.Algebra.Polynomial.Basic Mathlib.Algebra.Polynomial.Basis Mathlib.Algebra.Polynomial.Degree.Definitions Mathlib.Algebra.Polynomial.Degree.Monomial Mathlib.Algebra.Polynomial.Eval.Algebra Mathlib.Algebra.Polynomial.Eval.Defs Mathlib.Algebra.Polynomial.Monomial Mathlib.Algebra.Ring.CentroidHom Mathlib.Algebra.Ring.Semireal.Defs Mathlib.Algebra.Ring.Subring.Basic Mathlib.Algebra.Ring.Subring.MulOpposite Mathlib.Algebra.Ring.Subring.Pointwise Mathlib.Algebra.Ring.Subsemiring.Basic Mathlib.Algebra.Ring.Subsemiring.MulOpposite Mathlib.Algebra.Ring.Subsemiring.Pointwise Mathlib.Algebra.Ring.SumsOfSquares Mathlib.Algebra.SkewMonoidAlgebra.Basic Mathlib.Algebra.Small.Group Mathlib.Algebra.Small.Module Mathlib.Algebra.Small.Ring Mathlib.Algebra.Star.CentroidHom Mathlib.Algebra.Star.Free Mathlib.Algebra.Star.Module Mathlib.Algebra.Star.NonUnitalSubalgebra Mathlib.Algebra.Star.NonUnitalSubsemiring Mathlib.Algebra.Star.StarAlgHom Mathlib.Algebra.Star.Subalgebra Mathlib.Algebra.Star.Subsemiring Mathlib.Algebra.TrivSqZeroExt Mathlib.Algebra.Vertex.HVertexOperator Mathlib.Algebra.Vertex.VertexOperator Mathlib.CategoryTheory.Abelian.CommSq Mathlib.CategoryTheory.Abelian.DiagramLemmas.Four Mathlib.CategoryTheory.Abelian.DiagramLemmas.KernelCokernelComp Mathlib.CategoryTheory.Abelian.EpiWithInjectiveKernel Mathlib.CategoryTheory.Abelian.Exact Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Basic Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Colim Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Connected Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.FunctorCategory Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Indization Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Sheaf Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Types Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Basic Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Monomorphisms Mathlib.CategoryTheory.Abelian.Indization Mathlib.CategoryTheory.Abelian.Opposite Mathlib.CategoryTheory.Abelian.Refinements Mathlib.CategoryTheory.Abelian.SerreClass.Basic Mathlib.CategoryTheory.Abelian.Transfer Mathlib.CategoryTheory.Action.Continuous Mathlib.CategoryTheory.Action.Limits Mathlib.CategoryTheory.Action.Monoidal Mathlib.CategoryTheory.Adjunction.Additive Mathlib.CategoryTheory.Generator.Abelian Mathlib.CategoryTheory.Generator.Indization Mathlib.CategoryTheory.Generator.Preadditive Mathlib.CategoryTheory.Limits.ConcreteCategory.WithAlgebraicStructures Mathlib.CategoryTheory.Linear.Yoneda Mathlib.CategoryTheory.Localization.CalculusOfFractions.Preadditive Mathlib.CategoryTheory.Monoidal.Cartesian.CommGrp_ Mathlib.CategoryTheory.Monoidal.Cartesian.CommMon_ Mathlib.CategoryTheory.Monoidal.Cartesian.Grp_ Mathlib.CategoryTheory.Monoidal.Cartesian.Mon_ Mathlib.CategoryTheory.Monoidal.CommGrp_ Mathlib.CategoryTheory.Monoidal.Grp_ Mathlib.CategoryTheory.Monoidal.Internal.Module Mathlib.CategoryTheory.Monoidal.Internal.Types.CommGrp_ Mathlib.CategoryTheory.Monoidal.Internal.Types.Grp_ Mathlib.CategoryTheory.ObjectProperty.EpiMono Mathlib.CategoryTheory.ObjectProperty.Extensions Mathlib.CategoryTheory.Preadditive.CommGrp_ Mathlib.CategoryTheory.Preadditive.Indization Mathlib.CategoryTheory.Preadditive.Opposite Mathlib.CategoryTheory.Preadditive.Transfer Mathlib.CategoryTheory.Preadditive.Yoneda.Basic Mathlib.CategoryTheory.Shift.Opposite Mathlib.CategoryTheory.Shift.ShiftedHomOpposite Mathlib.CategoryTheory.Sites.Abelian Mathlib.CategoryTheory.Subobject.NoetherianObject Mathlib.CategoryTheory.Triangulated.Opposite.Basic Mathlib.CategoryTheory.Triangulated.Opposite.Triangle Mathlib.Combinatorics.Optimization.ValuedCSP Mathlib.Computability.ContextFreeGrammar Mathlib.Computability.Language Mathlib.Computability.RegularExpressions Mathlib.Data.Matrix.Auto Mathlib.Data.Matrix.Basic Mathlib.Data.Matrix.Basis Mathlib.Data.Matrix.Bilinear Mathlib.Data.Matrix.Block Mathlib.Data.Matrix.Composition Mathlib.Data.Matrix.ConjTranspose Mathlib.Data.Matrix.DualNumber Mathlib.Data.Matrix.Hadamard Mathlib.Data.Matrix.Invertible Mathlib.Data.Matrix.Notation Mathlib.Data.Matrix.Reflection Mathlib.Data.Matrix.RowCol Mathlib.Data.Set.Semiring Mathlib.Dynamics.Flow Mathlib.Dynamics.Minimal Mathlib.Dynamics.OmegaLimit Mathlib.Geometry.RingedSpace.Basic Mathlib.GroupTheory.Coxeter.Matrix Mathlib.LinearAlgebra.Basis.Basic Mathlib.LinearAlgebra.Basis.Bilinear Mathlib.LinearAlgebra.Basis.Defs Mathlib.LinearAlgebra.Basis.Fin Mathlib.LinearAlgebra.Basis.Flag Mathlib.LinearAlgebra.Basis.Prod Mathlib.LinearAlgebra.Basis.SMul Mathlib.LinearAlgebra.Basis.Submodule Mathlib.LinearAlgebra.BilinearForm.Basic Mathlib.LinearAlgebra.BilinearForm.Hom Mathlib.LinearAlgebra.Countable Mathlib.LinearAlgebra.Dual.Basis Mathlib.LinearAlgebra.Finsupp.LSum Mathlib.LinearAlgebra.Finsupp.LinearCombination Mathlib.LinearAlgebra.Finsupp.Pi Mathlib.LinearAlgebra.Finsupp.Supported Mathlib.LinearAlgebra.FreeModule.Basic Mathlib.LinearAlgebra.LinearIndependent.Basic Mathlib.LinearAlgebra.LinearIndependent.Defs Mathlib.LinearAlgebra.LinearPMap Mathlib.LinearAlgebra.Matrix.Circulant Mathlib.LinearAlgebra.Matrix.DotProduct Mathlib.LinearAlgebra.Matrix.Permanent Mathlib.LinearAlgebra.Matrix.Symmetric Mathlib.LinearAlgebra.Matrix.Trace Mathlib.LinearAlgebra.Matrix.Unique Mathlib.LinearAlgebra.Multilinear.Basic Mathlib.LinearAlgebra.Multilinear.Basis Mathlib.LinearAlgebra.Multilinear.Curry Mathlib.LinearAlgebra.Multilinear.Pi Mathlib.LinearAlgebra.Multilinear.TensorProduct Mathlib.LinearAlgebra.PiTensorProduct Mathlib.LinearAlgebra.Pi Mathlib.LinearAlgebra.Prod Mathlib.LinearAlgebra.SModEq Mathlib.LinearAlgebra.TensorProduct.Associator Mathlib.LinearAlgebra.TensorProduct.Basic Mathlib.LinearAlgebra.TensorProduct.Opposite Mathlib.LinearAlgebra.TensorProduct.Pi Mathlib.LinearAlgebra.TensorProduct.Prod Mathlib.LinearAlgebra.TensorProduct.Tower Mathlib.MeasureTheory.Constructions.AddChar Mathlib.RingTheory.Adjoin.Basic Mathlib.RingTheory.AlgebraTower Mathlib.RingTheory.HahnSeries.Multiplication Mathlib.RingTheory.HahnSeries.Summable Mathlib.RingTheory.IntegralClosure.Algebra.Defs Mathlib.RingTheory.IntegralClosure.IsIntegral.Defs Mathlib.RingTheory.IntegralClosure.IsIntegralClosure.Defs Mathlib.RingTheory.LocalRing.Subring Mathlib.RingTheory.NonUnitalSubring.Basic Mathlib.RingTheory.NonUnitalSubsemiring.Basic Mathlib.RingTheory.PiTensorProduct Mathlib.RingTheory.SimpleRing.Field Mathlib.RingTheory.TensorProduct.Basic Mathlib.RingTheory.TensorProduct.Pi Mathlib.Tactic.Algebraize Mathlib.Topology.Algebra.Algebra.Rat Mathlib.Topology.Algebra.ConstMulAction Mathlib.Topology.Algebra.GroupWithZero Mathlib.Topology.Algebra.Monoid.AddChar Mathlib.Topology.Algebra.Monoid Mathlib.Topology.Algebra.MulAction Mathlib.Topology.Algebra.ProperAction.Basic Mathlib.Topology.Algebra.ProperConstSMul Mathlib.Topology.Algebra.Star Mathlib.Topology.ApproximateUnit Mathlib.Topology.LocallyConstant.Algebra
2
14 files Mathlib.Algebra.Algebra.Rat Mathlib.Algebra.GroupWithZero.Action.Pointwise.Finset Mathlib.Algebra.GroupWithZero.Action.Pointwise.Set Mathlib.Algebra.GroupWithZero.Subgroup Mathlib.Algebra.GroupWithZero.Submonoid.Pointwise Mathlib.Algebra.Module.Equiv.Basic Mathlib.Algebra.Ring.Action.End Mathlib.Algebra.Ring.Action.Group Mathlib.Algebra.Ring.Subgroup Mathlib.Algebra.Star.Prod Mathlib.Data.Set.Pointwise.Support Mathlib.GroupTheory.Divisible Mathlib.LinearAlgebra.GeneralLinearGroup Mathlib.Topology.Bornology.Absorbs
3
Mathlib.Algebra.GroupWithZero.Action.Basic Mathlib.Algebra.Ring.AddAut 4
3 files Mathlib.Algebra.Order.Kleene Mathlib.Algebra.Order.Ring.Prod Mathlib.Algebra.Ring.Prod
93
Mathlib.Algebra.GroupWithZero.Prod 115
Mathlib.Algebra.GroupWithZero.ProdHom (new file) 339

Declarations diff

+ WithZero.toMonoidWithZeroHom_withZeroUnitsEquiv
+ apply_one_apply_eq
+ commute_inl_inr
+ comp_one
+ fst
+ fst_apply_coe
+ fst_comp_inl
+ fst_comp_inr
+ fst_inl
+ fst_inr_apply_of_ne_zero
+ fst_surjective
+ inl
+ inl_apply_unit
+ inl_injective
+ inl_mul_inr_eq_mk_of_unit
+ inr
+ inr_apply_unit
+ inr_injective
+ map_eq_zero_iff
+ one
+ one_apply_apply_eq
+ one_apply_of_ne_zero
+ one_apply_val_unit
+ one_apply_zero
+ one_comp
+ recZeroCoe_one
+ snd
+ snd_apply_coe
+ snd_comp_inl
+ snd_comp_inr
+ snd_inl_apply_of_ne_zero
+ snd_inr
+ snd_surjective
+ withZeroUnitsEquiv_symm_apply_coe

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh 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).

@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes. label Jun 5, 2025

/-- The trivial homomorphism between monoids with zero, sending everything to 1 other than 0. -/
noncomputable def trivial (M N : Type*) [MulZeroOneClass M] [MulZeroOneClass N]
[DecidablePred fun x : M ↦ x = 0] [Nontrivial M] [NoZeroDivisors M] :
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd suggest using the simpler

Suggested change
[DecidablePred fun x : M ↦ x = 0] [Nontrivial M] [NoZeroDivisors M] :
[DecidableEq M] [Nontrivial M] [NoZeroDivisors M] :

until you reach a case where you really need the precision

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The DecidablePred = 0 is trivially true for WithZero X for arbitrary X. Is that alright?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does mathlib know that fact, and is it used in this PR right now?

If everything is noncomputable for WithZero right now anyway, I'd prefer to leave that to a follow-up PR with the other changes you have in mind.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've removed the noncomputable here. Also, this DecidablePred is how the existing withZeroUnitsEquiv is defined.

@pechersky pechersky removed the awaiting-author A reviewer has asked the author a question or requested changes. label Jun 6, 2025
@YaelDillies YaelDillies added awaiting-author A reviewer has asked the author a question or requested changes. awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. labels Jun 6, 2025
and absorbing lemmas
@github-actions github-actions bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
…rooneclass

basically associativity isn't needed
@github-actions github-actions bot added merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) and removed awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. labels Jun 6, 2025
@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

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

Thanks!

maintainer delegate

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 7, 2025

🚀 Pull request has been placed on the maintainer queue by YaelDillies.

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jun 7, 2025
@riccardobrasca
Copy link
Copy Markdown
Member

Thanks!

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 7, 2025

✌️ pechersky can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Jun 7, 2025
@pechersky
Copy link
Copy Markdown
Contributor Author

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Jun 9, 2025
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 9, 2025

Build failed:

@pechersky
Copy link
Copy Markdown
Contributor Author

bors r-

@pechersky
Copy link
Copy Markdown
Contributor Author

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Jun 9, 2025
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 9, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(GroupWithZero): monoid with zero homs to (co)products [Merged by Bors] - feat(GroupWithZero): monoid with zero homs to (co)products Jun 9, 2025
@mathlib-bors mathlib-bors bot closed this Jun 9, 2025
@mathlib-bors mathlib-bors bot deleted the pechersky/g-w-zero-prod branch June 9, 2025 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). large-import Automatically added label for PRs with a significant increase in transitive imports t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants