CQCL / text_to_discocirc

Apache License 2.0
4 stars 1 forks source link

type expansion needs to be compatible with swaps #5

Closed JosephNathaniel closed 1 year ago

JosephNathaniel commented 1 year ago

In the case when we have swaps, type expansion needs to take account of these swaps, or else the ordering of the wires will be wrong.

For instance, consider "Bob who Alice loves runs". This should be semantically equivalent to "Alice loves Bob" and "Bob runs". After pulling out we get the following diagram

Image

With our current code, if we now apply n type expansion and then type expand (s type expansion) to the above, we get the following incorrect diagram, which puts "runs" onto the wire that now corresponds to "Alice"

Image

JosephNathaniel commented 1 year ago

fixed in https://github.com/CQCL/text_to_discocirc/commit/a143b119cba45c41ca73da2270f05bf71073e922