/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
module
public import Mathlib.Algebra.FreeAlgebra
public import Mathlib.Algebra.RingQuot@[expose] public sectionThe Weyl algebra
For a commutative ring R and an index type σ, we define the Weyl algebra
WeylAlgebra R σ as the quotient of the free R-algebra on σ ⊕ σ by the two-sided
ideal generated by the canonical commutation relations: writing x i for the generator
indexed by Sum.inl i and y i for the one indexed by Sum.inr i,
x i * x j = x j * x i;
y i * y j = y j * y i;
x i * y j = y j * x i for i ≠ j;
x i * y i = y i * x i + 1.
For σ = Fin n this is the n-th Weyl algebra $A_n(R)$: the associative R-algebra
with $2n$ generators $Y_1, \dots, Y_{2n}$ subject to $[Y_i, Y_{i+n}] = 1$ and all other
pairs of generators commuting (Sum.inl i is $Y_i$, Sum.inr i is $Y_{i+n}$). Over a
field of characteristic zero it is the algebra of polynomial-coefficient differential
operators in n variables.
Historical remark: Adjamagbo and van den Essen (AvdE07, Epilogue) argue that the algebra was introduced by Dirac in 1926 and should be called the "Dirac quantum algebra"; we keep the name in universal use.
namespace WeylAlgebravariable (R : Type*) [CommRing R] (σ : Type*)
The canonical commutation relations presenting the Weyl algebra as a quotient of the
free algebra on σ ⊕ σ: the Sum.inl generators pairwise commute, the Sum.inr
generators pairwise commute, and the commutator of the i-th Sum.inl generator with the
j-th Sum.inr generator is δ i j.
inductive Rel : FreeAlgebra R (σ ⊕ σ) → FreeAlgebra R (σ ⊕ σ) → Prop
| inl_mul_comm (i j : σ) :
Rel (FreeAlgebra.ι R (Sum.inl i) * FreeAlgebra.ι R (Sum.inl j))
(FreeAlgebra.ι R (Sum.inl j) * FreeAlgebra.ι R (Sum.inl i))
| inr_mul_comm (i j : σ) :
Rel (FreeAlgebra.ι R (Sum.inr i) * FreeAlgebra.ι R (Sum.inr j))
(FreeAlgebra.ι R (Sum.inr j) * FreeAlgebra.ι R (Sum.inr i))
| inl_mul_inr_of_ne {i j : σ} (h : i ≠ j) :
Rel (FreeAlgebra.ι R (Sum.inl i) * FreeAlgebra.ι R (Sum.inr j))
(FreeAlgebra.ι R (Sum.inr j) * FreeAlgebra.ι R (Sum.inl i))
| inl_mul_inr_self (i : σ) :
Rel (FreeAlgebra.ι R (Sum.inl i) * FreeAlgebra.ι R (Sum.inr i))
(FreeAlgebra.ι R (Sum.inr i) * FreeAlgebra.ι R (Sum.inl i) + 1)end WeylAlgebra
The Weyl algebra over R on the index type σ: the free R-algebra on σ ⊕ σ
modulo the canonical commutation relations WeylAlgebra.Rel. For σ = Fin n this is the
n-th Weyl algebra $A_n(R)$.
def WeylAlgebra (R : Type*) [CommRing R] (σ : Type*) : Type _ :=
RingQuot (WeylAlgebra.Rel R σ)namespace WeylAlgebravariable (R : Type*) [CommRing R] (σ : Type*)instance : Ring (WeylAlgebra R σ) :=
inferInstanceAs (Ring (RingQuot (Rel R σ)))instance : Algebra R (WeylAlgebra R σ) :=
inferInstanceAs (Algebra R (RingQuot (Rel R σ)))instance : Inhabited (WeylAlgebra R σ) := ⟨0⟩
The quotient map from the free algebra on σ ⊕ σ onto the Weyl algebra.
noncomputable def mkAlgHom : FreeAlgebra R (σ ⊕ σ) →ₐ[R] WeylAlgebra R σ :=
RingQuot.mkAlgHom R (Rel R σ)variable {R σ} in
theorem mkAlgHom_rel {x y : FreeAlgebra R (σ ⊕ σ)} (h : Rel R σ x y) :
mkAlgHom R σ x = mkAlgHom R σ y :=
RingQuot.mkAlgHom_rel R hvariable {σ}
The canonical generators of the Weyl algebra: of R (Sum.inl i) is the i-th
"position" generator ($Y_i$) and of R (Sum.inr i) the i-th "momentum" generator
($Y_{i+n}$).
noncomputable def of (v : σ ⊕ σ) : WeylAlgebra R σ :=
mkAlgHom R σ (FreeAlgebra.ι R v)The position generators pairwise commute.
theorem of_inl_mul_comm (i j : σ) :
of R (Sum.inl i) * of R (Sum.inl j) = of R (Sum.inl j) * of R (Sum.inl i) := R:Type u_1inst✝:CommRing Rσ:Type u_2i:σj:σ⊢ of R (Sum.inl i) * of R (Sum.inl j) = of R (Sum.inl j) * of R (Sum.inl i)
All goals completed! 🐙The momentum generators pairwise commute.
theorem of_inr_mul_comm (i j : σ) :
of R (Sum.inr i) * of R (Sum.inr j) = of R (Sum.inr j) * of R (Sum.inr i) := R:Type u_1inst✝:CommRing Rσ:Type u_2i:σj:σ⊢ of R (Sum.inr i) * of R (Sum.inr j) = of R (Sum.inr j) * of R (Sum.inr i)
All goals completed! 🐙Position and momentum generators with distinct indices commute.
theorem of_inl_mul_of_inr_of_ne {i j : σ} (h : i ≠ j) :
of R (Sum.inl i) * of R (Sum.inr j) = of R (Sum.inr j) * of R (Sum.inl i) := R:Type u_1inst✝:CommRing Rσ:Type u_2i:σj:σh:i ≠ j⊢ of R (Sum.inl i) * of R (Sum.inr j) = of R (Sum.inr j) * of R (Sum.inl i)
All goals completed! 🐙
The defining commutation relation: x i * y i = y i * x i + 1.
theorem of_inl_mul_of_inr_self (i : σ) :
of R (Sum.inl i) * of R (Sum.inr i) = of R (Sum.inr i) * of R (Sum.inl i) + 1 := R:Type u_1inst✝:CommRing Rσ:Type u_2i:σ⊢ of R (Sum.inl i) * of R (Sum.inr i) = of R (Sum.inr i) * of R (Sum.inl i) + 1
All goals completed! 🐙
The canonical commutation relation in commutator form: [x i, y i] = 1.
All goals completed! 🐙end WeylAlgebra