lean-mathlib-search

Search Mathlib and Batteries lemmas to close Lean 4 proof goals.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/my04337/shapez2-in-lean --skill lean-mathlib-search
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lean-mathlib-search
Source: https://github.com/my04337/shapez2-in-lean/tree/main/.github/skills/lean-mathlib-search
Command: npx skills add https://github.com/my04337/shapez2-in-lean --skill lean-mathlib-search

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps you locate relevant lemmas in Mathlib/Batteries to close a Lean 4 proof goal, saving time hunting through libraries.

Core Features & Use Cases

  • REPL-assisted lemma lookup: quickly search for exact lemmas that resolve a goal.
  • Multi-tool workflow: uses exact?, apply?, #leansearch, #loogle, and #check to verify candidates.
  • Domain guidance: leverages batteries catalog and search guide to steer discovery.

Quick Start

Search for a lemma that closes your current Lean 4 goal using Mathlib/Batteries.

Frequently Asked Questions about lean-mathlib-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find Mathlib lemmas to close a Lean 4 proof goal?

To find Mathlib lemmas for a Lean 4 proof goal, use a multi-tool workflow combining exact?, apply?, #leansearch, #loogle, and #check. This validates candidate lemmas quickly by leveraging the Batteries catalog and Mathlib search guide.

What is the best way to search for lemmas in Lean 4 Mathlib and Batteries?

The best way to search for lemmas in Lean 4 Mathlib and Batteries is using REPL-assisted lookup. This workflow applies exact? and apply? for direct resolution, then uses #leansearch and #loogle to discover and verify candidate lemmas.

Can I use exact? and apply? to automatically close Lean 4 goals with Mathlib?

Yes, you can use exact? and apply? to automatically close Lean 4 goals with Mathlib. They serve as the primary tools for finding exact matching lemmas or applying hypotheses, supplemented by #leansearch and #loogle for broader discovery.

Do I need access to the Mathlib REPL to verify candidate lemmas for Lean proofs?

Yes, you need access to Mathlib, Batteries, and the REPL references described in the Mathlib search guide to reliably verify candidate lemmas. The REPL environment executes the multi-tool workflow to validate search results for your proof tasks.

Why does my Lean 4 lemma search fail to find results in Mathlib?

A Lean 4 lemma search may fail if the query is too specific or the lemma is named differently. Broadening the search using #leansearch and #loogle, or checking lemma types with #check, helps locate relevant Mathlib/Batteries candidates that exact? might miss.