A Formal Library for Physics
Lean 4 proofs, knowledge graphs, and AI-assisted theorem proving for physics — from Maxwell's equations to quantum optics.
PhysLib is a collection of projects that formalize physics in Lean 4, organize the relationships between physical and mathematical concepts in a Neo4j knowledge graph, and use AI agents to assist in proof discovery. The goal is a machine-checkable library of physics, analogous to what Mathlib is for mathematics.
Components
Example
A ring resonator through-port transmission formalized in Lean 4:
import PhysLean.Photonics.RingResonator
theorem ring_through_port_unity_off_resonance
(r : RingResonator) (h : r.is_lossless)
(h_off : r.is_off_resonance) :
Complex.abs (r.through_port) = 1 := by
-- Lossless ring off resonance: |t|=1
simp [through_port, h.coupling_unitary, h_off]
Status
PhysLib is early-stage research software from the Quantum Photonics Group at MIT. Contributions, formalizations, and feedback are welcome.
- Photonics: ring resonators, directional couplers, waveguide modes
- Electromagnetism: Maxwell's equations, boundary conditions
- Numerics: FDTD convergence bounds, stability criteria
- Knowledge graph: ~12k nodes across MathGloss + Mathlib4