Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modeling Quantum Computing in Haskell Amr Sabry عمرو صبرى Indiana University.

Similar presentations


Presentation on theme: "Modeling Quantum Computing in Haskell Amr Sabry عمرو صبرى Indiana University."— Presentation transcript:

1

2 Modeling Quantum Computing in Haskell Amr Sabry عمرو صبرى Indiana University

3 August 28, 2003Haskell Workshop 2 of 31 Our Abstractions are Broken! CS prides itself on the fact that it is insensitive to the changes in the hardware and its technology Turing Machines, complexity classes, lambda calculus, etc, were supposed to be “perfect abstractions” Changes in the model of physics (classical vs. quantum) broke through our abstractions

4 August 28, 2003Haskell Workshop 3 of 31 Turing ‘36Deutsch ‘97 Computing is normally done by writing certain symbols on paper. We may suppose this paper is divided into squares like a child’s arithmetic book…. If we regard a symbol as literally printed on a square we may suppose that the square is 0 < x < 1, 0 < y <1. The symbol is defined as a set of points in this square, viz. the set occupied by printers ink. Turing hoped that his abstracted- paper-tape model was so simple, so transparent and well defined, that it would not depend on any assumptions about physics that could conceivably be falsified, and therefore that it could become the basis of an abstract theory of computation that was independent of the underlying physics. 'He thought,' as Feynman once put it, 'that he understood paper.' But he was mistaken. Real, quantum- mechanical paper is wildly different from the abstract stuff that the Turing machine uses. The Turing machine is entirely classical, and does not allow for the possibility the paper might have different symbols written on it in different universes, and that those might interfere with one another.

5 August 28, 2003Haskell Workshop 4 of 31 Challenge to PL Research Quantum physics is affecting hardware design, complexity theory, and propagates all the way to our high level programming languages Develop a new appropriate programming paradigm

6 August 28, 2003Haskell Workshop 5 of 31 Outline Quantum data Operations/Functions I/O or Measurement Example --- Wave/Particle Duality Conclusions and Related Work

7 Quantum Data

8 August 28, 2003Haskell Workshop 7 of 31 Bits and Qubits or True False qFT = True False 1 1 Examples of qubits True False 0 1qF = True False 1 0qT =

9 August 28, 2003Haskell Workshop 8 of 31 Generalize Given a type a with constructors C 1, C 2, …, C n Quantum values of type QV a C1C1 11 …… C2C2 CnCn 22 nn

10 August 28, 2003Haskell Workshop 9 of 31 Examples

11 August 28, 2003Haskell Workshop 10 of 31 Pairs Pairs of type (QV a, QV b): No surprises … Pairs of type QV (a, b) can be assembled from two quantum values using a tensor product: q 2 = True False 11 22 True False q 1 = 11 22 q 1 &* q 2 = (False,False)  1 *  1 (False,True)  1 *  2 (True,False)  2 *  1 (True,True)  2 *  2

12 August 28, 2003Haskell Workshop 11 of 31 Non Compositionality and Entanglement ENTANGLED. There is no way to describe the state of the pair p 2 in terms of the state of its two components. The values are ENTANGLED.

13 Functions / Operations

14 August 28, 2003Haskell Workshop 13 of 31 Two Simple Operations What is hadamard qF ?

15 August 28, 2003Haskell Workshop 14 of 31 Controlled-Not (cnot) c x not v y cnot(c,v) = (x,y) where x is always the same as c if c is False, y = v if c is True, y = not v What is cnot (qFT,qF) ? cnot(qFT,qF) = the pair p 2 ((False,False),(False,False)) 1 ((False, True),(False, True)) 1 ((True, False),(True, True)) 1 ((True, True),(True, False)) 1 cnotM =

16 August 28, 2003Haskell Workshop 15 of 31 Our First Circuit not hadamard qF

17 Measurement

18 August 28, 2003Haskell Workshop 17 of 31 Probabilities observe qFT should produce False with 50% probability and produce True with 50% probability What happens if we observe a quantum value qFT more than once?

19 August 28, 2003Haskell Workshop 18 of 31 Collapse MUST return (True,True,True) or (False,False,False) Not allowed to produce (True,False,True) or any other mixed values

20 August 28, 2003Haskell Workshop 19 of 31 Observing Pairs Given a pair of type QV (a,b) we can make three observations: 1. Observe the state of the pair itself 2. Observe the left component only 3. Observe the right component only

21 August 28, 2003Haskell Workshop 20 of 31 Observing Pairs

22 August 28, 2003Haskell Workshop 21 of 31 The EPR Paradox Entangled particles Light-years apart observeLeft must affect the right particle Faster than light communication? Multiple universes? Signals back from the future? Hidden local state? Spooky action at a distance. HOW?

23 August 28, 2003Haskell Workshop 22 of 31 Spooky Action at a Distance ) Side-effects

24 Wave/Particle Duality

25 August 28, 2003Haskell Workshop 24 of 31 Let’s Implement a Simple Example… The individual operations are easy: H is hadamard, V and VT are phase-shifting operations But given a generally entangled triple QV (a,b,c), how can we conveniently apply an operation on the first component, or the second and third, or the first and third, etc given that we cannot decompose the tuple into its three components.

26 August 28, 2003Haskell Workshop 25 of 31 Virtual Values & Adaptors (False,False,False) (True,True,True) 1 1 A quantum value with entangled subvalues A virtual value to operate on the third and first components Pointer to the real value Adaptor (a,b,c) (c,a) b

27 August 28, 2003Haskell Workshop 26 of 31 Apply cnot to our virtual value cnotM = ((False,False),(False,False)) 1 ((False, True),(False, True)) 1 ((True, False),(True, True)) 1 ((True, True),(True, False)) 1 ((a,b,c),(x,b,z)) cnotM((c,a),(z,x)) Promote cnotM to work on the full quantum value as follows: -Extract the required components using the adaptor, apply cnot -Other components are left unchanged Promoted cnotM =

28 August 28, 2003Haskell Workshop 27 of 31 Example

29 Conclusions and Related Work

30 August 28, 2003Haskell Workshop 29 of 31 Summary Quantum values are maps from classical values to probability amplitudes (complex numbers) Functions are matrices Observation causes collapse (modeled by side-effects) Programming without destructors

31 August 28, 2003Haskell Workshop 30 of 31 A Lambda Calculus for QC by André van Tonder -calculus with (quantum) constants Uses sequences of terms (history) to make reductions reversible State ´ a superposition of sequences To avoid having history terms entangled with computational terms, functions are linear (cannot discard superpositions) No observation No datatypes: still talks about qubits and gates Can use pattern-matching on entangled values!

32 August 28, 2003Haskell Workshop 31 of 31 And of course … Jerzy Karczmarczuk

33 August 28, 2003Haskell Workshop 32 of 31 BBC World on SAS flight It is a bizarre place … … normal laws of physics break … … the fastest machine today will seem like an abacus …

34 August 28, 2003Haskell Workshop 33 of 31 Computer Science Physics Hardware Assembly, C, etc Functional Programming, lambda calculus, etc

35 August 28, 2003Haskell Workshop 34 of 31 Matrix Representation

36 August 28, 2003Haskell Workshop 35 of 31 Conventions in Physics Quantum values represented by a vector of probability amplitudes (in some implicit order) Quantum operations represented by matrices giving for each input constructor its contribution to each output constructor Applying an operation to a value is multiplication

37 August 28, 2003Haskell Workshop 36 of 31 Potential Rewards Nature’s programming paradigm might be better than what we have. Information flow in QM is a mystery (EPR paradox). An executable semantics for QC might help. There are some appealing connections between quantum computing and functional programming (operations must be pure and reversible, evaluation is different from observation, quantum values cannot be cloned i.e. are linear, etc) comp.lang.functional discussion about free will and predestination

38 August 28, 2003Haskell Workshop 37 of 31 Bits and Qubits

39 August 28, 2003Haskell Workshop 38 of 31 Generalize

40 August 28, 2003Haskell Workshop 39 of 31 Pairs Pairs of type (QV a, QV b): No surprises … Pairs of type QV (a, b) can be assembled from two quantum values using a tensor product:

41 August 28, 2003Haskell Workshop 40 of 31 Virtual Values & Adaptors Quantum value with entangled subvalues Adaptor Virtual Value 11 22

42 August 28, 2003Haskell Workshop 41 of 31 Applying Operations to Virtual Values Input Function Output Promote the function

43 August 28, 2003Haskell Workshop 42 of 31 Examples

44 August 28, 2003Haskell Workshop 43 of 31 Observing Pairs (I)

45 August 28, 2003Haskell Workshop 44 of 31 Accessing Substructures In conventional programming: composable references, façade pattern, … In quantum computing: virtual registers, shuffle wires, or our proposal of virtual values and adaptors


Download ppt "Modeling Quantum Computing in Haskell Amr Sabry عمرو صبرى Indiana University."

Similar presentations


Ads by Google