All products

Simplify a Lean proof with AI

Improve a proof’s structure and readability without silently changing the theorem, its assumptions or its behaviour in the project.

Simplify a Lean proof with AI when the file already checks but its reasoning is difficult for another contributor to follow. The lean-simplifier skill has an agent inspect the surrounding declarations, establish the current diagnostics and make small, verifiable edits. Existing Mathlib results are worth checking before keeping a local helper solely out of habit.

A long tactic chain may be compact on the page but obscure why a hypothesis is needed. An explicit intermediate fact can make the argument clearer even if it adds a line. Conversely, a standard lemma can replace several repeated steps, provided that its hypotheses and conclusion genuinely match the original.

What it does

  • Record the current state before editing a working proof.
  • Clarify names and declarations within a defined scope.
  • Replace duplicate steps with an appropriate existing lemma.
  • Review imports and remove temporary diagnostic material.
  • Check the affected file after each logically separate change.

Install and use

  1. Use a coding agent with an authorised Lean 4 project, the correct Mathlib version and local diagnostics. Start from a known build result.
  2. Ask for a small readability improvement to a specific proof while keeping the public statement unchanged.
  3. Recheck the file and inspect the argument yourself before accepting the revision.

FAQ

Source

Made by Texra (texra-ai). Original skill: lean-simplifier, published on GitHub under the MIT licence.

View on GitHub