Skip to content

Add additive categories infrastructure#2304

Merged
jdchristensen merged 3 commits into
HoTT:masterfrom
CharlesCNorton:patch-7
Jun 15, 2026
Merged

Add additive categories infrastructure#2304
jdchristensen merged 3 commits into
HoTT:masterfrom
CharlesCNorton:patch-7

Conversation

@CharlesCNorton

@CharlesCNorton CharlesCNorton commented Aug 2, 2025

Copy link
Copy Markdown
Contributor

Defines additive categories on top of the semi-additive structure from #2305, following the design suggested in review.

Provides:

  • AdditiveCategory: a SemiAdditiveCategory together with an Inverse operation on each hom-set and the left inverse law
  • An IsAbGroup instance and a bundled abgroup_hom : AbGroup for each hom-set
  • Uniqueness of additive inverses, and compatibility of negation with composition on both sides
  • AdditiveFunctor: a functor whose action on each hom-set is monoid-preserving, with preservation of zero morphisms and negation derived
  • Identity and composition of additive functors

@jdchristensen

Copy link
Copy Markdown
Collaborator

Thanks @CharlesCNorton ! I just pushed a commit that shows that add_zero_morphism isn't needed. I suspect that many of your other wrappers can probably be avoided (maybe with the addition of some appropriate instances).

Comment on lines +18 to +21
Class AdditiveCategory := {
cat : PreCategory;
add_zero :: ZeroObject cat;
add_biproduct : forall (X Y : object cat), Biproduct X Y;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm confused by this class. The three fields above are already enough to show that cat has a unique enrichment over commutative monoids. That means that eight of the remaining nine fields are redundant. You only need to assume that inverses exist.

Here's an idea: Have a file, maybe called "SemiAdditive.v", which has a class with just the above three fields. In that file, prove that in every SemiAdditive category, the hom sets are commutative monoids in a way compatible with composition. It's probably best to use IsCommutativeMonoid from Classes/interfaces/abstract_algebra.v, which should then give you access to lots of lemmas (and notations) that hold for commutative monoids. Then, in Additive.v, you add the axiom that the commutative monoid structure defined in SemiAdditive.v has inverses. Then you can in fact say that the hom sets are abelian groups, using Algebra/AbGroups/AbelianGroup.v.

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'm confused by this class. The three fields above are already enough to show that cat has a unique enrichment over commutative monoids. That means that eight of the remaining nine fields are redundant. You only need to assume that inverses exist.

Here's an idea: Have a file, maybe called "SemiAdditive.v", which has a class with just the above three fields. In that file, prove that in every SemiAdditive category, the hom sets are commutative monoids in a way compatible with composition. It's probably best to use IsCommutativeMonoid from Classes/interfaces/abstract_algebra.v, which should then give you access to lots of lemmas (and notations) that hold for commutative monoids. Then, in Additive.v, you add the axiom that the commutative monoid structure defined in SemiAdditive.v has inverses. Then you can in fact say that the hom sets are abelian groups, using Algebra/AbGroups/AbelianGroup.v.

Just checking in - working on this, but it's taking some sweat. Will put a PR in soon.

CharlesCNorton added a commit to CharlesCNorton/Coq-HoTT that referenced this pull request Aug 10, 2025
Extracting SemiAdditive.v from additive categories work per PR HoTT#2304 review.

**Provides:**
- `SemiAdditiveCategory`: Class with just cat, zero object, and biproducts
- Derives `IsCommutativeMonoid` structure on morphisms using biproducts
- Addition defined as: f + g = ∇ ∘ (f ⊕ g) ∘ Δ  
- Proves identity laws, commutativity, associativity from biproduct axioms
- Bilinearity of composition (distributivity)

**Note:** The file is almost 1000 lines), especially the associativity proof. This was the only way I could get it to work - would very much appreciate help simplifying and identifying which helper lemmas can be removed. The associativity proof in particular requires many intermediate lemmas about how biproducts interact. It took me an entire week of 16 hour days to get here, but I assume there is a much more elegant method.

Addresses review feedback from HoTT#2304. Next step is to update AdditiveCategories.v to build on this, adding only the inverse axiom.
@CharlesCNorton CharlesCNorton force-pushed the patch-7 branch 10 times, most recently from 16d96dd to e96c31c Compare June 11, 2026 03:33
@CharlesCNorton

Copy link
Copy Markdown
Contributor Author

I think this is good to go. I've been wrong in the past though....

Comment thread theories/Categories/Additive/Additive.v
Comment thread theories/Categories/Additive/Additive.v Outdated
Comment thread theories/Categories/Additive/Additive.v Outdated
Comment thread theories/Categories/Additive/Additive.v Outdated
Comment thread theories/Categories/Additive/Additive.v Outdated
Comment thread theories/Categories/Additive/Additive.v Outdated
- Remove the unused imports Categories.Additive.Biproducts and
  Classes.theory.groups.  Nothing in the file refers to either: the
  monoid-morphism helpers (IsMonoidPreserving, id_monoid_morphism,
  compose_monoid_morphism, preserves_sg_op, ...) all come from
  abstract_algebra, which is already imported, and biproducts are reached
  transitively through SemiAdditive.

- Rename inverse_morphism_unique to hom_moveL_1V, paralleling the group
  movement lemma grp_moveL_1V, and update its two uses.

- Name the AdditiveFunctor fields consistently: the coercion is addfunctor
  and the monoid-preservation instance is ismonoidpreserving_addfunctor.

- Remove the AdditiveFunctorLaws section; its three lemmas were direct
  applications of preserves_sg_op, preserves_mon_unit and preserves_inverse,
  which apply to an additive functor's action without a wrapper.
@jdchristensen

Copy link
Copy Markdown
Collaborator

LGTM. Thanks!

@jdchristensen jdchristensen merged commit 40659d8 into HoTT:master Jun 15, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants