Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Programming Languages for Quantum Computing “Just the High (qu)Bits” Vadim von Brzeski [email protected] CS 203 QRAM Model of QC Classical Control, Quantum Data Quantum Subsystem (QRAM) Sequence of Operations Classical Control System qureg Measurement Typical Sequence of a Quantum Computation : 1. Initialize quantum subsystem 2. Perform sequence of operations (transformations) 3. Measure the result (one or more qubits) 4. Is the result correct ? No – Goto to Step 1. register(s) of n qubits in quantum superposition of all 2n possible states Constraints on a Quantum Program qubit q, p; bit b, c; ... q := p; ... ... b := p && p; quantum_op (p, p); ... ... c := p; quantum_op(p); .... .... quantum_op(q); All operations on quantum states must be reversible. No-cloning rule : cannot copy a quantum system that is in an unknown state. Operations must be on distinct states. Copy-by-value not allowed. An implicit measurement of qubit p. Collapses the quantum state of p (side-effect). quantum_op(p) will not yield expected result. If p and q are in an entangled quantum state, measuring p above also affects q. How do you ensure a quantum program is well-formed and well-typed ? Two Camps • Formalists – Define formal semantics and type systems for QPLs • Semantics of non-deterministic programs – “weakest precondition” “greatest pre-expectation” – Quantum lambda calculi – Functional language domain – Focus on static checking • Pragmatists – Quantum simulators on classical computers – Extensions of popular imperative and functional languages • C++ • Haskell – Run-time checking Two Examples • Quantum Lambda Calculus (van Tonder) – Based on theory of linear lambda calculi Non-linear terms – e :: = x | λx.e | e e | !e | λ!x.e – Linear term may appear in a function body exactly once • (λx. (x x)) is not valid since x is a linear term • Reversible Computation (Sanders & Zuliani, qGCL) – Set of rules (compiler) for transforming non-reversible programs to reversible programs x := e push x; x := e; pop x;