Open RazinShaikh opened 1 year ago
We already have a back-end of PyZX where we can write arbitrary Python code to implement rewrites. There's already quite a lot of arbitrary-arity rewrites in there that can be used in ZXLive, including the copy rule and bialgebra. Is it really worth it to build a system around this that is necessarily going to be at least a little complicated while also being restricted in what it can do?
But just to give a suggestion of a restricted pattern that might still cover many use-cases: have certain standard patterns that a user can define on certain generators. We had this different idea of a user being able to specify a custom generator. We could then have something say 'this generator interacts with Z-spiders according to the bialgebra rule', or 'this generator copies through W-states'.
Oh I like this idea of custom generators. This will also give an easy route to qudits by defining the multiplier. Do you think we can define a rule like the following WW bialgebra using these patterns?
Hmm, that is not a standard bialgebra, so that is not covered by what I was proposing I think. That rule is also quite complicated in that it has 2 bang-boxes and not just 1 (although this is true for any bialgebra rule).
For now, we should do custom generators + standard patterns. I am also interested in looking at scalable ZX but the divide and gather generators are not commutative so I can't think of an obvious way to represent them in pyzx as a graph. But at the same time, the matrix arrow is quite doable as it's just a parity matrix between Z & X. Matrix arrows of other types should also be similar: Z-H, Z-W, W-W.
I know that this is getting dangerously close to Quantomatic complexity, but I want to at least consider what restricted cases we can reasonably attempt without blowing everything up. I am opening this issue to start a discussion. I don't want to implement general !-graphs because they are too powerful and complex. But something that can allow us to do basic rewrites (e.g. pi-copy to arbitrary number of wires) would be useful in many situations.
Fragment of scalable ZX? Restricted bang boxes? Something even simpler?