<<

applied sciences

Article On the Definition of Quantum Programming Modules

Pedro Sánchez * and Diego Alonso

Department of Information and Communications Technologies, Universidad Politécnica de Cartagena, 30201 Cartagena, Spain; [email protected] * Correspondence: [email protected]; Tel.: +34-968-326-460

Abstract: There are no doubts that quantum programming and, in general, , is one of the most promising areas within computer science and one of the areas where most expectations are being placed in recent years. Although the days when reliable and affordable quantum computers will be available is still a long way off, the explosion of programming languages for quantum programming has grown exponentially in recent years. The software engineering community has been quick to react to the need to adopt and adapt well-known tools and methods for software development, and for the design of new ones tailored to this new . However, many key aspects for its success depend on the establishment of an appropriate conceptual framework for the conception and design of quantum programs. This article discusses the concept of module, key in the software engineering discipline, and establishes initial criteria for determining the cohesion and coupling levels of a module in the field of quantum programming as a first step towards a sound quantum software engineering. As detailed in the article, the conceptual differences between classical and quantum computing are so pronounced that the translation of classical concepts to the new programming approach is not straightforward.

 Keywords: software engineering; modularity; cohesion; design; quantum programming 

Citation: Sánchez, P.; Alonso, D. On the Definition of Quantum Programming Modules. Appl. Sci. 1. Introduction 2021, 11, 5843. https://doi.org/ Designing quantum programs (QP) is quite different from the way in which it is 10.3390/app11135843 performed in classical computing, basically because our intuition is anchored in radically different mathematical models and computer architectures [1]. The (surprising) laws of Academic Editor: Mario Piattini , which underpin quantum computers, allow us to formulate and solve problems in a new and radically different way from what we are used to in our Received: 23 May 2021 macroscopic world. To harness the computational power offered by quantum computers, Accepted: 21 June 2021 we, as programmers, have to change the way we conceive solutions, at least in terms of Published: 23 June 2021 their design. At the same time, it only makes sense to resort to the quantum solution if it is better, from a computational point of view, than any solution available in the “classical” Publisher’s Note: MDPI stays neutral model. In other words, it would be of little use to have a to solve with regard to jurisdictional claims in published maps and institutional affil- a problem that could be solved with a conventional computer with the same order of iations. complexity. This makes the quantum programming paradigm a challenge that becomes even more crucial in terms of what Software Engineering as a discipline can provide [2]. To give support to computation, several quantum architectures [3] and programming languages [2] have been proposed over the last twenty years. Since the first practical quantum QCL was introduced in 1988, many other languages have Copyright: © 2021 by the authors. appeared. They can be categorized into at least four groups [4] attending to the level of Licensee MDPI, Basel, Switzerland. abstraction of the primitives they provide: from high level to hardware-specific ones. In This article is an open access article distributed under the terms and all of them, QP are translated into a composed by a set of sequences of conditions of the Creative Commons quantum gates that manipulate the state of in order to perform a computation [5]. Attribution (CC BY) license (https:// The processing of is also quite different to classical computing. creativecommons.org/licenses/by/ Quantum computing is based on the phenomenon of quantum mechanics (superposition, 4.0/). entanglement, interference, etc.), whereas in conventional computing the state at a given

Appl. Sci. 2021, 11, 5843. https://doi.org/10.3390/app11135843 https://www.mdpi.com/journal/applsci Appl. Sci. 2021, 11, 5843 2 of 18

time is either “on” or “off” (purely binary) [6]. Moreover, with quantum machines the power of computation increases exponentially with the number of bits, in contrast to the linear proportion of conventional computers. Thus, QP are very well suited for tasks including optimization, analysis, and simulation of huge quantity of data [7]. On the downside, very common operations in classical programming are no longer possible for quantum computers, for instance, to produce perfect copies of unknown quantum states [8]. However, perhaps the main difference with classical programming is the fact that quantum algorithms are designed in a probabilistic way to solve the problems. These and other relevant differences form the perfect challenge for a community of software developers used to a set of concepts and rules that are no longer valid for the new paradigm [9]. Very recently, several authors have highlighted the importance of adopting the soft- ware engineering discipline in the field of quantum computing. One of the most rep- resentative works is [5], where the term “quantum software engineering” is redefined and introduces the “quantum software life-cycle”. Furthermore, the authors identify the main challenges and opportunities for the establishment of the new discipline. The first remark of importance is that quantum software development is much more than only quantum programming. Thus, a new approach is needed to cope with quantum software development. According to that, and in analogy with the classical software engineering approach, quantum software has to be built economically, has to be reliable, and has to work efficiently on real quantum computers by means of using the well-known artifacts, methods, tools, and processes. In [5], the same phases of the classical software development life cycle are imported to the quantum one and are extended to consider the “quantum” aspect: quantum software requirements analysis, quantum software design, quantum software implementation, quantum software testing, and quantum software maintenance. Most of these steps are nowadays waiting for contributions from the software engineering community, as summarized below. Firstly, to our knowledge, there is absolutely no contribution on requirements en- gineering. With respect to the design phase, a process to transform requirements into a suitable form so as to make relatively direct the transformation into executable quantum software is needed. Some authors have also given initial steps on the definition of de- sign patterns for quantum software [10]. Other authors are extending UML as a notation to represent (at the same abstraction level as quantum circuits) the sequences of gates implementing QP [11,12]. Testing and maintenance phases are especially complex, and a real challenge given the singularity of quantum hardware and quantum execution limits and constraints [13]. Quantum testing, including quantum verification, is also a matter of research due to the inherent randomness of quantum mechanical systems. The verification of QP is complex in nature due to the underlying obstacles to design them, the probabilistic nature of quantum mechanics, and the current absence of error-free hardware to execute QP. Here, the use of quantum error corrections to emulate noisy-free computers is also of special relevance to researchers [14]. Of great interest is the Talavera Manifesto for Quantum Software Engineering [15] as the result of many discussions of academia and industry in 2020. In this manifesto, many prin- ciples and commitments about how to adapt software engineering principles in quantum software development have been collected. The main driver is that quantum software engineering can definitely contribute to the quantum computing field after adapting or defining the existing principles and methodologies from the classical software engineering field. The stakeholders who should be involved in this objective are mainly software developers, researchers, educators, customers, and governments, among others. In software development, there is a long history of decomposing a system into smaller modules. Modularization is the technique for dealing with complex systems. Modules are well established in software engineering, since they were introduced in the 1970s [16] as a way to reduce the complexity of a system by applying the principle “divide and conquer”, thus allowing a programmer to approach the development of each module separately Appl. Sci. 2021, 11, 5843 3 of 18

and almost independently of each other. With a judicious distribution of the complete functionality of the system among the modules that comprise it, the design of the system can be greatly simplified. This facilitates enormously the work of the programmer, who can focus on developing only a (small) part of the program’s functionality and forget about the rest of the complexity of the system, at least momentarily. A good modular design facilitates not only the development phase, but also the debugging, maintenance, and reuse phases, among other desirable characteristics, of the modules created. Modules are a way to reduce the mental and intellectual load that the programmers of a system must bear. Modules also allow teamwork, in which each programmer or group of programmers is responsible for the development and maintenance of one or more modules. Modules encapsulate a particular functionality and have a well-defined interface that describes how to access their functionality in a pluggable way. Modularization is also a factor affecting the software quality attributes maintainability and reuse. The former is important as modules are dynamic and require modifications in their lifetime. The latter enables more rapid development of new products or enhancements of existing products, avoiding developing from “scratch” each time, which would increase the development costs. Not many authors have researched on the definition of module for quantum program- ming from a software engineering perspective, since most of the research results available come from the quantum mechanics field. One of the most significative works is described in [17], where the authors provided some insights on the definition of a formal framework for introducing modularity in QP. They extracted some important conclusions discussed further in this paper but, from our perspective, some rules for the definition of reusable modules in terms of software design are missing. This article aims to lay the initial foundations for the design of QP by addressing the concept of “module”, its fundamental characteristics, and the rules to design them for maximizing its reuse. The cohesion and coupling of a quantum module were also characterized, according to a set of specific rules, grading the cohesion levels in analogy as it was done for classical in the eighties. The main contribution of this work is, therefore, that it addresses the concept of module in the field of gate-based quantum programming applications and does so from a software engineering perspective, bringing together the main contributions in the field of quantum computing that, to a large extent, have an impact on the characteristics that has to fulfill a quantum module. To our knowledge, no reference has been found in the literature that addresses the definition of module, so this contribution can serve as a starting point for further work towards a robust software engineering approach to QP development. The article is organized as follows. Section2 gives a background on the quantum programming concepts to facilitate the reading of the content of the article and to describe the nomenclature used in it. Section3 provides a definition of module and the rules that must be considered together with a definition of several levels of cohesion and coupling in order to help QP designers to decide on the quality of their modules. Section4 is devoted to the discussion on the results of the work and presents some future research lines worth to be explored in the near future.

2. Brief Background on Quantum Programming This section is devoted to providing a brief introduction to the basic notions of quan- tum programming and to show the way in which QP are written. The first aspect that distinguishes quantum programming from classical programming is the use of quantum bits (qubits) instead of bits. Unlike a traditional bit, which can only take the value 0 or 1, a can be in a superposition of those two states, that is, a probabilistic combination of both (macroscopic) values. A will be given by the different values that the qubits can take plus the amplitude (α) which is set by a complex number. The magnitude associated with the amplitude is the absolute value of this complex number, while the relative phase is the angle of the complex number in polar Appl. Sci. 2021, 11, x FOR PEER REVIEW 4 of 18

