agentleFS
FrankieeWFrankieeW/agent-skills/learn-math-by-lean-notebook/SKILL.md

learn-math-by-lean-notebook

Skill0 starsChanged 8 months agoMITView on GitHub

Generate Jupyter notebooks that teach mathematics through Lean 4 and mathlib by interleaving compact bilingual-capable explanations, runnable Lean code cells, proof experiments, and small exercises. Use when the user asks to learn a math topic with Lean, wants a Lean 4/mathlib tutorial notebook, requests Chinese or English math-learning notebooks, or wants a theory-plus-formalization lesson in .ipynb form.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 4 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create a real .ipynb tutorial for a user-chosen mathematics topic using Lean 4 and mathlib as the executable medium.

    line 8
  2. Very specific:

    Read references/notebook-style.md before generating a notebook unless the task is only a quick outline.

    line 15
  3. Very specific:

    When the user asks to register, create, debug, or document a project-specific Lean 4 Jupyter kernel, use …

    line 27
  4. Distinctive:

    Keep markdown cells short.

    line 31
  5. Very specific:

    Put every abstract idea near a runnable Lean example, #check, #eval, example, lemma, or theorem.

    line 32
  6. Very specific:

    Prefer mathlib's existing names and APIs.

    line 33
  7. Distinctive:

    Avoid fake Lean. If a proof is likely hard, mark it as an exercise or use an honest intermediate theorem instead of inventing unsupported …

    line 34
  8. Distinctive:

    Keep code cells focused. One cell should introduce one definition, API, proof move, or theorem.

    line 35
  9. Distinctive:

    Use comments only where they orient the learner.

    line 36
  10. Very specific:

    Use Lean 4 syntax: fun x => ..., <| when it improves readability, and no empty lines inside declarations.

    line 41
  11. Very specific:

    Prefer small proofs with by, simp, rw, ring, omega, linarith, and explicit intermediate lemmas when appropriate.

    line 43
  12. Very specific:

    Do not hide hard formalization gaps behind set_option maxHeartbeats.

    line 44
  13. Very specific:

    Read references/notebook-style.md for the recommended notebook shape, language modes, Lean cell patterns, and validation checklist.

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Learn Math by Lean Notebook

Create a real .ipynb tutorial for a user-chosen mathematics topic using Lean 4 and mathlib as the executable medium. Match the rhythm of a theory-practice notebook: explain one idea, run or inspect a small Lean fragment, then build toward a modest theorem or proof pattern.

Default to Chinese prose when the user writes in Chinese, English prose when the user writes in English, and bilingual prose only when the user asks for it or says "中英文", "bilingual", or similar. Lean code, theorem names, identifiers, comments, and error labels should stay in English.

Workflow

  1. Infer the topic, target level, and requested language. If unclear, assume a curious beginner who can read basic Lean syntax.
  2. Read references/notebook-style.md before generating a notebook unless the task is only a quick outline.
  3. Choose one concrete end point: a formalized theorem, a reusable proof pattern, a small computation, a structure/API tour, or a Lean/mathlib translation of a familiar mathematical argument.
  4. Build the notebook as a sequence:
    • Title cell with the topic and language-appropriate subtitle.
    • Environment cell explaining the expected Lean 4/Jupyter setup.
    • Roadmap cell with 3-6 steps.
    • Concept blocks: short math explanation, then a focused Lean cell.
    • Proof blocks: definitions or examples first, lemmas next, final theorem last.
    • Debugging blocks: common Lean errors and how to read them.
    • Exercises: 3-5 small modifications or proofs.
  5. Save a valid .ipynb file. Prefer notebook-native JSON over prose-only drafts when the user asks to create the notebook.

When the user asks to register, create, debug, or document a project-specific Lean 4 Jupyter kernel, use scripts/register_lean4_jupyter_kernel.py as the canonical helper and read the kernel registration section in references/notebook-style.md.

Notebook Rules

  • Keep markdown cells short. Do not write a textbook chapter before the first Lean cell.
  • Put every abstract idea near a runnable Lean example, #check, #eval, example, lemma, or theorem.
  • Prefer mathlib's existing names and APIs. Use #check, #find, or local search when working in a real Lean project.
  • Avoid fake Lean. If a proof is likely hard, mark it as an exercise or use an honest intermediate theorem instead of inventing unsupported code.
  • Keep code cells focused. One cell should introduce one definition, API, proof move, or theorem.
  • Use comments only where they orient the learner.
  • Include expected outcomes in markdown near cells that may require an external Lean kernel.

Lean Style

  • Use Lean 4 syntax: fun x => ..., <| when it improves readability, and no empty lines inside declarations.
  • Name examples and lemmas in English when names matter.
  • Prefer small proofs with by, simp, rw, ring, omega, linarith, and explicit intermediate lemmas when appropriate.
  • Do not hide hard formalization gaps behind set_option maxHeartbeats.

Bundled Reference

Read references/notebook-style.md for the recommended notebook shape, language modes, Lean cell patterns, and validation checklist.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.