Find redundant Lean code with AI
Review apparently unused definitions, duplicated lemmas and unnecessary layers against their actual consumers before proposing removal.
Find redundant Lean code with AI when a formalisation has accumulated similar definitions and parallel modules. The find-simplification skill helps an agent collect evidence for structural opportunities, distinguish live consumers from historical mentions and compare local work with existing Mathlib declarations. A shorter file is not, by itself, a useful outcome.
A lemma may appear to repeat a standard result but require a different assumption. Check the exact statements, imports and dependent proofs first. A blueprint reference or test may still rely on the local name even if nearby source files do not. The guide also checks whether an earlier attempt at removal had to be reversed.
What it does
- Trace actual consumers of a candidate definition or module.
- Compare a locally proved fact with the closest library result.
- Separate live references from archived notes and incidental mentions.
- Estimate how much proof maintenance a proposed change would avoid.
- Verify a small authorised change against the project build.
Install and use
- Use an agent with an authorised Lean repository, its Git history and a working build. Python is needed for the optional local inspection scripts.
- Request candidate findings before edits, with evidence of use and a reason each item might still be necessary.
- Review the scope and rebuild the relevant project before accepting any removal.
FAQ
Source
Made by Texra (texra-ai). Original skill: find-simplification, published on GitHub under the MIT licence.
View on GitHub