Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Julia types in theories #191

Open
kris-brown opened this issue Jan 27, 2025 · 0 comments · May be fixed by #194
Open

Fixed Julia types in theories #191

kris-brown opened this issue Jan 27, 2025 · 0 comments · May be fixed by #194
Labels
enhancement New feature or request

Comments

@kris-brown
Copy link
Collaborator

GATs aren't able to express everything (such as sum types, function types) and therefore it is a useful design pattern to be able to declare a type in a theory and expect models of that theory to send it to a specific Julia type, for example DiscDiagram::TYPE might be expected to be sent to Catlab's DiscreteDiagram type, which can't be axiomatized in a GAT (insofar as it involves a list of objects).

There ought be a means of making this assumption explicit (and enforceable) rather than just left to documentation.

For example:

@theory ThCategoryUnbiasedCoproducts <: ThCategoryWithColimits begin
  DiscDiagram::TYPE{DiscreteDiagram} # uses whatever `DiscreteDiagram` is in scope
  colimit(d::DiscDiag)::Colimit 
  universal::Colimit, d::DiscDiag, csp::MCospan)::(ob(Σ)  apex(csp))
end

Then @instance ThCategoryUnbiasedCoproducts{...} would not require filling in a Julia type for the DiscDiagram sort.

Some issues: if the theory stores Julia types, then GATs which use this feature are no longer serializable. It's hard to imagine what theory morphisms could do other than demand that any TYPE{Foo} be sent to another TYPE{Foo} in the codomain (requires checking equality of types).

A natural follow-up would be to associate a particular julia method name with a term constructor of the theory, but that hasn't yet shown up as obviously useful.

@kris-brown kris-brown added the enhancement New feature or request label Jan 27, 2025
@kris-brown kris-brown linked a pull request Jan 28, 2025 that will close this issue
@kris-brown kris-brown linked a pull request Jan 28, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant