Documentation

LeanPool.LeanQuantumAlg.Core.Components.Control

Controlled gates #

Gate.controlled U is the (1 + n)-qubit gate that applies the n-qubit gate U on the target register exactly when the control qubit is in |1>, and does nothing when it is in |0> [CEMM98, cemm6.tex:127]. As a matrix it is the block decomposition c-U = |0><0| ⊗ 1 + |1><1| ⊗ U.

The projectors proj0 and proj1 are HilbertOperators, not gates.

The one-qubit projector |0><0| = [[1, 0], [0, 0]].

Equations
Instances For

    The one-qubit projector |1><1| = [[0, 0], [0, 1]].

    Equations
    Instances For
      noncomputable def QuantumAlg.Gate.controlledOp {n : } (U : Gate n) :

      Raw controlled-operator matrix.

      Equations
      Instances For
        noncomputable def QuantumAlg.Gate.controlled {n : } (U : Gate n) :
        Gate (1 + n)

        The controlled gate c-U.

        Equations
        Instances For
          @[simp]

          On the |0> control branch c-U does nothing.

          @[simp]

          On the |1> control branch c-U applies U.

          @[simp]

          On the |0> control branch c-U does nothing.

          @[simp]

          On the |1> control branch c-U applies U.

          c-U is unitary.

          Sanity check: the controlled Pauli-X gate is exactly CNOT.