complex number, while the relative phase is the angle of the complex number in polar form. Thus, each qubit is also defined by a magnitude and a relative phase (see [18] for a Appl. Sci. 2021, 11, 5843 complete explanation of the mathematical foundation). 4 of 18 Two qubits may be in four possible states, each parameterized by its amplitude, in which the quare represents the probability that the qubits, once read, will collapse to that value.form. A two-qubit Thus, each state qubit can is also be characterized defined by a magnitude as follows:and a relative phase (see [18] for a complete explanation of the mathematical foundation). | ⟩ | ⟩ | ⟩ | ⟩ Two qubits𝑆𝑦𝑠𝑡𝑒𝑚 may be in four𝑠𝑡𝑎𝑡𝑒 possible 𝑜𝑓 states, 2𝑞𝑢𝑏𝑖𝑡𝑠≡𝛼 00 each+𝛼 parameterized01 +𝛼 10 +𝛼 by its11 amplitude, in which the quare represents the probability that the qubits, once read, will collapse to that 𝑤ℎ𝑒𝑟𝑒 𝛼 ∈ ℂ 𝑎𝑛𝑑| 𝛼| + |𝛼| + |𝛼| + |𝛼| =1 value. A two-qubit state can be characterized as follows: where α0, α1, α2, and α3 are the amplitudes of each state; thus, the square of the absolute value of each oneSystem is the state probability of 2 qubits of≡ readingα0| 00i + suchα1| 01 valuesi + α2| 10wheni + α collapsing3| 11i the former 2 2 2 2 two qubits system. Thus,where theα isuperposition∈ and |α0| + of| α21n| states+ |α2 |can+ |beα3 |described= 1 with just n qubits, which is a tremendous computational advantage over the classical n bits, where only a where α0, α1, α2, and α3 are the amplitudes of each state; thus, the square of the absolute singlevalue fixed of eachstate one is available. is the probability In each of execution reading such time, values and whenprior collapsingto measuring, the former the qubit can twobe a qubits superposition system. Thus, of the the previous superposition states. of In 2n otherstates canwords, be described we no lo withnger just haven qubits, a classical bit withwhich a isspecific a tremendous value (0 computational or 1), but a qubi advantaget given overby a thesuperposition classical n bits, of values where only0 and a 1. singleComputation fixed state in is available.quantum In programming each execution time,is performed, and prior tounder measuring, the circuit the qubit representa- can tionbe of a QP, superposition by means of of the gates, previous which states. provi Inde other the words, primitive we no operations longer have to a manipulate classical bit the magnitudewith a specific and phase value of (0 orthe 1), system but a qubit qubits. given This by notation a superposition resembles of values the origins 0 and 1. of current electronicComputation computation, in quantum where the programming gates impl isemented performed, the under traditional the circuit Boolean representation operations. of QP, by means of gates, which provide the primitive operations to manipulate the A quantum computer implements in practice a set of primitive gates which are used to magnitude and phase of the system qubits. This notation resembles the origins of current buildelectronic others, computation, using circuits where as thea collection gates implemented of interconnected the traditional quantum Boolean gates operations. and opera- A tions.quantum The type computer of available implements gates independs practice on a set the of hardware primitive gates infrastr whichucture are used of the to buildquantum computer,others, usingdetermining circuits as the a collection way in which of interconnected a program quantumis solved gates in a andspecific operations. machine The [19]. typeWithout of available loss of gates generality, depends we on therestricted hardware the infrastructure discussion of of this the quantum work to computer,the universal set ofdetermining gates described the way in in the which seminal a program article is solved[20]. Among in a specific the basic machine set [19of ].gates, the Hada- mard (H)Without is one loss of ofthe generality, most used we restrictedas it provides the discussion an equal of thissuperposition work to the universalof states. set Other gatesof gatessuch describedas NOT (the in the quantum seminal article equivalent [20]. Among of the theconventional basic set of gates,gate), the Z, HadamardROTX, ROTY (H) is one of the most used as it provides an equal superposition of states. Other gates (for the manipulation of qubits properties by manipulating the relative phase in different such as NOT (the quantum equivalent of the conventional gate), Z, ROTX, ROTY (for the axis),manipulation SWAP (for ofexchanging qubits properties two qubits), by manipulating and CNOT the (a relative two-qubits phase gate in different that applies axis), the NOTSWAP operation (for exchanging to a target two qubit qubits), only andif the CNOT condition (a two-qubits qubit has gate the that value applies 1) are the among NOT the basicoperation operations to a targetthat can qubit be only considered if the condition on a qubitset of has qubits the value before 1) are collapsing among the through basic a READoperations operation. that A can set be of considered single-qubit on gates a set ofplus qubits CNOT before is called collapsing universal through when a READ they can be usedoperation. to construct A set of single-qubitany unitary gates matrix plus (see CNOT [20,21] is called for more universal details). when they can be used toAs construct an example, any unitary Figure matrix 1 shows (see [20a system,21] for morewith details).two qubits in superposition after ap- plying twoAs anH gates example, and FigureZ to the1 shows second a systemqubit. Each with twoqubit qubits has a in50% superposition of probability after of col- applying two H gates and Z to the second qubit. Each qubit has a 50% of probability of lapsing to 0 or 1 but the second one has a relative phase of 180° (see the angle of the radius collapsing to 0 or 1 but the second one has a relative phase of 180◦ (see the angle of the drawn).radius The drawn). magnitude The magnitude of the am ofplitude the amplitude associated associated with each with va eachlue valuea qubit a qubitcan take can (i.e., ∣0⟩take and (i.e., ∣1 |0⟩)〉 isand proportional |1〉) is proportional to the radius to the radius of the of filled the filled in area in area shown shown in inthe the circles. circles.

