liveBook · Manning

Logical OR

As explained in Quantum Programming in Depth

The OR operator returns true when at least one of its Boolean operands is true.

Logical OR returns true when at least one Boolean input is true. In quantum computation, its classical behavior must be represented through a reversible function before becoming a quantum circuit. section 6.4.1 section 6.4

Construct an OR-based quantum computation systematically:

  • Express the desired classical computation as Boolean logic, including OR and any other primitive operations. section 6.4
  • Preserve the input and store the result in a separate bit using F(x, y) = (x, y ⊕ f(x)); the input x may contain several bits. section 6.4.1
  • Replace the reversible Boolean operation with a quantum implementation as part of reversible-logic synthesis. section 6.4.1 section 6.4

Two-input truth table

For inputs 0,0; 0,1; 1,0; and 1,1, OR produces 0,1,1, and 1 respectively. The reversible form retains the input while XORing the OR result into an output bit. section 6.4.1 section 6.4

Figure 6.7 To convert a classical function into its quantum implementation, we start by representing it as a sequence of Boolean logic gates. Then, we replace each gate with its classical reversible equivalent. Finally, each classical reversible logic gate is replaced with a quantum gate that implements it.
figure

Follow the conversion from a Boolean OR expression to a reversible logic circuit and then to its quantum-gate implementation. section 6.4

Table 6.2 The truth tables of the main Boolean operations
\(x_0\) \(x_1\) NOT \(x_0\) \(x_0\) AND \(x_1\) \(x_0\) OR \(x_1\) \(x_0\) XOR \(x_1\) \(x_0\) EQUAL \(x_1\)
\(0\) \(0\) \(1\) \(0\) \(0\) \(0\) \(1\)
\(0\) \(1\) \(0\) \(1\) \(1\) \(0\)
\(1\) \(0\) \(0\) \(0\) \(1\) \(1\) \(0\)
\(1\) \(1\) \(1\) \(1\) \(0\) \(1\)

Inspect the truth table that places OR alongside NOT, AND, XOR, and equality. section 6.4

How Quantum Programming in Depth covers it

How deep it goes
Develops OR through truth-table behavior, reversible extension, and systematic conversion into quantum circuits.
Examples
Uses a two-input truth table and the reversible form F(x, y) = (x, y ⊕ f(x)).
What it assumes
Assumes Boolean operations and basic quantum-circuit mapping, while refreshing reversibility through preserved inputs and a separate output bit.
What you can do after
Implement OR within a reversible-logic synthesis workflow that produces a corresponding quantum circuit.
How it connects
Connects OR with Boolean logic, reversible logic circuits, logic synthesis, and quantum circuits.

Also explained in

Compare how 6 books explain logical OR →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantum Programming in Depth. The section links point to the parts of the book it draws on.