home / skills / a5c-ai / babysitter / lean-proof-assistant

This skill guides formal theorem verification in Lean 4, translating proofs, generating tactics, and leveraging Mathlib4 for rigorous results.

npx playbooks add skill a5c-ai/babysitter --skill lean-proof-assistant

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.1 KB
---
name: lean-proof-assistant
description: Interface with Lean 4 proof assistant for formal theorem verification
allowed-tools:
  - Bash
  - Read
  - Write
  - Edit
  - Glob
  - Grep
metadata:
  specialization: mathematics
  domain: science
  category: theorem-proving
  phase: 6
---

# Lean Proof Assistant

## Purpose

Provides expert guidance on using the Lean 4 proof assistant for formal theorem verification and mathematical formalization.

## Capabilities

- Parse informal proofs into Lean 4 syntax
- Generate tactic-based proof scripts
- Access Mathlib4 library for standard results
- Automated term rewriting and simplification
- Generate proof outlines with sorry placeholders
- Extract executable code from proofs

## Usage Guidelines

1. **Proof Development**: Use Lean 4 syntax with Mathlib4 conventions
2. **Tactic Application**: Apply tactics systematically (intro, apply, exact, rw)
3. **Library Navigation**: Search Mathlib4 for existing lemmas and theorems
4. **Proof Completion**: Fill sorry placeholders incrementally

## Tools/Libraries

- Lean 4
- Mathlib4
- Lake build system
- VS Code Lean extension

Overview

This skill interfaces with the Lean 4 proof assistant to help you develop, verify, and extract formal proofs and code. It provides guidance for converting informal arguments into Lean 4 syntax, generating tactic-based proof scripts, and leveraging Mathlib4 for standard results. The skill is designed to speed iterative proof development and reduce common syntactic and tactic errors.

How this skill works

The skill analyzes informal proof descriptions or partial Lean files, proposes Lean 4 syntax and tactic sequences, and can insert 'sorry' placeholders to scaffold proofs for later completion. It can search Mathlib4 for relevant lemmas, suggest rewrites and simplifications, and produce executable code extracted from proved constructions. Outputs are Lean 4 snippets and step-by-step proof outlines compatible with the Lake build system and typical VS Code Lean workflows.

When to use it

  • Formalizing an informal proof or textbook argument into Lean 4
  • Generating tactic-first proof scripts to jumpstart interactive development
  • Finding and applying Mathlib4 lemmas to avoid re-proving standard facts
  • Creating proof outlines with placeholders to structure large developments
  • Extracting executable code from constructive proofs for verification

Best practices

  • Write clear informal statements first, then request a Lean translation to avoid misinterpretation
  • Prefer small lemmas and incremental tactics (intro, apply, exact, rw) to keep proofs maintainable
  • Use 'sorry' placeholders sparingly and replace them iteratively with complete proofs
  • Cross-check suggested lemmas against Mathlib4 to ensure version compatibility
  • Run the Lake build and VS Code Lean extension to validate generated files locally

Example use cases

  • Turn a lecture note proof into a Lean 4 lemma with a tactic script and replace sorries over time
  • Refactor a long proof by extracting sublemmas suggested by the skill and importing Mathlib4 results
  • Automatically rewrite expressions using proven identities to simplify proof obligations
  • Generate an executable function from a constructive proof and include it in a Lake project
  • Search for relevant Mathlib4 lemmas when a proof gets stuck and propose next tactics

FAQ

Can the skill run Lean locally or verify proofs by itself?

The skill produces Lean 4 code and proof scripts but does not execute or typecheck them remotely; you should run Lake and the Lean toolchain locally or in your environment to verify.

How accurate are autogenerated tactic scripts?

Autogenerated scripts are practical starting points that often require small edits; they focus on common tactic patterns and Mathlib4 usage but may need adaptation to local library versions or naming.