Open source · Lean 4 + Mathlib

lean-mechanics

Continuum mechanics and structural theories, formally verified in Lean 4, with a published paper on reciprocal frames proved result by result.

Two theorems from the paper’s formalisation: the bending moment in the members is never below 2√2 − 2 of its reference value, and reaches that bound at a/l = 1 − √2/2
Two theorems from the paper’s formalisation: the bending moment in the members is never below 2√2 − 2 of its reference value, and reaches that bound at a/l = 1 − √2/2

lean-mechanics is an open-source library of continuum mechanics and structural theories written in Lean 4, the programming language and proof assistant, on top of the Mathlib mathematics library. Every definition is stated precisely and every theorem carries a proof that Lean checks mechanically: the main branch contains no sorry (unfinished proofs) and declares no axioms beyond Lean’s standard three.

Alongside the library sits a formalisation of our own paper on reciprocal frames: Greco, Lebée and Douthe (2013), which homogenizes the square nexorade as a plate. Each closed-form result in the paper is now a Lean theorem.

What the library covers

About 9,000 lines of Lean and nearly 500 theorems, organised the way a continuum-mechanics textbook is. Results are stated coordinate-free and, where the dimension does not matter, in any finite dimension.

  • Tensor algebra: symmetric and skew parts, invariants and Cayley–Hamilton, the spectral theorem, polar decomposition F = RU = VR, and the representation of isotropic fourth-order tensors.
  • Kinematics and stress: strain measures, objectivity, Saint-Venant compatibility, Cauchy’s theorem by the tetrahedron argument, and the balance laws giving div σ + b = 0 and σ = σᵀ.
  • Constitutive theory: frame indifference, the Rivlin–Ericksen representation theorem, and Saint Venant–Kirchhoff, neo-Hookean and Mooney–Rivlin materials with their linearisations.
  • Linear elastostatics: Clapeyron, Betti reciprocity, Kirchhoff uniqueness, minimum potential energy and Lax–Milgram well-posedness.
  • Beams and plates: Euler–Bernoulli and Timoshenko beams with the limit between them, the Euler buckling load, and Kirchhoff–Love and Mindlin–Reissner plates with Navier solutions.
The library’s modules, from tensor algebra to plates, and the paper built on them
The library’s modules, from tensor algebra to plates, and the paper built on them

Assumptions written down, not hidden

Where Mathlib does not yet have the analysis a result needs, such as the divergence theorem on general domains or Korn’s inequality, the library states the missing fact as an explicit hypothesis, lists it in a public GAPS file, and proves the hypothesis can be met by a concrete example. A reader always knows exactly what has been proved and from what.

The design trade-off the formalisation proves: the stress optimum and the stiffness optimum sit at different cell ratios, and choosing one means 7% more deflection or 21% more bending moment
The design trade-off the formalisation proves: the stress optimum and the stiffness optimum sit at different cell ratios, and choosing one means 7% more deflection or 21% more bending moment

A paper, checked line by line

The Nexorade folder formalises the 2013 homogenization of reciprocal frames: the four-point-bending stress field of the unit cell, the degenerate plate it produces, its compliance and stiffness, the optimal cell geometry and the Navier solution.

More in Research

Related work.

Interested in lean-mechanics?

Tell us about your problem — we’ll tell you how we’d approach it.

Get in touch →