60 likes | 189 Views
Programming Languages for Quantum Computing “ Just the High (qu)Bits”. Vadim von Brzeski vvonbrze@ucsc.edu CS 203. QRAM Model of QC Classical Control, Quantum Data. Quantum Subsystem (QRAM). Sequence of Operations. qureg. Classical Control System. Measurement.
E N D
Programming Languages for Quantum Computing“Just the High (qu)Bits” Vadim von Brzeski vvonbrze@ucsc.edu CS 203
QRAM Model of QCClassical Control, Quantum Data Quantum Subsystem (QRAM) Sequence of Operations qureg Classical Control System Measurement • Typical Sequence of a Quantum Computation : • Initialize quantum subsystem • Perform sequence of operations (transformations) • Measure the result (one or more qubits) • 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 • 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 Non-linear terms push x; x := e; pop x; x := e