Skip to content

x feat(Algebra): generalize ModuleCat to Semiring#30636

Closed
alreadydone wants to merge 1 commit intoleanprover-community:masterfrom
alreadydone:ModuleCat_semiring
Closed

x feat(Algebra): generalize ModuleCat to Semiring#30636
alreadydone wants to merge 1 commit intoleanprover-community:masterfrom
alreadydone:ModuleCat_semiring

Conversation

@alreadydone
Copy link
Copy Markdown
Contributor

@alreadydone alreadydone commented Oct 17, 2025

... so that ModuleCat only contains the AddCommMonoid data, not AddCommGroup. Consequently, the forgetful functor to AddCommGrpCat creates the neg and zsmul fields of AddCommGroup that may not agree with a preexisting instance.


Open in Gitpod

@alreadydone alreadydone added t-category-theory Category theory t-algebra Algebra (groups, rings, fields, etc) awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. labels Oct 17, 2025
@alreadydone alreadydone marked this pull request as ready for review October 17, 2025 17:10
@github-actions
Copy link
Copy Markdown

PR summary 6b1d0f08cb

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ forget₂_addCommMonCat_map
+ forget₂_addCommMonCat_obj
+ forget₂_addCommMonCat_obj_moduleCat_of
+ hasForgetToAddCommMonoid
+ instance (M : ModuleCat R) : AddCommGroup M := Module.addCommMonoidToAddCommGroup R
+ instance : (forget₂ (ModuleCat.{v} R) AddCommMonCat.{v}).ReflectsIsomorphisms
+ instance : AddCommMonoid (M ⟶ N)
+ instance : CommSemiring ((𝟙_ (ModuleCat.{u} R) : ModuleCat.{u} R) : Type u)
+ instance : HasZeroMorphisms (ModuleCat.{v} R)
+ instance : SMul ℕ (M ⟶ N)
+ instance {R} [CommRing R] : CommRing ((𝟙_ (ModuleCat.{u} R) : ModuleCat.{u} R) : Type u)
- instance : CommRing ((𝟙_ (ModuleCat.{u} R) : ModuleCat.{u} R) : Type u)
- mkOfSMul_smul

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).

/-- the underlying type of an object in `ModuleCat R` -/
carrier : Type v
[isAddCommGroup : AddCommGroup carrier]
[isAddCommMonoid : AddCommMonoid carrier]
Copy link
Copy Markdown
Contributor

@joelriou joelriou Oct 17, 2025

Choose a reason for hiding this comment

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

In case R is a ring, this does not change the category of modules up to an equivalence, but if M : ModuleCat R and m : M, we would no longer be able to write an equality such as m - m = 0. This seems to be an excessively radical change to me. Here, we may relax the Ring assumption as Semiring, but if would want modules over semirings without neg, I think you need to define a separate category.

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 added the instance (M : ModuleCat R) : AddCommGroup M := Module.addCommMonoidToAddCommGroup R below so m - m = 0 still works, but this causes defeq issues which can be hard to fix. I think @plp127 would be interested to see the fallout since he suggested this approach in #28826 (comment). For a while I thought this might result in less code change than #30624, but apparently not. I now have a better approach in #30638 so I'm closing this.

@joelriou joelriou added the awaiting-author A reviewer has asked the author a question or requested changes. label Oct 17, 2025
@alreadydone alreadydone changed the title feat(Algebra): generalize ModuleCat to Semiring x feat(Algebra): generalize ModuleCat to Semiring Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. t-algebra Algebra (groups, rings, fields, etc) t-category-theory Category theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants