Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

Proceedings of the Romanian Academy Series A Mathematics Physics Technical Sciences Information Science

Two examples of implementation of the if/then/else conditional statement with quantum computers

Guang Ping He

Published Sep 30, 2023• 1 citation
Publisher

Abstract

While quantum algorithms are known to be very powerful, there are also people who think that “quantum computers will never be able to run the if/then/else type of logic”. On the other hand, though many experts know that such a claim is a misconception, in literature there is still lacking of a general description of the procedure for implementing the if/then/else conditional statements in the quantum way. In the current work, we present such a general method in details, explaining how the unitary transformation required for any if/then/else operation can be constructed from simpler unitary transformations and projective operators. Moreover, by using the well-known controlled-NOT gate, Fredkin gate and Toffoli gate as examples, it is elaborated that the structure of the existing conditional quantum operations agrees with our general method. An even more complicated example is also provided, showing that our method is convenient for solving real-world if/then/else problems with quantum computers. Thus the result not only refutes the above claim, but also helps to develop the skill on quantum programming.

DOI
10.59277/pra-ser.a.24.3.09

Related papers

Quantum logic gates and circuits

Vinod Kumar Khanna

A quantum gate is the quantum analog of the classical logic gate of digital computers. It is a basic structural unit of a quantum circuit which operates on a small number of qubits to deliver a predefined output. A quantum circuit is a graphical representation of the sequence of the quantum gates used and the measurements performed in a quantum computation. Various quantum logic gates, namely, the Hadamard, T phase, NOT, Pauli-X, controlled NOT (CNOT), controlled-Z, SWAP and controlled phase gates as well as higher-level Toffoli and Fredkin gates are described. Conventions of reading quantum circuit diagrams are explained. Operation of a quantum full adder consisting of registers and gates is discussed, elaborating the role of the NOT gate, the sum calculation with CNOTgates and the carry C-out calculation with Toffoli gates. A primary tool used for performing arithmetic operations on a quantum computer is the quantum Fourier transform (QFT). The QFT adder and multiplier circuits are presented.

Institute of Physics eBooks•Jan 1, 2025•0 citations

Quantum conditional operations

Alessandro Bisio, Michele Dall’Arno, Paolo Perinotti

An essential element of classical computation is the ``if-then'' construct, that accepts a control bit and an arbitrary gate, and provides conditional execution of the gate depending on the value of the controlling bit. On the other hand, quantum theory prevents the existence of an analogous universal construct accepting a control qubit and an arbitrary quantum gate as its input. Nevertheless, there are controllable sets of quantum gates for which such a construct exists. Here we provide a necessary and sufficient condition for a set of unitary transformations to be controllable, and we give a complete characterization of controllable sets in the two-dimensional case. This result reveals an interesting connection between the problem of controllability and the problem of extracting information from an unknown quantum gate while using it.

arXiv:1509.01062•Physical Review A•Aug 30, 2016•30 citations

A Systematic Algorithm for Quantum Boolean Circuits Construction

I.-M. Tsai, Sy‐Yen Kuo

To build a general-purpose quantum computer, it is crucial for the quantum devices to implement classical boolean logic. A straightforward realization of quantum boolean logic is to use auxiliary qubits as intermediate storage. This inefficient implementation causes a large number of auxiliary qubits to be used. In this paper, we have derived a systematic way of realizing any general m-to-n bit combinational boolean logic using elementary quantum gates. Our approach transforms the m-to-n bit classical mapping into a t-bit unitary quantum operation with minimum number of auxiliary qubits, then a variation of Toffoli gate is used as the basic building block to construct the unitary operation. Finally, each of these building blocks can be decomposed into one-bit rotation and two-bit control-U gates. The efficiency of the network is taken into consideration by formulating it as a constrained set partitioning problem.

arXiv:quant-ph/0104037•Apr 9, 2001•6 citations

Optimal simulation of three-qubit gates

Nengkun Yu, Mingsheng Ying

In this paper, we study the optimal simulation of three-qubit unitary by using two-qubit gates. First, we give a lower bound on the two-qubit gates cost of simulating a multi-qubit gate. Secondly, we completely characterize the two-qubit gate cost of simulating a three-qubit controlled controlled gate by generalizing our result on the cost of Toffoli gate. The function of controlled controlled gate is simply a three-qubit controlled unitary gate and can be intuitively explained as follows: the gate will output the states of the two control qubit directly, and apply the given one-qubit unitary $u$ on the target qubit only if both the states of the control are $\ket{1}$. Previously, it is only known that five two-qubit gates is sufficient for implementing such a gate [Sleator and Weinfurter, Phys. Rev. Lett. 74, 4087 (1995)]. Our result shows that if the determinant of $u$ is 1, four two-qubit gates is achievable optimal. Otherwise, five is optimal. Thirdly, we show that five two-qubit gates are necessary and sufficient for implementing the Fredkin gate(the controlled swap gate), which settles the open problem introduced in [Smolin and DiVincenzo, Phys. Rev. A, 53, 2855 (1996)]. The Fredkin gate is one of the most important quantum logic gates because it is universal alone for classical reversible computation, and thus with little help, universal for quantum computation. Before our work, a five two-qubit gates decomposition of the Fredkin gate was already known, and numerical evidence of showing five is optimal is found.

