1.1. Quantum Harmonic Oscillator🔗

1.1.1. Introduction🔗

The quantum harmonic oscillator is a fundamental example of a one-dimensional quantum mechanical system. It is often one of the first models encountered by undergraduate students studying quantum mechanics.

This note presents the formalization of the quantum harmonic oscillator in the theorem prover Lean 4, as part of the larger project PhysLean. What this means is that every definition and theorem in this note has been formally checked for mathematical correctness for by a computer. There are a number of motivations for doing this which are dicussed physlean.com

Note that we do not give every definition and theorem which is part of the formalization. Our goal is give key aspects, in such a way that we hope this note will be useful to newcomers to Lean or those intrested in simply intrested in learning about the quantum harmonic oscillator.

1.1.2. Hilbert space

Definition (QuantumMechanics.OneDimension.HilbertSpace):

The Hilbert space for a one dimensional quantum system is defined as the space of almost-everywhere equal equivalence classes of square integrable functions from to .

Show Lean signature:
QuantumMechanics.OneDimension.HilbertSpace
    : AddSubgroup ( →ₘ[MeasureTheory.volume] )
Definition (QuantumMechanics.OneDimension.HilbertSpace.MemHS):

The proposition MemHS f for a function f : is defined to be true if the function f can be lifted to the Hilbert space.

Show Lean signature:
QuantumMechanics.OneDimension.HilbertSpace.MemHS
    (f : ) : Prop
Lemma (QuantumMechanics.OneDimension.HilbertSpace.memHS_iff):

A function f satisfies MemHS f if and only if it is almost everywhere strongly measurable, and square integrable.

Show Lean signature:
QuantumMechanics.OneDimension.HilbertSpace.memHS_iff
    {f : }
    : MemHS fMeasureTheory.AEStronglyMeasurable f
          MeasureTheory.volumeMeasureTheory.Integrable
          (fun x => f x ^ 2)
          MeasureTheory.volume
Definition (QuantumMechanics.OneDimension.HilbertSpace.mk):

Given a function f : such that MemHS f is true via hf, then HilbertSpace.mk hf is the element of the HilbertSpace defined by f.

Show Lean signature:
QuantumMechanics.OneDimension.HilbertSpace.mk
    {f : } (hf : MemHS f)
    : ↥QuantumMechanics.OneDimension.HilbertSpace
Definition (QuantumMechanics.OneDimension.HilbertSpace.parity):

The parity operator is defined as linear map from to itself, such that ψ is taken to fun x => ψ (-x).

Show Lean signature:
QuantumMechanics.OneDimension.HilbertSpace.parity
    : () →ₗ[] 
Lemma (QuantumMechanics.OneDimension.HilbertSpace.memHS_of_parity):

The parity operator acting on a member of the Hilbert space is in Hilbert space.

Show Lean signature:
QuantumMechanics.OneDimension.HilbertSpace.memHS_of_parity
    (ψ : ) (hψ : MemHS ψ)
    : MemHS (parity ψ)

1.1.3. The Schrodinger Operator

Definition (QuantumMechanics.OneDimension.HarmonicOscillator):

A quantum harmonic oscillator specified by a three real parameters: the mass of the particle m, a value of Planck's constant , and an angular frequency ω. All three of these parameters are assumed to be positive.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator
    : Type
Definition (QuantumMechanics.OneDimension.HarmonicOscillator.ξ):

The characteristic length ξ of the harmonic oscillator is defined as ( /(m ω)).

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.ξ
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    : 
Definition (QuantumMechanics.OneDimension.HarmonicOscillator.schrodingerOperator):

For a harmonic oscillator, the Schrodinger Operator corresponding to it is defined as the function from to taking

ψ - ^2 / (2 * m) * ψ'' + 1/2 * m * ω^2 * x^2 * ψ.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.schrodingerOperator
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (ψ : ) : 
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.schrodingerOperator_parity):

The Schrodinger operator commutes with the parity operator.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.schrodingerOperator_parity
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (ψ : )
    : Q.schrodingerOperator (parity ψ) =
      parity (Q.schrodingerOperator ψ)

1.1.4. The eigenfunctions of the Schrodinger Operator

Definition (PhysLean.physHermite):

The Physicists Hermite polynomial are defined as polynomials over in X recursively with physHermite 0 = 1 and

physHermite (n + 1) = 2 X * physHermite n - derivative (physHermite n).

This polynomial will often be cast as a function by evaluating the polynomial at X.

Show Lean signature:
PhysLean.physHermite : Polynomial 
Definition (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction):

The nth eigenfunction of the Harmonic oscillator is defined as the function taking x : to

1/(2^n n!) 1/(π ξ) * physHermite n (x / ξ) * e ^ (- x²/ (2 ξ²)).

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : ) : 

1.1.5. Properties of the eigenfunctions

Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_integrable):

The eigenfunctions are integrable.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_integrable
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : )
    : MeasureTheory.Integrable
      (Q.eigenfunction n) MeasureTheory.volume
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_conj):

The eigenfunctions are real.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_conj
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : ) (x : )
    : (starRingEnd ) (Q.eigenfunction n x) =
      Q.eigenfunction n x
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_aeStronglyMeasurable):

The eigenfunctions are almost everywhere strongly measurable.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_aeStronglyMeasurable
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : )
    : MeasureTheory.AEStronglyMeasurable
      (Q.eigenfunction n) MeasureTheory.volume
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_square_integrable):

The eigenfunctions are square integrable.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_square_integrable
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : )
    : MeasureTheory.Integrable
      (fun x => Q.eigenfunction n x ^ 2)
      MeasureTheory.volume
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_memHS):

