# On the Definition of Quantum Programming Modules
## 2 Brief Background on Quantum Programming
The magnitude of the amplitude associated with each value a qubit can take (i.e., \(|0\rangle\) and \(|1\rangle\)) is proportional to the radius of the filled in area shown in the circles. It is important to note that when a state is read, the superposition is lost. For instance, 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:  
Figure 1: Two qubits in superposition and the second with a relative phase of 180\({}^{\circ}\) (image obtained using the [[https://algassert.com](https://algassert.com)]([https://algassert.com](https://algassert.com)) tool, accessed on 23 June 2021). the exploitation of performing computations in superposition, but at the same time, one of the biggest headaches for programmers, along with quantum entanglement. Quantum programs usually consider the entanglement mechanical phenomenon where a part of the program cannot be described without considering another part, even if these parts are considerably separated in space. Thus, measurements done on one part instantaneously affect the other part entangled with it. This property has huge applications in quantum computing, especially in cryptography [22]. A quantum register is a collection of qubits used for quantum computation. A quantum circuit is a sequence of gates applied to a subset of the qubits of a quantum register. Figure 2 shows a quantum circuit demonstrating the increment and decrement of integers in superposition. More specifically, we implemented the increment and decrement operations using as input the value \(\ket{1}\). As it can be seen, the decrement operation is simply the increment with its constituent operations reversed. The initial instructions write the value \(\ket{1}\) to a quantum integer and then execute H and Z gates on the third qubit, resulting in a register as a superposition of \(\ket{1}_{4}\) and \(\ket{5}_{4}\). Basically, the steps followed for quantum computing include: (1) the initialization of qubits, (2) several operations on those qubits by applying any combination of gates, and (3) the measurement of quantum states to get classic data. The second step can be the sequence of many different combinations of gates, carrying out well known abstract operations such as entanglement, the computation of function tables, the reuse of computations of another quantum algorithms (Oracle, QFT, etc. ), uncomputing for removing the entanglement that resulted from computation, and operations with phases to converts inaccessible phase differences into readable magnitude differences, among others. There are many quantum primitives and algorithms of high interest that can be used as building blocks of bigger modules. Next, we provide a summary of the main ones. Many of the quantum algorithms that have a speedup on quantum versus conventional computers require calls to an oracle. An oracle provides, in a black-box fashion, information about a variable or a function, without revealing the variable or functions itself. The task in some algorithms is to determine the variable or function used by the oracle in as few calls as possible. In other words, an oracle is a function which we supply with data, and it responds with a yes/no. Some of the most well-known oracle-based algorithms are Deutsch-Jozsa and [PERSON]'s. The Deutsch-Jozsa algorithm solves, with exactly one query, a black-box problem which probably requires exponentially many queries for any deterministic classical computer. The algorithm determines whether a function is either constant (0 on all inputs or 1 on all inputs) or balanced (returns 1 for half of the input domain and 0 for the other half). [PERSON]'s algorithm enables one to find, with a high probability, a specific item within a randomly ordered set of N items in \(\surd\)N operations (it is a quadratic speedup, since a classical computer requires O(N) operations).