Position/momentum operators, commutator, expected value, dispersion and the Gaussian packet on
DefinitionLopesQM_DefsBasic objects of the operator formalism on used throughout the book. Wave functions are maps ; operators are maps sending wave functions to wave functions. Fix (Planck's constant) and .
- Position operator (p. 22–23): .
- Momentum operator (Definição 1.20): .
- Commutator (Definição 3.1): .
- Inner product and norm (Chapter 1): , .
- Expected value (Definição 8.1): .
- Dispersion (Definição 8.2): .
- Domains: ; .
- Gaussian wave packet (Definição 8.3): for , ,
These definitions are shared by every statement of the series drawn from this book.
Formalization Note is EuclideanSpace ℝ (Fin n) with Lebesgue measure, and is the Fréchet derivative evaluated on the -th standard basis vector. Integrals are Bochner integrals (value on non-integrable integrands); domains are separate predicates that theorems assume. The book writes in Definição 8.1 and on p. 128; the two agree for the self-adjoint observables the book considers, and the second form is used here.
import Mathlib
open MeasureTheory
namespace LopesQM
/-- Euclidean space `ℝⁿ`, carrying Lebesgue measure `volume`. -/
abbrev Rn (n : ℕ) := EuclideanSpace ℝ (Fin n)
/-- Complex-valued wave functions `ψ : ℝⁿ → ℂ`. -/
abbrev WaveFn (n : ℕ) := Rn n → ℂ
/-- (Possibly unbounded) operators, acting on all functions `ℝⁿ → ℂ`;
domains are imposed separately as hypotheses. -/
abbrev Op (n : ℕ) := WaveFn n → WaveFn n
/-- Position operator `Xⱼ` (multiplication by the coordinate `xⱼ`). -/
def positionOp {n : ℕ} (j : Fin n) : Op n :=
fun ψ x => ((x j : ℝ) : ℂ) * ψ x
/-- Momentum operator `Pⱼ = -iħ ∂/∂xⱼ` (Definição 1.20). -/
noncomputable def momentumOp {n : ℕ} (hbar : ℝ) (j : Fin n) : Op n :=
fun ψ x => -(Complex.I * (hbar : ℂ)) * fderiv ℝ ψ x (EuclideanSpace.single j (1 : ℝ))
/-- Commutator `[A, B] = AB - BA` (Definição 3.1). -/
def commutator {n : ℕ} (A B : Op n) : Op n :=
fun ψ => A (B ψ) - B (A ψ)
/-- The book's `L²` inner product `⟨φ, ψ⟩ = ∫ φ(x) conj(ψ(x)) dx`
(linear in the first argument, as in Chapter 1). -/
noncomputable def l2Inner {n : ℕ} (φ ψ : WaveFn n) : ℂ :=
∫ x, φ x * (starRingEnd ℂ) (ψ x)
/-- The `L²` norm `|ψ| = (∫ |ψ(x)|² dx)^{1/2}`. -/
noncomputable def l2Norm {n : ℕ} (ψ : WaveFn n) : ℝ :=
Real.sqrt (∫ x, ‖ψ x‖ ^ 2)
/-- Expected value `E_ψ(A) = ⟨Aψ, ψ⟩ / ⟨ψ, ψ⟩` (Definição 8.1, p. 128). -/
noncomputable def expectation {n : ℕ} (A : Op n) (ψ : WaveFn n) : ℂ :=
l2Inner (A ψ) ψ / l2Inner ψ ψ
/-- Dispersion `Δ_ψ(A) = |(A - E_ψ(A) I) ψ|` (Definição 8.2). -/
noncomputable def dispersion {n : ℕ} (A : Op n) (ψ : WaveFn n) : ℝ :=
l2Norm (fun x => A ψ x - expectation A ψ * ψ x)
/-- Domain `D(Xⱼ)`: `ψ ∈ L²(ℝⁿ)` and `xⱼ ψ ∈ L²(ℝⁿ)`. -/
def InPositionDomain {n : ℕ} (j : Fin n) (ψ : WaveFn n) : Prop :=
MemLp ψ 2 ∧ MemLp (positionOp j ψ) 2
/-- Domain `D(Pⱼ)`: `ψ` of class `C¹` with compact support (Definição 1.20). -/
def InMomentumDomain {n : ℕ} (ψ : WaveFn n) : Prop :=
ContDiff ℝ 1 ψ ∧ HasCompactSupport ψ
/-- Gaussian wave packet (Definição 8.3):
`ψ(x) = (2πa²)^{-n/4} exp(-|x - x₀|²/(4a²)) exp(i⟨p₀, x⟩/ħ)`. -/
noncomputable def gaussianPacket {n : ℕ} (hbar a : ℝ) (x0 p0 : Rn n) : WaveFn n :=
fun x => (((2 * Real.pi * a ^ 2) ^ ((n : ℝ) / 4))⁻¹ : ℝ) *
Complex.exp (((-(‖x - x0‖ ^ 2) / (4 * a ^ 2) : ℝ) : ℂ)) *
Complex.exp (Complex.I * (((inner ℝ p0 x) / hbar : ℝ) : ℂ))
end LopesQM
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic)
NON-BLIND READ-BACK — not independent testimony. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statement it describes, with full knowledge of the source text and of the intended meaning, at the explicit request of the account owner. It is therefore not a blind audit and must not be mistaken for independent testimony; reviewers should read the Lean code themselves and, ideally, obtain an independent blind read-back before relying on it.
The file introduces, for each natural number , the following objects (all inside the namespace LopesQM).
- is the Euclidean space of real -tuples (indices run over in the code), equipped with Lebesgue measure. A wave function is an arbitrary function — no measurability, integrability or smoothness is built into the type. An operator is an arbitrary map from wave functions to wave functions.
- Position operator : for every .
- Momentum operator for a real parameter (any real number, including or negative, is allowed by the definition): , where is the real Fréchet derivative of at and the -th standard basis vector. If is not differentiable at , the derivative is taken to be , so there.
- Commutator: (pointwise difference of functions).
- Inner product: , linear in the first argument. If the integrand is not integrable, the value is .
- Norm: ; again the integral is if is not integrable, giving .
- Expected value: ; division by gives , so whenever .
- Dispersion: (the norm above).
- Position domain : is (a.e.-strongly measurable and) square integrable, and is square integrable.
- Momentum domain (independent of ): is continuously differentiable ( in the real sense) and has compact support.
- Gaussian packet with real parameters and vectors :
where and is the Euclidean norm. Edge cases: if the quotient is and the prefactor is (equal to if , and otherwise); if the second exponential is . No positivity of or is imposed by the definition.