The eigenfunctions are members of the Hilbert space.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_memHS
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : ) : MemHS (Q.eigenfunction n)
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_differentiableAt):

The eigenfunctions are differentiable.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_differentiableAt
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (x : ) (n : )
    : DifferentiableAt  (Q.eigenfunction n) x
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_orthonormal):

The eigenfunctions are orthonormal within the Hilbert space.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_orthonormal
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    : Orthonormal  fun n =>
      QuantumMechanics.OneDimension.HilbertSpace.mk
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_parity):

The nth eigenfunction is an eigenfunction of the parity operator with the eigenvalue (-1) ^ n.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_parity
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : )
    : parity (Q.eigenfunction n) =
      (-1) ^ n * Q.eigenfunction n

1.1.6. The time-independent Schrodinger Equation

Definition (QuantumMechanics.OneDimension.HarmonicOscillator.eigenValue):

The nth eigenvalues for a Harmonic oscillator is defined as (n + 1/2) * * ω.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenValue
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : ) : 
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.schrodingerOperator_eigenfunction):

The nth eigenfunction satisfies the time-independent Schrodinger equation with respect to the nth eigenvalue. That is to say for Q a harmonic oscillator,

Q.schrodingerOperator (Q.eigenfunction n) x = Q.eigenValue n * Q.eigenfunction n x.

The proof of this result is done by explicit calculation of derivatives.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.schrodingerOperator_eigenfunction
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (n : ) (x : )
    : Q.schrodingerOperator (Q.eigenfunction n)
        x =
      ↑(Q.eigenValue n) * Q.eigenfunction n x

1.1.7. Completeness

Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.orthogonal_power_of_mem_orthogonal):

If f is a function satisfying MemHS f such that it is orthogonal to all eigenfunction n then it is orthogonal to

x ^ r * e ^ (- x ^ 2 / (2 ξ^2))

the proof of this result relies on the fact that Hermite polynomials span polynomials.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.orthogonal_power_of_mem_orthogonal
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (f : ) (hf : MemHS f)
    (hOrth : ∀ (n : ),
      inner
          (QuantumMechanics.OneDimension.HilbertSpace.mk
            ⋯)
          (QuantumMechanics.OneDimension.HilbertSpace.mk
            hf) =
        0)
    (r : )
    :  (x : ),
        x ^ r *
          (f x *
            ↑(Real.exp
                (-x ^ 2 / (2 * Q.ξ ^ 2)))) =
      0
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.orthogonal_exp_of_mem_orthogonal):

If f is a function satisfying MemHS f such that it is orthogonal to all eigenfunction n then it is orthogonal to

e ^ (I c x) * e ^ (- x ^ 2 / (2 ξ^2))

for any real c. The proof of this result relies on the expansion of e ^ (I c x) in terms of x^r/r! and using orthogonal_power_of_mem_orthogonal along with integrability conditions.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.orthogonal_exp_of_mem_orthogonal
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (f : ) (hf : MemHS f)
    (hOrth : ∀ (n : ),
      inner
          (QuantumMechanics.OneDimension.HilbertSpace.mk
            ⋯)
          (QuantumMechanics.OneDimension.HilbertSpace.mk
            hf) =
        0)
    (c : )
    :  (x : ),
        Complex.exp (Complex.I * c * x) *
          (f x *
            ↑(Real.exp
                (-x ^ 2 / (2 * Q.ξ ^ 2)))) =
      0
Lemma (QuantumMechanics.OneDimension.HarmonicOscillator.fourierIntegral_zero_of_mem_orthogonal):

If f is a function satisfying MemHS f such that it is orthogonal to all eigenfunction n then the fourier transform of

f (x) * e ^ (- x ^ 2 / (2 ξ^2))

is zero.

The proof of this result relies on orthogonal_exp_of_mem_orthogonal.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.fourierIntegral_zero_of_mem_orthogonal
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (f : ) (hf : MemHS f)
    (hOrth : ∀ (n : ),
      inner
          (QuantumMechanics.OneDimension.HilbertSpace.mk
            ⋯)
          (QuantumMechanics.OneDimension.HilbertSpace.mk
            hf) =
        0)
    : (Real.fourierIntegral fun x =>
        f x *
          ↑(Real.exp
              (-x ^ 2 / (2 * Q.ξ ^ 2)))) =
      0
Theorem (QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_completeness):

Assuming Plancherel's theorem (which is not yet in Mathlib), the topological closure of the span of the eigenfunctions of the harmonic oscillator is the whole Hilbert space.

The proof of this result relies on fourierIntegral_zero_of_mem_orthogonal and Plancherel's theorem which together give us that the norm of

f x * e ^ (- x^2 / (2 * ξ^2))

is zero for f orthogonal to all eigenfunctions, and hence the norm of f is zero.

Show Lean signature:
QuantumMechanics.OneDimension.HarmonicOscillator.eigenfunction_completeness
    (Q : QuantumMechanics.OneDimension.HarmonicOscillator)
    (plancherel_theorem : ∀ {f : },
      MeasureTheory.Integrable f
          MeasureTheory.volumeMeasureTheory.MemLp f 2
            MeasureTheory.volumeMeasureTheory.eLpNorm
              (Real.fourierIntegral f) 2
              MeasureTheory.volume =
            MeasureTheory.eLpNorm f 2
              MeasureTheory.volume)
    : (Submodule.span 
          (Set.range fun n =>
            QuantumMechanics.OneDimension.HilbertSpace.mk
              ⋯)).topologicalClosure =