Documentation

LeanPool.LeanQuantumAlg.Primitives.QKernel.Fidelity

Quantum kernel methods: the fidelity kernel and its Gram-matrix positive semidefiniteness #

A data-encoding quantum feature map sends a classical input x to a quantum state |φ(x)⟩. The induced fidelity quantum kernel is k(x, y) = |⟨φ(x) | φ(y)⟩|² (for pure states this equals tr[ρ(x) ρ(y)], the Hilbert–Schmidt inner product of the density operators). The core fact that makes such a k a legitimate kernel for classical kernel methods (SVMs, etc.) is that every Gram matrix K_{ij} = k(xᵢ, xⱼ) is positive semidefinite.

The proof realizes the fidelity kernel as a genuine inner-product Gram matrix: with the feature vector w(x) := φ(x) ⊗ conj φ(x) one has ⟨w(x), w(y)⟩ = ⟨φ(x), φ(y)⟩ · conj⟨φ(x), φ(y)⟩ = |⟨φ(x), φ(y)⟩|² (via PureState.inner_tensor_tensor), so the kernel Gram matrix factors as K = Bᴴ B and is positive semidefinite by Matrix.posSemidef_conjTranspose_mul_self.

Sources: Schuld & Killoran (2019), Quantum machine learning in feature Hilbert spaces; Schuld (2021), Supervised quantum machine learning models are kernel methods.

Main definitions / results #

noncomputable def QuantumAlg.PureState.conjState {n : } (ψ : PureState n) :

Elementwise complex conjugate of a pure state.

Equations
Instances For
    @[simp]
    theorem QuantumAlg.PureState.conjState_apply {n : } (ψ : PureState n) (i : Fin (2 ^ n)) :

    Conjugating both arguments conjugates the inner product.

    noncomputable def QuantumAlg.featureTensor {n : } {X : Type u_1} (φ : XPureState n) (x : X) :
    PureState (n + n)

    The feature vector φ(x) ⊗ conj φ(x) whose inner products realize the fidelity kernel as a Gram matrix.

    Equations
    Instances For
      noncomputable def QuantumAlg.quantumKernel {n : } {X : Type u_1} (φ : XPureState n) (x y : X) :

      The fidelity quantum kernel k(x, y) = |⟨φ(x), φ(y)⟩|², written as the complex product ⟨φ(x), φ(y)⟩ · conj⟨φ(x), φ(y)⟩ (a nonnegative real).

      Equations
      Instances For
        theorem QuantumAlg.quantumKernel_eq_inner_featureTensor {n : } {X : Type u_1} (φ : XPureState n) (x y : X) :

        The fidelity kernel is the inner product of the feature vectors φ(·) ⊗ conj φ(·).

        theorem QuantumAlg.quantumKernel_self {n : } {X : Type u_1} (φ : XPureState n) (x : X) :
        quantumKernel φ x x = 1

        The diagonal kernel value is 1.

        theorem QuantumAlg.quantumKernel_gram_posSemidef {n : } {X : Type u_1} {ι : Type u_2} [Finite ι] (φ : XPureState n) (x : ιX) :
        (Matrix.of fun (i j : ι) => quantumKernel φ (x i) (x j)).PosSemidef

        Validity of the quantum kernel. For any finite family of inputs, the fidelity-kernel Gram matrix K_{ij} = k(xᵢ, xⱼ) is positive semidefinite, hence k is a legitimate (positive-semidefinite) kernel.

        theorem QuantumAlg.QuantumKernel.main {n : } {X : Type u_1} {ι : Type u_2} [Finite ι] (φ : XPureState n) (x : ιX) :
        (Matrix.of fun (i j : ι) => quantumKernel φ (x i) (x j)).PosSemidef

        Main theorem: fidelity quantum-kernel Gram matrices are positive semidefinite.

        theorem QuantumAlg.QuantumKernel.main_feature_tensor {n : } {X : Type u_1} (φ : XPureState n) (x y : X) :

        Public supporting theorem: the fidelity kernel is an inner product after tensor lifting.

        theorem QuantumAlg.QuantumKernel.main_self {n : } {X : Type u_1} (φ : XPureState n) (x : X) :
        quantumKernel φ x x = 1

        Public supporting theorem: the diagonal fidelity-kernel value of a pure state is one.