<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Of-the-shelf Components for Quantum Programming and Testing</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>CláudioGomes</string-name>
          <email>gomes@student.dei.uc.pt</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>DanielFortunato</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>João PauloFernandes</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Rui Abreu</string-name>
          <email>rui@computer.org</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>CISUC - Departamento de Engenharia Informática da Universidade de Coimbra</institution>
          ,
          <country country="PT">Portugal</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Faculty of Engineering of the University of Porto</institution>
          ,
          <country country="PT">Portugal</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Instituto Superior Técnico, University of Lisbon</institution>
          ,
          <country country="PT">Portugal</country>
        </aff>
      </contrib-group>
      <fpage>14</fpage>
      <lpage>19</lpage>
      <abstract>
        <p>In this position paper, we argue that readily available components are much needed as central contributions towards not only enlarging the community of quantum computer programmers, but also in order to increase their eficiency and efectiveness. We describe the work we intend to do towards providing such components, namely by developing and making available libraries of quantum algorithms and data structures, and libraries for testing quantum programs. We finally argue that Quantum Computer Programming is such an efervescent area that synchronization eforts and combined strategies within the community are demanded to shorten the time frame until quantum advantage is observed and can be explored in practice.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Quantum Computing</kwd>
        <kwd>Software Engineering</kwd>
        <kwd>Reusable Components</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>There is a large body of compelling evidence tChaomtputation as we have known and used for
decades is under challenge. As new models for computation emerge, its limits are being pushed
beyond what pragmatically had been seen in practice. In this line, Quantum Computing (QC) has
received renewed worldwide attention. Having its foundations been thoroughly studied, mainly
from the point of view of its physical implementation, their potential has, even if preliminarily,
is currently being witnessed.</p>
      <p>A quantum computer can potentially solve various problems that a classical computer cannot
solve eficiently; this is known as Quantum Supremacy. Examples include scalable simulations
of quantum systems in physics, eficient modelling of chemical reactions, and fast breaking of
encryption codes in cryptography.</p>
      <p>In an article published in Nature in October 2019, Google describes how using a self-built
54-qubit processor correctly executed, in only 200 seconds, a benchmark that even the world’s
fastest supercomputer would have taken an estimation of 10,000 years to complete; this way
showing the so-called quantum supremacy.</p>
      <p>In a follow-up, IBM has disputed the foundations of such estimation, and mainly the claim
that quantum supremacy has been reached. IBM’s argument is mainly about the assertion that
a properly crafted supercomputer could have reached the same result even more eficiently than
the Google quantum computer. However, no empirical demonstration was provided to support
such assertion. In essence, Google’s experiment provides clear evidence of the progress that has
been made in terms of superconducting-based quantum computing. IBM itself has also made
substantial progress to build universal quantum computers to support business, engineering
and science.</p>
      <p>The field of QC is evolving at a pace faster than people originally expected. For example, in
September 2020 Honeywell announced a that its revolutionary quantum computer based on
trapped-ion technology with achieved a quantum volume 128 – the highest quantum volume
ever achieved, and twice as the previous state of the art. Quantum volume is a unit of measure
indicating the fidelity of a quantum system. This important achievement shows that the field of
quantum computing may reach industrial impact much sooner than originally expected.</p>
      <p>While the fast approaching universal access to quantum computers is bound to break several
computation limitations that have lasted for decades, it is also poses major challenges in many,
if not all, computer science disciplines. It is well known, e.g., that the foundations of modern
cryptography based on the prime number factorization problem will have to be reconsidered.</p>
      <p>In this position paper, we propose to explore the potential and study the implications of QC
under the lenses of Software Engineering, which entail several phases during for the development
life-cycle (see Figur1e). Despite there is the need to also advance the state-of-the-art of the
other phases, we propose to focus on the phases of implementation and validation of quantum
programs, both when considered in isolation, and in a hybrid approach that combines quantum
and classical programs. We argue that these two phases are the much needed work to make
quantum programming accessible to people outside the quantum mechanics world.</p>
      <p>Our initial goal, which is described in Sect2io,nis to propose abstraction mechanisms to
improve the state of the art in terms of quantum software implementation. As the current
approaches to quantum programming also resort to quantum gates, they require a significant
efort from programmers. We will provide more eficient development mechanisms by
implementing a library of (hybrid) algorithms and data structures whose classical implementation is
well known and widely used. This library will be published as an open source artifact that the
community can build upon.</p>
      <p>Furthermore, approaches to perform verification and validation of quantum programs are
