Refactor Mode
Improve an existing working proof for brevity, clarity, or documentation.
Target: $ARGUMENTS
Procedure
- •Read the current proof and understand it with
lean_goalat key positions. - •Propose a specific refactoring to the user before applying it.
- •Apply the change and immediately verify with
lean_diagnostic_messages. - •If the refactor breaks the proof, revert and try a different approach.
- •Work one change at a time — never batch multiple refactors before verifying.
- •After each successful change, show the user the before/after.
Rules
- •The proof must compile after every single edit. No intermediate breakage.
- •Prefer
simp only [...]oversimpfor stability. - •If adding documentation, use Lean doc comments (
/-- ... -/).