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

Algebraic Networks <-> Julia Programs #51

Closed
jpfairbanks opened this issue Nov 10, 2019 · 1 comment
Closed

Algebraic Networks <-> Julia Programs #51

jpfairbanks opened this issue Nov 10, 2019 · 1 comment

Comments

@jpfairbanks
Copy link
Member

@epatters, I would like to build programming languages from finitely presented SMCs. It looks like the Algebra.Networks module seems to be the best place to start. The goal would be one function L = language(::Presentation) which gives L::Language so that you can use a macro to define wiring diagrams in that category L. Then the @model macro would produce a Hom in the doctrine associated with the presentation object.

Here is an example of how it could work.

struct Presentation
    d::Doctrine
    obs::Vector{Ob{:generator}}
    homs::Vector{Hom{::generator}}
end

struct Language
   ...
end
p = Presentation(FreeBiproductCategory,
     Ob(FreeBiproductCategory, :A, :B, :C)
     [Hom(:f, A, B), Hom(:g, B, B), Hom(:h, otimes(B,B))]
)
L = language(p)
m = @model L (x[1], x[2]) begin
x[1] = f(x[1])
x[2] = g(x[2])
x[1] = h(x[1], x[2])
return x[1]
end
to_wiring_diagram(m) |> to_graphviz

to denote the hom expression m::Doctrine.Hom{T} = f\otimes g ; h
What would it take to get this working?

@epatters
Copy link
Member

epatters commented Nov 13, 2019

Maybe you know this, but we've already got a Presentation data type and corresponding macro. Example usage is in the unit tests. It should serve exactly the purpose you suggest.

The rest we will need to implement. I agree that the algebraic networks code would be a good place to start. I would like to clean that up anyway. The main thing we need to add is the ability to generate a wiring diagram from code in a fragment of the Julia language, as sketched in your post. That should be doable without too much pain. I'll think more about it and we can discuss on Friday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants