← All papers
First page of From Pen-and-Paper to Machine-Checked Proofs: Lean for System Identification

From Pen-and-Paper to Machine-Checked Proofs: Lean for System Identification

Manas Mejari, Dario Piga, Marco Forgione

eess.SY Nov 13, 2026 · v1 cs.AI
Introduces Lean 4 and Mathlib to system identification researchers, formalizing identifiability, set invariance, ARX identifiability and Ljung's noise-filter inversion lemma.
Mathematical proofs in scientific papers are often long and intricate, relying on chains of references to earlier results. This makes it difficult for readers and reviewers to verify each and every step. Interactive theorem proving offers a complement: the theorem and its proof are written as code, and every inference is checked by a small, trusted piece of software called the kernel. This paper serves as an introduction to the Lean 4 proof assistant for a system identification and control audience, assuming no prior exposure to formal methods. We first show how a Lean proof is read using two elementary examples: the first on identifiability, the second on set invariance. We then illustrate how Lean can be used to analyse results from the literature, taking as example a classic lemma on the inversion of the noise filter in prediction-error identification (Ljung, 1999, Lemma 3.1). Since in Lean every step must be justified, the formalization brings to light a subtle point: the original claim of that lemma holds almost surely, although not for every realisation, as its statement may suggest. A simple counterexample makes this concrete. Finally, the paper discusses guidelines and perspectives on the use of Lean in system identification research.

Proofs in system identification and control are long and intricate, so gaps and errors can reach the published literature. Proof assistants are rarely used in control and, to the authors' knowledge, have not been used in system identification.

The authors give a tutorial introduction to Lean 4 and Mathlib for control engineers, using elementary examples on identifiability and set invariance. They formalize a classic lemma on inverting the noise filter in prediction-error identification (Ljung 1999, Lemma 3.1). They also provide a four-step template for formalizing system identification results and apply it to prove strict global identifiability of the ARX structure. The Lean code was written with help from Claude Code and the statements were reviewed by the authors.

The formalization shows that the interchange of an infinite double sum in Ljung's proof needs justification. The lemma holds for every realisation under bounded noise, but only almost surely for finite-variance white noise, and a counterexample illustrates this. The corrected lemma is certified in Lean.