Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Second quantization on KKK orbitals: creators, annihilators, Slater determinants

Definition
KochHF_FockSpace

by Lucas · Oct 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

hartree-fockmathematical-physicssecond-quantization

Fix KKK orthonormal reference orbitals ϕ0,…,ϕK−1\phi_0,\dots,\phi_{K-1}ϕ0​,…,ϕK−1​. A one-electron orbital ∣φ⟩=∑μφμ∣ϕμ⟩|\varphi\rangle=\sum_\mu\varphi_\mu|\phi_\mu\rangle∣φ⟩=∑μ​φμ​∣ϕμ​⟩ is identified with its coefficient vector φ∈CK\varphi\in\mathbb C^Kφ∈CK, with inner product ⟨φ∣χ⟩=∑μφμ‾ χμ\langle\varphi|\chi\rangle=\sum_\mu\overline{\varphi_\mu}\,\chi_\mu⟨φ∣χ⟩=∑μ​φμ​​χμ​.

The Fock space is spanned by the orthonormal occupation-number states ∣S⟩|S\rangle∣S⟩, S⊆{0,…,K−1}S\subseteq\{0,\dots,K-1\}S⊆{0,…,K−1}, so vectors are functions ψ:P({0,…,K−1})→C\psi:\mathcal P(\{0,\dots,K-1\})\to\mathbb Cψ:P({0,…,K−1})→C and operators are complex 2K×2K2^K\times 2^K2K×2K matrices. The definitions are:

  1. Creation operator ci†∣S⟩=(−1)#{j∈S: j>i} ∣S∪{i}⟩c_i^\dagger|S\rangle=(-1)^{\#\{j\in S:\ j>i\}}\,|S\cup\{i\}\rangleci†​∣S⟩=(−1)#{j∈S: j>i}∣S∪{i}⟩ if i∉Si\notin Si∈/S, and ci†∣S⟩=0c_i^\dagger|S\rangle=0ci†​∣S⟩=0 if i∈Si\in Si∈S. With this sign convention cnN†⋯cn1†∣0⟩=∣{n1,…,nN}⟩c^\dagger_{n_N}\cdots c^\dagger_{n_1}|0\rangle=|\{n_1,\dots,n_N\}\ranglecnN​†​⋯cn1​†​∣0⟩=∣{n1​,…,nN​}⟩ for n1<⋯<nNn_1<\dots<n_Nn1​<⋯<nN​ (Eq. (26)).
  2. Annihilation operator ci=(ci†)†c_i=(c_i^\dagger)^\daggerci​=(ci†​)† (conjugate transpose).
  3. Vacuum ∣0⟩=∣∅⟩|0\rangle=|\emptyset\rangle∣0⟩=∣∅⟩ and basis states ∣S⟩|S\rangle∣S⟩.
  4. Inner product ⟨ψ∣φ⟩=∑SψS‾φS\langle\psi|\varphi\rangle=\sum_S\overline{\psi_S}\varphi_S⟨ψ∣φ⟩=∑S​ψS​​φS​ and matrix elements ⟨ψ∣A∣φ⟩\langle\psi|A|\varphi\rangle⟨ψ∣A∣φ⟩.
  5. Orbital operators (Eq. (16)): cφ†=∑μφμcμ†c^\dagger_\varphi=\sum_\mu\varphi_\mu c^\dagger_\mucφ†​=∑μ​φμ​cμ†​ and cφ=∑μφμ‾cμc_\varphi=\sum_\mu\overline{\varphi_\mu}c_\mucφ​=∑μ​φμ​​cμ​.
  6. Slater determinant (Eqs. (23), (26)) of orbitals α1,…,αN\alpha_1,\dots,\alpha_Nα1​,…,αN​:
∣Φα1⋯αN⟩=cαN†⋯cα1†∣0⟩.|\Phi_{\alpha_1\cdots\alpha_N}\rangle=c^\dagger_{\alpha_N}\cdots c^\dagger_{\alpha_1}|0\rangle .∣Φα1​⋯αN​​⟩=cαN​†​⋯cα1​†​∣0⟩.
  1. Projection onto the occupied orbitals (Eq. (41)): P∣φ⟩=∑n∣αn⟩⟨αn∣φ⟩P|\varphi\rangle=\sum_n|\alpha_n\rangle\langle\alpha_n|\varphi\rangleP∣φ⟩=∑n​∣αn​⟩⟨αn​∣φ⟩.
  2. One-body operator (Eqs. (33), (55)): M^=∑a,bMab ca†cb\hat M=\sum_{a,b}M_{ab}\,c^\dagger_a c_bM^=∑a,b​Mab​ca†​cb​ for a K×KK\times KK×K matrix MMM.

These are the objects in terms of which every statement of the mission is phrased.

Formalization Note Orbitals are indexed 0,…,K−10,\dots,K-10,…,K−1 (Fin K) and the NNN orbitals of a determinant by Fin N; slater α applies cα0†c^\dagger_{\alpha_0}cα0​†​ first. The source works with a possibly infinite orbital basis; here the basis is finite, as in the variational treatment of Sec. 3.

Definition code
import Mathlib

/-!
# Second quantization on a finite orbital basis

E. Koch, *Mean-Field Theory: Hartree-Fock and BCS*, Sec. 2 (Eqs. (14)-(16), (23), (26), (33), (41)).

Fix `K` orthonormal reference orbitals `ϕ_0, …, ϕ_{K-1}`.  A one-electron orbital is its
coefficient vector `Fin K → ℂ`.  The Fock space has the orthonormal occupation-number basis
`|S⟩`, `S ⊆ {0,…,K-1}`; Fock-space vectors are functions `Finset (Fin K) → ℂ` and operators are
complex matrices indexed by `Finset (Fin K)`.
-/

noncomputable section

namespace KochHF

open Matrix

/-- Vectors in the Fock space over `K` orbitals (coefficients in the occupation-number basis). -/
abbrev FockVec (K : ℕ) := Finset (Fin K) → ℂ

/-- Linear operators on the Fock space over `K` orbitals. -/
abbrev FockOp (K : ℕ) := Matrix (Finset (Fin K)) (Finset (Fin K)) ℂ

/-- Fermion sign `(-1)^{#{j ∈ S : i < j}}`. -/
def fermiSign {K : ℕ} (i : Fin K) (S : Finset (Fin K)) : ℂ :=
  (-1) ^ (S.filter (fun j => i < j)).card

/-- Creation operator `c†_i` of the reference orbital `ϕ_i`:
`c†_i |S⟩ = (-1)^{#{j ∈ S : j > i}} |S ∪ {i}⟩` if `i ∉ S`, and `c†_i |S⟩ = 0` if `i ∈ S`. -/
def cdag {K : ℕ} (i : Fin K) : FockOp K :=
  Matrix.of fun T S => if i ∉ S ∧ T = insert i S then fermiSign i S else 0

/-- Annihilation operator `c_i`, the adjoint (conjugate transpose) of `c†_i`. -/
def cann {K : ℕ} (i : Fin K) : FockOp K := (cdag i)ᴴ

/-- The vacuum state `|0⟩` (no orbital occupied). -/
def vacuum (K : ℕ) : FockVec K := Pi.single ∅ 1

/-- The occupation-number basis state `|S⟩`. -/
def basisState {K : ℕ} (S : Finset (Fin K)) : FockVec K := Pi.single S 1

/-- Fock-space inner product `⟨ψ|φ⟩ = Σ_S conj(ψ_S) φ_S`. -/
def fockInner {K : ℕ} (ψ φ : FockVec K) : ℂ := star ψ ⬝ᵥ φ

/-- Matrix element `⟨ψ|A|φ⟩`. -/
def matEl {K : ℕ} (ψ : FockVec K) (A : FockOp K) (φ : FockVec K) : ℂ := star ψ ⬝ᵥ (A *ᵥ φ)

/-- One-electron inner product `⟨φ|χ⟩ = Σ_μ conj(φ_μ) χ_μ`. -/
def orbInner {K : ℕ} (φ χ : Fin K → ℂ) : ℂ := star φ ⬝ᵥ χ

/-- Creation operator of the orbital `|φ⟩ = Σ_μ φ_μ |ϕ_μ⟩`: `c†_φ = Σ_μ φ_μ c†_μ` (Eq. (16)). -/
def cdagOrb {K : ℕ} (φ : Fin K → ℂ) : FockOp K := ∑ μ, φ μ • cdag μ

/-- Annihilation operator of the orbital `|φ⟩`: `c_φ = Σ_μ conj(φ_μ) c_μ`. -/
def cannOrb {K : ℕ} (φ : Fin K → ℂ) : FockOp K := ∑ μ, star (φ μ) • cann μ

/-- The Slater determinant `c†_{α_N} ⋯ c†_{α_1} |0⟩` of the orbitals `α_1, …, α_N`
(Eqs. (23), (26)); the orbitals are indexed `α 0, …, α (N-1)` and `c†_{α 0}` acts first. -/
def slater {K N : ℕ} (α : Fin N → Fin K → ℂ) : FockVec K :=
  (List.ofFn fun n => cdagOrb (α n)).reverse.prod *ᵥ vacuum K

/-- `P|φ⟩ = Σ_n |α_n⟩⟨α_n|φ⟩`, the projection onto the occupied orbitals (Eq. (41)). -/
def occProj {K N : ℕ} (α : Fin N → Fin K → ℂ) (φ : Fin K → ℂ) : Fin K → ℂ :=
  ∑ n, orbInner (α n) φ • α n

/-- Second-quantized one-body operator `M̂ = Σ_{a,b} M_{ab} c†_a c_b` (Eqs. (33), (55)). -/
def oneBodyOp {K : ℕ} (M : Matrix (Fin K) (Fin K) ℂ) : FockOp K :=
  ∑ a, ∑ b, M a b • (cdag a * cann b)

end KochHF