FigureFigure 1. Two 1. Twoqubits qubits in insuperposition superposition and and thethe secondsecond with with a relativea relative phase phase of 180 of◦ (image 180° (image obtained obtained using the usinghttps: the https://algassert.com//algassert.com tool, accessedaccessed on on 23 23 June June 2021). 2021).

It isIt important is important to to note note that that when when a state isis read,read, the the superposition superposition is lost. is lost. For For instance, instance, after reading any qubit on Figure1, there is a 50% of probability to observe each value of after reading any qubit on Figure 1, there is a 50% of probability to observe each value of the state, so the value read could be 0 or 1. This is one key aspect of quantum programming: the state, so the value read could be 0 or 1. This is one key aspect of quantum Appl.Appl. Sci. Sci. 20212021, 1111, x FOR PEER REVIEW 5 of 18 , , 5843 5 of 18

programming: the exploitation of performing computations in superposition, but at the the exploitation of performing computations in superposition, but at the same time, one same time, one of the biggest headaches for programmers, along with quantum of the biggest headaches for programmers, along with . Quantum entanglement.programs usually Quantum consider programs the entanglement usually mechanical consider phenomenonthe entanglement where amechanical part of the phenomenonprogram cannot where be describeda part of withoutthe program considering cannot another be described part, even without if these considering parts are anotherconsiderably part, even separated if these in parts space. are Thus, considerab measurementsly separated done in onspace. one Thus, part instantaneously measurements doneaffect on the one other part part instantaneously entangled with affect it. the This ot propertyher part entangled has huge with applications it. This property in quantum has hugecomputing, applications especially in quantum in cryptography computing, [22 especially]. in cryptography [22]. AA quantum registerregister isis a a collection collection of qubitsof qubits used used for quantumfor quantum computation. computation. A quan- A quantumtum circuit circuit is a sequenceis a sequence of gates of gates applied applie to ad subset to a subset of the qubitsof the ofqubits a quantum of a quantum register. register.Figure2 showsFigure a2 quantumshows a quantum circuit demonstrating circuit demonstrating the increment the andincrement decrement and ofdecrement integers ofin superposition.integers in superposition. More specifically, More we spec implementedifically, we the implemented increment and the decrement increment opera- and decrementtions using operations as input the using value as |1 input〉. As itthe can value be seen, ∣1 the⟩. As decrement it can be operation seen, the is decrement simply the operationincrement is with simply its constituent the increment operations with its reversed. constituent The initialoperations instructions reversed. write The the initial value instructions|1〉 to a quantum write the integer value and ∣ then1⟩ to executea quantum H and integer Z gates and on then the execute third qubit, H and resulting Z gates in on a ∣ ∣ theregister third asqubit, a superposition resulting in ofa register |1〉4 and as |5 a 〉superposition4. of 1⟩4 and 5⟩4.

FigureFigure 2. A quantum circuitcircuit includingincluding four four qubits qubits and and implementing implementing the the increment incremen (firstt (first part) part) and and decrement decrement (second (second part) part)of an of integer an integer (image (image obtained obtained using using the https://algassert.com the https://algassert.com tool, tool, accessed accessed on 23 on June 23 June 2021). 2021).

Basically,Basically, the the steps steps followed followed for for quantum quantum computing computing include: include: (1) (1) the the initialization initialization of of qubits,qubits, (2) (2) several operations onon thosethose qubitsqubits by by applying applying any any combination combination of of gates, gates, and and (3) (3)the the measurement measurement of quantum of quantum states states to get to classic get classic data. The data. second The second step can step be the can sequence be the sequenceof many differentof many combinations different combinations of gates, carrying of gates, out wellcarrying known out abstract well known operations abstract such operationsas entanglement, such as the entanglement, computation of the function comp tables,utation the of reuse function of computations tables, the ofreuse another of computationsquantum algorithms of another (Oracle, quantum QFT, etc.), algorithms uncomputing (Oracle, for removingQFT, etc.), the uncomputing entanglement thatfor removingresulted from the entanglement computation, that and resulted operations from with computation, phases to and converts operations inaccessible with phases phase todifferences converts intoinaccessible readable phase magnitude differences differences, into readable among others. magnitude differences, among others.There are many quantum primitives and algorithms of high interest that can be used as buildingThere are blocks many of quantum bigger modules. primitives Next, and we algori providethmsa of summary high interest of the that main can ones. be used as buildingMany blocks of the quantumof bigger modules. algorithms Next that, we have provide a speedup a summary on quantum of the main versus ones. conven- tionalMany computers of the requirequantum calls algorithms to an oracle. that An have oracle a provides,speedup inon a black-boxquantum fashion,versus conventionalinformation about computers a variable require or a function,calls to an without oracle. revealing An oracle the variableprovides, or in functions a black-box itself. fashion,The task information in some algorithms about a is variable to determine or a function, the variable without or function revealing used the by thevariable oracle or in functionsas few calls itself. as possible. The task Inin othersome words,algorithms an oracle is to determine is a function the which variable we supplyor function with used data, byand the it oracle responds in as with few acalls yes/no. as possible. Some ofIn theother most words, well-known an oracle oracle-based is a function algorithms which we supplyare Deutsch–Jozsa with data, and and it Grover’s. responds Thewith Deutsch–Jozsa a yes/no. Some algorithm of the most solves, well-known with exactly oracle- one basedquery, algorithms a black-box are problem Deutsch–Jozsa which probably and Grover’s. requires The exponentially Deutsch–Jozsa many algorithm queries forsolves, any withdeterministic exactly one classical query, computer.a black-box The problem algorithm which determines probably requires whether exponentially a function is many either queriesconstant for (0 any on alldeterministic inputs or 1 classical on all inputs) computer. or balanced The algorithm (returns determines 1 for half of whether the input a functiondomain is and either 0 for constant the other (0 on half). all inputs Grover’s or 1 algorithmon all inputs) enables or balanced one to (returns√ find, with 1 for a highhalf ofprobability, the input domain a specific and item 0 for within the other a randomly half). Grover’s ordered algorithm set of N items enables in oneN operationsto find, with (it ais high a quadratic probability, speedup, a specific since aitem classical within computer a randomly requires ordered O(N) operations).set of N items In general, in √N operationsGrover’s algorithm (it is a quadratic can be applied speedup, when since having a classical a function computer which requir returnses O(N) true operations). for one of its Inpossible general, inputs, Grover’s and algorithm false for all can the be others. applied The when job ofhaving the algorithm a function is which to find returns the one true that returns true. The basic ideas that comprise this algorithm are applicable in a much broader for one of its possible inputs, and false for all the others. The job of the algorithm is to find Appl. Sci. 2021, 11, 5843 6 of 18

context than searching on a database as it could be used for the implementation of other algorithms (for example, the factoring Shor’s algorithm for factoring integer numbers). The following are building blocks and patterns that appear in many algorithms. Quantum amplification converts inaccessible phase differences inside a QPU register into readable magnitude differences (and vice versa). It is a generalization of the Grover’s search algorithm that can be used as a subroutine providing performance speedup there where it is needed to check the validity of a solution (such as Boolean satisfiability, finding global/local minima, among others). Quantum Fourier transform (QFT), the quantum analogue of the inverse discrete Fourier transform, is a primitive allowing quantum software developers to access hidden patterns and information stored inside a QPU register’s relative phases and magnitudes. While the amplitude amplification primitive allows information to be extracted about discrete values encoded in the phases of the register, the QFT primitive aims to obtain patterns of information encoded in the QPU register. QFT is part of other well-known algorithms such as Shor’s algorithm and quantum phase estimation algorithm. Quantum phase estimation is also a very useful tool that, as with amplitude amplification and QFT, extracts tangible, readable information from superpositions. Phase estimation helps determine (to some precision) the eigenphases associated with the eigenstates of a QPU operation, returning a superposition of all the eigenphases. In other words, it finds a way of moving information about the global phase into another register in a readable form. There are many other well-known quantum algorithms such as Shor’s algorithm for solving the discrete logarithm problem and the integer factorization problem in polynomial time, and Simon’s algorithm to find how the values of a function on whole numbers repeat themselves. All these and other primitives are common and frequent assets for building QP. A more detailed description of all the algorithms and applications can be found in [23]. Given this initial background to quantum computing and how QP are built by means of gates and circuits, we discuss how to complete the first steps into the modular develop- ment of QP.

3. Towards Modular Quantum Programming This section provides, after detailing the existing gap between classical and quantum programming, some insights with respect to the concept of modularity in the quantum computing field. First of all, some background on the existing gat between classical and quantum ways of programming is given in Section 3.1. Afterwards, the main existing works dealing with modularity in the quantum regimen are given in Section 3.2, and finally, the definition of module for QP is given together with the definition of cohesion and coupling metrics.

3.1. Impedance Mismatch between Classical and Quantum Programming In traditional software engineering, the engineer makes use of conceptual tools to model the target system in the problem domain and, with gradual transformations, de- velops software using a programming language, where the design concepts have some correspondence with the implementation ones. Object orientation is the culmination of this process, where classes normally mimic concepts of the problem domain. In other words, through an iterative process of successive refinement, engineers arrive at a solution where the common concepts identified in the previous phases are not lost along the way. In contrast, when developing a QP, the engineer has to make use of mathematical structures and algebra operators to manipulate qubits. More specifically, they make use of magnitude and phase manipulation tools to provide a solution to a well-defined problem. Such tools do not come from a direct translation from concepts and rules used at the design level, but rather from the quantum mechanical field of physics itself. There are no classes or functions or similar high-level concepts (yet) at the programmer’s disposal to develop QP. Therefore, engineers face a big conceptual gap between conceptualization and implementation. This implementation, in terms of low-level concepts, is in a manner equivalent to how a programmer would implement the Quicksort algorithm in assembler, Appl. Sci. 2021, 11, 5843 7 of 18

which reminds us to a large extent to the beginnings of computing, with wiring programs directly on the primitive ENIACS. The clear proof of this conceptual gap is the fact that, although most of the algorithms conceived and widely known in quantum programming (such as Grover, QFT, and Shor to mention a few) are very well described and studied [23], they are difficult to under- stand, reuse, and much less to be extended by most of the “classical” programmers, a barrier that cannot be minimized as of today by learning the fundamental concepts of quantum programming. To add more difficulties, very basic operations of classic computing do not have a direct equivalence in quantum computing and have to be carried out in different, and sometimes very creative, ways. For instance, copying the value of a variable into another, a basic operation in traditional computing, is not possible in quantum computing, as information cannot be replicated (because of the no-cloning theorem [8]). The only way to do that is by means of teleportation [24] but at the price of destroying the qubit being teleported, the original one. This is only an example of the big conceptual gap between our way of thinking and the way in which quantum mechanics constraints what can be programmed with quantum computers. Authors of [23] analyzed up to twenty well-known quantum computing algorithms which are each one classified according to five paradigms (Grover operator, Quantum Fourier Transform, Harrow–Hassidim–Lloyd, Variational Quantum Eigenvalue solver, and direct Hamiltonian simulation). A combination of such paradigms can be found in the implementation of any quantum program. The number of quantum paradigms is reduced compared to classical software case because of the limitations imposed by unitarity and reversibility requirements of quantum operations and the intrusiveness of measurements. According to the area of application, each algorithm can also be classified into a class of quantum algorithm, namely, algebraic applications, graph applications, learning applica- tions, inverse function computation, number-theoretic applications, quantum simulation, and quantum utilities. To add, if possible, more complexity to the new software development paradigm, QP have to be developed using the minimum number of gates in order to finish execution before decoherence and other quantum errors arise, which reduce the probability of success in the computation. Classical computers are also affected by many sources of errors, but they can be fixed with a reduced and well-defined extra memory and logic. However, the loss of in quantum computers (coming from vibrations, fluctuations of tempera- ture, electromagnetic interactions with the environment, among others) produce a loss of the amazing properties of the quantum computer. To minimize this problem, engineers have tried to develop methods for algorithm optimization (also known as transpilation) to be able to execute them on noisy quantum computers (see [3,25] for more detail on this subject). Many companies are trying to minimize decoherence by using more robust quantum processes and studying different ways for detecting errors (mainly by using temperatures close to absolute zero and trapping atoms in electromagnetic fields). To sum up this motivation, quantum computers are not a simple evolution of classical computer in the same way as quantum programming is not yet another programming paradigm, and has nothing to do one with the other. As described in the literature, there are some problems where quantum algorithms (such as Deutsch–Jozsa and Simon) achieve exponential speedups over any known classical algorithms, which is a revolution in the computation field as quantum computers might surpass existing computers for some kinds of problems. The continuity of classic computers and software development tools developed has not been questioned in recent years. Quite the contrary. Current computers remain, at least in the medium term, as the most simple and economical way to solve most of the problems. At the same time, quantum computers have the opportunity of promoting radical advances in many fields such as chemistry, materials science, cryptography, machine learning, engineering, and finance, among others. Appl. Sci. 2021, 11, 5843 8 of 18

3.2. Background on Modularity in Quantum Programming In general, modularization is the process of breaking down a software into several modules, each one developed separately. One module should have limited or no depen- dency on other modules, in such a way that introducing changes in one of them affects the minimum number of other modules in order to reduce error propagation and maximize reuse. Modules also reduce intellectual burden on programmers, who can focus on just the functionality offered by the module. This concept has permeated and is present, in various forms, in all “traditional” programming languages. Quantum programming, with its special and counterintuitive rules and principles, should not be an exception to the inclusion of modules. Problem decomposition and module reuse have served us very well over the last 50 years in computer science (and for centuries to Humankind in other disciplines), and we should at least try to include modules and its key features into this new software development paradigm. However, to be able to talk about problem decomposition and reuse, we first need to explore the minimum reuse unit, the module, as well as the rules that constraint how to integrate and connect these units to other parts of a QP. Module independence is a key characteristic of any design. To measure it, at least qualitatively, the concepts of cohesion and coupling have been defined [16]. Cohesion is a measure of the relationship strength of the elements included in the definition of the module. In classical structured programming, seven levels of cohesion are distinguished, ranging from functional (the best) to co-incidental (the worst). Inter-related with cohesion, coupling measures the relationship strength among modules themselves. Six types of coupling have been distinguished, ranging from data (the best) to content (the worst). A good software system design should look for designing modules with high cohesion and low coupling [26]. These quality attributes have guided software developers for decades to achieve software systems of the highest possible quality. In the context of quantum programming and to our knowledge, there is only one work analyzing the concepts of module, cohesion, and coupling. In [14], several quantum archi- tecture design characteristics to measure these attributes were identified. It distinguished two levels of cohesion, depending on the use of qubits superposition (temporal cohesion) and the existence of “correlation between neighbouring qubits in order to interact”. Regard- ing coupling, the authors identified four levels, ranging from measure coupling (which exists between a quantum state and its environment) to non-coherent coupling (caused by loss of energy from emission of photon to the environment). From our point of view, both cohesion and coupling are defined there from a hardware perspective, and therefore, are not a useful tool for software modeling. Moreover, the definition of module is not clearly stated. Prior to these definitions, we must clearly define what a module is or can be in quantum computing terms. In [17], a formal framework for introducing modularity in quantum circuits is included. They demonstrate that it is not always possible to reuse a quantum circuit without knowing its implementation and, in certain situations, a small change in the algorithm can lead to a fully re-conception of the quantum circuit itself. Figure3 shows an example of an abstracted quantum circuit with two slots to parametrize different implementations of unitary transformations (U), which range over the set of possible inputs {U}. We can have many algorithmic realizations of each Ux, provided that each one pro- duces the same output (at the vector level) given the same input. According to [17], given Ux, we can say that a circuit P is modular with respect to Ux if it is possible to construct a Ux-independent module with different implementations provided that: (1) there is inde- pendence with respect to the infrastructure used for its realization (this requires that the physical systems implementing P and U are well-known, including the respective Hilbert spaces and computational basis), and (2), no changes on P are needed for replacing one Ux implementation by other equivalent. Appl. Sci. 2021, 11, 5843 9 of 18 Appl. Sci. 2021, 11, x FOR PEER REVIEW 9 of 18

FigureFigure 3. A modular3. A modular approximation approximation for quantum for computing. quantum Given computing. a set of qubits Given at input, a set they of arequbits processed at input, according they to a givenare circuit,processed which according is parametrized to a bygiven many circuit, entry points whic whereh is parametrized different U modules by many can be entry plugged points into. where different U modules can be plugged into. There is a constraint that must be satisfied if we want to have U modular with respect to P. Here, the classical concept of black box is needed. A black box [27] is a device or We can havesystem many which algorithmi can be viewedc realizations in terms of itsof inputs each andUx, outputs, provided without that any each knowledge one of produces the sameits output internals. (at Two the algorithms vector arelevel) equivalent given andthe indistinguishable same input. According if, given any to inputs, [17], they given Ux, we can saygenerate that a the circuit same outputs.P is modular Thus, ifwithP is modular respect with to U respectx if it is to possibleU, then P[U] to doesconstruct not reveal U a Ux-independentwhich module algorithm with has different actually beenimpl usedementations for implementing provided. This that: is a constraint(1) there limiting is independence withwhat respect kind of to quantum the infrastructure computations used can be for made itsmodular. realization As described (this requires in [17], therethat are many algorithms (like phase estimation, quantum factoring, solution of linear equations, the physical systemsamong implementing others) that are notP and modular U are (because well-known, they work byincluding extracting the information respective beyond Hilbert spaces andthe computational black-box properties basis), of and the embedded (2), no changes module), on thus P are precluding needed the for implementation replacing one Ux implementationof circuits by thatother work equivalent. for every possible input and forcing to be adapted for each possible There is a constraintentry. In that these must cases, be some satisfied redesign if is we needed want in to order have to makeU modular them modular. with respect Thus, in spite of the importance of being able to define QP as a set of separately to P. Here, the classicalconstructed concept modules of thatblack are box combined is needed. as needed A black without box knowing [27] theiris a device internal imple-or system which canmentation, be viewed scarce in terms theoretical of it resultss inputs have and demonstrated outputs, in without which situations any knowledge the modularity of its internals. Twois not algorithms possible, although are equivalent they also have and provided indistinguishable methods to avoid if, given the situation any inputs, for certain they generate the algorithms.same outputs. In some Thus, cases, if modularityP is modular can bewith achieved respect at theto U cost, then of losing P[U] part does of the information computed, while, in other cases, the information sacrificed is not crucial (for not reveal which algorithm has actually been used for implementing U. This is a constraint more detail about this subject, readers can refer to [17]). In any case, more guidelines for limiting what kindmodular of quantum design arecomputations needed in order can to be facilitate made the modular. development As described of QP. in [17], there are many algorithms (like phase estimation, quantum factoring, solution of linear equations, among3.3. others) Quantum that Modules are not modular (because they work by extracting information beyond theModules black-box are considered, properties under of thethe circuit embedded representation, module), as “regular” thus precluding gates that take qubit lines as inputs, apply the operations included inside the module to the joint state the implementationrepresented of circuits by the that input work qubits, for and haveevery the possible same number input of qubits and linesforcing as output. to be Each adapted for each possibleoperation entry. (gate) correspondsIn these cases, to applying some redesign a concrete matrixis needed to the in quantum order to state, make so the them modular. gates that make the module up are written from left to right. Figure4 shows a simple Thus, in spitequantum of the moduleimportance with four of (input being and able output) to define qubits (a), QP and as a programa set of composed separately by two sequential modules (b). constructed modules that are combined as needed without knowing their internal It is also possible to apply a module to a subset of the total program qubits, as implementation, scarceshown intheore Figuretical5a,when results there have is no demonstrated entanglement between in which the involved situations qubits, the the modularity is notequivalence possible, withalthough the application they also of identity have provided operators to methods the other qubits,to avoid as shown the in N N N N N situation for certainFigure algorithms.5b. This is becauseIn some(I cases,I modularityU)(|ψi |θ ican |beξi) ,achieved where is at the the tensor cost product, of N N losing part of the informationis the same as computed,|ψi |θi whileU|ξi (again,, in other when cases, there the is no information entanglement sacrificed among input qubits). When the qubits are entangled, as in Figure5c, the state cannot be factored as is not crucial (for amore product detail of the about individual this qubitsubject, states. readers Tensor can product refer is theto machinery[17]). In any used case, to build more guidelines forquantum modular systems design from are other needed existing in quantum order to systems. facilitate See [the18] fordevelopment more details onof the QP. mathematical foundations.

3.3. Quantum Modules Modules are considered, under the circuit representation, as “regular” gates that take qubit lines as inputs, apply the operations included inside the module to the joint state represented by the input qubits, and have the same number of qubits lines as output. Each operation (gate) corresponds to applying a concrete matrix to the quantum state, so the gates that make the module up are written from left to right. Figure 4 shows a simple quantum module with four (input and output) qubits (a), and a program composed by two sequential modules (b). Appl. Sci. 2021, 11, x FOR PEER REVIEW 10 of 18

Appl. Sci. 2021Appl., 11, Sci. x FOR2021, PEER11, 5843 REVIEW 10 of 18 10 of 18

(a) (b) Figure 4. (a) Module a simple gate. (b) Module with two sequential gates.

It is also possible to apply a module to a subset of the total program qubits, as shown in Figure 5a, when there is no entanglement between the involved qubits, the equivalence with the application of identity operators to the other qubits, as shown in Figure 5b. This is because (𝛪 ⨂ 𝐼 ⨂ 𝑈)(|𝜓⟩ ⨂ |𝜃⟩ ⨂ |𝜉⟩), where ⨂ is the tensor product, is the same as |𝜓⟩ ⨂ |𝜃⟩ ⨂ 𝑈|𝜉⟩ (again, when there is no entanglement among input qubits). When the qubits are entangled, as in Figure 5c, the state cannot be factored as a product of the individual qubit states. Tensor product is the machinery used to build quantum systems (a) from other existing quantum systems. See [18] for( bmore) details on the mathematical foundations. Figure Figure4. (a) 4.Module(a) Module a simple a simple gate. gate. (b (b)) Module Module with with two two sequential sequential gates. gates.

It is also possible to apply a module to a subset of the total program qubits, as shown in Figure 5a, when there is no entanglement between the involved qubits, the equivalence with the application of identity operators to the other qubits, as shown in Figure 5b. This is because (𝛪 ⨂ 𝐼 ⨂ 𝑈)(|𝜓⟩ ⨂ |𝜃⟩ ⨂ |𝜉⟩), where ⨂ is the tensor product, is the same as |𝜓⟩ ⨂ |𝜃⟩ ⨂ 𝑈|𝜉⟩ (again, when there is no entanglement among input qubits). When the (a) qubits are entangled,(b )as in Figure 5c, the state cannot (bec) factored as a product of the Figure 5. Module with a gate applied to a subset of qubits: (a) a single gate to a qubit; (b) the equivalence using identity Figure 5. Module withindividual a gate applied qubit to a subsetstates. of Tensor qubits: (a )product a single gate is tothe a qubit;machinery (b) the equivalence used to usingbuild identity quantum systems gates; and (c) the situation when there is entanglement. gates; and (c) the situationfrom whenother there existing is entanglement. quantum systems. See [18] for more details on the mathematical foundations. ItIt should should be be noted that in quantum comput computing,ing, not every unitary matrix is allowed forfor implementing quantum quantum systems. Those Those gates gates (as (as unitary unitary matrices) matrices) are are only valid comingcoming fromfrom the the combination combination of gatesof gates from from the basic the set,basic equivalent set, equivalent to the basic to instructionthe basic instructionset of a CPU. set This of a set CPU. is dependent This set is on depe thendent selected on quantumthe selected hardware quantum for executinghardware thefor executingquantum program.the quantum program. ConsideringConsidering all all the the above, the definition definition of module can be as follows.follows. A quantum modulemodule is thethe basicbasic reuse reuse unit unit in in quantum quantum programming, programming, which which provides provides a specific a specific func- functionalitytionality and and has has an interfacean interface given given by theby the same same number number of inputof input and and output output qubits. qubits. A A module has to satisfy the following rules, summarized in Table 1: module has to satisfy the following rules, summarized in Table1: 1. Any quantum gate belonging to the universal gate set is considered itself a quantum (a) 1. Any quantum(b) gate belonging to the universal gate set is considered(c) itself a quan- module;tum module; Figure 5. Module with a gate applied2.2. A toA quantum quantuma subset module moduleof qubits: has has (toa to) be a be singleunitary unitary gate and and toreversible. reversible. a qubit; This( Thisb) the is is because becauseequivalence every every operationusing identity gates; and (c) the situation when thereon onis a entanglement. astate state must must keep keep the the sum sum of probabilities of probabilities of all of possible all possible outcomes outcomes at exactly at exactly 1, and 1, it andmust it be must possible be possible to obtain to the obtain previous the previous state bystate using by only using the onlyoutput the state, output without state, additionalwithout additional information. information. In order to In be order reversible, to be reversible, no measurement no measurement of any of the of anyinput of It should be noted that in quantum computing, not every unitary matrix is allowed qubitsthe input can qubitsbe made can inside be made the insidemodule. the In module. addition, In addition,the designer the designerof a module of a module𝑈may for implementingneedU may to include need quantum to additional include systems. additional input qubits Those input in qubits gatesorder in to(as order allow unitary to the allow development matrices) the development areof the only valid coming frommoduleof the the module𝑈 thatcombination Uperforms† that performs the of inverse gates the inverse operation:from operation: the reconstructing basic reconstructing set, theequivalent original the original input to the basic instructionqubitsinput set that qubitsof a enteredCPU. that entered This𝑈. This setU. This 𝑈is depemoduleU† modulendent is computed ison computed the selected as as the the Hermitian Hermitianquantum matrix hardware for executing(transposed, (transposed,the quantum complex complex program. conjugate) conjugate) of of module module 𝑈U; ; 3.3. InIn case case the the module module needs needs scratch scratch qubits qubits to to store store the the result result of of temporary temporary computations, computations, Consideringit ithas has to to make makeall surethe sure above,that that they they the are are returneddefinition returned back back of to tomodule the the value value can they they be had had as before follows. entering A quantum module isthethe themodule. module. basic This This reuse can can be beunit a ahard hard in process processquantum in in ca casese programming, the the scratch scratch qubits qubits whichgot got entangled entangled provides inside inside a specific functionalitythe module.and has Scratch an interface qubits that given are entangledby the same with datanumber qubits of alter input the and state output of the qubits. A moduledata has qubitsto satisfy if they the are following reset or measured. rules, summarized Reclaiming scratch in Table (ancilla) 1: qubits is the process of returning them to their original state for future reuse [28]. This facilitates 1. Any quantumthe reuse ofgate the scratchbelonging qubits to on the subsequent universal computations, gate set is consider and, at theed same itself time, a quantum module;the modification of the scratch qubits downstream does not affect the output qubits 2. A quantumin case theymodule are entangled; has to be unitary and reversible. This is because every operation on4. a stateA quantum must keep module the can sum be replacedof probabilities indistinguishably of all possible by any other outcomes equivalent at exactly mod- 1, and ule which, given the same inputs, produces the same outputs. In other words, it it must be possible to obtain the previous state by using only the output state, without additional information. In order to be reversible, no measurement of any of the input qubits can be made inside the module. In addition, the designer of a module 𝑈may need to include additional input qubits in order to allow the development of the module 𝑈 that performs the inverse operation: reconstructing the original input qubits that entered 𝑈. This 𝑈 module is computed as the Hermitian matrix (transposed, complex conjugate) of module 𝑈; 3. In case the module needs scratch qubits to store the result of temporary computations, it has to make sure that they are returned back to the value they had before entering the module. This can be a hard process in case the scratch qubits got entangled inside Appl. Sci. 2021, 11, 5843 11 of 18

should be possible to make use of the module without knowing its construction, as a black box. Please note that, according to the “no-go” theorem described in [17], the implementation in circuits of certain quantum algorithms may force to rebuild almost entirely the circuit after changing some input data. These types of circuits are not considered modular according to the given constraints, as they can reveal information regarding which algorithm was used beyond its black-box properties; 5. It is possible to include a controlled sub-module to decide, at run-time, if the sub- module should be executed or not. Controlled modules are a particularly important class of modules where one qubit (the controller) turns on or off a unitary operation U. This is a very relevant question in quantum computing because in many cases it is not clear how to directly add a control to a quantum operation, especially in situations where the module implementation is unknown. This is a matter of research that has generated a lot of theorical work [29]. For our purposes and considering the desired black-box properties of the modules, the only way to accomplish that is through the use of the SWAP gate, as it is described in [30]; 6. Any explicit sequence of universal gates or sub-modules integration is also considered a quantum module, provided that all the stated constraints are satisfied; 7. Input qubits should not be entangled (though superposition is allowed) with other qubits that do not enter the module or a sub-module. Otherwise, the execution of the module will generate changes beyond the output qubits specified in the definition of a module as a black box, effectively breaking encapsulation. In addition, it could hinder reversibility since the module does not have enough information to reverse the computation. This last rule is added more as a recommendation than an obligation but is needed in order to achieve universal module reuse (for more details on this see the Discussion Section).

Table 1. Summary of rules for building up quantum modules.

Property Description Uniformity Basic quantum gates are modules Composability Any valid sequence of modules is a module Indistinguishability Given inputs, if same outputs then same module Unitarity and reversibility Modules have to be reversible because quantum mechanics is reversible Ancilla reclaiming Reclaiming ancilla qubits via uncomputation Entanglement limitation Input qubits should not be entangled with others external to the module Feasibility of controlled sub-modules A control qubit can decide whether or not to call a submodule

Figure6 shows a possible abstract structure of a general module. Some scratch (ancilla) qubits could be considered (as auxiliary) in order to make the computation reversible. The result of the computation could be stored in the relative phase of the output qubit/s (or directly as magnitude). The scheme showed corresponds to a module which itself includes the reverse of the operation performed. As long as the computation does not interfere with the relative phases of the output registers, the information can survive the uncompute step [30]. Please note that not all parts of the figure are mandatory. For instance, a module may not need scratch qubits or to perform the uncompute step. Figure7 shows an example of a module developed to add two integer numbers encoded in 4 and 3 qubits, respectively. This module implements the expression a = a + b. This in an example of a module that follows the aforementioned structure, but which: (1) does not require scratch qubits to store temporary values, (2) does not require additional qubits to store the result of the computation, and (3) does not require an uncompute step, since the result is stored on the input qubits. In addition, the operation is performed in such a way that is reversible: Input values can be re-constructed from output one just by subtracting the second number from the first one. Appl. Sci. 2021, 11, x FOR PEER REVIEW 12 of 18

Appl. Sci. 2021, 11, x FOR PEER REVIEW 12 of 18 Appl. Sci. 2021, 11, 5843 12 of 18

Figure 6. General scheme for a reusable module.

Figure 7 shows an example of a module developed to add two integer numbers encoded in 4 and 3 qubits, respectively. This module implements the expression 𝑎=𝑎+ 𝑏. This in an example of a module that follows the aforementioned structure, but which: (1) does not require scratch qubits to store temporary values, (2) does not require additional qubits to store the result of the computation, and (3) does not require an uncompute step, since the result is stored on the input qubits. In addition, the operation is performed in such a way that is reversible: Input values can be re-constructed from

output one just by subtracting the second number from the first one. FigureFigure 6. 6.General General scheme scheme for a for reusable a reusable module. module.

Figure 7 shows an example of a module developed to add two integer numbers encoded in 4 and 3 qubits, respectively. This module implements the expression 𝑎=𝑎+ 𝑏. This in an example of a module that follows the aforementioned structure, but which: (1) does not require scratch qubits to store temporary values, (2) does not require additional qubits to store the result of the computation, and (3) does not require an uncompute step, since the result is stored on the input qubits. In addition, the operation is performed in such a way that is reversible: Input values can be re-constructed from output one just by subtracting the second number from the first one.

FigureFigure 7. 7. ExampleExample of of reusable reusable module module for adding for adding two numbers two numbers represented represented by the register by the a and register a and b. b.Despite Despite it itdoes does not not include include allall thethe elements elements indicated indicated above, above, it is ait moduleis a module that fulfils that thefulfils the constraintsconstraints required to to be be a module a module (image (image obtained obtain usinged the using https://algassert.com the https://algassert.com tool, accessed tool, accessed onon 23 23 June June 2021). Figure8 shows an example of a module which implementation is closer to the abstract schemeFigure shown 8 shows in Figure an6. Itexample solves a concreteof a module 3-SAT problem which including implementation three Boolean is closer to the abstractinputs. Afterscheme a superposition shown in ofFigure the inputs, 6. It two solves logical a clausesconcrete are evaluated,3-SAT problem followed including by three Booleana flip of phaseinputs. to highlightAfter a thesuperposition selected valid combinationof the inputs, of Boolean two logical values; afterwards,clauses are evaluated, uncomputing is performed to obtain the original values that satisfied the Boolean equation, followedfollowed by aa mirror flip of operation phase to as highlight an amplitude the amplification selected valid mechanism. combination of Boolean values; Figure 7. Example of reusable module for adding two numbers represented by the register a and afterwards,The next uncomputing section is devoted is to performed classifying modules to obta accordingin the tooriginal their levels values of cohesion that satisfied the Booleanandb. Despite coupling. equation, it does not followedinclude all theby elementsa mirror indicated operation above, asit is ana module amplitude that fulfils amplification the constraints required to be a module (image obtained using the https://algassert.com tool, accessed mechanism. on 23 June 2021).

Figure 8 shows an example of a module which implementation is closer to the abstract scheme shown in Figure 6. It solves a concrete 3-SAT problem including three Boolean inputs. After a superposition of the inputs, two logical clauses are evaluated, followed by a flip of phase to highlight the selected valid combination of Boolean values; afterwards, uncomputing is performed to obtain the original values that satisfied the Boolean equation, followed by a mirror operation as an mechanism. Appl. Sci. 2021, 11, x FOR PEER REVIEW 13 of 18

superposition uncomputing mirror

Appl. Sci.Appl. 2021 Sci., 202111, x, 11FOR, 5843 PEER REVIEW 13 of 1813 of 18

superposition uncomputing mirror phase computation manipulation Figure 8. Sample of reusable module for solving a 3-SAT to find whether exists a combination of the three Boolean inputs to evaluate as true a given logic expression (image obtained using the https://algassert.com tool, accessed on 23 June 2021).

The next section is devoted to classifying modules according to their levels of cohesion and coupling.

phase 3.4. Cohesion andcomputation Coupling Levels for Quantummanipulation Modules

FigureFigure 8. Sample 8.AfterSample of reusablethe of reusable definition module module forof for solvingquantum solving a 3-SAT module to to find find whether anwhetherd its exists existsmain a combination a characteristics,combination of the of three the Booleanwethree can Boolean inputs now to inputs to evaluateevaluatetackle as astrue the true a study agiven given logic logicof theexpression expression cohesion (image(image and obtained obtained coupling using using the levels.the https://algassert.com https://algassert.com We followed, tool, tool,to accessed some accessed on extent, 23 on June 23 2021). Junethe 2021). naming conventions3.4. of Cohesion cohesion and Coupling levels Levelsfrom for classic Quantum programming; Modules however, in some The next section is devoted to classifying modules according to their levels of cases, we adopted newAfter names the and definition constraints, of quantum according module andto the its mainquantum characteristics, context. weFrom can now cohesion and coupling. best to worst, wetackle considered the study ofthat the cohesiona module and couplingU can levels.have Wefunc followed,tional, tosequential, some extent, the communicational, andnaming clustered conventions cohesion. of cohesion For levelsall the from definitions classic programming; we always however, assumed in some the cases, same Hilbert space3.4.we Cohesion adoptedand communicational and new Coupling names and Levels constraints, forbasis Quantum among according Modules the to the quantum quantum context.information From best to exchanged by modules.worst,After we the considered definition that of a modulequantum U canmodule have functional,and its main sequential, characteristics, communicational, we can now and clustered cohesion. For all the definitions we always assumed the same Hilbert space We argued thattackle a module the study U hasof the functional cohesion cohesionand coupling when levels. its sub-modules We followed, contribute to some extent, the namingand communicational conventions of basis cohesion among levels the quantum from informationclassic programming; exchanged by however, modules. in some to the realization of a singleWe argued well-defined that a module task.U has Figure functional 9 shows cohesion an whenexample its sub-modules of functional contribute cases, we adopted new names and constraints, according to the quantum context. From cohesion, where thereto the is realization a module of a(called single well-defined“incr”) for task. incrementing Figure9 shows an an integer example number of functional best to worst, we considered that a module U can have functional, sequential, represented by threecohesion, qubits. where Please there isnote a module that (calledthe other “incr”) constraints for incrementing coming an integer from number the rep- communicational,resented by three and qubits. clustered Please note cohesion. that the For other all constraints the definitions coming we from always the definition assumed the definition of modulesameof were module Hilbert also were spacefulfilled also fulfilledand (specially, communicational (specially, its its reversibility). reversibility). basis Functionalamong Functional the cohesion quantumcohesion is the greatestisinformation the greatest levelexchanged andlevel the and most by the modules. mostdesirable desirable in interms terms of of reuse reuse and and modifiability modifiability of a QP.of a QP. We argued that a module U has functional cohesion when its sub-modules contribute to the realization of a single well-defined task. Figure 9 shows an example of functional cohesion, where there is a module (called “incr”) for incrementing an integer number represented by three qubits. Please note that the other constraints coming from the definition of module were also fulfilled (specially, its reversibility). Functional cohesion is the greatest level and the most desirable in terms of reuse and modifiability of a QP.

FigureFigure 9. Circuit 9. Circuit including including the reuse the ofreuse a module of a module (called “incr” (called and “incr” detailed and on thedetailed right side) on the with right functional side) with cohesion (imagefunctional obtained cohesion using the (image https://algassert.com obtained using tool, the accessed https://algassert.com on 23 June 2021). tool, accessed on 23 June 2021).

When the module performsWhen the module more than performs one moretask, than but onestill task, the butorder still in the the order execution in the execution of of the gates is relevant, we say that the module U has sequential cohesion, being a lower the gates is relevant,level we than say functional that the one. module An example U has could sequential be a module cohesion, performing being the incrementa lower and Figure 9. Circuit including the reuse of a module (called “incr” and detailed on the right side) with level than functionalthe one. multiplication An example by a factorcould of be two. a module performing the increment and functional cohesion (image obtained using the https://algassert.com tool, accessed on 23 June 2021). the multiplication by a factorThe next of level two. is communicational cohesion. We consider that a module U has commu- The next levelnicational is communicational cohesion when the cohesion. embedded We sub-modules consider use, that each, a only module a subset U of has theinput qubitsWhen to the carry module out separate performs tasks, more and than their one partial task, results but still are returnedthe order by in thethe module. execution of communicationalthe cohesion gates is whenrelevant, the we embedded say that thesub-modules module U hasuse, sequential each, only cohesion, a subset being of a lower the input qubits levelto carry than out functional separate one. tasks, An exampleand their could partial be a results module are performing returned the by increment the and the multiplication by a factor of two. The next level is communicational cohesion. We consider that a module U has communicational cohesion when the embedded sub-modules use, each, only a subset of the input qubits to carry out separate tasks, and their partial results are returned by the Appl. Sci. 2021, 11, x FOR PEER REVIEW 14 of 18

Appl. Sci. 2021, 11, 5843 14 of 18 module. However, there are some execution dependencies among some of the tasks. Figure 10 shows the situation of a module that computes both the Boolean OR and AND operationsHowever, (the there last are two some qubits execution of the dependencies circuit are where among the some outputs of the tasks.are calculated Figure 10 and stored).shows This the situationlevel of cohesion of a module is thatnot computesdesirableboth because the Boolean the reuse OR andof the AND module operations is not so feasible.(the last It twoshould qubits be of thepreferrable circuit are whereto split the the outputs tasks are of calculated U into andtwo stored). separate This levelmodules embeddedof cohesion sequentially is not desirable into because the circuit, the reuse as ofis thetaught module on isfirst not soyear feasible. courses It should on classical be U programming.preferrable to split the tasks of into two separate modules embedded sequentially into the circuit, as is taught on first year courses on classical programming.

(a) (b) (c)

FigureFigure 10. (a) 10. A (samplea) A sample of a ofcircuit a circuit embedding embedding a module a module with with communicational communicational cohesion. cohesion. (b ()b The) The implementation implementation of the of the modulemodule including including OR/AND OR/AND submodules. submodules. The The tasks tasks pe performedrformed within within the modulemodule (AND/OR (AND/OR operations) operations) share share the firstthe first three incomingthree incoming qubits qubits as input as input data. data. (c) (Detailc) Detail of ofthe the implementation implementation of thethe submodules. submodules.

Finally,Finally, a module a module has has clustered clustered cohesion when when the the embedded embedded sub-modules sub-modules carry carry out out independentindependent tasks tasks that that overlap overlap inin time, time, and and therefore, therefore, there there is no is order. no order. A control A control qubit can qubit can activateactivate or or deactivate deactivate the the execution execution of some of some tasks tasks of the of module. the module. This is This the worstis the levelworst of level cohesion because it greatly prevents the reuse of the module. of cohesion because it greatly prevents the reuse of the module. Coupling is a metric used to measure the degree of interdependence between software modules.Coupling In thisis a case metric there isused no direct to measure correspondence the degree with the of coupling interdependence levels of classical between softwaresoftware modules. as the concept In this of case “module there call”is no does direct not correspondence exist as such in quantum with the programming. coupling levels of classicalIn this context, software we studiedas the twoconcept situations: of “mod (a) theule coupling call” does between not exist a module as such (Ma) in and quantum the programming.submodules (MIn a,ithis) used context, to build we M astudied, and (b) thetwo coupling situations: between (a) the the submodulescoupling between Ma,i a modulethemselves (Ma) and as part the of submodules the realization (M ofa,i M) useda. to build Ma, and (b) the coupling between the submodulesRegarding Ma,i (a), wethemselves argued that as M parta,i is of data the coupled realization with Ma of whenMa. the only information exchanged between the Ma and Ma,i is a subset of the qubits handled by Ma. This is the Regarding (a), we argued that Ma,i is data coupled with Ma when the only coupling level by default. We argued that Ma,i is control coupled with Ma when one or information exchanged between the Ma and Ma,i is a subset of the qubits handled by Ma. more input qubits of Ma,i are used to control internally its execution. Coupling by data is Thisthe is the desirable coupling level level for all by the default. modules We and argued it is generally that Ma,i related is control to functional, coupled with sequential, Ma when oneand or more communicational input qubits cohesion. of Ma,i are Control used to coupling control may internally be more its frequent execution. for clusteredCoupling by datacohesion is the desirable and should level be avoided for all tothe have module a reusables and module. it is generally related to functional, sequential,Regarding and communicational (b), two submodules cohesion. Ma,i and Co Mntrola,j are coupling coupled may by entanglement be more frequent when for clusteredsome outputcohesion qubits and of should Ma,i are be entangled avoided withto have input a reusable qubits of module. Ma,j as a consequence of theRegarding execution (b), of M twoa,i. This submodules is a high level Ma,i of and coupling Ma,j andare shouldcoupled be by avoid entanglement because when when this occurs the effect of the module Ma,j is given not only by its input qubits but also some output qubits of Ma,i are entangled with input qubits of Ma,j as a consequence of the by the interactions that its qubits may have with Ma,i, canceling the expected properties execution of Ma,i. This is a high level of coupling and should be avoid because when this of a black-box module. Please take into account that we were not ruling out the use of occursentanglement the effect butof the rather module limiting M itsa,j is scope given to thenot boundaries only by its of in theput module. qubits but also by the interactionsBoth that the definitionits qubits of may module have and with its rules,Ma,i, canceling together withthe expected the different properties levels of of a black-boxcohesion module. and coupling, Please were take a usefulinto toolaccoun for thet that design we ofwere any QP.not ruling out the use of entanglement but rather limiting its scope to the boundaries of the module. 4.Both Discussion the definition of module and its rules, together with the different levels of cohesionFor and a successfulcoupling, achievement were a useful of atool quantum for the software design engineeringof any QP. discipline, we con- sidered crucial the establishment of abstractions for quantum software development. In

Appl. Sci. 2021, 11, 5843 15 of 18

object-oriented software development, as an evolution from the original abstract data types, the main abstractions used were the concepts of object and classes, as factories for creating objects according to a given template. Before that, procedures and functions were the only abstractions available to implement software, defined as a sequence of in- structions that manipulate (common) data, and allowing hierarchical interactions through procedure-to-procedure calls. At first sight, the notion of class may not be probably an adequate abstraction for quantum software development. The software engineering community may have the temptation to quickly adopt well-known abstractions (classes, objects, etc.) and their corresponding techniques and look for the equivalence for developing quantum software, trying to do something that is radically different. As stated in [31], researchers should focus their contributions having in mind to “think and model in quantum”. This is exactly the rationale behind the seven rules that define a module that have been described in this work. We think that they are the minimum set of rules necessary to allow the successful creation of modules in quantum programming. However, they can nevertheless be extended with additional ones by quantum software designers according to their specific needs and limitations (for instance, characteristics of the hardware where they execute their QP). The rule #1 states that the elementary quantum gates are modules, while #6 says that all groupings of gates that meet the previous rules are also modules. That is, they are the rules that establish that it is possible to create new modules by composing modules that meet certain properties. These types of rules are present in the definition of reusable entities in all classical programming languages. Rules #2 to #5 are derived from the intrinsic characteristics and limitations imposed by quantum mechanics as follows. Rules #2 and #3 are directly related to the fact that com- putation must be unitary and reversible. If additional qubits are used to store temporary results (ancilla qubits), they must be restored to the previous state after performing the computation before being used in a new computation to avoid unwanted effects of their (possible) entanglement with other qubits. Rule #4 is, perhaps, the most surprising one, derived from deeper research on modularity of quantum circuits. It states that a set of gates and sub-modules can be considered modular, and therefore, can be reused as a building in other QP only if its black box properties, that is, considering only the input and output values, do not allow the user of the module to identify how it is implemented. From this it follows that, unlike classical programming languages, not every grouping of quantum gates is modular per se. Rule #5 only applies if, in a module, it is needed to include control-U functionality. That is, if one or more qubits are going to control whether a certain part of the module, which implements a U operation, should be executed or not. As such, this rule is not essential since many algorithms do not need to make use of this functionality. However, if needed, it should be included carefully, for instance, by using SWAP gates. Rule #7 states that, if any entangled qubit enters a module, then all the qubits that are entangled with it must enter the module too. This is a recommendation, rather than an obligation, considering that we aim to achieve universal module reuse, that is, being able to reuse the module without knowing anything about the rest of the quantum program in which it will be integrated into. The objective is to mimic the characteristics of the standard libraries that come with programming languages, like , which provide functionality that can be used and reused many times, and which introduce no restrictions or assumptions about the source code that surrounds their use. Entanglement opens up the possibility that qubits entering a module are modified by some other parts of the quantum program, outside the module’s control. It is like having global variables or pointers to the local variables of functions, which can be modified from any point of the source code, in a concurrent program. This is, in general, a bad design. If the programmer is careful, one can still create a program that does its job and uses global variables, since one knows and controls how the code is implemented. However, it would be hard and error-prone Appl. Sci. 2021, 11, 5843 16 of 18

to reuse these functions in other programs, especially by third parties. Our position with entanglement is similar to this one, and this is why we state that, in order to maximize reuse, all entangled qubits or none at all should enter a module. This rule may seem too restrictive but, from our point of view, is needed if we want to converge to an off-the-shelf scheme of module cataloguing and reuse in quantum programming. We have also purposely avoided, in general, references to concrete quantum pro- gramming languages when defining the main properties that a module should have. Our objective is to provide a “language-agnostic” module definition, which could be used in any such language, given the variability in their implementation (from imperative languages like Q#, functional languages like QPL to specialized libraries and SDKs for general-purpose languages like ). We adapted the classical definitions of cohesion and coupling between modules to the characteristics of the (circuit-based) quantum programming and quantum modules. The different levels of cohesion highly determine the coupling level between the modules. As expected, the higher the cohesion, the lower the coupling, which provides much better reuse, among other benefits from modular design. The provided classification can be subjected to other points of view and updates, given the novelty of quantum programming and the small quantity of examples to take as input to evaluate it. For instance, since there is no support for datatype definitions right now (data are just qubits) it makes no sense to consider stamp coupling. However, this may change in the future. Further, most of the developed algorithms were designed for a specific task and they are not usually conceived thinking in their reuse as part of a more general program. As the development of new software and algorithms for quantum programming progresses, new case studies become available to validate the usefulness of heuristics such as those provided in this work. On the other hand, we identified a new type of coupling that is only present in QP: coupling by entanglement. We also made a proposal for a general internal structure that a module could have, according to the module definition rules described in the article. Not all the blocks proposed on the structure are mandatory, but rather the objective is to provide a starting point, it is, a template for helping the quantum module designer to keep in mind all the options that he should consider when developing quantum modules. As with general purpose languages where the use of generics is important, the param- eterization of modules in such a way that concrete realizations can be made from a template is also of interest. In terms of module parameterization, we identified two scenarios at the design level: (1) when including gates with a concrete configuration parameter (e.g., indicating the angle of the phase rotation gate) into a module, (2) when considering a conceptual parameterization at the schematic design level (e.g., the one we have when it is indicated to the phase estimation algorithm that it receives the operator U on which such estimation is made). In the first case, the parameterization is seen as the concrete realization of the gate being embedded on the module. In the second case, it is an abstract representa- tion aspect of the algorithm whose only implication is the fact that when implementing the specific algorithm, the gates necessary for its implementation have been included as part of the module realization (in the case of the example of phase estimation, it would be equivalent to the unitary operator U on which the invoked estimation is made, applying all j the controlled operations C − U2 ). The first scenario is fully compatible with the definition of module provided above. However, the second one requires a deeper research since in theory it would be possible to provide a concrete operation U that could make the whole module not valid according to our definition. From our point of view, one important contribution comes from the definition of domain-specific languages for quantum software development (QDSL). To that aim, the extensions of the UML notation for enabling classical and quantum aspects to be modeled together are very useful for software developers (for example, see the quantum UML profile introduced in [12] to design and model quantum circuits using UML activity diagrams). Appl. Sci. 2021, 11, 5843 17 of 18

Together with the use of QDSL, another major contribution to the establishment of quantum software engineering discipline comes from working on the use of patterns [10]. The definition of a repository of useful patterns will serve as generic way solutions to recurring problems in the context of quantum computing. The independence of platform implementations, assumed by the definition of pattern itself, is still a matter of research in the quantum computing field given the differences between quantum execution platforms. Nevertheless, it serves as a very interesting starting point for the success of the quantum software engineering. The combination of patterns with a QDSL for defining not only the patterns, but also the quantum applications using these patterns, would be tremendously useful for software practitioners. It is needed a means to support not only the definition of patterns and the combination of them, but also a refinement process to directly applicate these patterns to concrete solutions modeled using the QDSL. This needs to be done taking into consideration the previously mentioned limitations of unitary transformations reuse and having a well-defined concept of module. Prior to the definition of QDSLs and patterns for reuse, the software engineering community must agree upon adopting a set of common criteria, including the definition of quantum program modules and a way to measure their modularity. The promotion in short term of reuse facilities and the achievement of the well-known benefits from traditional software modeling techniques is, without a doubt, of great interest for the adoption of software engineering techniques in quantum computing discipline. As stated in [32], there is some urgency in developing and adapting classical software engineering techniques to the new challenge of quantum programming. Our work is a first step in a non-easy journey, as it has been explained in the paper. The progress on the establishment of a sound quantum software engineering discipline will depend on how solid the foundations for managing the basic gears are. Without a doubt and from our point of view, a proper definition of quantum module is part of the solution. The next steps from our side will be, on one hand, the definition of initial methodolog- ical heuristics for guiding the developers in the design of QP from a software engineering perspective and considering the definition of module given in this work, and on the other hand, the identification of useful basic patterns to serve a design by reuse process. We also want to further research how to parameterize quantum modules in order to maximize their reuse in as many QP as possible, how mainstream quantum programming languages and libraries support the concept of module, and what similarities and differences exist between their definition of module and the one proposed in this article.

Author Contributions: Conceptualization, P.S. and D.A.; methodology, P.S. and D.A.; formal analysis, P.S. and D.A; investigation, P.S. and D.A.; writing—original draft preparation, P.S. and D.A.; writing— review and editing, P.S. and D.A.; supervision, P.S. and D.A.; funding acquisition, P.S. and D.A. All authors have read and agreed to the published version of the manuscript. Funding: This research was funded by Fundación Séneca, Agencia de Ciencia y Tecnología de la Región de Murcia under the ‘Excelence Group Program 19895/GERM/15’. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: Data sharing not applicable. Conflicts of Interest: The authors declare no conflict of interest.

References 1. Nielsen, M.A.; Chuang, I.L. Quantum Computation and Quantum Information, 2nd ed.; Cambridge University Press: Cambridge, UK, 2010. 2. Heim, B.; Soeken, M.; Marshall, S.; Granade, C.; Roetteler, M.; Geller, A.; Troyer, M.; Svore, K. Quantum programming languages. Nat. Rev. Phys. 2020, 2, 709–722. [CrossRef] Appl. Sci. 2021, 11, 5843 18 of 18

3. Bertels, K.; Sarkar, A.; Hubregtsen, T.; Serrao, M.; Mouedenne, A.A.; Yadav, A.; Krol, A.; Ashraf, I. Quantum Computer Architecture: Towards Full-Stack Quantum Accelerators. In Proceedings of the 23rd Conference on Design, Automation and Test in EuropeMarch (DATE’ 20), Grenoble, France, 9–13 March 2020; pp. 139–144. 4. Zhao, J. Quantum Software Engineering Landscapes and Horizons. arXiv 2020, arXiv:2007.07047. 5. Smith, R.S.; Curtis, M.J.; Zeng, W.J. A practical quantum instruction set architecture. arXiv 2016, arXiv:1608.03355. 6. Ladd, T.D.; Jelezko, F.; Laflamme, R.; Nakamura, Y.; Monroe, C.; O’Brien, J.L. Quantum computers. Nature 2010, 464, 45–53. [CrossRef][PubMed] 7. Brown, K.L.; Munro, W.J.; Kendon, V.M. Using Quantum Computers for Quantum Simulation. Entropy 2010, 12, 2268–2307. [CrossRef] 8. Ortigoso, J. Twelve years before the quantum no-cloning theorem. Am. J. Phys. 2018, 86.[CrossRef] 9. Piattini, M.; Peterssen, G.; Pérez-Castillo, R. Quantum Computing: A New Software Engineering Golden Age. SIGSOFT Softw. Eng. Notes 2020, 45, 12–14. [CrossRef] 10. Leymann, F. Towards a Pattern Language for Quantum Algorithms. In and Optimization Problems (QTOP), 2019, Lecture Notes in Computer Science (LNCS); Springer: Munich, Germany, 2018; pp. 218–230. [CrossRef] 11. Pérez-Delgado, C.A.; Perez-Gonzalez, H.G. Towards a Quantum Software Modeling Language. In Proceedings of the ICSEW’20: Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops, First International Workshop on Quantum Software Engineering Q-SE 2020, Seoul, Korea, 27 June–19 July 2020; pp. 442–444. [CrossRef] 12. Perez-Castillo, R.; Jiménez-Navajas, L.; Piattini, M. Modelling Quantum Circuits with UML. arXiv 2021, arXiv:2103.16169. 13. Honarvar, S.; Mousavi, M.; Nagarajan, R. Property-based testing of quantum programs in Q#. In Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops, First International Workshop on Quantum Software Engineering (Q-SE 2020), Seoul, Korea, 27 June–19 July 2020; pp. 430–435. [CrossRef] 14. Dey, N. QDLC—The Quantum Development Life Cycle. arXiv 2020, arXiv:2010.08053. 15. Piattini, M.; Peterssen, G. The Talavera Manifesto for Quantum Software Engineering and Programming. In Short Papers Proceedings of the 1st International Workshop on the QuANtum SoftWare Engineering & pRogramming, Talavera de la Reina, Spain, 11–12 February 2020; CEUR Workshop Proceedings, 2020; Available online: http://ceur-ws.org/Vol-2561/ (accessed on 20 June 2021). 16. Yourdon, E.; Constantine, L. Structured Design: Fundamentals of a Discipline of Computer Program and Systems Design, 2nd ed.; Yourdon Press, Pearson Education: Englewood Cliffs, NJ, USA, 2008. 17. Thompson, J.; Modi, K.; Vedral, V.; Gu, M. Quantum plug & play: Modular computation in the quantum regime. New J. Phys. 2017, 20, 1–11. 18. Sutor, R.S. Dancing with Qubits: How Quantum Computing Works and How It Can Change the World, 1st ed.; Packt Publishing: Birmingham, UK, 2018. 19. Jain, S. Quantum computer architectures: A survey. In Proceedings of the 2nd International Conference on Computing for Sustainable Global Development (INDIACom), New Delhi, India, 11–13 March 2015; pp. 2165–2169. 20. Barenco, A.; Bennett, C.; Cleve, R.; DiVincenzo, D.; Margolus, N.; Shor, P.; Sleator, T.; Smolin, J.; Weinfurter, H. Elementary gates for quantum computation. Phys. Rev. A 1995, 52, 3457–3467. [CrossRef][PubMed] 21. Gimeno-Segovia, M.; Harrigan, N.; Johnston, E.R. Programming Quantum Computers: Essential Algorithms and Code Samples, 1st ed.; O’Reilly Media, Inc.: Sebastopol, CA, USA, 2019. 22. Bennett, C.H.; Brassard, G. : Public key distribution and coin tossing. Theor. Comput. Sci. 2014, 560, 7–11. [CrossRef] 23. Abhijith, J. Quantum Algorithm Implementations for Beginners. arXiv 2020, arXiv:1804.03719. 24. Pirandola, S.; Eisert, J.; Weedbrook, C.; Furusawa, A.; Braunstein, S.L. Advances in . Nat. Photon 2015, 9, 641–652. [CrossRef] 25. Unruh, W.G. Maintaining coherence in quantum computers. Phys. Rev. A 1995, 51, 992–997. [CrossRef][PubMed] 26. Page-Jones, M. The Practical Guide to Structured Systems Design, 2nd ed.; Prentice-Hall International, Inc.: Upper Saddle River, NJ, USA, 1988. 27. Rice, H. Classes of Recursively Enumerable Sets and Their Decision Problems. Trans. Am. Math. Soc. 1953, 74, 358–366. [CrossRef] 28. Ding, Y.; Wu, X.C.; Holmes, A.; Wiseth, A.; Franklin1, D.; Martonosi, M.; Chong, F.T. SQUARE: Strategic Quantum Ancilla Reuse for Modular Quantum Programs via Cost-Effective Uncomputation. In Proceedings of the ACM/IEEE 47th Annual International Symposium on Computer Architecture (ISCA), Valencia, Spain, 30 May–3 June 2020. 29. Araújo, M.; Feix, A.; Costa, A.; Brukner, C.ˇ Quantum circuits cannot control unknown operations. New J. Phys. 2014, 16, 093026. [CrossRef] 30. Zhou, X.Q.; Ralph, T.; Kalasuwan, P.; Zhang, M.; Peruzzo, A.; Lanyon, B.P.; O’Brien, J.L. Adding control to arbitrary unknown quantum operations. Nat. Commun. 2011, 2.[CrossRef][PubMed] 31. Moguel, E.; Berrocal, J.; García-Alonso, J.; Murillo, J.M. A Roadmap for Quantum Software Engineering: Applying the lessons learned from the classics. In Proceedings of the 1st Quantum Software Engineering and Technology Workshop Co-Located with IEEE International Conference on Quantum Computing and Engineering (IEEE Quantum Week), Denver–Broomfield, CO, USA, 13 October 2020. 32. Piattini, M.; Serrano, M.; Perez-Castillo, R.; Petersen, G.; Hevia, J.L. Toward a Quantum Software Engineering. IT Prof. 2021, 23, 62–66. [CrossRef]