AlgebraicJulia / Catlab.jl

A framework for applied category theory in the Julia language
https://www.algebraicjulia.org
MIT License
604 stars 56 forks source link

Add ∘ operator support in GATs #131

Open mehalter opened 4 years ago

mehalter commented 4 years ago

After removing support for arbitrary Julia code in @signature/@theory, there is no way to define ∘(f, g) = compose(g, f) where is it available to use throughout the GAT definition, syntax, and instances.

epatters commented 4 years ago

Follow-up to issue #112 and PR #130.

jpfairbanks commented 4 years ago

The other examples that got dropped where multiargument compose and the declaration of constants. I think it is fine eliminate those from the doctrines as long as we have a way to put them in the syntax. And we want the syntax to do some normalizing of the expressions, like f circ g should get normalized to compose(g,f) and multiple argument compose should only be available in the syntax if we want to autonormalize by applying the associators.

How should we handle constants in the syntax layer? I’d like to be able to write a linear map like copy(X)otimes(scalar(X,5), A)mplus(X) or something like that. Maybe we don’t need scalar values in the syntax and the syntactic expression should just use variables for that, reserving the specification of actual numbers for the instances.

jpfairbanks commented 4 years ago

Nvm, I misread the last PR to have deleted the tests for this stuff.

epatters commented 4 years ago

Yeah, the multi-argument compose still works. It's implemented differently in doctrines/Category.jl. I had to double-check that myself.