arXiv:1301.3727•Jan 16, 2013•7 citations

Quantum Computing: A Practical Approach

Kolla Bhanu Prakash

Unlock the future of quantum technology with this comprehensive guide that bridges the gap between complex quantum theory and real-world applications, giving you the practical edge needed to solve the next generation’s toughest scientific and industrial problems. At its core, quantum computing leverages the principles of quantum mechanics to process information in fundamentally different ways from classical computing. As physical limits constrain the continued scaling of classical technologies, quantum computing offers a fundamentally new pathway toward solving complex problems in science, engineering, and industry. This book is a comprehensive guide designed to bridge the gap between theoretical principles and real-world quantum computing applications. It explores quantum information theory, a cornerstone of quantum computing, to explain how information is encoded, manipulated, and measured in a quantum system. Topics such as quantum gates, circuits, and the Bloch sphere representation are covered in detail, offering readers a solid grounding in the mechanics of quantum operations. With a focus on practical implementation, this book is tailored for students, researchers, and professionals seeking to delve into the transformative world of quantum computing, where the boundaries of classical computation are redefined. Readers will find the book: Uses step-by-step guides and hands-on tutorials for building quantum circuits and running algorithms; Explores core algorithms through detailed walkthroughs of quantum algorithms, including Shor’s, Grover’s, and Quantum Fourier Transform; Provides hands-on learning through exercises, coding challenges, and projects to reinforce practical skills. Audience Academics, researchers, quantum software developers and hardware engineers, data scientists, AI specialists, and security experts focused on the study and implementation of quantum systems and processors.

Wiley eBooks•Aug 17, 2026•0 citations

Quantum Gates and Circuits

Radhika Vathsan

We are now ready to see how computing with qubits can be done. In this book, we will mainly use the circuit model for computation which was first introduced by Deutsch [25]. We will represent by quantum “wires,” the qubits upon which manipulations. The length of the wire is to be interpreted as the time axis. Manipulations on qubits can be done using basic unitary operators that are the equivalents of logic “gates.” An algorithm, or a complete set of steps for achieving a processing task, is a combination of wires and gates representing a quantum circuit. This circuit must be thought of as a time sequence of events with every wire a way of representing qubit states, and with gates representing processing of those states.

