Skip to content

Add instances for rig categories#510

Draft
ricky136973 wants to merge 4 commits intoagda:masterfrom
ricky136973:rig-instance
Draft

Add instances for rig categories#510
ricky136973 wants to merge 4 commits intoagda:masterfrom
ricky136973:rig-instance

Conversation

@ricky136973
Copy link

Introduce Sets and PartialFunctions as rig categories.

@ricky136973 ricky136973 marked this pull request as ready for review March 11, 2026 18:20
Copy link
Collaborator

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

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

Very nice! I want to explore some potential changes. But while I say 'Request changes', what I really mean is "let's discuss the design some more". This is definitely a great contribution.

P⊗ .identity (x , y) = refl

P⊗ .homomorphism {f = f₁ , f₂} (x₁ , x₂)
with f₁ x₁ | f₂ x₂
Copy link
Collaborator

Choose a reason for hiding this comment

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

we've used very little with in agda-categories up until now. It's fragile. I do realize that for dealing with partial functions, it is a powerful tool.

What I'm wondering is if the "pattern of reasoning" going on here could be abstracted out and used here?

}

PM⊗ .unitorˡ-commute-from {f = f} (lift tt , x)
with f x
Copy link
Collaborator

Choose a reason for hiding this comment

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

here I definitely would like to see this kind of reasoning abstracted out!

@TOTBWF
Copy link
Collaborator

TOTBWF commented Mar 16, 2026

I'd maybe rename PartialFunctions to something else. In constructive foundations, A -> Maybe B describes partial functions whose domain of definition has decidable membership.

@ricky136973
Copy link
Author

I'd maybe rename PartialFunctions to something else. In constructive foundations, A -> Maybe B describes partial functions whose domain of definition has decidable membership.

I know the more general notion of "partial functions" is $\sum_{P:X\to\Omega}(\sum_{x:X}P(x))\to Y$, and that's also the encoding used in 1lab. I still named it as PartialFunctions only because there is already a module Categories.Category.Instance.PartialFunctions defining the maybe-functions as a category, and I believe it is better to maintain some sort of consistency of naming here.

@ricky136973 ricky136973 marked this pull request as draft March 17, 2026 06:21
@JacquesCarette
Copy link
Collaborator

I agree that consistency is very important. In the absence of other forces, I would always let consistency win.

In this case: I agree with @TOTBWF that this is a bad name. So I would like to find a better name -- and then I will change Categories.Category.Instance.PartialFunctions accordingly.

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