The document describes a verified optimizer for quantum circuits called VOQC. VOQC is implemented in Coq and consists of 8000 lines of code. It performs optimizations like gate propagation, cancellation, and merging on quantum circuits represented using a Small Quantum Intermediate Representation (SQIR). The optimizations are formally verified to be semantics-preserving by proving properties like circuits having the same effect on basis states. An example shows X and Z gate propagation rules and their associated proofs. The goal is to build a fully verified compiler stack for quantum programs.
D. Mladenov - On Integrable Systems in CosmologySEENET-MTP
Lecture by Prof. Dr. Dimitar Mladenov (Theoretical Physics Department, Faculty of Physics, Sofia University, Bulgaria) on December 7, 2011 at the Faculty of Science and Mathematics, Nis, Serbia.
D. Mladenov - On Integrable Systems in CosmologySEENET-MTP
Lecture by Prof. Dr. Dimitar Mladenov (Theoretical Physics Department, Faculty of Physics, Sofia University, Bulgaria) on December 7, 2011 at the Faculty of Science and Mathematics, Nis, Serbia.
Task Constrained Motion Planning for Snake RobotGiovanni Murru
Presentation of the work I've done during the Mobile Robotics course, about the task constrained motion planning for a snake-like robot with 24 dof, using probabilistic planning RRT to handle the task.
Joint blind calibration and time-delay estimation for multiband rangingTarik Kazaz
In this presentation, we focus on the problem of blind joint calibration of multiband transceivers and time-delay (TD) estimation of multipath channels. We show that this problem can be formulated as a particular case of covariance matching. Although this problem is severely ill-posed, prior information about radio-frequency chain distortions and multipath channel sparsity is used for regularization. This approach leads to a biconvex optimization problem, which is formulated as a rank-constrained linear system and solved by a simple group Lasso algorithm.
% This method is general and can be also applied for calibration of sensors arrays and in direction of arrival estimation.
Numerical experiments show that the proposed algorithm provides better calibration and higher resolution for TD estimation than current state-of-the-art methods.
Abstract
1. Description of singular Lagrangian theories by using a
Clairaut-type version of the Hamiltonian formalism.
2. Formulation of a some kind of a nonabelian gauge theory, such
that “nonabelianity” appears due to the Poisson bracket in the
physical phase space.
3. Partial Hamiltonian formalism.
4. Introducing a new (non-Lie) bracket.
5. Equivalence of a classical singular Lagrangian theory to the
multi-time classical dynamics.
simple problem to convert NFA with epsilon to without epsilonkanikkk
conversion of NFA,this will helps to easily solve the problems
by this small example you can solve large problems also.by solving this type of small problems we can get a more ideas to solve this type of problems
Task Constrained Motion Planning for Snake RobotGiovanni Murru
Presentation of the work I've done during the Mobile Robotics course, about the task constrained motion planning for a snake-like robot with 24 dof, using probabilistic planning RRT to handle the task.
Joint blind calibration and time-delay estimation for multiband rangingTarik Kazaz
In this presentation, we focus on the problem of blind joint calibration of multiband transceivers and time-delay (TD) estimation of multipath channels. We show that this problem can be formulated as a particular case of covariance matching. Although this problem is severely ill-posed, prior information about radio-frequency chain distortions and multipath channel sparsity is used for regularization. This approach leads to a biconvex optimization problem, which is formulated as a rank-constrained linear system and solved by a simple group Lasso algorithm.
% This method is general and can be also applied for calibration of sensors arrays and in direction of arrival estimation.
Numerical experiments show that the proposed algorithm provides better calibration and higher resolution for TD estimation than current state-of-the-art methods.
Abstract
1. Description of singular Lagrangian theories by using a
Clairaut-type version of the Hamiltonian formalism.
2. Formulation of a some kind of a nonabelian gauge theory, such
that “nonabelianity” appears due to the Poisson bracket in the
physical phase space.
3. Partial Hamiltonian formalism.
4. Introducing a new (non-Lie) bracket.
5. Equivalence of a classical singular Lagrangian theory to the
multi-time classical dynamics.
simple problem to convert NFA with epsilon to without epsilonkanikkk
conversion of NFA,this will helps to easily solve the problems
by this small example you can solve large problems also.by solving this type of small problems we can get a more ideas to solve this type of problems
In the study of probabilistic integrators for deterministic ordinary differential equations, one goal is to establish the convergence (in an appropriate topology) of the random solutions to the true deterministic solution of an initial value problem defined by some operator. The challenge is to identify the right conditions on the additive noise with which one constructs the probabilistic integrator, so that the convergence of the random solutions has the same order as the underlying deterministic integrator. In the context of ordinary differential equations, Conrad et. al. (Stat.
Comput., 2017), established the mean square convergence of the solutions for globally Lipschitz vector fields, under the assumptions of i.i.d., state-independent, mean-zero Gaussian noise. We extend their analysis by considering vector fields that need not be globally Lipschitz, and by
considering non-Gaussian, non-i.i.d. noise that can depend on the state and that can have nonzero mean. A key assumption is a uniform moment bound condition on the noise. We obtain convergence in the stronger topology of the uniform norm, and establish results that connect this topology to the regularity of the additive noise. Joint work with A. M. Stuart (Caltech), T. J. Sullivan (Free University of Berlin).
All of material inside is un-licence, kindly use it for educational only but please do not to commercialize it.
Based on 'ilman nafi'an, hopefully this file beneficially for you.
Thank you.
Basic concepts and how to measure price volatility
Presented by Carlos Martins-Filho at the AGRODEP Workshop on Analytical Tools for Food Prices
and Price Volatility
June 6-7, 2011 • Dakar, Senegal
For more information on the workshop or to see the latest version of this presentation visit: http://www.agrodep.org/first-annual-workshop
We present a proof of the Generalized Riemann hypothesis (GRH) based on asymptotic expansions and operations on series. The advantage of our method is that it only uses undergraduate maths which makes it accessible to a wider audience.
We present a proof of the Generalized Riemann hypothesis (GRH) based on asymptotic expansions and operations on series. The advantage of our method is that it only uses undergraduate maths which makes it accessible to a wider audience.
NITheP WITS node Seminar by Dr Dr. Roland Cristopher F. Caballar (NITheP/UKZN)
TITLE: "One-Dimensional Homogeneous Open Quantum Walks"
ABSTRACT: In this talk, we consider a system undergoing an open quantum walk on a one-dimensional lattice. Each jump of the system between adjacent lattice points in a given direction corresponds to a jump operator, with these jump operators either commuting or not commuting. We examine the dynamics of the system undergoing this open quantum walk, in particular deriving analytically the probability distribution of the system, as well as examining numerically the behavior of the probability distribution over long time steps. The resulting distribution is shown to have multiple components, which fall under two general categories, namely normal and solitonic components. The analytic computation of the probability distribution for the system undergoing this open quantum walk allows us to determine at any instant of time the dynamical properties of the system.
Probabilistic Control of Switched Linear Systems with Chance ConstraintsLeo Asselborn
An approach to algorithmically synthesize control
strategies for set-to-set transitions of uncertain discrete-time
switched linear systems based on a combination of tree search
and reachable set computations in a stochastic setting is
proposed in this presentation. The initial state and disturbances
are assumed to be Gaussian distributed, and a time-variant
hybrid control law stabilizes the system towards a goal set.
The algorithmic solution computes sequences of discrete states
via tree search and the continuous controls are obtained
from solving embedded semi-definite programs (SDP). These
program taking polytopic input constraints as well as timevarying
probabilistic state constraints into account. An example
for demonstrating the principles of the solution procedure with
focus on handling the chance constraints is included.
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...University of Maribor
Slides from:
11th International Conference on Electrical, Electronics and Computer Engineering (IcETRAN), Niš, 3-6 June 2024
Track: Artificial Intelligence
https://www.etran.rs/2024/en/home-english/
What is greenhouse gasses and how many gasses are there to affect the Earth.moosaasad1975
What are greenhouse gasses how they affect the earth and its environment what is the future of the environment and earth how the weather and the climate effects.
Seminar of U.V. Spectroscopy by SAMIR PANDASAMIR PANDA
Spectroscopy is a branch of science dealing the study of interaction of electromagnetic radiation with matter.
Ultraviolet-visible spectroscopy refers to absorption spectroscopy or reflect spectroscopy in the UV-VIS spectral region.
Ultraviolet-visible spectroscopy is an analytical method that can measure the amount of light received by the analyte.
Toxic effects of heavy metals : Lead and Arsenicsanjana502982
Heavy metals are naturally occuring metallic chemical elements that have relatively high density, and are toxic at even low concentrations. All toxic metals are termed as heavy metals irrespective of their atomic mass and density, eg. arsenic, lead, mercury, cadmium, thallium, chromium, etc.
Professional air quality monitoring systems provide immediate, on-site data for analysis, compliance, and decision-making.
Monitor common gases, weather parameters, particulates.
Nutraceutical market, scope and growth: Herbal drug technologyLokesh Patil
As consumer awareness of health and wellness rises, the nutraceutical market—which includes goods like functional meals, drinks, and dietary supplements that provide health advantages beyond basic nutrition—is growing significantly. As healthcare expenses rise, the population ages, and people want natural and preventative health solutions more and more, this industry is increasing quickly. Further driving market expansion are product formulation innovations and the use of cutting-edge technology for customized nutrition. With its worldwide reach, the nutraceutical industry is expected to keep growing and provide significant chances for research and investment in a number of categories, including vitamins, minerals, probiotics, and herbal supplements.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.Sérgio Sacani
The return of a sample of near-surface atmosphere from Mars would facilitate answers to several first-order science questions surrounding the formation and evolution of the planet. One of the important aspects of terrestrial planet formation in general is the role that primary atmospheres played in influencing the chemistry and structure of the planets and their antecedents. Studies of the martian atmosphere can be used to investigate the role of a primary atmosphere in its history. Atmosphere samples would also inform our understanding of the near-surface chemistry of the planet, and ultimately the prospects for life. High-precision isotopic analyses of constituent gases are needed to address these questions, requiring that the analyses are made on returned samples rather than in situ.
Richard's aventures in two entangled wonderlandsRichard Gill
Since the loophole-free Bell experiments of 2020 and the Nobel prizes in physics of 2022, critics of Bell's work have retreated to the fortress of super-determinism. Now, super-determinism is a derogatory word - it just means "determinism". Palmer, Hance and Hossenfelder argue that quantum mechanics and determinism are not incompatible, using a sophisticated mathematical construction based on a subtle thinning of allowed states and measurements in quantum mechanics, such that what is left appears to make Bell's argument fail, without altering the empirical predictions of quantum mechanics. I think however that it is a smoke screen, and the slogan "lost in math" comes to my mind. I will discuss some other recent disproofs of Bell's theorem using the language of causality based on causal graphs. Causal thinking is also central to law and justice. I will mention surprising connections to my work on serial killer nurse cases, in particular the Dutch case of Lucia de Berk and the current UK case of Lucy Letby.
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...Ana Luísa Pinho
Functional Magnetic Resonance Imaging (fMRI) provides means to characterize brain activations in response to behavior. However, cognitive neuroscience has been limited to group-level effects referring to the performance of specific tasks. To obtain the functional profile of elementary cognitive mechanisms, the combination of brain responses to many tasks is required. Yet, to date, both structural atlases and parcellation-based activations do not fully account for cognitive function and still present several limitations. Further, they do not adapt overall to individual characteristics. In this talk, I will give an account of deep-behavioral phenotyping strategies, namely data-driven methods in large task-fMRI datasets, to optimize functional brain-data collection and improve inference of effects-of-interest related to mental processes. Key to this approach is the employment of fast multi-functional paradigms rich on features that can be well parametrized and, consequently, facilitate the creation of psycho-physiological constructs to be modelled with imaging data. Particular emphasis will be given to music stimuli when studying high-order cognitive mechanisms, due to their ecological nature and quality to enable complex behavior compounded by discrete entities. I will also discuss how deep-behavioral phenotyping and individualized models applied to neuroimaging data can better account for the subject-specific organization of domain-general cognitive systems in the human brain. Finally, the accumulation of functional brain signatures brings the possibility to clarify relationships among tasks and create a univocal link between brain systems and mental functions through: (1) the development of ontologies proposing an organization of cognitive processes; and (2) brain-network taxonomies describing functional specialization. To this end, tools to improve commensurability in cognitive science are necessary, such as public repositories, ontology-based platforms and automated meta-analysis tools. I will thus discuss some brain-atlasing resources currently under development, and their applicability in cognitive as well as clinical neuroscience.
Merged Talk: A Verified Optimizer for Quantum Circuits & Verified Translation Between Low-Level Quantum Languages
1. A Verified Optimizer for
Quantum Circuits
Kesha Hietala, Robert Rand, Shih-Han Hung,
Xiaodi Wu, Michael Hicks
Verified translation between
low-level quantum languages
Kartik Singhal, Robert Rand, Michael Hicks
&
1 PLanQC 2020
2. Verified Compiler Stack
• End goal: verified compiler stack for quantum programs
High-level Language
E.g. QWIRE, Quipper, Q#
Unoptimized IR
E.g. OpenQASM, Quil
Optimized IR
E.g. OpenQASM, Quil
Hardware Instructions
2
3. Verified Compiler Stack
• End goal: verified compiler stack for quantum programs
High-level Language
E.g. QWIRE, Quipper, Q#
Unoptimized IR
E.g. OpenQASM, Quil
Optimized IR
E.g. OpenQASM, Quil
Hardware Instructions
2
Optimization
Circuit synthesis
Circuit mapping
…
4. Verified Compiler Stack
• End goal: verified compiler stack for quantum programs
High-level Language
E.g. QWIRE, Quipper, Q#
Unoptimized IR
E.g. OpenQASM, Quil
Optimized IR
E.g. OpenQASM, Quil
Hardware Instructions
2
Optimization
Circuit synthesis
Circuit mapping
…
Means that we’ve formally
verified that the transformation
is semantics-preserving
5. Verified Compiler Stack
• We present VOQC, our Verified Optimizer for Quantum
Circuits, which is built on top of SQIR, our Small
Quantum Intermediate Representation
• Implemented in 8000 lines of Coq code, with 1500 for
core SQIR and the rest for program transformations
• 400 lines of standalone OCaml code for parsing and
translating OpenQASM
• We extract VOQC to OCaml and compile it to a binary, so
using VOQC doesn’t require knowledge of Coq or OCaml
3
6. Verified Compiler Stack
• End goal: verified compiler stack for quantum programs
High-level Language
E.g. QWIRE, Quipper, Q#
Unoptimized IR
E.g. OpenQASM, Quil
Optimized IR
E.g. OpenQASM, Quil
Hardware Instructions
4
Unoptimized SQIR
Optimized SQIR
VOQC
7. SQIR
• Syntax
• Semantics assumes a global register of size d
• A unitary program corresponds to a unitary matrix of
size
• A non-unitary program corresponds to a function
between density matrices of size
2d
× 2d
2d
× 2d
5
pro-
s uni-
which
s that
, a
nto a
allow
ubits,
te set
lobal
ation
ts are
dex is
will often want something more general since and ei
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
∀P, nT(P)o = nPo
8. SQIR
• Syntax
• Semantics assumes a global register of size d
Unitary semantics Non-unitary semantics
6
pro-
s uni-
which
s that
, a
nto a
allow
ubits,
te set
lobal
ation
ts are
dex is
will often want something more general since and ei
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
∀P, nT(P)o = nPo
Dra paper, November 22, 2019, K. Hietala, R. Rand, S. Hung, X. Wu M
nU1; U2od = nU2od × nU1od
nG1 qod =
appl 1(G1, q, d) well-typed
02d otherwise
nG2 q1 q2od =
appl 2(G2, q1, q2, d) well-typed
02d otherwise
Figure 3. Semantics of unitary s programs, assuming a
controlled-not gate. We refer to this gate set as the
It is the same as the underlying set used by OpenQA
and is universal, meaning that it can approximate any
operation to within arbitrary error. The matrix interp
of the single-qubit R , , gate is
cos( 2) −ei
sin( 2)
ei
sin( 2) ei( + )
cos( 2)
and the matrix interpretation of the CNOT gate is g
Section 2.1.
A Verified Optimizer for antum Circuits
{skip}d ( ) =
{P1; P2}d ( ) = ({P2}d ○ {P1}d )( )
{U }d ( ) = nU od × × nU o†
d
{meas q P1 P2}d ( ) = {P2}d (0q0 × × 0q0)
+ {P1}d (1q1 × × 1q1)
Figure 4. s density matrix semantics, assuming a globa
9. VOQC Transformations
• Unitary optimizations - inspired by Nam et al.1
• Gate propagation and cancellation
• Rotation merging
• Non-unitary optimizations
• Classical state propagation
• Removing z-rotations before measurement
• Circuit mapping
• Naive mapping for arbitrary connected graph
1Nam et al. Automated Optimization of Large Quantum Circuits with Continuous Parameters. 2018.
7
10. Example: X/Z Propagation
• Simplified code:
8
er 22, 2019, K. Hietala, R. Rand, S. Hung,
X H ● H X
→
H Z ● H X
→
H ● Z H X
→
H ● H X X
→
H ● H
e of not propagation. In the rst step the leftmost X gate propagates through the le
he second step the Z gate propagates through the control of the CNOT gate. In the th
he rightmost H gate and becomes an X gate. In the nal step the two X gates cancel.
H ≡
●
H H Rz 4(k)
●
k′) ≡
● ●
Rz 4(k′) Rz 4(k)
Whereas evaluation of the right-hand cir
x1,x2 → x1,x1 ⊕ x2
→ x2,x1 ⊕ x2
→ ei((k+k′
) 4)x2
x2,x
ro-
ni-
ch
hat
, a
o a
ow
its,
set
bal
on
will often want something more general since and e
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
11. Example: X/Z Propagation
• Simplified code:
8
A
A
er 22, 2019, K. Hietala, R. Rand, S. Hung,
X H ● H X
→
H Z ● H X
→
H ● Z H X
→
H ● H X X
→
H ● H
e of not propagation. In the rst step the leftmost X gate propagates through the le
he second step the Z gate propagates through the control of the CNOT gate. In the th
he rightmost H gate and becomes an X gate. In the nal step the two X gates cancel.
H ≡
●
H H Rz 4(k)
●
k′) ≡
● ●
Rz 4(k′) Rz 4(k)
Whereas evaluation of the right-hand cir
x1,x2 → x1,x1 ⊕ x2
→ x2,x1 ⊕ x2
→ ei((k+k′
) 4)x2
x2,x
ro-
ni-
ch
hat
, a
o a
ow
its,
set
bal
on
will often want something more general since and e
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
12. Example: X/Z Propagation
• Simplified code:
8
B
B
er 22, 2019, K. Hietala, R. Rand, S. Hung,
X H ● H X
→
H Z ● H X
→
H ● Z H X
→
H ● H X X
→
H ● H
e of not propagation. In the rst step the leftmost X gate propagates through the le
he second step the Z gate propagates through the control of the CNOT gate. In the th
he rightmost H gate and becomes an X gate. In the nal step the two X gates cancel.
H ≡
●
H H Rz 4(k)
●
k′) ≡
● ●
Rz 4(k′) Rz 4(k)
Whereas evaluation of the right-hand cir
x1,x2 → x1,x1 ⊕ x2
→ x2,x1 ⊕ x2
→ ei((k+k′
) 4)x2
x2,x
ro-
ni-
ch
hat
, a
o a
ow
its,
set
bal
on
will often want something more general since and e
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
13. Proof Overview
• For a transformation T, we want to prove that
(up to a global phase)
• For complex optimizations, rather than proving this
equality directly we may prove that and have
the same output on every basis state
• For circuit mapping we also prove that for every ,
respects the provided connectivity constraints
• Proofs proceed by induction on
→ [X q]
t → t
t → H q ; propagate_Z q t
: t → Rz†
q ; propagate_X q t
∀P, nT(P)o = nPo
mand meas q P1 P2 (inspired by a similar con-
PL [43]) measures the qubit q and either performs
or P2 depending on the result. We dene non-
measurement and resetting a qubit to 0 in terms
g measurement:
measure q = meas q skip skip
reset q = meas q (X q) skip
denes the semantics of non-unitary programs
density matrices, following the approach of sev-
T(P) P
P T(P)
P
9
14. Example: X/Z Propagation
• We will want to prove that for any instruction list lst,
(propagate_X q lst) has the same denotation as (X q ; lst)
• propagate_X q lst X q ; lst
• Proof proceeds by induction on lst
≡
10
ro-
ni-
ch
hat
, a
o a
ow
its,
set
bal
on
will often want something more general since and ei
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
15. Example: X/Z Propagation
• We will want to prove that for any instruction list lst,
(propagate_X q lst) has the same denotation as (X q ; lst)
• propagate_X q lst X q ; lst
• Proof proceeds by induction on lst
≡
propagate_X q [ ] [ X q ] X q ; [ ]→ ≡
10
ro-
ni-
ch
hat
, a
o a
ow
its,
set
bal
on
will often want something more general since and ei
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
16. Example: X/Z Propagation
• We will want to prove that for any instruction list lst,
(propagate_X q lst) has the same denotation as (X q ; lst)
• propagate_X q lst X q ; lst
• Proof proceeds by induction on lst
≡
propagate_X q (X q :: t) t X q ; X q ; t→ ≡
10
ro-
ni-
ch
hat
, a
o a
ow
its,
set
bal
on
will often want something more general since and ei
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
17. Example: X/Z Propagation
• We will want to prove that for any instruction list lst,
(propagate_X q lst) has the same denotation as (X q ; lst)
• propagate_X q lst X q ; lst
• Proof proceeds by induction on lst
≡
propagate_X (Rz q :: t)
Rz† q ; propagate_X q t
Rz† q ; (X q ; t)
X q ; Rz q ; t
→
≡
≡
10
ro-
ni-
ch
hat
, a
o a
ow
its,
set
bal
on
will often want something more general since and ei
(for ∈ R) represent the same physical state. We therefore say
that two circuits are equivalent up to a global phase, written
U1 ≅ U2, when there exists a such that nU1od = ei
nU2od .
3.2 Adding Measurement
To describe general quantum programs P, we extend unitary
s with a branching measurement operation.
U ∶= U1; U2 G q G q1 q2
P ∶= skip P1; P2 U meas q P1 P2
let propagate_X q lst = match lst with
| [] → [X q]
| X q :: t → t
| H q :: t → H q ; propagate_Z q t
| Rz q :: t → Rz†
q ; propagate_X q t
...
18. Verifying Matrix Equivalences
• Proving matrix equivalences in Coq is tedious
• E.g.
11
each other out.
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to justify
local rewrites. Proof that an optimization is correct thus relies
on proofs that the circuit equivalences it uses are correct.
Many of our circuit equivalence proofs have a common form,
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denition
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
per Figure 3. Suppose both sides of the equation are well
typed (m d and n d and m = n), and consider the case
m n (the n m case is similar). We expand appl 1 and
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
term.)
simpli
matrix
In o
gridif
I2m ⊗
provin
We
in the
is mos
alence
apply t
For eq
one us
but sti
4.3 O
Our pr
localiz
rules. T
of gate
other out.
Proving Circuit Equivalences
’s optimizations use circuit equivalences to justify
ewrites. Proof that an optimization is correct thus relies
oofs that the circuit equivalences it uses are correct.
of our circuit equivalence proofs have a common form,
we illustrate by example.
pose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
bitrary n,m and dimension d. Applying our denition
ivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
gure 3. Suppose both sides of the equation are well
(m d and n d and m = n), and consider the case
(the n m case is similar). We expand appl 1 and
2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
pl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
m p q
term.) After expressions are in g
simplies them by removing mu
matrix and rewriting simple matr
In our example, after normaliz
gridify, both sides of the equalit
I2m ⊗ 11 ⊗ I2p ⊗ I2 ⊗ I2q + I2m
proving that the two expressions
We use gridify to verify mos
in the optimizations given in Sec
is most eective when equivale
alences used in gate cancellation
apply to patterns of at most ve
For equivalences over larger, non
one used in rotation merging, we
but still rely on our automation f
4.3 Optimization by Propaga
Our propagate-cancel optimizatio
localize a set of gates by repeate
rules. Then we apply a circuit equ
of gates. In most optimizatio
of code patterns, but one—not pr
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to jus
local rewrites. Proof that an optimization is correct thus re
on proofs that the circuit equivalences it uses are corr
Many of our circuit equivalence proofs have a common fo
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denit
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
per Figure 3. Suppose both sides of the equation are w
typed (m d and n d and m = n), and consider the c
m n (the n m case is similar). We expand appl 1 a
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
appl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
+ I2m ⊗ 00 ⊗ I2p ⊗ I2 ⊗ I2q
19. Verifying Matrix Equivalences
• Proving matrix equivalences in Coq is tedious
• E.g.
11
each other out.
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to justify
local rewrites. Proof that an optimization is correct thus relies
on proofs that the circuit equivalences it uses are correct.
Many of our circuit equivalence proofs have a common form,
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denition
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
per Figure 3. Suppose both sides of the equation are well
typed (m d and n d and m = n), and consider the case
m n (the n m case is similar). We expand appl 1 and
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
term.)
simpli
matrix
In o
gridif
I2m ⊗
provin
We
in the
is mos
alence
apply t
For eq
one us
but sti
4.3 O
Our pr
localiz
rules. T
of gate
other out.
Proving Circuit Equivalences
’s optimizations use circuit equivalences to justify
ewrites. Proof that an optimization is correct thus relies
oofs that the circuit equivalences it uses are correct.
of our circuit equivalence proofs have a common form,
we illustrate by example.
pose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
bitrary n,m and dimension d. Applying our denition
ivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
gure 3. Suppose both sides of the equation are well
(m d and n d and m = n), and consider the case
(the n m case is similar). We expand appl 1 and
2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
pl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
m p q
term.) After expressions are in g
simplies them by removing mu
matrix and rewriting simple matr
In our example, after normaliz
gridify, both sides of the equalit
I2m ⊗ 11 ⊗ I2p ⊗ I2 ⊗ I2q + I2m
proving that the two expressions
We use gridify to verify mos
in the optimizations given in Sec
is most eective when equivale
alences used in gate cancellation
apply to patterns of at most ve
For equivalences over larger, non
one used in rotation merging, we
but still rely on our automation f
4.3 Optimization by Propaga
Our propagate-cancel optimizatio
localize a set of gates by repeate
rules. Then we apply a circuit equ
of gates. In most optimizatio
of code patterns, but one—not pr
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to jus
local rewrites. Proof that an optimization is correct thus re
on proofs that the circuit equivalences it uses are corr
Many of our circuit equivalence proofs have a common fo
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denit
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
per Figure 3. Suppose both sides of the equation are w
typed (m d and n d and m = n), and consider the c
m n (the n m case is similar). We expand appl 1 a
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
appl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
+ I2m ⊗ 00 ⊗ I2p ⊗ I2 ⊗ I2q
local rewrites. Proof that an optimization is correct thus relies
on proofs that the circuit equivalences it uses are correct.
Many of our circuit equivalence proofs have a common form,
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denition
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
per Figure 3. Suppose both sides of the equation are well
typed (m d and n d and m = n), and consider the case
m n (the n m case is similar). We expand appl 1 and
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
appl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
+ I2m ⊗ 00 ⊗ I2p ⊗ I2 ⊗ I2q
gridify, both sides of th
I2m ⊗ 11 ⊗ I2p ⊗ I2 ⊗
proving that the two ex
We use gridify to ve
in the optimizations give
is most eective when
alences used in gate ca
apply to patterns of at m
For equivalences over la
one used in rotation mer
but still rely on our auto
4.3 Optimization by
Our propagate-cancel op
localize a set of gates by
rules. Then we apply a c
of gates. In most op
of code patterns, but on
we discuss it rst.
6
Many of our circuit equivalence proofs have a common form
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denitio
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(
per Figure 3. Suppose both sides of the equation are we
typed (m d and n d and m = n), and consider the cas
m n (the n m case is similar). We expand appl 1 an
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
appl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
+ I2m ⊗ 00 ⊗ I2p ⊗ I2 ⊗ I2q
20. Verifying Matrix Equivalences
• Proving matrix equivalences in Coq is tedious
• E.g.
11
each other out.
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to justify
local rewrites. Proof that an optimization is correct thus relies
on proofs that the circuit equivalences it uses are correct.
Many of our circuit equivalence proofs have a common form,
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denition
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
per Figure 3. Suppose both sides of the equation are well
typed (m d and n d and m = n), and consider the case
m n (the n m case is similar). We expand appl 1 and
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
term.)
simpli
matrix
In o
gridif
I2m ⊗
provin
We
in the
is mos
alence
apply t
For eq
one us
but sti
4.3 O
Our pr
localiz
rules. T
of gate
other out.
Proving Circuit Equivalences
’s optimizations use circuit equivalences to justify
ewrites. Proof that an optimization is correct thus relies
oofs that the circuit equivalences it uses are correct.
of our circuit equivalence proofs have a common form,
we illustrate by example.
pose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
bitrary n,m and dimension d. Applying our denition
ivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
gure 3. Suppose both sides of the equation are well
(m d and n d and m = n), and consider the case
(the n m case is similar). We expand appl 1 and
2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
pl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
m p q
term.) After expressions are in g
simplies them by removing mu
matrix and rewriting simple matr
In our example, after normaliz
gridify, both sides of the equalit
I2m ⊗ 11 ⊗ I2p ⊗ I2 ⊗ I2q + I2m
proving that the two expressions
We use gridify to verify mos
in the optimizations given in Sec
is most eective when equivale
alences used in gate cancellation
apply to patterns of at most ve
For equivalences over larger, non
one used in rotation merging, we
but still rely on our automation f
4.3 Optimization by Propaga
Our propagate-cancel optimizatio
localize a set of gates by repeate
rules. Then we apply a circuit equ
of gates. In most optimizatio
of code patterns, but one—not pr
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to jus
local rewrites. Proof that an optimization is correct thus re
on proofs that the circuit equivalences it uses are corr
Many of our circuit equivalence proofs have a common fo
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denit
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
per Figure 3. Suppose both sides of the equation are w
typed (m d and n d and m = n), and consider the c
m n (the n m case is similar). We expand appl 1 a
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
appl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
+ I2m ⊗ 00 ⊗ I2p ⊗ I2 ⊗ I2q
ate-of-
e two
gation
ern of
latter
duces
ect of
ram—
cancel
ustify
relies
orrect.
form,
dimensions are appropriate):
● Imn = Im ⊗ In
● A × (B +C) = A × B + A ×C
● (A + B) ×C = A ×C + B ×C
● A ⊗ (B +C) = A ⊗ B + A ⊗C
● (A + B) ⊗C = A ⊗C + B ⊗C
● (A ⊗ B) × (C ⊗ D) = (A ×C) ⊗ (B × D)
The rst rule is applied to facilitate application of the other
rules. (For instance, in the example above, I2n would be re-
placed by I2m ⊗ I2 ⊗ I2p to match the structure of the appl 2
term.) After expressions are in grid normal form, gridify
simplies them by removing multiplication by the identity
matrix and rewriting simple matrix products (e.g. x x = I2).
In our example, after normalization and simplication by
gridify, both sides of the equality in Equation (1) become
I2m ⊗ 11 ⊗ I2p ⊗ I2 ⊗ I2q + I2m ⊗ 00 ⊗ I2p ⊗ x ⊗ I2q ,
proving that the two expressions are equal.
We use gridify to verify most of the equivalences used
in the optimizations given in Sections 4.3 and 4.4. The tactic
21. Verifying Matrix Equivalences
• Proving matrix equivalences in Coq is tedious
• E.g.
• Fortunately, this is mostly automated in our development
11
each other out.
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to justify
local rewrites. Proof that an optimization is correct thus relies
on proofs that the circuit equivalences it uses are correct.
Many of our circuit equivalence proofs have a common form,
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denition
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
per Figure 3. Suppose both sides of the equation are well
typed (m d and n d and m = n), and consider the case
m n (the n m case is similar). We expand appl 1 and
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
term.)
simpli
matrix
In o
gridif
I2m ⊗
provin
We
in the
is mos
alence
apply t
For eq
one us
but sti
4.3 O
Our pr
localiz
rules. T
of gate
other out.
Proving Circuit Equivalences
’s optimizations use circuit equivalences to justify
ewrites. Proof that an optimization is correct thus relies
oofs that the circuit equivalences it uses are correct.
of our circuit equivalence proofs have a common form,
we illustrate by example.
pose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
bitrary n,m and dimension d. Applying our denition
ivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
(1)
gure 3. Suppose both sides of the equation are well
(m d and n d and m = n), and consider the case
(the n m case is similar). We expand appl 1 and
2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
pl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
m p q
term.) After expressions are in g
simplies them by removing mu
matrix and rewriting simple matr
In our example, after normaliz
gridify, both sides of the equalit
I2m ⊗ 11 ⊗ I2p ⊗ I2 ⊗ I2q + I2m
proving that the two expressions
We use gridify to verify mos
in the optimizations given in Sec
is most eective when equivale
alences used in gate cancellation
apply to patterns of at most ve
For equivalences over larger, non
one used in rotation merging, we
but still rely on our automation f
4.3 Optimization by Propaga
Our propagate-cancel optimizatio
localize a set of gates by repeate
rules. Then we apply a circuit equ
of gates. In most optimizatio
of code patterns, but one—not pr
4.2 Proving Circuit Equivalences
All of ’s optimizations use circuit equivalences to jus
local rewrites. Proof that an optimization is correct thus re
on proofs that the circuit equivalences it uses are corr
Many of our circuit equivalence proofs have a common fo
which we illustrate by example.
Suppose we wish to prove the equivalence
X n; CNOT m n ≡ CNOT m n; X n
for arbitrary n,m and dimension d. Applying our denit
of equivalence, this amounts to proving
appl 1(X,n,d) × appl 2(CNOT,m,n,d) =
appl 2(CNOT,m,n,d) × appl 1(X,n,d),
per Figure 3. Suppose both sides of the equation are w
typed (m d and n d and m = n), and consider the c
m n (the n m case is similar). We expand appl 1 a
appl 2 as follows with p = n −m − 1 and q = d − n − 1:
appl 1(X,n,d) = I2n ⊗ x ⊗ I2q
appl 2(CNOT,m,n,d) = I2m ⊗ 11 ⊗ I2p ⊗ x ⊗ I2q
+ I2m ⊗ 00 ⊗ I2p ⊗ I2 ⊗ I2q
22. Experiment
• Evaluated unitary optimizations
• Compared against Qiskit, t ket , PyZX, Nam et al. and
Amy et al.2
• Benchmark of 29 programs from Amy et al., ranging from
45 to 61629 gates and 5 to 192 qubits
• Considered reduction in total gate count and T-gate count
2Amy et al. Polynomial-Time T-Depth Optimization of Clifford+T Circuits Via Matroid Partitioning. 2014.
⟩|
12
23. Results
• Average gate count reduction
• Average T-count reduction
Amy et al. Nam et al. PyZX VOQC
40.9% 41.0% 42.6% 39.4%
Nam et al. Qiskit t ket VOQC
26.5% 10.7% 11.2% 18.4%
⟩|
13
24. ❓
❓
Is the translation between
industry IRs and SQIR correct?
High-level Language
E.g. QWIRE, Quipper, Q#
Unoptimized IR
E.g. OpenQASM, Quil
Optimized IR
E.g. OpenQASM, Quil
Hardware Instructions
Unoptimized SQIR
Optimized SQIR
VOQC
14
25. Is the translation between
industry IRs and SQIR correct?
High-level Language
E.g. QWIRE, Quipper, Q#
Unoptimized IR
E.g. OpenQASM, Quil
Optimized IR
E.g. OpenQASM, Quil
Hardware Instructions
Unoptimized SQIR
Optimized SQIR
VOQC
14
26. We verify translation between
OpenQASM and SQIR
A feature-complete parser for OpenQASM
Translation between unitary fragments of
the two languages
A denotational semantics for unitary OpenQASM
Semantic preservation property of translation
15
27. Unitary SQIR and OpenQASM
have fairly similar abstract syntax
cute code on real machines [Wille et al. 2019].
observe that at their core, OpenQASM and s are very similar languages but dier
pect. Namely, s assumes a global, indexed register that makes it easy to refer to any
ble to the program with its unique index; while OpenQASM uses abstract identier
o be declared and looked up.
verify correctness of a translation from/to OpenQASM, we must develop a denota
tics for the language, which lacks one despite its pervasiveness. Amy [2019] provid
ional semantics for a subset of the language which we use as a starting point.
Syntax. We employ the following syntax of OpenQASM, following Amy [2019]:
Identier x
Index i
Expression E ::= x | x[i]
Unitary Statement U ::= H(E) | CX(E1, E2) | E(E1, . . . , En) | U1; U2
Command C ::= qreg x[i] | gate x(x1, . . . ,xn) { U } | U | C1; C2
yntax focuses on only the unitary fragment of OpenQASM. It also ignores gates paramet
l numbers in favor of built-in gates. For example, instead of the unitary U gate that takes
arameters, this syntax uses the Hadamard (H) gate from the OpenQASM standard library
liberate choice for the purpose of translation as most OpenQASM programs are written
mmon gates dened in the standard library. Other single-qubit gates are similar modul
OpenQASMa
OpenQASM is a larger language
that supports declaring qubit registers
and user-defined gates
SQIR
s is a language for describing quantum programs that
is deeply embedded in the Coq proof assistant. In s, a
qubit is referred to by a natural number that indices into a
global register of quantum bits. Unitary s programs allow
sequencing and unitary gate application to one or two qubits,
drawing from a xed set of gates.
U ∶∶= U1; U2 G q G q1 q2
G ∶∶= H CNOT
Each s program is parameterized by a unitary gate set
(from which G is drawn) and the dimension of the global
register (i.e., the number of available qubits).
A unitary programU is well-typed if every gate application
is valid. A gate application is valid if all of its arguments are
in-bounds indices into the global register, and no index is
repeated. This second requirement enforces linearity and
thereby quantum mechanics’ no-cloning theorem.
The semantics of unitary s programs is shown in Fig-
ure 3. If a program is not well-typed, its denotation is the
zero matrix. The advantage of this denition is that it allows
gate is R
gate is R0,
as s pro
swaps two
We say
U1 ≡ U2, if
For verifyi
will often w
(for ∈ R)
that two c
U1 ≅ U2, w
3.2 Add
To describ
s with
The comm
QPL [41])
P1 or P2 de
measurem
Qubits are indices into a global register
16
28. Unitary SQIR and OpenQASM
have fairly similar abstract syntax
cute code on real machines [Wille et al. 2019].
observe that at their core, OpenQASM and s are very similar languages but dier
pect. Namely, s assumes a global, indexed register that makes it easy to refer to any
ble to the program with its unique index; while OpenQASM uses abstract identier
o be declared and looked up.
verify correctness of a translation from/to OpenQASM, we must develop a denota
tics for the language, which lacks one despite its pervasiveness. Amy [2019] provid
ional semantics for a subset of the language which we use as a starting point.
Syntax. We employ the following syntax of OpenQASM, following Amy [2019]:
Identier x
Index i
Expression E ::= x | x[i]
Unitary Statement U ::= H(E) | CX(E1, E2) | E(E1, . . . , En) | U1; U2
Command C ::= qreg x[i] | gate x(x1, . . . ,xn) { U } | U | C1; C2
yntax focuses on only the unitary fragment of OpenQASM. It also ignores gates paramet
l numbers in favor of built-in gates. For example, instead of the unitary U gate that takes
arameters, this syntax uses the Hadamard (H) gate from the OpenQASM standard library
liberate choice for the purpose of translation as most OpenQASM programs are written
mmon gates dened in the standard library. Other single-qubit gates are similar modul
OpenQASMa
OpenQASM is a larger language
that supports declaring qubit registers
and user-defined gates
SQIR
s is a language for describing quantum programs that
is deeply embedded in the Coq proof assistant. In s, a
qubit is referred to by a natural number that indices into a
global register of quantum bits. Unitary s programs allow
sequencing and unitary gate application to one or two qubits,
drawing from a xed set of gates.
U ∶∶= U1; U2 G q G q1 q2
G ∶∶= H CNOT
Each s program is parameterized by a unitary gate set
(from which G is drawn) and the dimension of the global
register (i.e., the number of available qubits).
A unitary programU is well-typed if every gate application
is valid. A gate application is valid if all of its arguments are
in-bounds indices into the global register, and no index is
repeated. This second requirement enforces linearity and
thereby quantum mechanics’ no-cloning theorem.
The semantics of unitary s programs is shown in Fig-
ure 3. If a program is not well-typed, its denotation is the
zero matrix. The advantage of this denition is that it allows
gate is R
gate is R0,
as s pro
swaps two
We say
U1 ≡ U2, if
For verifyi
will often w
(for ∈ R)
that two c
U1 ≅ U2, w
3.2 Add
To describ
s with
The comm
QPL [41])
P1 or P2 de
measurem
Qubits are indices into a global register
16
29. Unitary SQIR and OpenQASM
have fairly similar abstract syntax
cute code on real machines [Wille et al. 2019].
observe that at their core, OpenQASM and s are very similar languages but dier
pect. Namely, s assumes a global, indexed register that makes it easy to refer to any
ble to the program with its unique index; while OpenQASM uses abstract identier
o be declared and looked up.
verify correctness of a translation from/to OpenQASM, we must develop a denota
tics for the language, which lacks one despite its pervasiveness. Amy [2019] provid
ional semantics for a subset of the language which we use as a starting point.
Syntax. We employ the following syntax of OpenQASM, following Amy [2019]:
Identier x
Index i
Expression E ::= x | x[i]
Unitary Statement U ::= H(E) | CX(E1, E2) | E(E1, . . . , En) | U1; U2
Command C ::= qreg x[i] | gate x(x1, . . . ,xn) { U } | U | C1; C2
yntax focuses on only the unitary fragment of OpenQASM. It also ignores gates paramet
l numbers in favor of built-in gates. For example, instead of the unitary U gate that takes
arameters, this syntax uses the Hadamard (H) gate from the OpenQASM standard library
liberate choice for the purpose of translation as most OpenQASM programs are written
mmon gates dened in the standard library. Other single-qubit gates are similar modul
OpenQASMa
OpenQASM is a larger language
that supports declaring qubit registers
and user-defined gates
SQIR
s is a language for describing quantum programs that
is deeply embedded in the Coq proof assistant. In s, a
qubit is referred to by a natural number that indices into a
global register of quantum bits. Unitary s programs allow
sequencing and unitary gate application to one or two qubits,
drawing from a xed set of gates.
U ∶∶= U1; U2 G q G q1 q2
G ∶∶= H CNOT
Each s program is parameterized by a unitary gate set
(from which G is drawn) and the dimension of the global
register (i.e., the number of available qubits).
A unitary programU is well-typed if every gate application
is valid. A gate application is valid if all of its arguments are
in-bounds indices into the global register, and no index is
repeated. This second requirement enforces linearity and
thereby quantum mechanics’ no-cloning theorem.
The semantics of unitary s programs is shown in Fig-
ure 3. If a program is not well-typed, its denotation is the
zero matrix. The advantage of this denition is that it allows
gate is R
gate is R0,
as s pro
swaps two
We say
U1 ≡ U2, if
For verifyi
will often w
(for ∈ R)
that two c
U1 ≅ U2, w
3.2 Add
To describ
s with
The comm
QPL [41])
P1 or P2 de
measurem
Qubits are indices into a global register
16
30. Unitary SQIR and OpenQASM
have fairly similar abstract syntax
cute code on real machines [Wille et al. 2019].
observe that at their core, OpenQASM and s are very similar languages but dier
pect. Namely, s assumes a global, indexed register that makes it easy to refer to any
ble to the program with its unique index; while OpenQASM uses abstract identier
o be declared and looked up.
verify correctness of a translation from/to OpenQASM, we must develop a denota
tics for the language, which lacks one despite its pervasiveness. Amy [2019] provid
ional semantics for a subset of the language which we use as a starting point.
Syntax. We employ the following syntax of OpenQASM, following Amy [2019]:
Identier x
Index i
Expression E ::= x | x[i]
Unitary Statement U ::= H(E) | CX(E1, E2) | E(E1, . . . , En) | U1; U2
Command C ::= qreg x[i] | gate x(x1, . . . ,xn) { U } | U | C1; C2
yntax focuses on only the unitary fragment of OpenQASM. It also ignores gates paramet
l numbers in favor of built-in gates. For example, instead of the unitary U gate that takes
arameters, this syntax uses the Hadamard (H) gate from the OpenQASM standard library
liberate choice for the purpose of translation as most OpenQASM programs are written
mmon gates dened in the standard library. Other single-qubit gates are similar modul
OpenQASMa
OpenQASM is a larger language
that supports declaring qubit registers
and user-defined gates
SQIR
s is a language for describing quantum programs that
is deeply embedded in the Coq proof assistant. In s, a
qubit is referred to by a natural number that indices into a
global register of quantum bits. Unitary s programs allow
sequencing and unitary gate application to one or two qubits,
drawing from a xed set of gates.
U ∶∶= U1; U2 G q G q1 q2
G ∶∶= H CNOT
Each s program is parameterized by a unitary gate set
(from which G is drawn) and the dimension of the global
register (i.e., the number of available qubits).
A unitary programU is well-typed if every gate application
is valid. A gate application is valid if all of its arguments are
in-bounds indices into the global register, and no index is
repeated. This second requirement enforces linearity and
thereby quantum mechanics’ no-cloning theorem.
The semantics of unitary s programs is shown in Fig-
ure 3. If a program is not well-typed, its denotation is the
zero matrix. The advantage of this denition is that it allows
gate is R
gate is R0,
as s pro
swaps two
We say
U1 ≡ U2, if
For verifyi
will often w
(for ∈ R)
that two c
U1 ≅ U2, w
3.2 Add
To describ
s with
The comm
QPL [41])
P1 or P2 de
measurem
Qubits are indices into a global register
16
Only shown a sample gate set
of Hadamard (H) and
controlled NOT (CNOT or CX)
31. Unitary SQIR and OpenQASM
have fairly similar abstract syntax
aAmy M. Sized Types for Low-Level Quantum Metaprogramming. Reversible Computation. RC 2019.
cute code on real machines [Wille et al. 2019].
observe that at their core, OpenQASM and s are very similar languages but dier
pect. Namely, s assumes a global, indexed register that makes it easy to refer to any
ble to the program with its unique index; while OpenQASM uses abstract identier
o be declared and looked up.
verify correctness of a translation from/to OpenQASM, we must develop a denota
tics for the language, which lacks one despite its pervasiveness. Amy [2019] provid
ional semantics for a subset of the language which we use as a starting point.
Syntax. We employ the following syntax of OpenQASM, following Amy [2019]:
Identier x
Index i
Expression E ::= x | x[i]
Unitary Statement U ::= H(E) | CX(E1, E2) | E(E1, . . . , En) | U1; U2
Command C ::= qreg x[i] | gate x(x1, . . . ,xn) { U } | U | C1; C2
yntax focuses on only the unitary fragment of OpenQASM. It also ignores gates paramet
l numbers in favor of built-in gates. For example, instead of the unitary U gate that takes
arameters, this syntax uses the Hadamard (H) gate from the OpenQASM standard library
liberate choice for the purpose of translation as most OpenQASM programs are written
mmon gates dened in the standard library. Other single-qubit gates are similar modul
OpenQASMa
OpenQASM is a larger language
that supports declaring qubit registers
and user-defined gates
SQIR
s is a language for describing quantum programs that
is deeply embedded in the Coq proof assistant. In s, a
qubit is referred to by a natural number that indices into a
global register of quantum bits. Unitary s programs allow
sequencing and unitary gate application to one or two qubits,
drawing from a xed set of gates.
U ∶∶= U1; U2 G q G q1 q2
G ∶∶= H CNOT
Each s program is parameterized by a unitary gate set
(from which G is drawn) and the dimension of the global
register (i.e., the number of available qubits).
A unitary programU is well-typed if every gate application
is valid. A gate application is valid if all of its arguments are
in-bounds indices into the global register, and no index is
repeated. This second requirement enforces linearity and
thereby quantum mechanics’ no-cloning theorem.
The semantics of unitary s programs is shown in Fig-
ure 3. If a program is not well-typed, its denotation is the
zero matrix. The advantage of this denition is that it allows
gate is R
gate is R0,
as s pro
swaps two
We say
U1 ≡ U2, if
For verifyi
will often w
(for ∈ R)
that two c
U1 ≅ U2, w
3.2 Add
To describ
s with
The comm
QPL [41])
P1 or P2 de
measurem
Qubits are indices into a global register
16
Only shown a sample gate set
of Hadamard (H) and
controlled NOT (CNOT or CX)
32. Denotational semantics of SQIR
and OpenQASM correspond
17
SQIR
Dra paper, November 22, 2019, K. Hietala, R. Rand, S. Hung, X. Wu
nU1; U2od = nU2od × nU1od
nG1 qod =
appl 1(G1, q, d) well-typed
02d otherwise
nG2 q1 q2od =
appl 2(G2, q1, q2, d) well-typed
02d otherwise
Figure 3. Semantics of unitary s programs, assuming a
global register of dimension d. The appl k function maps a
gate name to its corresponding unitary matrix and extends
the intended operation to the given dimension by applying
an identity operation on every other qubit in the system. For
example, appl 1(X, q, d) = I2q ⊗ x ⊗ I2(d−q−1) where x is
the matrix interpretation of the X gate.
3.1 Unitary Core
s is a language for describing quantum programs that
is deeply embedded in the Coq proof assistant. In s, a
qubit is referred to by a natural number that indices into a
global register of quantum bits. Unitary s programs allow
sequencing and unitary gate application to one or two qubits,
drawing from a xed set of gates.
{skip}d ( ) =
{P1; P2}d ( ) = ({P2}d ○ {P1}d )( )
{U }d ( ) = nU od × × nU o†
d
{meas q P1 P2}d ( ) = {P2}d (0q0 × × 0
+ {P1}d (1q1 × × 1
Figure 4. s density matrix semantics, assumin
register of size d.
and the matrix interpretation of the CNOT gate
Section 2.1.
Common single-qubit gates can be dened in
R , , . For example, the identity I is R0,0,0; the Ha
gate is R 2,0, ; the Pauli X gate is R ,0, and th
gate is R0,0, . We can also dene more complex o
as s programs. For example the SWAP operat
swaps two qubits, is a sequence of three CNOT g
We say that two unitary programs are equivale
U1 ≡ U2, if their denotation is the same, i.e., nU1o
For verifying equivalence of quantum programs, ho
will often want something more general since
(for ∈ R) represent the same physical state. We th
A SQIR unitary program
denotes a unitary matrix2d
× 2d
OpenQASM 3
Value V = Location, l + Loc. Array, (lj, . . . ,lk )
+ Unitary Gate, (x1, . . . ,xn).U
Environment = Identier ! Value
Quantum State | i = 2d -dimension complex vector
Here | i is a vector in a 2m-dimension complex Hilbert space, representing the complete quantum
state available to a program. For a given program, the size of the vector is determined by m =
Õ
ni
where ni are the sizes of each of the declared quantum registers.
Similar to the semantics of s, we need padding functions that are used to determine the
modied quantum state after applying a unitary operation to the given location(s), for example:
apply(H, | i ,l) = (I ⌦l
⌦ H ⌦ I ⌦m l 1
) | i
This manipulation of global quantum state is necessary as quantum computing inherently
involves non-local eects such as entanglement.
We can now specify semantic functions for each of the three syntactic classes:
Expressions need environment
and return bound values
Unitary statements modify
quantum state
Commands modify both
environment and quantum state
Value V = Location, l + Loc. Array, (lj, . . . ,lk )
+ Unitary Gate, (x1, . . . ,xn).U
Environment = Identier ! Value
Quantum State | i = 2d -dimension complex vector
| i is a vector in a 2m-dimension complex Hilbert space, representing the complete quantum
available to a program. For a given program, the size of the vector is determined by m =
Õ
ni
re ni are the sizes of each of the declared quantum registers.
milar to the semantics of s, we need padding functions that are used to determine the
ied quantum state after applying a unitary operation to the given location(s), for example:
apply(H, | i ,l) = (I ⌦l
⌦ H ⌦ I ⌦m l 1
) | i
his manipulation of global quantum state is necessary as quantum computing inherently
lves non-local eects such as entanglement.
e can now specify semantic functions for each of the three syntactic classes:
(| |)E : E ⇥ ! V
(| |)U : U ⇥ ⇥ | i ! | 0
i
(| |)C : C ⇥ ⇥ | i ! 0
⇥ | 0
i
(| |)E : E ⇥ ! V
(| |)U : U ⇥ ⇥ | i ! | 0i
(| |)C : C ⇥ ⇥ | i ! 0 ⇥ | 0i
xpressions need an environment to return bound values. Unitary statements require an environ-
t and the complete quantum state but only manipulate the quantum state. Finally, commands
Details elided
33. Semantic preservation properties
are maintained during translation
18
inally, we would also like to see that if we convert from one language to another and back, we
ain the identity function:
8x 2 L(s), (f (x)) = x (3)
is very easy to use our translation to obtain the original program written in s and hence the
mposition of and f is equivalent to identity function. But a similar statement for translating
enQASM to s and back does not hold. This is because of the lack of identiers in s. Our
Further, converting from SQIR to OpenQASM and back
recovers the original program.
For all valid programs in SQIR of dimension ,
their denotation is equivalent to
the denotation of their translation, and vice versa.
dwant to show that the translations from s to OpenQASM (which we will call f ) and
ASM to s ( ) are semantics preserving:
8x 2 L(s), nxod = (|f (x)|) (1)
8 2 L(OpenQASM), (| |) = n ( )od (2)
f : L(s) ! L(OpenQASM) (3)
: L(OpenQASM) ! L(s) (4)
of these properties are easy to prove using structural induction on the abstract syntax. For
reate a single qubit register “q” of size m (dim of s) to serve as the quantum state | i and
ngle mapping for that in the environment . For (2), we also need to prove the correctness
unction that maps an OpenQASM register and its index to a s global index.
M to s ( ) are semantics preserving:
8x 2 L(s), nxod = (|f (x)|) (1)
8 2 L(OpenQASM), (| |) = n ( )od (2)
f : L(s) ! L(OpenQASM) (3)
: L(OpenQASM) ! L(s) (4)
hese properties are easy to prove using structural induction on the abstract syntax. For
te a single qubit register “q” of size m (dim of s) to serve as the quantum state | i and
e mapping for that in the environment . For (2), we also need to prove the correctness
tion that maps an OpenQASM register and its index to a s global index.
we would also like to see that if we convert from one language to another and back, we
identity function:
8x 2 L(s), (f (x)) = x (5)
easy to use our translation to obtain the original program written in s and hence the
n of and f is equivalent to identity function. But a similar statement for translating
M to s and back does not hold. This is because of the lack of identiers in s. Our
to s is necessarily forgetful and hence, when we translate the program back to
M, we lose some of the structure of the original program.
ocamllex (the OCaml lexer generator) and the Menhir parser generator [Pottier and
as 2019] to write a feature-complete parser for OpenQASM. We then translate the
34. Semantic preservation properties
are maintained during translation
18
inally, we would also like to see that if we convert from one language to another and back, we
ain the identity function:
8x 2 L(s), (f (x)) = x (3)
is very easy to use our translation to obtain the original program written in s and hence the
mposition of and f is equivalent to identity function. But a similar statement for translating
enQASM to s and back does not hold. This is because of the lack of identiers in s. Our
Further, converting from SQIR to OpenQASM and back
recovers the original program.
But the reverse direction does not hold.
For all valid programs in SQIR of dimension ,
their denotation is equivalent to
the denotation of their translation, and vice versa.
dwant to show that the translations from s to OpenQASM (which we will call f ) and
ASM to s ( ) are semantics preserving:
8x 2 L(s), nxod = (|f (x)|) (1)
8 2 L(OpenQASM), (| |) = n ( )od (2)
f : L(s) ! L(OpenQASM) (3)
: L(OpenQASM) ! L(s) (4)
of these properties are easy to prove using structural induction on the abstract syntax. For
reate a single qubit register “q” of size m (dim of s) to serve as the quantum state | i and
ngle mapping for that in the environment . For (2), we also need to prove the correctness
unction that maps an OpenQASM register and its index to a s global index.
M to s ( ) are semantics preserving:
8x 2 L(s), nxod = (|f (x)|) (1)
8 2 L(OpenQASM), (| |) = n ( )od (2)
f : L(s) ! L(OpenQASM) (3)
: L(OpenQASM) ! L(s) (4)
hese properties are easy to prove using structural induction on the abstract syntax. For
te a single qubit register “q” of size m (dim of s) to serve as the quantum state | i and
e mapping for that in the environment . For (2), we also need to prove the correctness
tion that maps an OpenQASM register and its index to a s global index.
we would also like to see that if we convert from one language to another and back, we
identity function:
8x 2 L(s), (f (x)) = x (5)
easy to use our translation to obtain the original program written in s and hence the
n of and f is equivalent to identity function. But a similar statement for translating
M to s and back does not hold. This is because of the lack of identiers in s. Our
to s is necessarily forgetful and hence, when we translate the program back to
M, we lose some of the structure of the original program.
ocamllex (the OCaml lexer generator) and the Menhir parser generator [Pottier and
as 2019] to write a feature-complete parser for OpenQASM. We then translate the
35. OpenQASM parser written in
OCaml programming language
19
Conforms to OpenQASM specb
Uses OCamllex and Menhir parser generator
Available now as an OCaml library on
OPAM package repository:
opam install openQASM
bCross et al. Open Quantum Assembly Language. arXiv:1707.03429
36. Ongoing and Future Work
• We’re always looking for more transformations to verify
• Optimization from other compilers (incl. error aware)
• More sophisticated circuit mapping
• Compilation of classical circuits
• Performance improvements; evaluations on larger sets of
benchmarks
• Larger verified toolchain
• Translation and verification of non-unitary fragments
• Validate our OpenQASM parser using Menhir’s Coq backend
• Verify translation from high-level languages such as QWIRE
20
37. Conclusions
• We have developed a compiler VOQC and an IR SQIR, both
implemented and verified in Coq
• Performance is comparable to state-of-the-art compilers
• We have also taken steps to ease interoperability with industry
toolchains with translation from and to OpenQASM
• Lots of ongoing work, let us know if you’re interested!
• Code:
•github.com/inQWIRE/SQIR
•github.com/inQWIRE/openqasm-parser
• Draft of VOQC paper: cs.umd.edu/~mwh/papers/voqc-draft.pdf
21