Imports
/- Copyright (c) 2026 Axiomatic-AI. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Matteo Cipollina -/ module public import Physlib.QuantumMechanics.Operators.StateObservables.Variance

Covariance

i. Overview

In this module we define the covariance of two partial linear maps A and B in a common state ψ as the real part of the inner product of their centered vectors.

ii. Key results

    covariance : the real part of the centered inner product.

    covariance_comm : covariance is symmetric in the two observables.

    covariance_eq_re_symm_centered : covariance as the real part of the symmetrized centered inner product.

    covariance_self_eq_variance : the covariance of an observable with itself is its variance.

iii. Table of contents

    A. Covariance

iv. References

    [B. C. Hall, Quantum Theory for Mathematicians, Chapter 12][hall2013quantum].

@[expose] public section

A. Covariance

Covariance, defined as the real part of the centered inner product.

def covariance : ℝ := (⟪centered A ψ, centered B ⟨ψ, hψB⟩⟫_ℂ).re

Covariance, unfolded to the real part of the centered inner product.

lemma covariance_eq_re_inner_centered : covariance A B ψ hψB = (⟪centered A ψ, centered B ⟨ψ, hψB⟩⟫_ℂ).re := rfl

Swapping the two observables does not change the covariance.

All goals completed! 🐙

Covariance as the real part of the symmetrized centered inner product.

H:Type u_1inst✝¹:NormedAddCommGroup Hinst✝:InnerProductSpace ℂ HA:H →ₗ.[ℂ] HB:H →ₗ.[ℂ] Hψ:↥A.domainhψB:↑ψ ∈ B.domainz:ℂ := ⟪A.centered ψ, B.centered ⟨↑ψ, hψB⟩⟫_ℂhz:⟪B.centered ⟨↑ψ, hψB⟩, A.centered ψ⟫_ℂ = star z⊢ (⟪A.centered ψ, B.centered ⟨↑ψ, hψB⟩⟫_ℂ).re = (⟪A.centered ψ, B.centered ⟨↑ψ, hψB⟩⟫_ℂ + star z).re / 2 H:Type u_1inst✝¹:NormedAddCommGroup Hinst✝:InnerProductSpace ℂ HA:H →ₗ.[ℂ] HB:H →ₗ.[ℂ] Hψ:↥A.domainhψB:↑ψ ∈ B.domainz:ℂ := ⟪A.centered ψ, B.centered ⟨↑ψ, hψB⟩⟫_ℂhz:⟪B.centered ⟨↑ψ, hψB⟩, A.centered ψ⟫_ℂ = star z⊢ z.re = (z + star z).re / 2 All goals completed! 🐙
H:Type u_1inst✝¹:NormedAddCommGroup Hinst✝:InnerProductSpace ℂ HA:H →ₗ.[ℂ] Hψ:↥A.domain⊢ (↑‖A.centered ψ‖).re * (↑‖A.centered ψ‖).re - (↑‖A.centered ψ‖).im * (↑‖A.centered ψ‖).im = ‖A.centered ψ‖ * ‖A.centered ψ‖ All goals completed! 🐙