 pre-seated, we can kick off for what's going to be two hours of tutorial on something that's called ZX Calculus. I'm Bob and I'm Chief Scientist at Quantinium and then some other stuff, say some more about that later. So I'll give some references for what I'm going to talk about. So first of all there is like a paper which I'm directly going to follow and that you can get on the archive. There is a book and another book, let me show them. So this is the paper that I'm following and this is where, so I'm basically going to do the same as I did a few months ago, when Art Rekard asked me to give a couple of lectures on ZX Calculus for his students because they requested that, that's in the maths department at Oxford University. Now this is exactly what I'm going to follow today. There is also this book, Quantum in Pictures by myself and Stefano Gugioso and what's special about that book, I don't know if you can read it. Hello there, want to learn some quantum? Maybe you think you don't know enough maths, well that's not a problem. The picture in this book are a new kind of maths that will teach you all about the quantum world and then blah, blah, blah, blah, all the stuff we're going to see. So basically this is a book that's readable by people who don't know any maths. So basically what you're going to learn today about is a new way to do quantum mechanics in which you can actually do very sophisticated stuff but for which you don't need to know any maths really. So that's kind of cool. Now if you want to delve a bit, so I'm going to assume that you know a little bit of Hilbert space today. I'm going to assume you know a tiny bit of Dirac notation, the dude which seems to have been lecturing here too. So if you want to delve a bit deeper into it later then there is also this book with Alex Kissinger which is called The Dode Book and that's a course at Oxford University, 30 years, 40 years students and that actually teaches you Hilbert space from the pictures. So you start with the pictures and then you explain how Hilbert space falls out of that. And just as a teaser what you see here is a full description of quantum teleportation which The Dode is thinking about. Even an extinct animal, probably soon not extinct anymore I've heard, an extinct animal can do quantum teleportation in pictures. Okay so let me give some introduction where did ZX calculus come from. So ZX calculus goes back to 2007 and Ross Duncan who's the head of quantum software at Quantinium myself we sort of came up with it. We did a line of research which was called category quantum mechanics and which required you to know a hell of a lot of mathematics. So it actually started as a super abstract thing all this and then it became like a baby thing. So yeah I mean it started a long time ago but it took quite a while before people actually started to pick it up. The community started to pick it up. And I can give sociological talk about that why that is the case. I won't do that. But like now more recently it's very widespread in quantum industry and that's why you're getting two hours of it. So this is a paper by PsyQuantum which is the largest photonic quantum computing company and they just use this as their main language. They usually only speak this sort of language like ZX calculus is immensely useful graphically. So it's especially in quantum optics that it's pretty much impossible quantum photonics to just use Hilbert space language. It's too complicated. It's a big mess. And with these diagrams which you're going to learn about today things become actually quite easy. And so all the photonic people are using it not just not just PsyQuantum. And then more recently this is Peter Schor who was know about. So he's also now starting to advocate ZX calculus for error correction. He said like everybody does error correction should actually be doing this. That's what he said. And he's teaching ZX calculus at MIT now. But this is all quite recent. You see 2023. This doesn't have a date. I think this was 2022. Like recently there has been a boom in this stuff. People start to realize how valuable this was. So these are now all the companies I know of using it. So again that's all very recent development for every reason. Okay. Let's start with the meet. So we're going to talk about something which I will call process theories. So process theory is a theory not like all your theories of physics you've ever been taught about where you start with a kinematic description and then a dynamic description. Process theories are theories where you start with processes. So the basic entity of your theories process and the way you compose and plot processes together. That's sort of the basic ingredient of the theory. And just to give you some history. A long time ago, not in Italy but in Greece, some 2,400, 2,500 years ago there were two people. One was called Heraclitus and the other one was called Parmenidus. And Parmenidus said the world is always in a static picture and the world is really a bunch of pictures just placed after each other. So at any moment of time there is a static picture. And Heraclitus said no, no, no. The only thing which exists is flux and process. And they were arguing a lot and they were arguing a lot. And what happened historically is that everybody was following Parmenidus. So now we get the theory of physics, they first give you a static picture which they call kinematics and quantum mechanics as a Hilbritz structure and then they sort of generate dynamics over it. So we are going back all the way to Heraclitus. We're starting with processes. The only person who kind of has been going in that direction was Whitehead, the mathematician Whitehead philosopher in the previous century, what he called process ontologies. But here it's a bit different and the way we write things down is for us a system is a wire. A wire is something where you can think a quantum particle or a classical particle or some food or some water or some electricity or whatever can flow. So things flow in wires. I need to say, see, I've got multiple wires next to each other so multiple things can flow through the wires in parallel. And a box is something that acts on wires. So this could be in quantum or quantum measurement. This could be classically a computer program. This could be an oven in which you put your food and then cook it. So this can be a lot of stuff. And so we got these wires and boxes and they are going to be the basic ingredients of our language. And then we're going to look at some very special wires and boxes. So we read these diagrams from bottom to top just by convention. And if you have no input, if you have no input and only outputs, then we call it a state. A state is something that's given. I mean, it's the result of some process. You don't know where it starts. You don't know where it came from. It's the result of some process. And you can act on it. You can do stuff with it. Yeah, that's what the state is something you don't care where it came from. You've got it and you can do stuff with it. And then the dual notion where you only got inputs and outputs is something we call an effect or a test. It's basically verifying whether something is the case. So these are all questions. You can think of these as question and effect. So question, test, blah, blah, blah. It's all the same. And this is actually, so there was this person, Dirac, who had been riding on this board, I was told, a while back. So actually what I've been teaching you is Dirac stuff. So here you see this is my triangle where some wire comes out, no input. I rotate this a little bit and then I chop off the corners and then I get a cat. I take this triangle, this effect. I chop off the corners on this bit and I get a bra. And if I compose these two and do the same, I get a bracket. So Dirac notation is really an instance of these wires and box stuff. So basically what we're doing is a two-dimensional generalization because you can both, so if you compose cat and brass, that would be this direction. That would be like the vertical direction. But we can also compose wires horizontally with the tensor product. I don't know whether you ever tried using usual Dirac notation and tried to describe something like entanglement swapping. It's a complete mess. It's a complete mess with indices and all that because quantum physics doesn't want to live on a line. It wants to live in the plane because you've got these two different compositions. You've got composition in time and then you've got tensoring, what do you do? Tensoring systems. You see, tensoring system is another dimension and composition in time. And that's why these things want to live in two dimensions. And that's what it is all about. I mean this field started under the name Categorical Quantum Mechanics, like going like for this two-dimensional representation. Then now we call it process theories. In the middle it was kind of called quantum picturalism or something like that. Okay, so there are numbers. Numbers are boxes without inputs and outputs. Box without an input and output. That's a number. You can think of it as a probability or something like that. You can think of it as a probability or something like that. And what's special about the numbers is because they have no wires to constrain them, they can just dance around each other. They're completely free. You can stick them wherever in the picture you want. It doesn't matter anything. Okay, I've got a question. What would be the meaning of an empty picture? If I just would have a blackboard with nothing on it, what would be the meaning? Any guess? Yeah, that's true. No system. Nothing. But it would be the number one. It would be the number one because you can join it to everything. I can take this picture and stick an extra bit of blackboard to it and nothing changes. So it's the number one. It doesn't change anything. Right. Okay, so now the main thing you can do with these boxes, you can compose them. You see here I compose a bunch of boxes and I get like a process with inputs and outputs. Here I compose some, but there is no input. So this is like a composite state. And this is a composite number. So some diagram like this without inputs or outputs, that's just a number again. So that's how probabilities rise in a thing like this, in a theory like this. Okay, now I'm going to... So these were general boxes and wires. And now I'm going to go to very specific boxes and wires. And this is the notation or the language of the X calculus. And they will be representing very special linear maps. I mean, you can also interpret these things in other theories than linear maps, in absurd toy theories and stuff like that. This is still possible, but for today we're going to just stick to linear maps and stuff like that. Okay, there they are. That's the X notation. So we got this green dot with a bunch of wires coming in and a bunch of wires coming out. And that's what we call a Z spider, Z, from the Z observable. And then you got this red dot here with a number of wires coming in and a number of wires going out. And this we call the X spider. Why do we call them spiders? Because they look like spiders. I mean, there is a technical name for these things. And if you prefer the technical name, you can use that. And I always have to think hard for what the... It's a special dagger commutative Frobenius algebra. That's what it is. But I think spider is kind of better. Okay. Yeah? Oh, okay. I'll explain. They are different things. I'll tell you otherwise they wouldn't have different colors. I'm going to define them now. So they are different things. They are two different things. And I'll explain now what exactly they are. I'll use some direct notation for that. But yeah, the reason for these colors is Rosdank and I were in my office in 2007 and I had two pens, a red and a green one. We gave this a lot of deep thought. Right. So here is the definition to answer the question. So the way you define these things, I'm now defining them in the case of qubits just for a two-dimensional Hilbert space is you basically take the sum of like an input. So I take a bra with n inputs here with zeros, a bra with n inputs here with ones. And then I take the cat with the number of outputs, zeros and zeros. And then I add them up. So that's the definition. That's the definition of the z-spider. Now, this definition of the x-spider and see what I've changed. I've changed the choice of bases. Here I take the plus bases and the minus bases instead of the zero and the one bases. So that's why I called these ones. Oh, sorry. That's why I called these ones. These ones are called z-spiders because I use the z-basers. And these one are called x-spiders because I use the x-basers. And that's the difference. And are they different? What do you think? Let's look at some examples. So anyway, you know these. Do you know these bases, this notation? Just in case. Everybody knows this? Yes, zero, one. I'm assuming very little here. Okay, here are some examples. So this is the, let me write this down. So this would be zero, zero, zero plus one, one, one. So that would be the first spider there. So this one, this one you see, it has two outputs and one input. Now if I would write down the same for plus and minus, would I get the same thing? Yeah? What do you think? So what is this thing doing? If I stick in a zero, zero state, I get a zero, zero out. If I stick in a one state, I get one, one out. Now, so they just get copied. Zero and one get copied. Is there any other state that would be copied by this thing? Any other state that would be copied by this thing? Indeed, by the no-cloning theorem, we know that if an operation copies two states, then these states must be orthogonal. There are only two orthogonal states on a qubit, zero and one. I mean, there's no third one which is orthogonal to all of them. So these operations would just copy zero and one and nothing else. Nothing else. So if you stick in, for example, the plus state, you get the bell state out. If you stick in the plus state, you get a bell state out. You get this one plus this one. Now, if I do the same for this one, this copy, this one would only copy the plus state and the minus state and nothing else. So they are generally very different things. More than that, this thing, if I give you this one or this one or any other such, maybe for another Bayer-Spider, then this operation alone gives you bases. It defines the bases. It characterizes the bases as those elements that are copied by it. So this is actually a representation of a base. And I'm not going to go into it, but we have a theorem which is a non-trivial theorem. And that is, if you take all the spiders of one color, say the green ones, and then you put some rules on it, which we're going to see later, the rules which define the behavior of the spiders, then they're always in one-to-one correspondence with orthonormal bases. So the answer to the question, the colors, what do they mean? They mean orthonormal bases. So each family of spiders, each color corresponds to an orthonormal base. I could take a whole rainbow for lots of different bases if you want to. Sometimes people use the blue for the Y observable, we won't need it. So here are, so this is a copy. This would be a delete for this color, copy and delete. So okay, if we now look at just one input and one output, so this is actually only one zero and one zero there and one one and one then there, you get identity. And of course the identity is the same for both colors. So the identity is an example of a spider. If you take this one, so that's actually, this is not there, there's no inputs, the inputs are gone, well you get zero zero plus one one, bell state. This is the bell state. This is the bell state and it's the same for both bases and this will be the bell effect and the same for both bases. Anybody can guess what this is? Louder. So you have no inputs, you have no inputs and zero zero zero plus one one one. That's G at Z state. That's G at Z state. So you see with the spiders you can already represent, these people call this coherent copying relative to a basis. So you can represent them. You got the cups, the bell state, bell effects, G at Z state and some other stuff. So some things you can already write on. Now spiders aren't good enough or rich enough for us. We also, like many spiders in nature, we want the spiders to carry a decoration. And this decoration would be something that in the definition is just a phase difference between the first term and the second term. So this is like a little bit more notation and we call them phases. We just call them phases. These things actually for totally abstract reasons from spiders being a daggers special community for Venus also, but for abstract reason they always form a group. And of course this is the circle because it's the circle of phases on the equator of the block sphere, right? This is the circle of phase on the equator of the block sphere. Okay, so we do the same for the other color. We do the same for the other color. We stick also possible phases in there. And now then this is now a general ZX diagram. It would be a bunch of spiders plucked together and they may carry phases. So this is a ZX diagram. It looks like this. So you could call it a spider web or something like that. Spider web. This is general ZX diagram. Are there any questions? I should stop. Are there any questions at this point? No. Yeah. Yeah, so like I said before, we usually read these things from top to bottom. But actually, it's a good question because the nature of the spiders and their symmetries are such that it actually doesn't matter. If I turn this picture upside down, of course, I need to keep track which open ends. I have to give this open end names. But however I orient it, it's not going to change. It's not going to change because of the symmetries. Because of the symmetries of these things. They are very symmetric as you see from the definition. See? I mean, it depends what they're going to do with it. So we will use this to describe quantum circuits. And then of course, you want to keep track of what is the inputs and what are the outputs. But if I take such a leg and I build, I can just flip it up and down and it's just another spider. I'll show this later. These things are so much symmetry. And actually, the power of calculating in ZX calculus is that as compared to say quantum circuits, is that you can forget that you're dealing with unitary circuits. And you can do sort of much more wilder manipulations as we will see. We'll see intermediate steps in calculations which don't, for rewriting circuits, which don't look like circuits anymore at all. We'll see that. And that's actually where the power come from. I mean, it's a little bit like complex analysis. Complex analysis about real systems, real numbers. But by going into the complex, you can actually do much easier calculations. And it's a little bit what's happening here too. Let's see. Okay. So I'm going to give some more examples. So the phase spider, this is a phase gate. This is just the usual phase gate with phase alpha. You can see this. Let me go back. If I got just one input and one output, so then there is only one zero here and one zero there and one, one there and one, one there. So you got a one. So the off diagonal elements are zero and a diagonal. You got a one and this phase. So it's a phase gate. It's a phase gate. So this, this, this red pie turns out to be a not gate. This turns out to be a not gate. So that's cool. And here is one of the beautiful things. If you stick a green spider and a red spider together like this, which is actually the same as doing this. And that's again the symmetry I was talking about where it doesn't really matter what you consider as inputs and outputs. And because it's the same, we write like that. And this is C not gate. This is C not gate. So your, all your basic gates are starting to fall out already for quantum circuits. And, and the fact that you can actually decompose a C not gate in two pieces, which are very well behaved, also gives you a lot of power to, to calculate or reason about quantum circuits. The fact that you can actually break up something like a C not gate in two pieces. As it is two pieces, they mean nothing anymore. They can't be unitary because they got three legs. You can never turn this into unitary. But that's actually where the power goes from. And the, if you take the, the zero and the pie spider, this would be the zero state and this would be the one state. So don't get confused. So the red, red gives a basis for green and green gives a basis for red. The basis vectors of, of green are actually these red points and the basis vectors of red are actually these green points. So, a lot of, so you see this, this, this language is very expressive already in the sort of things we can write down in it. Okay. So now I'm going to prove, I'm going to show a theorem. And that's about universality of zx not this. So universality means that whatever matrix you give me, I can write it down. Any matrix you ever give me, I can write it down like this. Any matrix. You can write down like this. Like SSH spider web. Okay. So and I'm not going to give a full proof, but I give, I'm going to give a hint of a proof. So that's what I just said. Any linear map between cubits can be written down as spiders in the way I just, so that's universality. Okay. How do you prove that? Basically it's a known fact and I'm not going to prove that because you can find these in books that if you got z not gate and face gates, you can express any unitary. That's a, that's a known fact from C not gate and face gates. You can express any unitary and they're both made up of spiders. So we can express any unitary. Now, let me apply this to the zero state. So these are the zero states. These are the zero states. I apply an arbitrary unitary to the zero states. So I can get an arbitrary state, of course. I can get an arbitrary state. If I can, if I've got arbitrary unitary, I'll apply them to zero. I can send the zeros to any state I want. I can pick the unitary freely. So, so we got now any state and then the next thing is we take any state and we're going to take, for example, these n outputs and we bend them into inputs and we take these m outputs and leave them to be outputs. And this is, this is called Choy Jamal Kowski or map state duality. From any state, you can get an linear map if you do that. So in this way, we can actually represent any linear map. In the book, we give a much more elegant proof of this fact, not relying on existing work. But so we go on a uniform, so these spiders are universal language for, for, for linear maps. So that, that's kind of cool. Okay. Now, so far this was just a language for expressing things. It's a good language because you can express everything. But the real, the real meat is in actually, are you going to calculate with these things? And so here are the rules of the X calculus and what makes them so, so good is that they are so simple. Okay. Here, this is the spider, let's call this spider fusion rules. It can't get any simpler. If you've got two spiders which are connected, they become one spider. And not difficult. It's not difficult. So, and this is true for the, for the green color. So it's a very, very simple rule. This afternoon, so I'm going to give a lecture this afternoon, which is more about the research in quantum AI and stuff like that. But then I'll, I'll give another intuition about, about this particular rule and why it's so cool. But for now, I'm just going to focus on just listing them. So the same is true for the red ones. I mean, this is not something that's hard to remember, right? This is not something that's hard to remember. That's the whole point. And okay. And now this is something that I was saying earlier about the symmetries. If you take, for example, if you take a spider and then I sort of unfuse this with a cup. So this is a cup spider. It's a cup spider, not a spider. So I take this wire, I unfuse it. Then this is actually just a cup. I can basically then put it all the way down so that it actually becomes an input of a spider. And then I can bend it down in an output. So it's, it's, so inputs and outputs are very interchangeable with these bees. And that, that's, that's part of the power again, that, that you can do all these things with them, that they're so flexible. Right. Okay. The phases. So what happens to the phases? Well, they just get added up. If they fuse, they just get added up. Think of it. This is the genetic material of one spider is genetic material of the other spider. And they combine. That's how simple it is. Very simple rule. Same for the red ones. Oh, okay. Here is it. So, so what happens? Good. Are there clocks? Okay, that's good. Now what happens if a green spider meets a red spider? That's of course where, where interesting stuff is going to happen. So as it happens to be the case, if they are connected by two wires, this wire, wires fall away. If a green spider is connected to red spider. And, and there's two wires, these wires fall away. I think I've got a, so this is sort of, yeah. Yes. Yes. Very important. So it's, so one, one just stays. If one wire would fall away, these two things would never get connected. So that would, that would, we would have like a silly theory. So it's really, and I'll explain what it means. I'll explain what it means. I'll explain what it means later. Why, why it's, what's the intuition behind this? So first, let's, let's write a very simple, this is sort of a simpler version of the same, man. So I got green and red connected to in the middle, they fall away. So that's, that's a simpler version of the same. You can actually show that this equation is equivalent. So we remember green is a basis and red is a basis. They're both or to normal basis. And they all, because of the, the copying operation determines an or to normal base. So the way you have to think about it is like, this is a relation between two or to normal basis. Can anybody guess which relation this could be? What is, what is the sort of one special relation to or to normal basis can I have? I don't hear it. Did anybody ever hear about mutual on biasness? Mutual on biasness. So mutual on biasness. So this, this is an expression of mutual on biasness. Mutual on biasness means if I got two or to normal basis, for example, we're going to call them red and green here. And I take a basis vector of the red basis, then it will have equal probability to all the basis vectors of the green basis. A basis vector of one basis has equal probability to the basis vectors of the other base. So they're sort of maximally apart. They're maximally apart. On the block sphere, on the block sphere, it means they're orthogonal. On the block sphere, it means they're orthogonal like z and x. So it's a special relation that basis can have. And this equation exactly expresses that relation. And we're going to see this even in operational terms later. So these are very important relations. So basically what we got here, we've got two mutual, they, in the old days, they used to call that complementarity. Complementary basis and examples were position and momentum. They were complementary basis. So they were the first one people were talking about position and momentum. But other complementary basis are z and x, or x and y, or y and z. They're all complementary or mutual on bias because I'll repeat, if you take a basis vector of one of them, then it will have equal probability to the basis vectors of the others. That's mutual on bias. So we got two bases now in a very special relationship. And, okay. So we initially called this complementarity. So it's a very important relation. These bases are maximally far apart. But then we discovered something really weird. We discovered that also z and x satisfy these relations. Z and x also satisfies the relations, the z and x spiders. And I mean, I'll explain what they mean. I'll explain, I'll analyze them a little bit more. The two on the right are quite simple. They're saying the red, the zero basis vector is copied by the z spider. I mean, this is something I explained here. This one copies zero and one. And that's actually exactly what this is saying. The red dot was the zero state. If you take the zero state and the green spider, you get two zero states. And this is saying that if I take the plus state and the red spider, then I get two plus states. So basically, this is the expression of the copying. Now, what kind of a beast is this? What kind of a beast is this? In mathematics, it's something that was again known. And people call this a bi-algebra. This is a bi-algebra. It was a known thing. But in this context, they didn't express it ever with spiders. They did this for what's called a monoid and a commonoid, not for the spiders. Okay, let me see. This equation, which the mathematicians usually write like this, I prefer to write like this. Basically, what you got here, you got a four cycle. You got a four cycle of spiders. And then what you can do is you say a number of these outputs, you take everything that's connected to red and connected to green. You see four and two, they're connected to red there. And here four and two are connected to green. I take everything that's connected to green, which is one and three. One and three, I connect them to red. And then I connect these two colors. So basically what this is doing for me, it takes a square and it gets rid of it. It gets rid of squares in my spider web. That's what it does. Let's now go back to the previous one. What does this do? This one gets rid of two cycles. This one gets rid of two cycles. And do you think you could use this equation to prove the one for getting rid of squares? Just use your intuition. Never, because this just talks about two cycles. It says nothing about squares. So it turns out, it turns out that this equation, these three equations together are much stronger than this one. What is it? This one can actually be derived from these ones. I'll do this now. That's the first calculation you're going to see. Like I said, mathematicians write that one like this, but I prefer to write it like this, just getting rid of squares. Let's show. So I start with this left-hand side here, and now I want to use my square, my getting rid of squares in relation to do something with this. So basically what I do, I create a square. You see, I pull out this green spider, I pull out this red spider. Remember, like a spider with one input and one output is just an identity. Spider with one input and one output is just an identity. Let me go back, because we're using that here, all the way back. There are my examples. So we're using this now. We're using this now. That plain wire, I can stick a red dot on, or I can stick a green dot on. And then I can use my, okay, here. Then I can use my spider rules, but I'm going to use them from right to left. I'm going to use them from right to left. I can pull out a spider. If I've got one spider, I can pull out a second one. Like from right, like what the gremlins did that? Anybody ever seen this movie, gremlins? If you throw water on them, then other gremlins popped out of them or something. I mean, you can do this here. This happens with these spiders too. Okay, where's the calculation? Okay, there's a calculation. So you see, I create a bit of identity here, a bit of identity here. I put a red dot on it, a red dot there, a green dot, and then I pull another dot out. That's what I was just explaining, yeah? Does everybody understand this stuff? Yeah, so actually, and now you see I've got a square. I've got a square. So since I've got a square, I can use this. I can use this. You could check, I exactly did this, so now this red will now be connected to a green. And this green will now be connected to a red, this green will now be connected to a red. Because really, really what happens here is the green, oh, sorry. The green and red, whatever is connected to green becomes red, whatever is connected to red becomes green. So it's like a commutation. It's a bit like a commutation of two colors. Now, let's go again back. You remember these rules? A green copies red, red copies green. We go on. That's not the one. Okay, so here you see, red gets copied. So this red one goes through this green one and becomes two red dots. You have to sort of see, look at the sideways, but it's really, this red one is copied through this green one. This green one is copied through this red one. And so it comes out, it comes out, and then there is these two things. And this is just a number. Let's not care about it. It's just a number. We don't care about it. And so what remains is this. So we actually derived, we derived this one from this one. And so since this one was called complementarity, we call this strong complementarity. It's a really weird thing, but so it turns out that many bases, many orthonormal bases, not at all, all pairs, but many pairs of unbiased or complementary orthonormal bases are subject to stronger equations than the unbiasedness alone. And they are very powerful equations and they were not known. Nobody knew them in quantum computing. Nobody used them in quantum computing. And they're very useful. They actually don't have to be very useful, these equations, these. Very useful. We're going to see in examples. Oh, good. Okay, another equation that you actually can derive from the previous ones, which I'm not going to do. I'm not going to do this. But again, this is basically, this equation is copying the one state. So the z copy copies the one state and the x copy copies the minus state. That's really what these equations are saying. So these equations are all just about copying of base states. I'm not going to derive them, but this one you can derive from what we just saw before. They are derivable. Okay, leave it like that. And then for something, I mean, this is, this is a gate you don't really need because you can actually see this is the Hadamard gate. Hadamard gate. And does everybody know Euler angle decompositions? Yeah. So Euler angle decomposition is when you decompose something like the Hadamard gate by certain rotations of the sphere, typically along the z and the x axis. So you can actually decompose the Hadamard gate in rotations along the z and the x axis of 90 degrees. These are rotations of 90 degrees. This is along the z axis. This is along the x axis. So you can actually define the Hadamard gate like that. And then you can show that actually the Hadamard gate becomes a color changer. If I take a green spider and I sort of sandwich it between Hadamard gates, it becomes a red one. And that's a very, very useful thing to have around. It's a very useful thing to have around for calculations. So that's, that's some extra notation we usually introduce, especially if it was common circuits and stuff like that. So the Hadamard gate is a color changer. So, so, I mean, so the spider fusion is very easy. Spider fusion is very easy. Color change here is very easy. Copying is very easy to remember the copying. So this is really the only one which is a little bit more difficult to remember. Okay. Yeah, that's the one which is more difficult to remember. So I'll re-explain. So you see a square here, a square and of course, squares alternating colors. Otherwise, you fuse together in something smaller. So you've got a square with alternating colors. And I've, I've labeled the four wires that go out. So what you do then is you look at all the wires that are connected to green. This is number one and number three. And you connect them to a red dot. You take all the wires which are connected to red. It's number two and number four. And you connect them to a green dot. And then you connect the two dots. Oh, it means nothing, it means nothing. It means nothing. These are wires. I mean, I mean, you should look at the mess of the wires here. There are nothing and stuff like that. It doesn't matter. So, yeah, important for those people who know something about knot theory, there's no knots here. So those people who know a lot of topology, these diagrams actually live in four dimensions. We draw them on a plane, but mathematically they live in four dimensions because in four dimensions there are no knots. I don't know whether you knew that if you, if you go to four dimensions, knot theory in four dimension is really worth a very interesting PhD thesis. It's an empty one because there's no knots. So knots is a very typical thing for three dimensions. So, I mean, you write them on a plane, but basically the thing is you can think of wires just moving through it. It's sort of like electricity wires. It doesn't matter. With electricity wires it doesn't matter how they're sort of configured. But yeah, there was good remark. So it doesn't matter. Okay. Right. So I've almost shown you, so there is actually, there's actually one more rule of zx calculus. I'm not even going to write it out and it's something like this. It tells you how you can actually swap the colors of a, of like a green phase red and a green phase to a red phase green. I'm not going to explain it because we never use it. We never use it. Now, why do I give it, why do I give it this rule if we never use it? Because there is a very important theorem and this theorem says completeness of zx calculus. This is not something, some notion which is typically known to physicists. It's not something physicists ever would write about. And it's because in the nature of physics is done with like a static Hilbert space and then you generate dynamics and physicists don't think in terms of these rewrite rules. So what is completeness means? Any equation that holds for linear maps between qubits can be derived in zx calculus from the both stated rules. This is quite something. This means anything you can do with linear algebra, any equation you can derive using matrices and all that, anything, anything you can do with those rules I just showed you. So which rules do we have? We have these ones, we have these ones, spider fusion, we had, oh sorry I'm going back too far, so we had spider fusion, these ones, spider fusion, we had these ones. So the square getting rid of the square and the copying, getting rid of the square and the copying. This is actually, this is just notation, this is the color change, the color change rule. And some rule which I'm not going to specify, which we never use anyway, we never use it. But you can show that any equation between matrices and all that tensor products and everything in linear algebra can be derived from these rules. There's nothing more you can do in Hilbert space than what you can do with these spider rules. And that's, that's, that's what logicians call completeness, complete logician, so I'm going to talk a bit logic now. So logicians, so they, they axiomatize things. You take for example a model like Hilbert space and then you write actions down for Hilbert space. And then a complete axiomatization is that with your actions you can do everything that actually can prove in the model. And so this is the same here too. Whatever you can prove in Hilbert space model, any equation you can derive from this axiomatization. Yeah. So classical bits can be, can be embedded in here. They can be, I'll show this later. They can be fully embedded. So we will, at the moment I'm just talking about linear maps. Later I'll talk about density matrices and stuff like that in this language. And then you can embed classical probability inside. And I'll show how you do that. I'll show. There's lots more to come. There's lots more to come. So I'll show out. But this, this is an incredible result. This is a shocking result. I mean, I don't think anybody ever believed that when we start to do these things at, at any point these diagrams could actually replace Hilbert space in, in, in terms of what you can derive. But we're there now. This was proven 2018 for qubits and a few weeks ago. We've, we've slightly different calculus. We proved it for, in all finite dimensions. We proved that you get a clever calculus in all finite dimensions in which you can prove anything that you can prove for Hilbert spaces. So yeah, I mean, but that's known, huh? Yeah, it's, it's, it's, it's similar. Of course, like, of course, the difference here is we're talking about in, in class computation you, you, you have a discrete model, a discrete model. Zeroes and ones and functions. So it's not entirely surprised that you could come up with such a discrete actualization. You were talking about continuous Hilbert spaces. So it's, it's, it's, it's less expected that you could come up with such a discrete actualization in any way. And, and what's also remarkable is how different this looks from Hilbert space. It's not, it's not obvious if, if you take, okay, I've got the little book here. If you're a physicist and you read this book which, which explains nothing about Hilbert spaces. It's just all this in its own right. It's non-trivial to connect this to Hilbert space if you, if it hasn't been explained to you. It's non-trivial to connection. And a funny thing is if you go to Amazon then on the one end you've got like reviews by ten-year-olds saying this is a fantastic book and then you've got reviews by people saying I'm a professional theoretical physicist. I do quantum information and I think this is really difficult. Yeah, okay. Because they want, they can't, they don't have the capability because of ego and whatever else and training to take this of face value and forget what they already know. They need to translate to what they already know and it's very non-trivial translation. It's a highly non-trivial translation. So in a way you have to all learn something to, to, to really appreciate this stuff. I mean, I'm not going to give the proof. This is a really hard theorem. I, I didn't prove that. So, so much more people than me prove that. This is a really hard theorem and people were looking for this for ten years. But so this is, this is, this is quite a big deal. This is quite a big deal. Okay. Let's now, yeah. I would assume so. I would assume so. No, no. There's of course like there is something about what you call non-linearities if you're thinking quantum machine learning or something like that. Typically, non-linearities people refer to stuff which is not unitary anymore because that's actually something which arises from non-linear non-linear, non-linear generalization of Schrodinger equation. And these things, these things they exist inside. These things, so a lot of work has been done using this calculus. Is, is Ritchie here? Oh, lazy PhD students, mind. So, huh? Is he online? Okay, people are online. So, so, so people have been doing work like in, in quantum machine learning, looking for baron plateaus and stuff like that using this sort of stuff. So, I mean, and I peep, I know, I know, I know some of our people are now talking to Nathan about quantum chemistry and these sort of things. This, this is not something I'm going to talk about, but in the, the calculus I mentioned that, that we recently proved completeness of, in all dimensions, you can write down Hamiltonians, you can differentiate, you can integrate, you can exponentiate. I'm not going to talk about it today, but you can do, so this calculator I exist, they're very recent. And then, then you can really do the, what, what physics is called real physics. Okay, let's do a very trivial little calculation. This is a very little and trivial calculation just to show you the gist of calculating. So, these are three C naught gates. This is quantum circuit, three qubits, three C naught gates. That's quantum circuit. I said, I told you this is, these are C naught gates. So, what do you do now? You want to see if you can simplify it. You want to compile. You want to compile. So, basically, what you do is, I see red and red. I see green, green, green. I fuse. I see two wires in between. I throw away. I see a spider with only an input and an output. Yes, that's a plain wire. So, you see how these, these simple rules basically help you see, this is a very trivial circuit, of course. This is a very trivial one. But this, this is kind of the idea we see all these simple rules. And this worked for much more complicated examples, too. And as a matter of fact, today, if I'm still up to date, the state of the art of quantum circuit optimization, meaning making a circuit as small as possible, is this. Sometimes combined with other methods. But this is the state of the art. I don't know. Can somebody back me up? Are there any quantum software people here? Because these things move back. But this one, this is, huh? Yeah. Yeah, yeah, yeah. It's a hard problem. I don't think there are any results yet of like anybody saying, okay, this is the best you can do. It's just, it's just a methodology to do as good as possible. Because exactly the reason you say, it's mostly a methodology to do as good as possible. And there are strategies which you can use here and do better than anything else. That's basic. And I'll show, I'll show what the strategy is in a bit. But you're right, of course, these are very complicated, complex problems. Okay, so that's what I just showed you, written down nicely on a blackboard on a line. Right. So this is another one. So you see, I've got three C naught gates, but now they're alternating on two qubits. So I could C naught gate, swap C naught gate, C naught gate. Now what you do, you see there's a square there. See the square there. So what are we going to do now? So this one, this one stays, goes there, this one stays, goes there. And you see here again, one and three, one and three, they go to red, two and four, two and four on red there. So they go to green and I connect them. What you see now is, I've got two C naught gates, but now the colors match. Now the colors match. So I can fuse them. They vanish and so this is the same as the swap. This is a slightly more involved example because you need the square elimination thing. Okay. Now, now I'm going to prove that the C naught gate is the C naught gate. I'm going to prove C naught gate is the C naught gate. So this is my C naught gate and I stick in the zero state. What happens with the zero state? I have a green dot. So it gets copied. It gets copied. You see it gets copied through. So I've got these two red dots coming out. They fuse together. This is an identity. So if I stick in a zero in the control, C naught gate does nothing, is identity. Now if I stick in a one, so the pi is the one state, the one gets copied too. I get a pi there. Pi is not. I said pi gate is the naught gate. Red pi is not. So if I put a one in the control, I get a naught on the other side. So I should just show it here that this is indeed a C naught gate because it behaves as a C naught gate. So now I'm going to show. So these were simple examples. So this is the sort of this is a continuum paper and this is about like really compiling circuits as small as possible. Making them as small as possible. So that's Roman, Ross and his team Ross Duncan, the head of software and his team. And this is the technique I was mentioning that they use to get them as small as possible. There is no theorem saying that this is the best you can do. But this is at the moment is the best and it's building. It's building in the ticket compiler. So the continuum compiler uses this method to optimize circuits. Yeah. Yeah. Not confluent, not confluent. So yeah, yeah. So this is strategy. This is this strategy that does that. So that's what they prove in the paper. He doesn't say that it's the best strategy but it's a strategy that you will do better than before. So it's it pushes you in one direction and you'll see why you'll get the gist of it when I when I start explain. Okay. Suppose you got something like this. So you got all these C naught gate. You see this C naught gate and this C naught gate. They really want to cancel out but there is this phase in the middle which is preventing them to cancel out. And if this would have canceled out then these would have canceled out but it's this phase in the middle blocking everything. What can you do? It looks pretty bad. What can you do? No much. Okay. I'm going to look at this this little thingy alone. Everybody has an anybody has an idea what I'm going to do now. Look a little bit. It's always the same rules we use. Let me and that's my advice. There aren't really that many. How many rules do we have involving two colors? Square. There is a square here. There's a square here. Look. I mean, I made it very explicit but if you fuse these two together if you fuse these two together then I've got green dot, red dot, red dot, green dot, red dot. There's a square sitting inside. And now I make it very explicit here. So if I fuse this green and this green together it becomes one, right? And then so I've got one green, one red, one green, one red and it's a square. Now you say, okay, but there is a face sitting here but I can pull the face out. I can just unfuse the face. And here you say, okay, you've got a bunch of wires coming in there. I unfuse that. So this wire is connected to green. This wire is connected to green. Here this wire is connected to green. This wire is connected to green. That wire is connected to red. That wire is connected to red. That wire is connected to red. That wire is connected to red. And in between the two red ones there is a phase. See it's the same, yeah? So I'll unfuse this to find a square. So that's a more non-privilege use, but you pretty much, this is actually all you really need to do to simplify circuits in this strategy. Just getting rid of a phase which is obstructing. So let's see what happens now. So we got the square here, number four and number two, number four and number two. So they are gonna get connected to a red dot. We got number three and number one. They're connected to red, so they're gonna get connected to green and now then we connect the green and the red dot. So what we obtain is this. We obtain a thing like that. So this thing, which is like a very annoying thing, becomes a thing with only green dots. And this, you see, this is not at all anything anymore like a circuit made up of unit trees. This is nothing anymore like a circuit made up of unit trees. It doesn't look like that at all with this thing hanging out. And now let's see what happens. So now we have this configuration again I start from and because we can now stick in this one, you see now all this green commutes through each other. So you actually turned a red thing into a green thing. And you've got a lot of commutation going on now. And, up. So basically these two can now cancel out because this is a green spider and a red spider connected by two wires. And so this thing simplifies to this thing. So we were able to cancel out these two synod gates. And this is a confluent strategy. It takes you in one direction and it's always gonna simplify your circuits. I'm not saying that you can do every single application like that, but you definitely are going in one direction. And this scales, so we saw this little thing. If actually you've got something like this, then it becomes this. If you've got something like this, it becomes this. And this thing is what people call phase gadgets. So basically the strategy to simplify circuits is to turn as much as possible stuff into phase gadgets which nicely commute through each other because they're all on the same color. They're all the same color, so they commute through each other. So that's the usual, that's the sort of professional strategy that people now use. Like I said, it's not necessarily, at this point we don't know whether it's the best possible one, but it actually is the best practical one that exists now. So it's louder. Yeah, yeah, I mean, I mean, I have even been told, I mean that this sort of representation for an iron trap quantum computer is actually more native than the circuit representation. So this is actually something that physically is closer to the thing you can actually do on top. But the main thing is you see all these green dots, they could just commute through each other. So they will commute through each other. Yeah, no, there may be obstructions you just don't get rid of like this. There may be obstructions you just don't get rid of. It's not known, it's not known. At this point it's not known. This sort of circuit simplification stuff is a very recent development. It's not something people have been doing for 10 years. It's like a couple of years, max, that people have been doing this. Because it was not a question people were asking before. There actually were quantum computers. It's something the mainstream community never really thought about, and now it's a very important thing. Okay, yeah. Actually we can take a little break, but keep asking questions. Yeah, yeah, no, no, yeah. Okay. Doesn't that? Well, I mean, it can be decomposed into gates, I just showed you. This is a phase, oh, sorry. This is a phase gadget, and this is decomposition. I mean, basically what you do is you start with something like this. You move to these ones, you simplify, and then you move back. Yeah, I mean, it all depends on the art where you're working with. It depends on the art where you're working with. Like I said, on, for example, the quantum computers, these things are kind of native to what you actually implement. Okay, let's show some actual examples. So what I'm representing, these are sort of the Bell states, and the Bell states can be represented in ZX calculus, like the Bell state is just a cup. The one with a minus, you just stick a green pie. The, here, this one, you stick the knot, basically to get this one, and if you stick both, you get this. So we can represent these Bell states, which we use in many protocols like this, and you can also say a cup, you could actually, as a circuit, realize like this. If I take like a plus state and a zero state, and I apply a C knot gate, I get a cup, and so on, you see, I'm just like, I'm fusing these into little circuits. We'll see that later. We'll see that later why we need it. I'll get back to this. So this is just the representation in the ZX calculus for these Bell states. Now, okay, let's derive quantum teleportation. This is actually the first diagrammatic thing. This goes back to 2003 or something, like that we did. So you got Alice and you got Bob. They share a Bell state, they share a Bell state, and Alice has a state psi that she wants to get to Bob. So how are you gonna do that? Intuitively, yeah, you can draw it in the air. Yeah, yeah, yeah, indeed. You just stick a cup cap there, and now this one up is all the way to Bob. That's as simple as this. So this is what's called post-selected teleportation. That you do a Bell measurement, and you just hope that you get this one, this outcome. You do a Bell measurement, you just hope that you get the right outcome. That's basically what this is. So yeah, that's what I'm saying. It's as if you can slide this box there. Many times the same thing. Okay, that was actually pretty cool. Up, up, up, up, up, up, up. That's pretty cool. Yeah. Okay, so this is what we have, but it may be the case that you don't just get the expected outcome here. So there's four possible outcomes which I indicate by either a zero or a pi there, or a zero or a pi. And of course I'm referring now, I'm referring to these four possible Bell states, which are the four possible effects you can have in a Bell measurements, those four. So I indicate them here. So these are four possible outcomes now we can have. Now what do you do? So Alice picks up the phone, tells to Bob, which thing happened there, and Bob undoes the same using phase gates. And then of course there's a telephone call necessary to do that and this is teleportation. This is this full blown teleportation. This is clear. So here if you got the outcome of your measurement four possibilities and Bob does the corresponding correction. All right. Clear everybody? So this is how you arrive to teleportation. Now what is really annoying here is that I've got this orange curly wire here. I mean, this is for old people who had these telephones with these curly things too. I mean, I think there's probably two here in the room who ever had a telephone like that. And that was not part of a language. This is not spider. So later we're gonna see how you can actually substitute this wire with spiders too. How this classical stuff also can become spiders. Okay, measurement based quantum computing. That's what the optical quantum people are doing. Yeah? Well, I mean, so basically there are two readings. There are two readings here. One reading is with time that flows up. So initially you got this size state and you got this cup state. And then at the later time, you got this cup effect. So that's sort of the operational reasoning, a reading if you want. This is like really how the processes take place in space and time. But then there is also some sort of logical reasoning and that's really the math, the semantics. And the semantics allows you to slide this box all the way there. Ugh. I mean people, so even in the very beginning when Bennett and all these people came up with teleportation, they were already talking about the fact that it felt as if the state was sort of sent backward in time. As if, of course that doesn't really work because that's against the relativity theory. So, but it's sort of logically can reason as if you can push the state back in time. That's, I mean, that's an entire discussion in its own right basically. I mean, this is entanglement. This entanglement and this entanglement. So entanglement pairs of entanglement and entangled state and entanglement effect allow you in principle to send stuff faster than light, but it's not true. The reason it's not true is because you're never sure which outcome you're gonna get in this measurement. And so in order to get this corrected at the other side, in order to get this corrected at the other side, you need to make a phone call. So you can't violate. So this is, it's a very subtle thing about quantum mechanics. No, locality is a very subtle thing. It's, you can't use it to send information, but something is going on between distant parts. Something that you can't use to send. Yeah, yeah. So there is a similar, there's a similar analysis you can do of teleportation in that sense. It's, initially it seems as if you can't signal, but then this telephone line is preventing it. Okay, measurement based quantum computing. I don't know if you hear about that, but it's now with all the photonic quantum computing companies are trying to establish because you get some sort of fault tolerance for free. I'm gonna show you a very simple example of measurement based quantum computing. So you got a state here. You got a state here. It's a little bit like teleportation. I got a state here. And then now you look at the circuit. I got a C not gate. I got a zero state. I've got like a there plus test. You see the green fuses together, the red fuses together. So really it's just the state. And the state ends up at the other side. It's not very interesting. Now things become much more interesting if the measurement that I do here is against a certain phase. So I do measurement at a phase and see what happens now. Green phase fuses, red fuses. And now I have by actually doing a measurement against alpha, actually have applied the alpha gate to psi. So I'm using a measurement to apply a gate and the measurement angle defines which gate I'm actually applying. And again, I have to do the sort of correcting thing but that's not a problem. If I got alpha or alpha plus pi and then I do the corresponding correction. So this is actually a way by means of measuring and applying certain fixed gates, just pi or not, to actually apply an arbitrary gate. And there are arguments to do that and that actually is much more fault tolerant than just applying the gates themselves. So that was the idea of measurement based quantum computing which now goes back to 2001 or something like that. And here is a little nice elegant calculation which is the sort of thing which is basically impossible to do in Hilbert space in any elegant way. So I've got psi state and a bunch of plus states here and what I'm applying here, what I'm applying here is actually what's called a control z gate. It's called a cz gate and the way you write it down is basically two green dots with a Hadamard in the middle. Okay, let's see what happens with that. All the green stuff's gonna fuse together and you get this. And now we're gonna do measurement based quantum computing. So we got, this is what people call a cluster state. This is called a cluster state if you hear that name. This is called a cluster state. And now if I pick my angles like alpha, beta, gamma here and my measurement directions and see they fuse together. They fuse together. Here we got beta in between, a green beta in between Hadamars. So it's gonna change the color. It's gonna change, oh, sorry. It's gonna change the color. And then I've got an alpha and a gamma. These two Hadamars are gonna cancel each other out. And what I end up with, what I end up with is really this is an arbitrary unitary, arbitrary one cubed unitary applied to psi. So this sort of, so basically what I've been doing, let's go back, just by measuring, just by three measurements, just by doing three measurements and I can do them in parallel. I can do them in parallel, these three measurements. That's actually where the fault tolerance come from. I actually have applied an arbitrary one cubed gate. And this is paradigm for computation. This you can show gives you universal computation and that's what psi quantum is trying to build. That's what xanadu is trying to build. That's what Kondella is trying to build. They're doing this. They don't do circuits. They do this. Classic, okay, let's do a few minutes pause. Yeah? Like till 20 past, say. Oh, I'm not done, eh? Hello? What?