Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

CNF

class CNF(ast, num_vars=None)

GitHub

Bases: qiskit.aqua.circuits.boolean_logical_circuits.BooleanLogicNormalForm

Class for constructing circuits for Conjunctive Normal Forms

Constructor.

Parameters

  • ast (tuple) – The logic expression as an Abstract Syntax Tree (AST) tuple
  • num_vars (int) – Number of boolean variables

Raises

AquaError – invalid input


Methods

compute_num_ancillae

CNF.compute_num_ancillae(mct_mode='basic')

returns the number of ancillary qubits needed

construct_circuit

CNF.construct_circuit(circuit=None, variable_register=None, clause_register=None, output_register=None, ancillary_register=None, mct_mode='basic')

Construct circuit.

Parameters

  • circuit (QuantumCircuit) – The optional circuit to extend from
  • variable_register (QuantumRegister) – The optional quantum register to use for problem variables
  • clause_register (QuantumRegister) – The optional quantum register to use for problem clauses
  • output_register (QuantumRegister) – The optional quantum register to use for holding the output
  • ancillary_register (QuantumRegister) – The optional quantum register to use as ancilla
  • mct_mode (str) – The mode to use for building Multiple-Control Toffoli

Returns

quantum circuit.

Return type

QuantumCircuit

Raises

AquaError – invalid input


Attributes

ancillary_register

returns ancillary register

clause_register

returns clause register

num_clauses

returns num clauses

num_variables

return num variables

output_register

returns output register

variable_register

returns variable register

Was this page helpful?
Report a bug or request content on GitHub.