an algebraic foundation for quantum programming languages
DESCRIPTION
An Algebraic Foundation for Quantum Programming Languages. Andrew Petersen & Mark Oskin Department of Computer Science The University of Washington. The Quantum Divide. Stagnation in Quantum Software Few new algorithms discovered Little discussion of higher level languages. - PowerPoint PPT PresentationTRANSCRIPT
An Algebraic Foundation for Quantum Programming Languages
Andrew Petersen &
Mark Oskin
Department of Computer Science
The University of Washington
The Quantum Divide
Advances in Quantum Hardware
• 7-bit computers created• Silicon devices proposed• Solid-state bits entangled• Photons teleported
Stagnation in Quantum Software
• Few new algorithms discovered• Little discussion of higher level languages
What is the Problem?
• No more quantum algorithms exist…?
• We’re just not smart enough…?
• No representation developed for computing– Traditional notations describe physical systems
• Dirac notation: describes system state
• Matrix notation: represents system evolution
– Enabling computation requires more• Assist in guiding systems to “interesting” states
• Support reasoning about system evolution
ObjectiveDevelop an alternative notation for quantum computing
• Representation: dealing with groups of bits is hard– Ensure operations are insensitive to state space size– Introduce shorthand for common entangled states– Facilitate computation on large, highly entangled states
• Reasoning: interesting states are difficult to identify– Identify quantum properties explicitly– Define operations by the quantum properties they induce– Favor local transformations over global ones
• Not a language … yet
Qubits: Quantum BitsBits and qubits both have two states: 0 and 1
• Superposition:
A qubit may be in both states simultaneously
• Phase:
A qubit may have a negative quantity of a state
• Entanglement:
Multiple qubits may share a single state
Dirac Notation: a Qubit
|q> = |0> + |1>
Superposition
Probability AmplitudeState
Matrix Notation: a Qubit
Probability Amplitudefor State 0
Probability Amplitudefor State 1
Representing Qubit Systems
|p,q> = |00> + |01> + |10> + |11>
Amplitude for 00Amplitude for 01Amplitude for 10Amplitude for 11
The New Algebra: a Qubit
10 qqq k
Name Weight
StateSuperposition
Unit of Phase
The New Algebra: Operators
• Superposition: +– Identity exists: xy + 0 = xy
– Inverses exist: xy + (-1) xy = 0
• Association: *– Identity exists: 1 xy = xy xy = xy
– xy xz = 0 for y z
• Other axioms hold for both operators– Associativity and commutativity of + and *– Distributivity of * over +
10 qq
10qp
Association and Entanglement
Unentangled(a)
Entangled(b)
)( 1000100 ppqqpqp
0
1
0
1
2
1
1
0
0
1
2
1
qpqpqp |1100
Unentangled(a)
Entangled(b)
00011011
Distributivity reveals the lack of entanglement.
Weight and Phase in the Algebra
• Concepts of weight and phase separated– Weights are positive real values– Phases are complex values
• State probabilities are easy to compute120 31 qqq
n
Phase and Interference
• Fundamental unit of phase introduced– Phase is manipulated in discrete increments– –
• Addition simulates phase interactions01010 2))1(()( qqqqqq
1,1 2*202 nn
nikk e 2/*
Matrix Notation: Procedures
Procedures are represented as matrices• Larger state spaces require larger matrices• The effect of the matrix may not be apparent
11
11H
1010
0101
1010
0101
1H
1100
1100
0011
0011
2H
The New Algebra: Procedures
newstateoldstate
definitionparametersname
on
)(
||: 11 newpatternoldpatterndefinition
Computation is performed via pattern matching:
A procedure has four parts:
...||: 22 newpatternoldpattern
Example: The Hadamard Gate
)( pHadamard 101100 :||: pppppp
Name Parameter Definition
Initial State Transformed State
Computation in the New Algebra
1. ConsolidateAssociate the states of all arguments
2. MatchFind affected patterns and replace them
3. Simplify
101100 :||:)( pppppppH 1100 qpqpon
110010 )()( qppqpp
Example: Controlled Not
• Expressions can contain wild-cards
• Patterns can call other procedures
0110
1100
:||:)(
)(:||:),(
pppppNot
qNotpqpqpqpqpCNot xxxx
An Example: EPR PairsIn matrix notation:
qpqpqp
qpponqpCNot
ppponpH
qqqubit
pqubit p
|
)(),(
)(
1100
010
100
0
0
1
0
0
1
2
1
0
1
0
1
2
1
0100
1000
0010
0001
0
1
0
1
2
1
0
1
1
1
2
1
0
1,
1
1
2
1
0
1
11
11
2
1
0
1,
0
1
In the algebra:
Universality and Illegal States
The algebra is complete and expressive– All legal operations can be defined (Boykin et al.)
– All legal states can be expressed
– Illegal states cannot be reached using legal gates
1100
1100
101100
n
:||:)(
)(:||:),(
:||:)(
qqqqqT
qNotpqpqpqpqpCNot
qqqqqqqHxxxx
Negation
Represents all states not present
xUx x
111000
0
qpqpqpy
px
01
1
qpy
px
111101111011
0011110101010001
1110011010100010
1100010010000000
trqptrqptrqp
trqptrqptrqptrqp
trqptrqptrqptrqp
trqptrqptrqptrqpz
1001 trqpz
Computing on Negations
Computation may be performed directly1. Add all the cases of the gate being applied
2. Apply the gate to the negated state
3. Subtract the result from 2) from 1)
11)( qponpH
0100
11101000 22
qpqp
qpqpqpqp
)))(()(( 101010 qqpppp 110 )( qpp
Example: Grover’s Algorithm
• Fast search algorithm
• The desired solution is designated with a hat
• An Oracle is required– Adds a negative phase to the desired solutions
• A PhaseFlip operation is needed– Adds a negative phase to all non-zero states
Example: Grover Iteration
)...()1()...))(1(2(
)1()...(2 }
)(
{
ˆ)1(ˆˆ)(
{ )ˆˆ1 ][(
01
001
0
ˆ01
0
pprppr
Urpp
pH
pforall
prUprppOracle
prpasnpationGroverIter
nnn
Pn
n
i
i
P
Example: Grover Iteration
pr
rpr
prUr
pH
pforall
Urppr
pprpprpPhaseFlip
nn
nPn
i
i
Pn
n
nnn
ˆ)2
12(ˆ)
2
11(}
ˆ)1(2))1(22(}
)(
{
)1()...))(1(22(
)...()1()...))(1(2( )(
11
ˆ01
0
01
001
0
Summary
• Explicit indicators of quantum properties– Superposition operator +– Basic unit of phase – Entanglement via distributivity
• Support for computing on large systems– Size-independent procedures– Focus on local transformations
• Methods for reasoning about entangled states– Symmetric entanglement operator |– Computation on negations
Future Work
• Reasoning about phase is still difficult– A compact representation for complex phases is needed– Weight and phase interactions may be further formalized
• Types could be used to enforce constraints– Separate quantum and classical types would properly
restrict interactions– Linear types would prevent copying of state
• User studies will indicate problem areas• Our final goal is a language implementation
Questions?
Previous Work• Quantum circuits (Deutsch, Yao)
Circuit representation with state annotations
• QCL (Ömer) Imperative language based on defining matrices
• qGCL (Sanders and Zuliani)Probabilistic language featuring a refinement calculus
• Quantum C++ (Bertelli)C++ with quantum operations defined as data structures
• Block-QPL (Selinger)A functional, graph-based computational model
Grover’s Algorithm
)1(2 ,ˆˆ}
)1(2 ,ˆˆ
)1(2 ,ˆˆ}
ˆ)2
12(ˆ)
2
11()(
{ 1)n( 1
ˆˆ))...((}
:||:)(
{
...][
{ ) (
n
n
n
11
10
00
10
101100
01
0
rprp
rprpMeasure(p)
rprp
pr
rpr
pationGroverIter
toifor
ppUpppp
pppppppH
pforall
ppnpqubit
nvalGrover
nn
pnn
iiiiiii
i
n