Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion Amsterdam 2019

16 views

Published on

Quantum computers can use all of the possible pathways generated by quantum decisions to solve problems that will forever remain intractable to classical compute power. As the mega players vie for quantum supremacy and Rigetti announces its $1M "quantum advantage" prize, we live in exciting times. IBM-Q and Microsoft Q# are two ways you can learn to program quantum computers so that you're ready when the quantum revolution comes. I'll demonstrate some quantum solutions to problems that will forever be out of reach of classical, including organic chemistry and large number factorisation.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion Amsterdam 2019

  1. 1. USING MANY WORLDS OF COMPUTE POWER Quantum Computers exist, they are real and you can program them. But what gives them their awesome power and what use will it be?
  2. 2. JAMES BIRNIE ● James Birnie, lead consultant @ ThoughtWorks since June 2015 ● http://www.jamesbirnie.com/ ● jbirnie@thoughtworks.com ● Worked at a startup for 9 years ● Worked in software since 1996 ● I suffer from Prosopagnosia
  3. 3. ThoughtMobile hits the streets ThoughtWorks incorporated 1993 2000 2005 1996 2004 2006 2008 2010 2014 2016, 2017, 2018 2018 500+ ThoughtWorkers ThoughtWorks University 1st office outside U.S. for distributed agile 25th book by ThoughtWorkers 1st edition of Technology Radar 3000+ ThoughtWorkers AnitaB.org names ThoughtWorks Top Company for Women Technologists 5000+ ThoughtWorkers Named as one of the fastest-growing private companies for the fourth consecutive year TECHNOLOGY EXCELLENCE THEN, NOW AND NEXT ThoughtWorks has a reputation of being on the forefront, defining the tech principles used by the most advanced organizations. 2001 Created the first Open Source Continuous Integration Server 2017 Apax Partners acquires ThoughtWorks Top 10 contributor to open source
  4. 4. #1 in Agile and Continuous Delivery 100+ books written
  5. 5. REAL QUANTUM COMPUTING ● Why Quantum computing? ● Quantum vs Classical, Bits vs Qubits ● State of the Quantum Computing Art ● What is this Many Worlds Thing? ● The Elephant in the Quantum Room
  6. 6. WHY QUANTUM COMPUTING? Why am I standing in front of an audience talking about a subject that a few months ago I had at best a vague understanding of?
  7. 7. https://www.thoughtworks.com/radar/languages-and-frameworks
  8. 8. QUANTUM v CLASSICAL QUBITS v BITS How does a quantum computer work? How does a digital computer work? What do the differences mean?
  9. 9. CLASSIC BIT ● Unit of binary information ● Can hold one of two states which we generally represent as 0 and 1 ● Usually stored as one of two distinct low voltages
  10. 10. LOGIC GATES COMPOSE INTO ARITHMETIC
  11. 11. QUBIT ● Two possible outcomes for the measurement of a qubit - usually 0 and 1 ● Observing the value “collapses” the state to a single value ● Any quantum “thing” can be a qubit, such as an electron, a photon or an ion ● Qubits can be in superposition, holding both states simultaneously https://en.wikipedia.org/wiki/Qubit
  12. 12. QUANTUM STATE - THE BLOCH SPHERE ● Quantum state is a complex valued probability amplitude ● Probabilities of measuring the different values are derived from the quantum state ● This maps to a point on the Bloch Sphere for a single qubit in a pure state By Smite-Meister - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=5829358 https://skillsmatter.com/skillscasts/11445-introduction-to-q-development-can-rob-use-entanglement-to- thwart-heisenberg
  13. 13. QUANTUM LOGIC GATES ● Like classical logic gates they transform quantum states into new quantum states ● Can act upon multiple Qubits - usually one or two ● Each gate degrades fidelity of the system ● Simplest is ID gate ● X, Y, Z gates rotate around an axis in the Bloch sphere ● IBM Q-Experience defines 13 gates
  14. 14. QUANTUM COMPUTATION V CLASSICAL COMPUTATION ● Quantum circuits hold exponentially more information at any given time for the same logical circuit size ● Quantum makes insoluble problems solvable in reasonable time ● Quantum computers cannot meaningfully persist state ● Physical limitations of hardware limit the breadth and depth of programs ● Quantum computers are hard to program
  15. 15. Clementine’s Cat Indifference...
  16. 16. Indifferent Aloof StandoffishArrogant Disinterested Detached DistantUnresponsive
  17. 17. https://www.microsoft.com/en-us/quantum/development-kit
  18. 18. THE STATE OF THE QUANTUM COMPUTING ART What quantum computers are actually in existence? Can I use them? How would I program a quantum computer? Does the Russian government have one?
  19. 19. https://dilbert.com/strip/2012-04-17
  20. 20. MICROSOFT IS IN THE GAME... https://www.cbronline.com/news/microsoft-set-5-year-quantum-computing https://en.wikipedia.org/wiki/Majorana_fermion
  21. 21. RIGETTI QUANTUM ADVANTAGE PRIZE https://techcrunch.com/2018/09/07/rigetti-announces-its-hybrid-quantum-computing-platform-and-a-1m- prize/?guccounter=1 https://www.rigetti.com/
  22. 22. WHAT DO WE NEED TO BUILD A COMMERCIAL QUANTUM SOLUTION? Scalable Qubit Foundation Cryogenic Systems Quantum - Classical Interface Error Correction Integration with Cloud Provider Algorithms and Applications These are REALLY hard! This is expensive This WILL happen This IS happening
  23. 23. SO WHAT IS THIS MANY WORLDS THING? Hey Birnie, you promised us that you’d show us many worlds of compute power. Where are these many worlds and how are they going to help us?
  24. 24. WE MADE A VIDEO AT THOUGHTWORKS LAST WEEK... https://vimeo.com/327282856/21cae5df2c
  25. 25. SO LIGHT TRAVELS IN WAVES, RIGHT?
  26. 26. BUT WAIT, IT TURNS OUT LIGHT IS PARTICLES, PHOTONS..?? ● It turns out that light ISN’T made up of waves after all ● Light consists of photons, these are particles that have no mass but do have energy and momentum ● As light spreads out, it doesn’t weaken, you just receive and process photons less frequently ● Our eyes are not equipped to see single photons although some animal eyes are
  27. 27. BUT WE STILL SEE INTERFERENCE WITH ONLY ONE PHOTON...??? https://oneandother.io/articles/2016/5/12/the-double-slit-experiment
  28. 28. QUANTUM FOURIER TRANSFORM ● Transforms time domain into frequency domain ● Helps analyse interference between qubits ● Underpins a lot of quantum algorithms including Shor’s algorithm for factorisation ● CANNOT be efficiently simulated on a classical computer ● Implement using Hadamard and controlled rotation gates https://en.wikipedia.org/wiki/Quantum_Fourier_transform
  29. 29. MODELLING COMPLEX DYNAMICAL SYSTEMS https://www.dwavesys.com/home
  30. 30. MODELLING COMPLEX DYNAMICAL SYSTEMS https://newsroom.ibm.com/2019-01-08-New-IBM-Weather-System-to-Provide- Vastly-Improved-Forecasting-Around-the-World
  31. 31. FINANCIAL APPLICATIONS ● Francis Lacan, Financial Risk Management solutions executive, IBM ● Marco Paini, Program Manager and Quantum Applications Lead, QxBranch https://www.meetup.com/London-Quantum-Computing-Meetup/events/255097947/
  32. 32. FINDING THE GROUND STATE OF A MOLECULE Caffeine is about as complicated a molecule as can be simulated accurately by classical computers But organic chemistry has far more complex molecules and sub-molecules
  33. 33. THE HABER-BOSCH PROCESS FOR NITROGEN FIXATION https://en.wikipedia.org/wiki/Haber_process
  34. 34. THE ELEPHANT IN THE (MANY) QUANTUM ROOMS What is Shor’s algorithm? Why does it matter? Should I be worried about it ay time soon? What can I do to avoid to prepare for a future without RSA?
  35. 35. James Ellis Clifford Cocks Malcolm Williamson
  36. 36. Martin Hellman Whitfield Diffie
  37. 37. Ronald Rivest Len Adleman Adi Shamir
  38. 38. PUBLIC KEY CRYPTOGRAPHY 101 ● Find an algorithm that is easy to do in one direction and hard to do backwards ○ Multiply two large primes ○ Discrete logarithms ○ Elliptic curve factorisation ● Factorisation of large numbers takes sub-exponential time on a classical computer
  39. 39. SHOR’S ALGORITHM TO FACTORISE N 1. Pick a random number a < N 2. Use Euclidean algorithm to find GCD of a and N 3. If this is not 1, you are done 4. Find the period r of the function a^x mod N 5. If r is odd OR a^r/2 = -1 mod N go back to step 1 6. gcd(ar/2 + 1, N) and gcd(ar/2 - 1, N) are both nontrivial factors of N. We are done. WHERE IS THE MAGIC IN ALL OF THIS? https://www.youtube.com/watch?v=wUwZZaI5u0c https://en.wikipedia.org/wiki/Shor%27s_algorithm
  40. 40. AN EXAMPLE OF SHOR’S ALGORITHM TO FACTORISE 15 Randomly choose a number LESS THAN 15: a = 4 GCD (4, 15) = 1 Period of 4^x mod 15 = 2 4^1 - 1 = 3, GCD(3, 15) = 3 4^1 + 1 = 5, GCD(5, 15) = 5 15 = 3 * 5
  41. 41. AN EXAMPLE OF SHOR’S ALGORITHM TO FACTORISE 1517 Randomly choose a number LESS THAN 1517: a = 10 GCD (10, 1517) = 1 Period of 10^x mod 1517 = 15 so this is an odd number go back to step 1 Randomly choose another number LESS THAN 1517: a = 14 GCD(14, 1457) = 1 Period of 14^x mod 1517 = 24 so move forward 14^12 - 1 = 56693912375295, GCD(56693912375295, 1517) = 37 14^12 + 1 = 56693912375297, GCD(56693912375297, 1517) = 41 1517 = 37 * 41
  42. 42. IMPLEMENTING SHOR IN A SPREADSHEET...
  43. 43. STEP 4 IS THE QUANTUM MAGIC 1. Pick a random number a < N 2. Use Euclidean algorithm to find GCD of a and N 3. If this is not 1, you are done 4. Use the quantum period finding routine to find the period r, the period of the function a^x mod N 5. If r is odd OR a^r/2 = 1 mod N go back to step 1 6. gcd(ar/2 + 1, N) and gcd(ar/2 - 1, N) are both nontrivial factors of N. We are done. Finding the period of a function a^x mod N is exponential complexity using a classical computer but the quantum period finding routine has polynomial complexity
  44. 44. HERE’S ONE I MADE EARLIER... https://github.com/JimBobBirnie/shor-by-james
  45. 45. AND ONE ANDREW MADE EARLIER... https://github.com/AndrewBryer/shor-by-andrew
  46. 46. SO IS RSA DEAD? ● Implementing Shor’s algorithm requires at least twice the number of qubits as the size of the key ● Factorising a 2048 bit key is estimated to require a quantum computer with around 6000 qubits ● The biggest (publicly known) gate-logic quantum computer has 72 qubits
  47. 47. WHAT DO I DO IF RSA IS DEAD? ● BB84 demonstrated in 1984 by Bennett and Brassard ● Some classical algorithms exist that will not be vulnerable even to quantum attack ○ Lattice based encryption ○ Supersingular elliptic curve isogeny cryptography ○ Symmetric key quantum resistance ● Open Quantum Safe (OQS) was started late in 2016 https://en.wikipedia.org/wiki/Post-quantum_cryptography
  48. 48. A BRIEF HISTORY LESSON ● Diffie and Hellman publish “multi user cryptographic techniques” in 1976 which is the precursor to what is thought to be the world’s first public key cryptography system ● In 1977 Rivest, Shamir and Adleman publish the RSA algorithm and later set up the RSA company and patent the algorithm in the US ● BUT…. ● In 1997 it emerges that scientists working at GCHQ, James Ellis, Clifford Cocks and Malcolm Williamson had created public key cryptography, including an algorithm almost identical to RSA, “several years earlier”
  49. 49. SOME BOOKS I HAVE READ (OR NOT) THAT HELPED ALONG THE WAY
  50. 50. ANY QUESTIONS? Does anybody have any questions? Please feel free to ask. Please don’t get offended if I don’t know the answer.
  51. 51. QUANTUM STATE What state does a single qubit hold? What about when you have multiple qubits together in the same system? What happens when you measure state?
  52. 52. The unit of information in a quantum computer is called a quantum bit or qubit. In contrast to classical bits, or cbits, the value of qubits are not as easily defined as those of cbits. Where a cbit either has the value of 0 or 1, a qubit can exist in a superposition of the two values. Consequently a qubit can’t be said to have an actual value, but rather a probability to be found in a certain state when measured. The measuring of qubits is performed as the final step of a computation to produce an output in cbits. This destroys the quantum state. A qubit can be described as a unit vector in a 2D complex vector space C 2 . In this paper the ket notation will be used for describing the qubit vectors. A qubit in the zero state is written as |0⟩ and a qubit in the one state as |1⟩. |0⟩ and |1⟩ are basis vectors in the 2D complex vector space C 2 . |0⟩ = ( 1 0 ) |1⟩ = ( 0 1 )
  53. 53. A Bloch sphere, seen in figure 2.1, can be used as a geometrical representation of the qubit. The Bloch sphere is the space of all rays in C 2 [5]. The north pole of the sphere represents the |0⟩ state and the south pole represents the |1⟩ state. A state |ψ⟩ = α0 |0⟩ + α1 |1⟩ is represented as the point (θ, ϕ) 3 4 CHAPTER 2. BACKGROUND on the sphere, where α0 = cos θ 2 and α1 = e iϕ sin θ 2 [6]. The Bloch sphere can be useful for visualizing the state of a qubit and the effect of transformations performed on the qubit. x y z φ θ 1 0 ψ Figure 2.1: Bloch sphere [7] https://www.mathopenref.com/ray.html This is the definition of a ray in complex vector space and shows why the Bloch Sphere is the space of all rays
  54. 54. QUANTUM FOURIER TRANSFORM IN (VERY STYLISED) PICTURES https://quantumcomputing.stackexchange.com/questions/2607/simplified-explanation-of-shor-qft- transformation-as-thumbtack
  55. 55. MY TYPICAL CHROME BROWSER
  56. 56. LOTS OF CONFERENCE TALKS https://web2day.co/
  57. 57. SATURDAY OCTOBER 5TH - THE QUANTUM HACK DAY https://www.meetup.com/London-Quantum-Computing-Meetup/events/254156028/
  58. 58. https://www.youtube.com/watch?v=fFW36-CGkPY
  59. 59. CLASSIC LOGIC GATES ● Idealised or physical device applying a boolean function ● Performs a logical operation on one or more binary inputs and produces one binary output ● An ideal logic gate would have zero rise time and unlimited fan out ● Implemented with diodes or transistors acting as electronic switches ● Modern computers can be considered to be composed of ideal logic gates
  60. 60. CLIFFORD GROUP ● Clifford group of logic gates consists of X, Y, Z, Hadamard, S, T and CNOT ● Only a limited set of states can result from applying these transformations ● A circuit containing only Clifford transforms can be simulated in polynomial time on a classical computer ● U1, U2, U3 gates makes all points on the Block sphere accessible
  61. 61. MAJORANA TOPOLOGICAL QUBITS https://en.wikipedia.org/wiki/Majorana_fermion
  62. 62. RIGETTI HAS AN OFFERING https://www.rigetti.com/
  63. 63. FINDING THE PERIOD (SIMPLIFIED EXPLANATION) ● You need 2 quantum registers (input and output) ● The input register has 2N bits, the output register N bits ● The input register is a superposition (use Hadamard gates) of ALL the values from 0 to about 2 x N ● Entangle the registers by performing a controlled exponential function from the input to the output register ● Carry out the Quantum Fourier Transform on the input register ● Observe the input register, this yields a value that is a factor of the period r of a modulo N ● Repeat until you have enough factors to deduce the value of r
  64. 64. LOTS OF MEETUPS https://en.wikipedia.org/wiki/Majorana_fermion
  65. 65. HELLO QUANTUM ● Android and iOS application ● Puzzle solving game ● Visualises interactions between 2 qubits ● Tutorials and information on quantum logic https://www.vysor.io/ https://helloquantum.mybluemix.net/
  66. 66. OTHER QUANTUM COMPUTING CONCEPTS ● Qubits can become entangled so that measuring one will tell us the state of the other. The qubits that interact in a CNOT gate are thus entangled. ● A unary operation (such as a single gate) can be controlled by a control qubit. ● Any gate or compound operation necessarily has an adjoint which is the complex conjugate transpose, effectively an inverse function. https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full- user-guide&page=004-Quantum_Algorithms~2F110-
  67. 67. CLEMENTINE’S CAT Who is Clementine? Why am I talking about her cat? Why wouldn’t I just use Schrodinger’s cat to demonstrate a quantum program?
  68. 68. https://github.com/JimBobBirnie/clementines-cat.git
  69. 69. WRITING QUANTUM CODE ● https://quantumexperience.ng.bluemix.net/qx/editor ● https://developer.ibm.com/code/2017/05/17/developers-guide-to- quantum-qiskit-sdk/ ● https://docs.microsoft.com/en-us/quantum/quantum- writeaquantumprogram?view=qsharp-preview&tabs=tabid-vscode ● https://docs.microsoft.com/en-us/quantum/quantum-qr- intro?view=qsharp-preview ● https://marketplace.visualstudio.com/items?itemName=quantum.quantu m-devkit-vscode
  70. 70. WILL WE EVER HAVE USEFUL QUANTUM COMPUTERS? ● Optimistic View - 2023 ● Realistic View - 2048 ● Pessimistic View - NEVER! https://superposition.com/2018/02/08/mathematician-gil- kalai-says-quantum-computers-will-never-work/
  71. 71. QUANTUM FOURIER TRANSFORM ● Transforms time domain into frequency domain ● Underpins a lot of quantum algorithms including Shor’s algorithm for factorisation ● CANNOT be efficiently simulated on a classical computer ● Shor used Hadamard and controlled rotation gates https://en.wikipedia.org/wiki/Quantum_Fourier_transform
  72. 72. QUANTUM FOURIER TRANSFORM https://www.youtube.com/watch?v=fFW36-CGkPY
  73. 73. FINDING THE PERIOD Shor's period-finding algorithm relies heavily on superposition. To compute the period of a function we evaluate the function at all points simultaneously. Quantum physics does not allow us to access all this information directly, though. A measurement will yield only one of all possible values, destroying all others. We have to transform the superposition to another state that will return the correct answer with high probability. This is achieved by the Quantum Fourier Transform. https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user- guide&page=004-Quantum_Algorithms~2F110-Shor%27s_algorithm https://www.futurelearn.com/courses/intro-to-quantum- computing/0/steps/31577
  74. 74. ANDREW BRYER ● Andrew Bryer, graduate consultant @ ThoughtWorks since late 2018 ● Studied Maths and Computer Science at University of Birmingham ● Interested in Quantum Computing and Post Quantum Cryptography ● Dissertation about Ring Learning With Errors http://www.dgalindo.es/mscprojects/bryer.pdf
  75. 75. YOU WANT ME TO MAKE A STRATEGY…???
  76. 76. QUBIT ● Two possible outcomes for the measurement of a qubit - usually 0 and 1 ● Observing the value “collapses” the state to a single value ● Lots of physical implementations ● Qubits can be in superposition, holding both states at the same time https://en.wikipedia.org/wiki/Qubit
  77. 77. IBM Q EXPERIENCE ● Publicly accessible quantum computer ● Easy to set up an account ● Can compose quantum scores and persist them ● Can execute programs on a real 5 qubit quantum computer ● Quantum simulator also available https://quantumexperience.ng.bluemix.net/qx/community
  78. 78. https://dilbert.com/strip/2012-04-17
  79. 79. PUBLIC KEY CRYPTOGRAPHY 101 ● Find an algorithm that is easy to do in one direction and hard to do backwards ○ Multiply two large primes (and keep the primes secret) ○ Discrete logarithms ○ Elliptic curve factorisation ● Don’t tell anybody the secret bit ● Factorisation of large numbers takes sub-exponential time on a classical computer
  80. 80. MAGIC #1; STEP 6 EXPLAINED (NOT QUANTUM MAGIC)
  81. 81. IMPLEMENTING SHOR - CLASSICAL V QUANTUM
  82. 82. QUANTUM KEY DISTRIBUTION https://en.wikipedia.org/wiki/Quantum_key_distribution
  83. 83. THE ELEPHANT IN THE QUANTUM ROOM!!
  84. 84. She still doesn’t care!!!

×