essentially lacking and largely unexplored. In fact, having implemented a quantum program,
the current practice to try to establish its correctness is to run the program multiple times and
observe its probable result. Although programmers can already run a program on a quantum
computer, there is no abstraction layer to make testing, let alone verification or validation,
more efective. As described in Section3 We will propose black-box methods to eficiently test
programs running on a quantum computer. Black-box methods are especially suited because,
due to the underlying classic quantum mechanics, one cannot observe the inner workings of
a quantum program without altering the program’s state and the final result, as measuring a
qubit destroys superposition.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Quantum algorithms and data structures</title>
      <p>In 1976, in the title of his landmark textboo1k][, Niklaus Wirth coined a famous equation in
Computer Science:ℎ +  =  .</p>
      <p>The sharpness of the equation supports the argument that mastering programming can not
be achieved without the combined knowledge of both algorithms and data structures.</p>
      <p>When defining a data structure, one’s goal is to represent an entity from the real world as a
string of bits in such a way that queries about that entity can be established eficiently. Studying
data structures aims precisely at finding the sweet spot between the length of the bit string and
the time it takes to answer queries on it.</p>
      <p>Problems associated with data structures are often divided into two categories: static and
dynamic. For static problems, we are essentially interested in being able to answer queries over
a data structure. For dynamic problems, we additionally want to be able to eficiently change
the data structure content.</p>
      <p>We propose to study and implement data structures in quantum processing units both for
static and dynamic problems. A concrete research challenge that the quantum context entails
is that query operations typically need to inspect, or measure, the (qu)bit string, which may
irreversibly alter the corresponding data. This difers from the classical context in the sense
that now we will also need to consider how many times one can use a data structure.</p>
      <p>We will start by targeting classical data structures with quantum access before moving on
to explore fully quantum data structures. In the former model, data is stored in classical bits,
which can be accessed quantumly. While this approach is certainly constructive, it has been
shown that for most problems, it has no (asymptotical) advantage over classical data structures.
We will then move on to the fully quantum realm, where data is encoded in qubits instead of
bits, and where we have access to all the operations that are provided in quantum computing.</p>
      <p>We will also considered extensively and in depth the quantum-setting algorithmic counterpart
of Wirth’s equation.</p>
      <p>Quantum computation models have originally been studied in the 1980s and algorithms to
explore quantum computing started appearing in the early 1990s, even if back then quantum
computational devices were essentially theoretical.</p>
      <p>Two of the most well known quantum algorithms are Shor’s polynomial-time algorithm for
prime factorization and discrete logarithm and Grover’s algorithm that can eficiently search
data in an unstructured database.</p>
      <p>
        While the groundbreaking nature of these well known algorithms can not be denied, a
challenge that we face here is that they are not possible to be executed in the near-term.
While near-term hardware implementations (of less than a hundred qubits) have recently been
developed, their limitations pose significant challenges regarding the development of practical
algorithms, the ones we propose to target. Nevertheless, a number of NISQ algorithms have
already been proposed, namely the Variational Quantum Eigenso2l]vaern[d the Quantum
Approximate Optimization Algorithm [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], which demonstrate the feasibility of the approach.
      </p>
      <p>The development of quantum algorithms is particularly challenging since it requires a
combination of skills which include, e.g., quantum mechanics and complexity theory, as well as a deep
computer science background. This will be strategically considered by representing diferent
profiles to supervise and conduct the associated workplan.</p>
      <p>The outcomes of our work will be made publicly available as open source tool sets that can
benefit the entire community. These artifacts will target multiple platforms that are already
available for general-purpose quantum computing such as IBM Qiskit or Google’s Cirq.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Validation and verification (V&amp;V) of quantum programs</title>
      <p>Quantum programming is challenging as quantum programs are necessarily probabilistic and
impossible to examine without disrupting execution. This dificulty is compounded by the fact
that quantum programs are dificult to test and/or debug.</p>
      <p>In the Classical Computing realm, V&amp;V has been extensively addressed. Classical computing
V&amp;V techniques, however, cannot be applied of-the-shelf.</p>
      <p>Consider, e.g., two standard techniques for debugging programs: breakpoints and print
statements. In a quantum program, printing the value of a quantum bit entails measuring it and
printing the returned value (i.e., measuring a qubit), which destroys superposition. Unit tests are
similarly of limited value when a program is probabilistic; repeatedly brute-forcing/running unit
tests on a quantum computer may be prohibitively expensive. Simulating quantum programs
on a classical computer holds some promise but requires resources exponential in the number
of qubits, so simulation cannot help in the general case.</p>
      <p>
        In the context of Quantum Computing, V&amp;V is still in its infanc4y][. A venue that has been
explored is to reason about a quantum program with vectors, as vectors do not collapse when
being analyzed. As formal verification is parametric in its inputs, one can prove properties of
that algorithm for arbitrary arities given as arguments. Preliminary advances have been shown
in a recent work using techniques like induction and algebraic reasoning[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        We argue that, in part, the lack of study in the field may be attributed to the fact that
programming languages available for QC are still essentially low-level, operating at the level of
quantum gates [
        <xref ref-type="bibr" rid="ref5 ref6">6,5</xref>
        ]. However, Quantum Programming languages are emerging 8[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]., While
high-level constructs aim at improving productivity, they also aim to allow programmers to
express even more complex computations.
      </p>
      <p>In this context, we aim to devise novel optimized quantum testing techniques to help develop
high quality quantum programs, thus leading to more confidence when deploying the envisioned
future safety and mission-critical applications of quantum computing in the long-term. Thus,
we will attempt to build theoretical foundations complemented with technologies for testing
quantum programs and, therefore, ensuring the dependability of quantum applications.</p>
      <p>Another challenge of addressing V&amp;V within Quantum Computing is that the systems of the
future will be hybrid, in the sense that the majority of software features will still be implemented
‘classically’, while computation-intensive features may be delegated to quantum components.
This means that our studies need to combine strategies that have demonstrated useful in the
classical setting with innovative ones that suit the quantum setting.</p>
      <p>
        We will start by exploring the applicability of the classical computing technique cause
elimination, which is a debugging technique that formulates hypotheses (using inductive/deductive
reasoning) by specifying a root cause for a bug under analysis. Then, data inputs and
experiments are crafted to refute or prove the hypothesis. We argue that this approach suits
quantum computing. Given the probabilistic nature of the QC progra4m],s[we plan to extend
the techniques used for testing probabilistic programs running on C9]Cto[ the QC domain.
Moreover, as this technique requires the program to be executed multiple times, possibly with
diferent inputs, we will also explore strategies to generate inputs to quantum programs (by
adapting the ever popular fuzzing techniques - which will require strategies to generate inputs
for testing quantum programs). Finally, the multiple executions, leveraging the logs, we will
propose semi-automated techniques to pinpoint the root cause of faulty programs[
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>All the techniques and approaches will not only be ofered within an IDE but also
seamlessly handle problems in both quantum and classical programs (i.e., hybrid programs) to ease
adoption.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions</title>
      <p>Computing in its current form is very much limited to address problems that scale linearly
with the problem size. In turn, quantum computing is expected to be a true game changer, as
it theoretically promises polynomial and exponential speedups. Numerous projects focus on
hardware advances to enable this computation, but the awareness of this opportunity for the
perspective of the user (e.g., developers of quantum programs) is still lagging behind.</p>
      <p>In this position paper, we propose a roadmap to advance the state-of-the-art of design and
development of quantum programs from the perspective of (quantum) software engineering.
To achieve this vision, and similar to today’s development of classical programs, we argue
that the research community needs to focus its eforts in developing quantum algorithms
and data structures as well as techniques of validate and verify quantum programs. These
developments will ofer of-the-shelve components and libraries that will help programmers
to develop quantum programs without the need to fully understand the underlying (quantum
mechanics) technologies.</p>
      <p>A key on the development of these approaches is to have the right abstraction such that
ifelds ranging from business economics, computer science, computer engineering and electrical
engineering are able to develop their applications. This abstraction will only be achieved if
researchers from diferent domains collaborate amongst themselves.</p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgements</title>
      <p>That authors would like to thank Shaukat Ali, Marco Pistoia, and Koen Bertels for the countless
discussions on defining a roadmap for Quantum Software Engineering.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>N.</given-names>
            <surname>Wirth</surname>
          </string-name>
          ,
          <article-title>Algorithms + data structures=programs</article-title>
          , Prentice-Hall,
          <string-name>
            <given-names>Englewood</given-names>
            <surname>Clifs</surname>
          </string-name>
          ,
          <string-name>
            <surname>N.J</surname>
          </string-name>
          ,
          <year>1976</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>A.</given-names>
            <surname>Peruzzo</surname>
          </string-name>
          ,
          <string-name>
            <surname>J. McClean</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Shadbolt</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.-H. Yung</surname>
            ,
            <given-names>X.-Q.</given-names>
          </string-name>
          <string-name>
            <surname>Zhou</surname>
            ,
            <given-names>P. J.</given-names>
          </string-name>
          <string-name>
            <surname>Love</surname>
          </string-name>
          , A. AspuruGuzik,
          <string-name>
            <surname>J. L. O'Brien</surname>
          </string-name>
          ,
          <article-title>A variational eigenvalue solver on a photonic quantum processor</article-title>
          ,
          <source>Nature Communications</source>
          <volume>5</volume>
          (
          <year>2014</year>
          ). URL:http://dx.doi.
          <source>org/10.1038/ncomms5213. doi1:0</source>
          . 1038/ncomms5213.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>E.</given-names>
            <surname>Farhi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Goldstone</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gutmann</surname>
          </string-name>
          ,
          <article-title>A quantum approximate optimization algorithm applied to a bounded occurrence constraint problem, 20a1r5X</article-title>
          .iv:
          <volume>1412</volume>
          .
          <fpage>6062</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Miranskyy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , On testing quantum programs,
          <source>2019 IEEE/ACM 41st International Conference on Software Engineering: New Ideas and Emerging Results (ICSE-NIER)</source>
          (
          <year>2019</year>
          ). URL: http://dx.doi.org/10.1109/ICSE-NIER.
          <year>2019</year>
          .
          <volume>00023</volume>
          . do1i:
          <fpage>0</fpage>
          .1109/icse- nier.
          <year>2019</year>
          .
          <volume>00023</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>R.</given-names>
            <surname>Rand</surname>
          </string-name>
          , Formally Verified Quantum Programming,
          <source>Ph.D. thesis</source>
          , University of Pennsylvania,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>A. W.</given-names>
            <surname>Cross</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. S.</given-names>
            <surname>Bishop</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. A.</given-names>
            <surname>Smolin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Gambetta</surname>
          </string-name>
          , Open quantum assembly language,
          <year>2017</year>
          . arXiv:
          <volume>1707</volume>
          .
          <fpage>03429</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>A. S.</given-names>
            <surname>Green</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. L.</given-names>
            <surname>Lumsdaine</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N. J.</given-names>
            <surname>Ross</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Selinger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Valiron</surname>
          </string-name>
          , Quipper,
          <source>ACM SIGPLAN Notices</source>
          <volume>48</volume>
          (
          <year>2013</year>
          )
          <fpage>333</fpage>
          -
          <lpage>342</lpage>
          . URL:http://dx.doi.
          <source>org/10.1145/2499370.2462177. do1i:0.1145/ 2499370</source>
          .2462177.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <article-title>[8] What are the Q# programming language</article-title>
          and QDK? - Microsoft
          <string-name>
            <surname>Quantumht</surname>
          </string-name>
          ,tps://docs. microsoft.com/en-us/quantum/language/?view=qsharp-preview,
          <year>2020</year>
          . Accessed:
          <fpage>2020</fpage>
          -10- 03.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>S.</given-names>
            <surname>Dutta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Legunsen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Huang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Misailovic</surname>
          </string-name>
          ,
          <article-title>Testing probabilistic programming systems</article-title>
          ,
          <source>in: Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering</source>
          , ESEC/FSE 2018,
          <article-title>Association for Computing Machinery</article-title>
          , New York, NY, USA,
          <year>2018</year>
          , p.
          <fpage>574</fpage>
          -
          <lpage>586</lpage>
          . URL: https://doi.org/10.1145/3236024.3236057. doi1:
          <fpage>0</fpage>
          .1145/3236024.3236057.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>W. E.</given-names>
            <surname>Wong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Gao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Abreu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wotawa</surname>
          </string-name>
          ,
          <article-title>A survey on software fault localization</article-title>
          ,
          <source>IEEE Transactions on Software Engineering</source>
          <volume>42</volume>
          (
          <year>2016</year>
          )
          <fpage>707</fpage>
          -
          <lpage>740</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>