CRC Press eBooks•Jul 21, 2015•3 citations
While quantum algorithms are known to be very powerful, there are also people who think that “quantum computers will never be able to run the if/then/else type of logic”. On the other hand, though many experts know that such a claim is a misconception, in literature there is still lacking of a general description of the procedure for implementing the if/then/else conditional statements in the quantum way. In the current work, we present such a general method in details, explaining how the unitary transformation required for any if/then/else operation can be constructed from simpler unitary transformations and projective operators. Moreover, by using the well-known controlled-NOT gate, Fredkin gate and Toffoli gate as examples, it is elaborated that the structure of the existing conditional quantum operations agrees with our general method. An even more complicated example is also provided, showing that our method is convenient for solving real-world if/then/else problems with quantum computers. Thus the result not only refutes the above claim, but also helps to develop the skill on quantum programming.
A quantum gate is the quantum analog of the classical logic gate of digital computers. It is a basic structural unit of a quantum circuit which operates on a small number of qubits to deliver a predefined output. A quantum circuit is a graphical representation of the sequence of the quantum gates used and the measurements performed in a quantum computation. Various quantum logic gates, namely, the Hadamard, T phase, NOT, Pauli-X, controlled NOT (CNOT), controlled-Z, SWAP and controlled phase gates as well as higher-level Toffoli and Fredkin gates are described. Conventions of reading quantum circuit diagrams are explained. Operation of a quantum full adder consisting of registers and gates is discussed, elaborating the role of the NOT gate, the sum calculation with CNOTgates and the carry C-out calculation with Toffoli gates. A primary tool used for performing arithmetic operations on a quantum computer is the quantum Fourier transform (QFT). The QFT adder and multiplier circuits are presented.
An essential element of classical computation is the ``if-then'' construct, that accepts a control bit and an arbitrary gate, and provides conditional execution of the gate depending on the value of the controlling bit. On the other hand, quantum theory prevents the existence of an analogous universal construct accepting a control qubit and an arbitrary quantum gate as its input. Nevertheless, there are controllable sets of quantum gates for which such a construct exists. Here we provide a necessary and sufficient condition for a set of unitary transformations to be controllable, and we give a complete characterization of controllable sets in the two-dimensional case. This result reveals an interesting connection between the problem of controllability and the problem of extracting information from an unknown quantum gate while using it.
To build a general-purpose quantum computer, it is crucial for the quantum devices to implement classical boolean logic. A straightforward realization of quantum boolean logic is to use auxiliary qubits as intermediate storage. This inefficient implementation causes a large number of auxiliary qubits to be used. In this paper, we have derived a systematic way of realizing any general m-to-n bit combinational boolean logic using elementary quantum gates. Our approach transforms the m-to-n bit classical mapping into a t-bit unitary quantum operation with minimum number of auxiliary qubits, then a variation of Toffoli gate is used as the basic building block to construct the unitary operation. Finally, each of these building blocks can be decomposed into one-bit rotation and two-bit control-U gates. The efficiency of the network is taken into consideration by formulating it as a constrained set partitioning problem.
In this paper, we study the optimal simulation of three-qubit unitary by using two-qubit gates. First, we give a lower bound on the two-qubit gates cost of simulating a multi-qubit gate. Secondly, we completely characterize the two-qubit gate cost of simulating a three-qubit controlled controlled gate by generalizing our result on the cost of Toffoli gate. The function of controlled controlled gate is simply a three-qubit controlled unitary gate and can be intuitively explained as follows: the gate will output the states of the two control qubit directly, and apply the given one-qubit unitary uuu on the target qubit only if both the states of the control are ∣1⟩\ket{1}∣1⟩. Previously, it is only known that five two-qubit gates is sufficient for implementing such a gate [Sleator and Weinfurter, Phys. Rev. Lett. 74, 4087 (1995)]. Our result shows that if the determinant of uuu is 1, four two-qubit gates is achievable optimal. Otherwise, five is optimal. Thirdly, we show that five two-qubit gates are necessary and sufficient for implementing the Fredkin gate(the controlled swap gate), which settles the open problem introduced in [Smolin and DiVincenzo, Phys. Rev. A, 53, 2855 (1996)]. The Fredkin gate is one of the most important quantum logic gates because it is universal alone for classical reversible computation, and thus with little help, universal for quantum computation. Before our work, a five two-qubit gates decomposition of the Fredkin gate was already known, and numerical evidence of showing five is optimal is found.
Unlock the future of quantum technology with this comprehensive guide that bridges the gap between complex quantum theory and real-world applications, giving you the practical edge needed to solve the next generation’s toughest scientific and industrial problems. At its core, quantum computing leverages the principles of quantum mechanics to process information in fundamentally different ways from classical computing. As physical limits constrain the continued scaling of classical technologies, quantum computing offers a fundamentally new pathway toward solving complex problems in science, engineering, and industry. This book is a comprehensive guide designed to bridge the gap between theoretical principles and real-world quantum computing applications. It explores quantum information theory, a cornerstone of quantum computing, to explain how information is encoded, manipulated, and measured in a quantum system. Topics such as quantum gates, circuits, and the Bloch sphere representation are covered in detail, offering readers a solid grounding in the mechanics of quantum operations. With a focus on practical implementation, this book is tailored for students, researchers, and professionals seeking to delve into the transformative world of quantum computing, where the boundaries of classical computation are redefined. Readers will find the book: Uses step-by-step guides and hands-on tutorials for building quantum circuits and running algorithms; Explores core algorithms through detailed walkthroughs of quantum algorithms, including Shor’s, Grover’s, and Quantum Fourier Transform; Provides hands-on learning through exercises, coding challenges, and projects to reinforce practical skills. Audience Academics, researchers, quantum software developers and hardware engineers, data scientists, AI specialists, and security experts focused on the study and implementation of quantum systems and processors.
We are now ready to see how computing with qubits can be done. In this book, we will mainly use the circuit model for computation which was first introduced by Deutsch [25]. We will represent by quantum “wires,” the qubits upon which manipulations. The length of the wire is to be interpreted as the time axis. Manipulations on qubits can be done using basic unitary operators that are the equivalents of logic “gates.” An algorithm, or a complete set of steps for achieving a processing task, is a combination of wires and gates representing a quantum circuit. This circuit must be thought of as a time sequence of events with every wire a way of representing qubit states, and with gates representing processing of those states.