by Giovanni Pilato (CNR-ICAR), Salvatore Gaglio (Università degli Studi di Palermo and CNR-ICAR) and Filippo Vella (CNR-ICAR)

Programming quantum systems still requires working with low-level circuit operations. Researchers at CNR-ICAR and the University of Palermo are exploring a higher-level alternative: Quantum Logic Programming in Prolog (QLPP), which translates logical formulas into sequences of quantum gates. Although quantum computing is progressing from theoretical promise toward increasingly powerful hardware platforms, programming quantum systems remains a challenge. QLPP aims to address this by providing a high-level approach for researchers who are used to rule-based and logic-based descriptions of problems. 

Quantum logic is a field of study that starts from the logical structures inherent in quantum mechanics and moves beyond the framework of classical logic. Its formal origins can be traced to the 1936 article “The logic of quantum mechanics” by Birkhoff and von Neumann, where the authors identify the underlying logical structures of physical theories, such as quantum mechanics, that differ from classical logic.

Quantum logical connectives are declared as Prolog operators and associated with quantum gates such as NOT, CNOT and Toffoli. The syntactic structure of a formula is then used to build a quantum circuit layer by layer.

In QLPP, the structure of the Prolog formula determines the circuit, while each logical connective is replaced by its corresponding quantum gate.
The relevance of non-classical logic in quantum theory stems from the way propositions about physical quantities are represented mathematically.  These representations differ from those used in classical physics and give rise to non-classical logical models. Non-classical logics form a family of approaches that arise from the abstract structures of quantum theory.

An example is provided by Dalla Chiara et al. [3], who introduced a logic for quantum computation implemented by quantum circuits. Sentences in the logical language are composed of atomic symbols corresponding to quantum registers, and quantum computational Boolean connectives such as ¬ (NOT), ∧ (AND), ∨ (inclusive OR), and ⊎ (exclusive OR). These connectives are implemented using X quantum gates for NOT, Toffoli gates for AND, a mapping of inclusive OR to AND via the De Morgan laws, and controlled NOT gates for the exclusive OR. To the classical Boolean operators are also added specific quantum computational connectives, such as √(¬) and √id.

The quantum Boolean computation is represented and analysed using a syntactic tree. The generic formula α is represented with a sequence of levels from the original formula to its elementary parts. Starting from the original formula α, which forms the bottom level, the next levels are obtained by removing the principal connective and repeating all the atomic sentences of the current level.

Each element of the syntactic tree can be associated with a meaning through the so-called holistic map. This map is a density operator, implemented through partial trace [2]. This operator is useful for interpreting formulas because its value depends on the entire formula rather than on a single symbol. This is a distinctive feature of the formalism that is difficult to reproduce using a classical representation.

Quantum logic for robot planning
Logic-based systems described through Boolean representations and assertions can describe both system evolution and target functions. System states are represented at the bit-level and evolve according to predefined update rules.

A similar method can be applied to all systems described by production rules. These rules are often used to characterise problems in a way that resembles human reasoning. They are also connected with Markov models, which in turn can be related to Universal Turing Machines.

 The representation and evolution through rules that can be translated into quantum operators are well suited to logic programming, particularly through the Prolog language, which can be used to implement a computational logic formulation.

 A simple example is robot movement on a small grid. The robot’s current position and its possible movement are represented by Boolean variables, and the corresponding update rules can be expressed as logical formulas in Prolog. QLPP then translates these formulas automatically into a sequence of quantum gates (Figure 1). In this example, the circuit uses controlled-NOT, NOT and SWAP operations. In our case study [2], the resulting circuit is subsequently combined with Grover’s algorithm, a quantum search method, to identify movements that lead the robot to a target position.

Figure 1: Quantum circuit implementing a robot-movement rule on a 2 × 2 map. Qubit x represents the x-coordinate, y the y-coordinate, and mov the movement.
Figure 1: Quantum circuit implementing a robot-movement rule on a 2 × 2 map. Qubit x represents the x-coordinate, y the y-coordinate, and mov the movement.

One advantage of using Prolog for this formulation is its declarative nature: the programmer can describe the problem in logical terms, while QLPP generates the corresponding sequence of quantum gates. The benefit at this stage is therefore a higher level of abstraction rather than a demonstrated computational speed-up over existing quantum programming approaches.

It is very suitable for symbolic AI, theorem proving and constraint satisfaction problems. Pattern matching can support symbolic manipulation and translation from one domain to another, facilitating the creation of a quantum solution given the definition of the problem with classical formulas.

References: 
[1] A. Chella, et al., “An architecture for a quantum teleo-reactive robot”, Entropy, 2026.
[2] G. Pilato, et al., “Towards quantum logic programming”, in Proc. 2025 IEEE Conf. Pervasive Intell. Comput. (PICom), 2025, pp. 267–272.
[3] M. L. Dalla Chiara, et al., “Quantum Computation and Logic: How Quantum Computers Have Inspired Logical Investigations”, Springer, 2018.

Please contact: 
Giovanni Pilato
CNR-ICAR, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.