end
Source
E. Koch, *Mean-Field Theory: Hartree-Fock and BCS*, in E. Pavarini, E. Koch, J. van den Brink, G. Sawatzky (eds.), Quantum Materials: Experiments and Theory, Modeling and Simulation Vol. 6, Forschungszentrum Jülich, 2016, ISBN 978-3-95806-159-0, http://www.cond-mat.de/events/correl16, Sec. 2.1–2.4, pp. 2.5–2.13, Eqs. (14)–(16), (23), (26), (33), (41), (55).
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) — NON-BLIND: same agent that drafted the statements

Non-blind read-back — not independent testimony. This read-back was written by the same agent that drafted the Lean statement, with full knowledge of the source text and of the intended meaning. It is not a blind audit and must not be mistaken for independent testimony; reviewers should compare the Lean code against the source themselves.

The file fixes K∈NK\in\mathbb NK∈N and builds the following objects, all over C\mathbb CC.

  • A Fock vector is any function from the finite subsets S⊆{0,…,K−1}S\subseteq\{0,\dots,K-1\}S⊆{0,…,K−1} to C\mathbb CC; a Fock operator is any complex matrix indexed by pairs of such subsets.
  • sgn⁡(i,S)=(−1)#{j∈S: i<j}\operatorname{sgn}(i,S)=(-1)^{\#\{j\in S:\ i<j\}}sgn(i,S)=(−1)#{j∈S: i<j}.
  • ci†c_i^\daggerci†​ is the matrix with entry (T,S)(T,S)(T,S) equal to sgn⁡(i,S)\operatorname{sgn}(i,S)sgn(i,S) when i∉Si\notin Si∈/S and T=S∪{i}T=S\cup\{i\}T=S∪{i}, and 000 otherwise. Hence ci†c_i^\daggerci†​ sends ∣S⟩|S\rangle∣S⟩ to sgn⁡(i,S)∣S∪{i}⟩\operatorname{sgn}(i,S)|S\cup\{i\}\ranglesgn(i,S)∣S∪{i}⟩ when i∉Si\notin Si∈/S and to 000 when i∈Si\in Si∈S.
  • cic_ici​ is the conjugate transpose of ci†c_i^\daggerci†​.
  • ∣0⟩|0\rangle∣0⟩ is the vector with value 111 at ∅\emptyset∅ and 000 elsewhere; ∣S⟩|S\rangle∣S⟩ is the vector with value 111 at SSS and 000 elsewhere.
  • ⟨ψ∣φ⟩=∑Sψ(S)‾ φ(S)\langle\psi|\varphi\rangle=\sum_S\overline{\psi(S)}\,\varphi(S)⟨ψ∣φ⟩=∑S​ψ(S)​φ(S), and ⟨ψ∣A∣φ⟩=∑Sψ(S)‾ (Aφ)(S)\langle\psi|A|\varphi\rangle=\sum_S\overline{\psi(S)}\,(A\varphi)(S)⟨ψ∣A∣φ⟩=∑S​ψ(S)​(Aφ)(S).
  • For φ,χ∈CK\varphi,\chi\in\mathbb C^Kφ,χ∈CK, ⟨φ∣χ⟩=∑μφμ‾χμ\langle\varphi|\chi\rangle=\sum_\mu\overline{\varphi_\mu}\chi_\mu⟨φ∣χ⟩=∑μ​φμ​​χμ​.
  • cφ†=∑μφμ cμ†c^\dagger_\varphi=\sum_\mu\varphi_\mu\,c^\dagger_\mucφ†​=∑μ​φμ​cμ†​ and cφ=∑μφμ‾ cμc_\varphi=\sum_\mu\overline{\varphi_\mu}\,c_\mucφ​=∑μ​φμ​​cμ​.
  • For α0,…,αN−1∈CK\alpha_0,\dots,\alpha_{N-1}\in\mathbb C^Kα0​,…,αN−1​∈CK (no condition on them), ∣Φα⟩|\Phi_\alpha\rangle∣Φα​⟩ is the vector cαN−1†⋯cα1†cα0†∣0⟩c^\dagger_{\alpha_{N-1}}\cdots c^\dagger_{\alpha_1}c^\dagger_{\alpha_0}|0\ranglecαN−1​†​⋯cα1​†​cα0​†​∣0⟩; for N=0N=0N=0 it is ∣0⟩|0\rangle∣0⟩. If the αn\alpha_nαn​ are linearly dependent this vector is 000; it is not normalized in general.
  • Pαφ=∑n⟨αn∣φ⟩ αnP_\alpha\varphi=\sum_{n}\langle\alpha_n|\varphi\rangle\,\alpha_nPα​φ=∑n​⟨αn​∣φ⟩αn​ (this is an orthogonal projection only when the αn\alpha_nαn​ are orthonormal; no such condition is imposed here).
  • For a K×KK\times KK×K complex matrix MMM, M^=∑a,bMab ca†cb\hat M=\sum_{a,b}M_{ab}\,c^\dagger_a c_bM^=∑a,b​Mab​ca†​cb​.

All objects are total; there are no degenerate inputs other than those noted (N=0N=0N=0, K=0K=0K=0, dependent orbitals).

Human review
  • Endorsed by Shuze Chen · Oct 10, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 10, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me