Documentation

LeanPool.LeanQuantumAlg.Primitives.SwapTest

The SWAP test #

The SWAP test estimates the overlap |<psi|phi>|^2 of two n-qubit states: run the Hadamard test with the unitary that swaps the two registers [BCWdW01, main.tex:291]. Measuring the control yields outcome 1 with probability (1 - |<psi|phi>|^2)/2 [BCWdW01, main.tex:328].

The permutation of joint basis labels that exchanges two n-qubit registers.

Equations
Instances For

    The register-swap gate SWAP : Gate (n + n).

    Equations
    Instances For
      theorem QuantumAlg.swapRegisters_apply_tensor {n : } (psi phi : PureState n) :
      (swapRegisters n).apply (psi.tensor phi) = phi.tensor psi

      The register swap exchanges tensor factors.

      noncomputable def QuantumAlg.swapTest (n : ) :
      Gate (1 + (n + n))

      The SWAP test circuit: the Hadamard test of the register swap.

      Equations
      Instances For
        theorem QuantumAlg.re_inner_swapRegisters {n : } (psi phi : PureState n) :
        (inner (psi.tensor phi) ((swapRegisters n).apply (psi.tensor phi))).re = inner psi phi ^ 2

        Re <psi ⊗ phi, SWAP (psi ⊗ phi)> = |<psi|phi>|^2.

        theorem QuantumAlg.swapTest_probQubit0_zero {n : } (psi phi : PureState n) :
        ((swapTest n).apply (PureState.ket0.tensor (psi.tensor phi))).probQubit0 0 = (1 + inner psi phi ^ 2) / 2

        SWAP test, outcome 0 [BCWdW01, main.tex:328].

        theorem QuantumAlg.SwapTest.main {n : } (psi phi : PureState n) :
        ((swapTest n).apply (PureState.ket0.tensor (psi.tensor phi))).probQubit0 1 = (1 - inner psi phi ^ 2) / 2

        SWAP test, outcome 1 [BCWdW01, main.tex:328].