Skip to content

Conversation

@CharlesCNorton
Copy link
Contributor

Extracting Biproducts.v from stable categories formalization (#2288).

Status: WIP - not ready for merge

Changes from original formalization:

  • Fixed imports (removed non-existent ZeroMorphismLemmas.v)
  • Made ZeroObject implicit throughout using `{Z : ZeroObject C}
  • Updated zero_morphism calls to use implicit Z parameter
  • Removed unused definitions (bi_inl, bi_inr, bi_outl, bi_outr, biproduct)
  • Removed unused lemma (biproduct_prod_unique)
  • Applied HoTT style conventions

The file provides:

  • BiproductData: injection/projection morphisms
  • IsBiproduct: axioms (beta_l, beta_r, mixed_l, mixed_r)
  • HasBiproductUniversal: universal properties as product and coproduct
  • Biproduct: complete structure combining the above
  • Operations: biproduct_coprod_mor, biproduct_prod_mor with beta lemmas
  • Uniqueness lemma: biproduct_coprod_unique

@jdchristensen This is work in progress, naturally - submitting early for initial feedback. I will be continuously re-reviewing for anything I missed. Thank you very much for your time

Extracting Biproducts.v from stable categories formalization (HoTT#2288).

**Status: WIP - not ready for merge**

Changes from original formalization:
- Fixed imports (removed non-existent ZeroMorphismLemmas.v)
- Made `ZeroObject` implicit throughout using `` `{Z : ZeroObject C} ``
- Updated `zero_morphism` calls to use implicit Z parameter
- Removed unused definitions (bi_inl, bi_inr, bi_outl, bi_outr, biproduct)
- Removed unused lemma (biproduct_prod_unique)
- Applied HoTT style conventions

The file provides:
- `BiproductData`: injection/projection morphisms
- `IsBiproduct`: axioms (beta_l, beta_r, mixed_l, mixed_r)
- `HasBiproductUniversal`: universal properties as product and coproduct
- `Biproduct`: complete structure combining the above
- Operations: biproduct_coprod_mor, biproduct_prod_mor with beta lemmas
- Uniqueness lemma: biproduct_coprod_unique

@jdchristensen This is work in progress, naturally - submitting early for initial feedback. I will be continuously re-reviewing for anything I missed. Thank you very much for your time
Following patterns from ZeroObject, make Biproduct a Class to enable
automatic inference. Add coercion from BiproductData to object which
allows writing just (biproduct_data B) instead of the verbose
(biproduct_obj (biproduct_data B)) throughout.

Changes:
- Change Record Biproduct to Class Biproduct for typeclass inference
- Add Coercion biproduct_obj : BiproductData >-> object
- Simplify all morphism type expressions using the new coercion
- Style: use 1: instead of braces in biproduct_coprod_unique proof

This brings the file in line with the patterns established in PR HoTT#2293.
- Move parameter to next line in HasBiproductUniversal (80 char limit)

- Add coercion from Biproduct to BiproductData for cleaner API usage
Copy link
Collaborator

@jdchristensen jdchristensen left a comment

Choose a reason for hiding this comment

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

This is looking good! Just a few minor things.

@jdchristensen
Copy link
Collaborator

@Alizter @JasonGross Do either of you know why the doc-dep-graphs build is failing? It happened on two PRs today. The error is

+ (script @ line 12) $ cabal update
Config file path source is default config file.
Config file /home/coq/.cabal/config not found.
Writing default configuration to /home/coq/.cabal/config
<repo>/root.json does not have enough signatures signed with the appropriate keys

@jdchristensen
Copy link
Collaborator

@CharlesCNorton BTW, you said that this is WIP, but it looks fairly polished. If your plan is to add more, I recommend that we first address the comments above, and then merge this and do additional work in a followup PR.

@JasonGross
Copy link
Contributor

JasonGross commented Jul 29, 2025

The internet suggests this is an issue with cabal-install metadata being outdated, and that adding ghcup install cabal before cabal update might fix the issue.

If that doesn't work, we can try

rm -rf ~/.cabal/packages/hackage.haskell.org  # might need to be a different path
ghcup upgrade
ghcup install cabal latest
ghcup set cabal latest
sed -i 's|http://hackage|https://hackage|' ~/.cabal/config
cabal update

(not sure if all these steps are needed)

CharlesCNorton and others added 5 commits July 30, 2025 18:55
- Remove unnecessary `: Type` annotations from Records and Class
- Add missing biproduct_prod_unique lemma for dual completeness
- Name hypotheses in lemma signatures rather than using intros
- Leverage coercion to write `B` instead of `biproduct_data B`
Per reviewer feedback, add biproduct_coprod_universal and biproduct_prod_universal 
definitions to avoid repeating @center expressions. Beta lemmas still use 
set/destruct due to Coq type inference limitations with mixed sigma/product types.
@jdchristensen jdchristensen merged commit 97e533b into HoTT:master Jul 31, 2025
21 of 22 checks passed
@CharlesCNorton CharlesCNorton deleted the patch-7 branch July 31, 2025 21:07
CharlesCNorton added a commit to CharlesCNorton/Coq-HoTT that referenced this pull request Aug 2, 2025
Extracting AdditiveCategories.v from stable categories formalization (HoTT#2288).

**Provides:**
- `AdditiveCategory`: Categories with zero objects, biproducts, and abelian group structure on hom-sets
- Helper functions for accessing biproduct components  
- Universal property operations with uniqueness (both product and coproduct)
- `AdditiveFunctor`: Preserves zero objects, biproducts, and morphism addition
- Main theorem: `additive_functor_preserves_zero_morphisms`
- Identity and composition of additive functors

**Changes from original:**
- Fixed imports (removed non-existent ZeroMorphismLemmas.v)
- Changed to `Class` with implicit `ZeroObject` instance
- Added complete abelian group structure on hom-sets:
  - `add_morphism` operation with commutativity, associativity
  - Zero morphism as identity, existence of inverses
  - Bilinearity of composition (distributivity)
- Removed 8 unused wrapper lemmas (e.g., `add_beta_l`, `add_mixed_r`)
- Added `add_prod_unique` for product/coproduct duality
- Updated transport lemma names to match Core.v
- Applied HoTT style conventions

Depends on: HoTT#2293 (ZeroObjects), HoTT#2300 (Biproducts)

@jdchristensen The main new addition (no pun intended) is the abelian group structure on hom-sets, which makes this a proper additive category (not just a category with zero objects and biproducts). Also I have probably overlooked a few things. Will be looking over again, but wanted to get the PR submitted.
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.

3 participants