PhysLib

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

physlean-photonics
Lean 4 formalizations of photonic systems. Maxwell's equations, ring resonator transfer matrices, FDTD convergence bounds. Extends Ben Breen's Axiomatic-AI/FormalVerification.
physlib-neo4j
Knowledge graph integrating MathGloss, Mathlib4, and physics definitions. Captures the dependencies between physical laws, mathematical structures, and formal proofs.
physlib-claude-cypher
AI-assisted theorem proving using Claude and Neo4j Cypher queries. Searches the knowledge graph to find relevant lemmas, suggests proof strategies, and generates Lean 4 proof sketches.

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.

References