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

Wiring diagrams for bicategories of relations #49

Closed
jpfairbanks opened this issue Oct 17, 2019 · 7 comments
Closed

Wiring diagrams for bicategories of relations #49

jpfairbanks opened this issue Oct 17, 2019 · 7 comments
Assignees

Comments

@jpfairbanks
Copy link
Member

I think this is a bug in v0.3.

MWE:
The following code returns a MethodError: no method matching dagger(::WiringDiagram)

X,Y = Ob(FreeBicategoryRelations, :X, :Y)
f = Hom(:f, X,Y)
to_wiring_diagram(f) #works
to_wiring_diagram(dagger(f)) #errors

Is this a real bug?

@epatters
Copy link
Member

Probably a bug. I'll look into it soon.

@jpfairbanks
Copy link
Member Author

Thanks, here is a related problem,

X,Y = Ob(FreeAbelianBicategoryRelations, :X, :Y)
f = Hom(:f, X,Y)
to_wiring_diagram(f)
wd(mplus(X))

MethodError: no method matching mplus(::Ports{Symbol})

@epatters
Copy link
Member

epatters commented Oct 18, 2019

Having refreshed myself on the situation, I'd say that these are not so much bugs as features that I never implemented. Bicategories of relations in Catlab have been neglected, since I'm not currently using them in any computational project. But I would like to improve this.

I see two different issues here:

  1. Wiring diagrams for bicategories of relations: I need to implement the dagger and possibly a few other things. This should be fairly straightforward.

  2. Wiring diagrams for abelian bicategories of relations: there are now two different diagonal and codiagonal structures. How to best handle this will require some thought. The obvious strategy is to have two different kinds of junction nodes, but the Junction type is currently not very flexible.

@epatters epatters changed the title Bug: cannot create wiring diagram with dagger(hom) in FreeBicategoryRelations Wiring diagrams for bicategories of relations Oct 18, 2019
@epatters
Copy link
Member

The first step is probably to resolve #54. Then we can make sure that all the operations in a bicategory of relations get properly translated into wiring diagrams.

@jpfairbanks
Copy link
Member Author

jpfairbanks commented Dec 7, 2019

For making WDs for Rel, should we introduce a DaggerBox that has an AbstractBox in it tells you to flip it? I am thinking like this:

struct DaggerBox{T} where T<: AbstractBox
  box::T
end

dagger(b::Box) = DaggerBox(b)
dagger(b::DaggerBox) = b.box

Do you think this is the right approach?

@epatters
Copy link
Member

PR #68 is a start towards a proper implementation of wiring diagrams for bicategories of relations.

If I'm not mistaken, the dagger is now the only missing operation. I like the strategy suggested here. We would further write:

input_ports(box::DaggerBox) = output_ports(box.box)
output_ports(box::DaggerBox) = input_ports(box.box)

@epatters
Copy link
Member

epatters commented Jan 5, 2020

Issues related to abelian bicategories of relations will be taken up in #70.

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