 Thank you. Good afternoon. This was a talk I didn't really expect to give because I thought it would be rejected since it doesn't really have any python in it. Very much python. But I put it in to encourage me to learn more about content computing. And as I learned a bit more, I decided to change the subtitle to a gentle-ish glance into a likely future. And then as I actually came to preparing the slides, I decided all I could really possibly aim to do is to explain why everything you've ever read about content computing is probably wrong unless you've read the real stuff. So I'm going to try and give you one or two really important corrections to a lot of what I think is misinformation. It's great to see so many people here. I'm assuming some of you are here in Edinburgh for Europe Python. Maybe quite a lot of you. That's not actually why I'm here. I live here. I came to Edinburgh in 1986 because I was invited by Peter Higgs, humble brag, the guy they built the LHC for to discover the Large Hadron Collider, and had the privilege of being taught quantum field theory by him. And I say that not to imply that everything I get wrong is his fault at all because he's a genius, but just to say I have spent a lot of time thinking about this. And what you're going to find during this talk is at various points, I'm going to say things that are completely ridiculous and obviously wrong. And you're going to think these things are completely impossible and you're going to be reminded of Alice in Wonderland or rather through the looking glass where she said, there's no use trying. One can't believe impossible things. I am going to ask you to believe things that will appear to be impossible. It's entirely up to you whether you do, but it's something that everyone who tries to come to terms with quantum physics has to do, and there's no way around it, I'm afraid. If you have read or learnt anything about quantum computing, probably the most likely thing you've heard is that if it ever really works, cryptography is in trouble and SSL, the security of the internet, is in trouble. And there's quite a lot of truth to that. Not complete truth. Not all cryptography is in trouble, but certainly cryptography based on the difficulty of factorising big semi-prime numbers is in trouble, which is what SSL is based on and RSA, public key cryptography. So, the basic idea with public key cryptography is that it's easy to multiply two numbers together, but it's very hard to figure out what the two prime factors are if you have a semi-prime number, one that has exactly two prime factors. But we need to be rather precise. When I say it's hard, that's actually not true at all. It's incredibly easy. In fact, it's slow. We can write just five lines of Python that will factorise any semi-prime number. This is only really using two things. It's using the fact that we know that if we have two factors in number, one of them can't be bigger than the square root of the number because obviously if we multiply two things that are bigger than the square root of the number, we're going to get something bigger than the number. The other thing about this incredibly simplistic approach to it is it uses one difficult or one slow operation, which is this percent operator here, which is integer division, right, integer modular division, and division is slow. So, if we didn't care about how long each individual step takes, there might actually be a more interesting way to do it, which would be dramatically less efficient, but would parallelise well. So we might just write a function that, given our semi-prime number n, our big number n, and two possible factors just returns true if it's truth to two factors, multiply together to give it, and false otherwise, and then we could just do a double loop, one over the small numbers and one over the big numbers, one's bigger than the square root, and one of those, if it is indeed semi-prime, would come back with our result. And if we had a parallel computer, if we had a really big parallel computer, like one with at least n squared processors, which is probably really quite big if n's big, then things would be quite nice, because we could just, you know, on one processor try, well, you know, does 15, I know 15's not a very big number, but you know, does 15 equals two times three times, does 15 equals two times four and so on, and one of these would find our answer. So this would be a nice way if we had a sufficiently large parallel computer, I'm sorry, I'm moving away from the mic, if we had a sufficiently large parallel computer to solve the problem. But there is a detail missing, and it's quite an important detail, which is that it's no good just finding the answer on processor seven, especially if we've actually got, say, 100 quadrillion processors, because we're probably not connected to all of them. So what we have to do at the end of the operation is we have to collect our answer, we have to arrange for the answer somehow to filter back to the actual processor we're talking to, the host processor, if you like. And that's not difficult at all, but we have to do that in operation and reduce them in pairs and get the answer back. But it is something we have to remember, and that will become important in about 15 minutes. So hold this thought, we're going to do some physics in a minute. You probably all know what bits are, I'm sure you all know what bits are, bits of boxes that contain zeros or ones, right? And if it's a bit in random access memory, then you can set that value to either one or zero, and you can read that value back and find out whether it's one and zero, and if nothing goes wrong, the same thing that you set it to is what you'll get back when you read it back any time later. And so the crucial thing, of course, is that the same bit in random access memory, in memory we can change, can have different values at different times. Hopefully that's not news to anyone. So what about quantum computing? Well, quantum computing is based on quantum bits. And quantum bits are boxes you can put zeros and ones in as well. It's just the slightly funny shaped boxes that Paul Dirac, great British physicist, designed and called KETS. Now these actually have a very specific meaning, but for our purposes, just think of it as a box that contains a zero or a one. Or possibly both. Not like half, but like maybe it's partly a zero and it's partly a one at the same time. And we would write that, in fact, there's one over root two of the KETS zero plus one over root two of number one. Why one over root two, not half? Well, it turns out we square these numbers. In fact, we take the, if they're complex numbers which they tend to be, we take the complex conjugate and multiply that by the thing to get our probability. But it doesn't matter, it's just the way we write it. But I want to go back to this important point that a single qubit, a single quantum bit can be simultaneously partly one and partly zero. And that's so important, I'm going to shout it as well. A single qubit can be both one and zero at the same time in some sense. And you're going to say, well that makes no sense, this is impossible. And I'm going to say, I completely agree that makes no sense it's impossible. It just turns out that's how the universe works. And what I'm going to try and do is tell you why physicists, even physicists who've thought about this an awful long time, whom it still makes absolutely no sense, believe this. And we're going to take our cue from Feynman, one of the greatest quantum physicists ever, brilliant teacher, who introduces volume three of his lecture series with three experiments. The first of which is an experiment with waves. So think about water, or think about light if you prefer, but I'm thinking specifically about water here, where we've got something that's bobbing up and down on the water creating waves, or maybe it's a set of drips falling on the water creating waves. And we've got a barrier in front of it that's got a couple of holes in it, in a wall, and then we've got an absorber at the back. And what we know about waves is that they exhibit interference. That is, if we have multiple drops falling on a puddle, then the waves around the droplets spread out, but they just go through each other, right? They don't stop, they just go through each other. And at the point where they meet, they exhibit interference. So if two troughs come together, if two troughs, if two peaks come together like this, we get a bigger peak, and that's constructive interference. And where a peak meets a trough, they cancel out and we get destructive interference. No great surprises there. And exactly the same thing happens with light. If we have this same double-slit experiment and make the slits really close together, then what we'll find is right behind the slits, we'll get this really bright point because the paths are the same length. But if we move a bit to the side, then one of the paths will be half a wavelength longer than the other path. So we'll get negative, we'll get destructive interference and they'll cancel out. And we get this black band. And when the difference in the path length is a whole wavelength again, we'll get back to positive interference and so forth. So now we'll do an experiment with bullets. And it's exactly the same setup, just slightly larger. We've got a rattling machine gun. We're not going to kill anyone. Don't worry, no threads will die in this presentation. Bullets do not exhibit interference. They might occasionally bounce off each other and all sorts of crazy stuff will happen. But if when one hole is open, this is the distribution that we see of bullets from this rattling machine gun and this is the other, then we just add up those two distributions and that's where it will be. And if the slits are close, if the holes are close together, then actually the most likely place to find a bullet will be in the middle. Bullets do not exhibit interference. We know this, right? So now let's do it with electrons. Now you know what electrons are. Electrons are like tiny little bullets. They're the things that hover around in a sort of cloud around the nucleus of atoms. They're incredibly small. In fact they probably are not certain, but they're kind of point-like. But we can do things with them. We can have electron guns that are just like, well actually they're not very like machine guns, but we have electron guns that fire them out over some angle, and again if we have slits that are close together, we can do the same experiment and the completely unbelievable thing is that electrons do exhibit interference exactly the same way all the other way phenomena we know about it. And you think, well that doesn't really seem to make any sense. But maybe what's going on is maybe electrons are going through both slits and they're kind of bouncing off each other, just like we can imagine bullets hitting into each other and somehow they're causing this interference pattern. Not quite clear how that would happen, but maybe that's happening. But that's not what's happening. We know that it's not what's happening because if you reduce the power of the electron gun so that there's only a single electron in the system at any time, you still get the interference pattern. Which I know makes no sense, but there's a lot of not making any sense in this talk. The electrons act as if they were being guided by waves and that the wave went through both slits and the wave actually caused interference and the position of the electron that we measure is only the places where there's positive interference and where it cancels out we never find the electron. And in fact that's exactly how quantum mechanics describes the world. So Schrodinger's equation and all the more modern versions like Dirac's equation describe the path of electrons, the evolution of electrons and all other particles in the form of a wave function, a complex wave function, whose amplitude at any point is a complex number and if you take the size of that if you square that amplitude by taking the complex conjugate at times itself, that gives you the probability of finding the particle at that position in space time. So the wave function can be in what we call a superposition of states. That is a mixture of states. It can be partly in order. It doesn't have to be a 50-50 mixture. It can be any mixture we like. These coefficients can even be complex. Schrodinger's equation tells us all the more modern versions tell us how psi evolves over time. But whenever we actually measure where the particle is, we always find it either went through the left slit or the right slit. If we measure the cube bit we always get a 1 or a 0 out, not a mixture. But in between when we're not looking at it it's as if it's in both states partly. We talk about the wave function collapsing or at least we used to talk about the wave function collapsing. Now, you're probably going to say that still makes no sense, and again I can't really argue with you. But what I don't want you to think is that means there's something bad about quantum mechanics because quantum mechanics is literally the best scientific theory we have and the best scientific theory we have ever had. It's one of the two great pillars of physics. There's relativity and they're quantum mechanics. There's this slight embarrassment that they're incompatible with each other, but don't worry about that. Relativity is really good at the big scale. Quantum mechanics is really big at the small scale. And in fact there has never been a reproducible experiment that disagreed with the results of quantum mechanics. Sometimes quantum mechanics gives us probabilistic answers. Sometimes it gives us definite answers. But we've actually verified those answers more accurately than we've ever verified anything else in the world. Like to almost a part in a billion. It is our best theory. It works. If you use the equations unless you make mistakes you always get the right answer. The only difficulty is understanding what an earth fiance means except in terms of the probability of where particles are. Now, in 1957 a guy called whoever it was working for as a student for John Archibald Wheeler and he came up with a particular interpretation that is favoured by almost everyone in quantum computing, probably largely because one of the fathers of quantum computing David Deutsch very strongly advocates this way and it gives you a very nice way of thinking about things as long as you don't mind your head hurting. Whatever it suggested is that every time there are multiple possibilities suggested by quantum theory what happens is the universe literally splits and all the different possibilities are realised in different universes. It's sliding doors if you've seen that film. Both things happen. Or in fact perhaps not even just both things but if there are lots of possibilities maybe as many as a continuous infinity of different things happen in different universes. So there are loads of all of you sitting here in different universes just with very slightly different quantum states. And what the many worlds interpretation says is that when we measure the outcome of an experiment when we measure Psi what we're actually doing is we're finding out the value of Psi in our universe the particular universe we're in at that point. But the really interesting thing is that the different universes interfere with each other. The wave functions from different universes interfere with each other, you get constructive and destructive interference and they influence the probability of you finding yourself in any particular universe. If it's in a superposition of states with alpha and beta then the probability of finding ourselves in a universe where the answer is 0 will be proportional to essentially alpha squared and the other possibility will be beta squared. And again you say this doesn't make any sense I know I'm getting a bit repetitive here but this seems to work. Now let's go back to stuff we all understand. Bites and words and things like that. So obviously we don't only do bits in computing we do bites as well. Bites are 8 bits, we look at longer words like 64 bit words and so forth because it's pretty difficult to do anything interesting with a single bit. We can do something similar with qubits. We can form cubites if you like or keywords if you like quantum bytes and quantum words using something called entanglement. An entanglement is a phenomenon whereby multiple qubits which are discrete physical things but multiple of them are described by a single wave function and that means that we say that they're entangled that is to say if we worked with 8 qubits then obviously that could represent up to 256 different values 0 up to 255 say then we can actually have a wave function that describes the state of this cubite if you like as being partly 0, partly 1 all the way up to partly 255 and we can hold that thing for a while and do computations on it which is weird. So probably you're getting where I'm going here, right? Why was I talking about all this parallel computing stuff? Why was I talking about really stupid algorithms that would work well if we could run over multiple universes? Presumably what I'm saying is that quantum computing is like this free parallel computing where we just run our computer run our computation across loads of different universes and one of them finds the answer and we're done. That's how I'm glad there are people wincing. That's how almost every pop article I've ever read about quantum computing makes it sound like quantum computing works. And there's a little bit of truth in it. We can set the computation up like this and we can set up the superposition of the state of the input state of the quantum computer so that every universe would do a different version of the computation. So it's kind of right but there's a but and quite a big but. And the but is that it's not just the quantum computer and the qubits that spread across the universes it's us as well. And so if we do set up the computation this way the trouble is we don't get to choose which universe we lock up the answer in. So almost certainly in this case we're going to find we tried three times four and it didn't equal 15 and the game's a bogey. So if you take nothing else out of this talk even if you think all this bullshit all this stuff I've said about quantum computing can't possibly be right quantum mechanics stuff this guy clearly doesn't know what he's talking about what you should remember is this is not how quantum computers work. It's not free parallel computing across universes it's a lot more complicated than that. Thank you very much. Ah but I'm not done because I'm going to try and tell you how it does work kind of sorter which is a bit harder it's quite a lot harder actually. So to benefit from quantum computing what we need to do is we need to find algorithms in which all the bad bits of the computation all the dead ends all the bits we don't want exhibit destructive interference if we think of this multiple universe model which I think is nonsense by the way it's not the interpretation I favour I like one that goes backwards in time instead it's much better. We have to arrange things so that all the bad solutions all the things we're not interested in destructively interfere and kill each other and the solution the thing we're actually looking for exhibits constructive interference ideally so that we get with probability one the answer that we're actually looking for and if we do that then it doesn't matter which universe we're in because all the universe is produced the same answer. We're looking for global properties of the computation of the system that we're doing and if you've heard of Shaw's algorithm which is the main way that this semi-prime factorisation problem is tackled that's what Shaw's algorithm is that distributes the work across a superposition of states such that the result is a global property of the result of the computation and Shaw's so quantum cubes have been built not with all that many qubits but they have been built and they do work and they have been tested and we have used Shaw's algorithm to factorise large-ish semi-prime numbers depending on your definition of large-ish biggest we've done so far is 21 but you know it's a start it's not like the smallest semi-prime number there's another way in fact of doing quantum computing called adiabatic quantum computing and we've got up as high as 143 with that so that's even more impressive and it turned out when they went back and analysed what had happened it had also factorised 56,153 just sort of as a little bonus which they hadn't asked for quantum computing is a little bit weird these aren't incredibly impressive results numerically because if I run my stupid little program it factorises 56,153 in about a 20th of a second almost all of which is python start-up time and even my mind crashingly stupid implementation does it in about a second and that's running on a single core if you gave me n squared cores where n is like a really big number I'd probably be slower anyway so the summary before I am going to try and describe how Shaw's algorithm works but I want to do the summary first that should be easy enough to explain the whole of the rest of quantum physics the physics behind quantum computing is 100% sound as the president of the US might say it's the best science we have it really is literally the best science we have it works the engineering is tricky to build quantum computers we typically have to operate at a few millikelvin that is a few thousandths of a degree above absolute zero that is that we can't keep them in order for quantum computation to work the system has to remain coherent what does that mean it means that other stuff in the universe mustn't interfere with its quantum state too much and other stuff in this universe and all the other universes does have a bit of a habit after not very much time of causing the kind of interference we don't want that turns the whole system to a state that we can't do anything with so it's very hard to keep the system's coherent but we're getting better at this stuff there doesn't seem to be anything in physics that says we couldn't build a big one we know that in principle the physics works so everything's good so it's probably coming now I'm going to try and explain Shaw's algorithm so the way Shaw's algorithm works is it doesn't tackle factorisation of large semi-prime numbers head on it tackles it kind of sideways it uses a number theoretic property which is if we take almost any number and we compute x modulo the number that we're trying to factorise modulo n that is you know the percent operator in python, integer remained a division in python so if we compute x modulo n and then x squared modulo n and then x cube modulo n we keep on doing that up to a really really really big power of x and it helps obviously that python is quite happy with arbitrarily large computations but it also helps that we're doing it modulo n so it doesn't actually get out of control it will turn out in almost all circumstances to be periodic that is this remainder will repeat it might have a very long period but it will repeat over some period that might be close to n the number that we're trying to factorise but it turns out if we can find that period of this sequence for x and we can find it for maybe half a dozen different x's that's enough to allow us to figure out what the prime factors of n are I can't explain exactly why that is you just have to take it number theorist that's good and in fact Euler worked this out in the 18th century so if we can find the period of such sequences for a few values of x we can find our two prime factors of n so how do we do that well what we do and this is another really crucial point we don't allocate different possible factors across our if we think of this multi-universe thing we don't create a superposition over the possible factors we create a superposition over the elements of this series that we're trying to compute so we put x on one x squared on the next one x cubed on the next one and we compute on each one what the remainder when we divide it by n is and then we use a quantum Fourier transform to find the period you probably all use quantum Fourier transforms they're exactly like Fourier transforms except they're quantum because you know if you know nothing else about a Fourier transform you know that it finds frequencies and you know that frequencies are the inverse of periods so if we could calculate a quantum Fourier transform then we'd be done and that's what we're doing the crucial thing is that the period that comes out is a property of the whole computation that we can look up in any universe five minutes so I'm going to now try to illustrate this using an idea by Scott Aaronson but he didn't write the Python that wrote the JavaScript that does the demonstration so I'm going to claim some credit I'm not on a 24-hour cycle I'm on some other cycle and we don't know what it is but I'm very regular and I get up at the same time each day the same time on whatever cycle I'm on and what we've got here is we've got a set of clocks one of which goes round once every 21 hours one of which goes round every 22 hours one of which goes round every 23 hours all the way up to 30 hours and underneath each clock and underneath each clock we've got a pin board with a drawing pin that's stuck in the middle at the start and what happens is every time I get up I go to each of the clocks and I move the pin under each clock in the direction that it's hands are pointing it's only got one hand it's our hand is pointing and so what happens for most of the clocks is that they do this sort of little random walk and it never really gets very far because the period of the clock doesn't match up with my circadian cycle the direction the arrow is pointing is the arrow that the hand is pointing is different at different times on different days on different my whatever our days but there's something special about the one that does have the same period as me and things that have multiples of that period and so on which is that every time I get up on my clock the one that actually matches my cycle then the hand is going to be pointing in the same direction and therefore I'm going to move the drawing pin in the same direction and so if we watch this what we should find happening it's JavaScript but it was JavaScript that was generated by python so I think it's kosher what we should find is that most of these are wandering around in a fairly hap hazard way but one of them possibly the one for 26 hours is trying to make a dash I'm not going to let it get out of the circle don't worry it's not going to run right across the 27 or anything but this is the one we can see quite clearly is in fact the cycle and in an incredibly hand-wavy way that's how a quantum Fourier transform works it arranges the computation in such a way that all the bad periods disappear because we get things that cancel out in this quantum sense but the good period keeps reinforcing and therefore whatever universe we're in if you think of the multi-universe thing or in fact you can forget thinking about multi multiple universes now the result of our computation is a well-defined result so we find our period and then we reverse engineer that we do that with a few different numbers we find our P and Q we factorise it, we've broken the internet and everything's good so that's pretty much what I had to say so you're welcome to email me about this stuff or stuff I actually know about you can find me on Twitter and I pop up in lots of universes thank you very much we've got time for one question if anyone has one you do have to come up to the front the microphones don't walk this time thank God it's not Peter Higgs one question given the fact that these famous algorithms usually require maximum fault tolerance do you think there is any use of quantum computing before we achieve systems that require fault tolerance to implement the quantum algorithm? no so if people didn't know I think the question was basically are quantum computers with short lived small numbers of quantum bits useful for anything practical no I don't think they are they only become useful when we actually get long enough coherence times and large enough numbers of cupids to do meaningful things I could be wrong about this but I'm not aware of any algorithms that do anything interesting with very small amounts of time with very small numbers of cupids