Agent skill

Math Formalization

by tradecatlabs in tradecatlabs/vibe-coding-cn

Turns a mathematical claim into a small Lean 4 and Mathlib formalization checked by the proof assistant kernel, and refuses to report a pass without real evidence.

MITAuto-check passedResearch & Science

SKILL.md written in Chinese; this summary is our English description.

Install Math Formalization

skills CLI
$ npx skills add tradecatlabs/vibe-coding-cn --skill math-formalization -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tradecatlabs/vibe-coding-cn math-formalization --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tradecatlabs/vibe-coding-cn.git skills-src && mkdir -p .claude/skills && cp -r skills-src/research/vibe-mathing-cn-public/.codex/skills/math-formalization .claude/skills/math-formalization && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
math-formalization
GitHub stars
17k
Token cost
~717 tokens
SKILL.md length
185 words
Files
6 (incl. references)
Skills in repo
17
Repo updated
First seen
Licence
MIT

At a glance

Turns a mathematical claim into a small Lean 4 and Mathlib formalization checked by the proof assistant kernel, and refuses to report a pass without real evidence.

  • Verifying a key lemma with Lean 4 and Mathlib
  • SKILL.md covers Position in the Method Map, When to Use This Skill, Not For / Boundaries and Quick Reference, plus 3 more sections
  • Calls rg
  • Splitting a natural-language theorem into definitions and lemmas that can be formalized

What it does

The skill cuts a mathematical statement into the smallest pieces a proof assistant kernel can check: definitions, imports, lemmas and a theorem, with the original claim mapped to its Lean statement. At the start of each task the agent probes for lean, elan and lake. If they are missing, it produces only a plan and the formalization slice, marks the work blocked and does not invent compile logs.

A result may be called kernel-checked only when the command truly succeeds, the files contain no sorry, admit or unapproved axiom, and a separate audit confirms the Lean statement faithfully captures the original proposition. A proof can pass the kernel and still be blocked for proving something weaker. Timeouts, verified=false, unsupported inputs and compile errors are recorded by failure type and never treated as counterexamples.

Each package records the original claim, the Lean statement, a definition mapping, imports, proof obligations, the commands run with exit codes, Lean and Mathlib versions and the axiom and sorry audit. Verification receipts tie the result to the current input and toolchain, so a self-reported verified flag or an old pass counts for nothing. The reference files cover pressure-test scenarios and a source map.

When your agent uses it

  • Verifying a key lemma with Lean 4 and Mathlib
  • Splitting a natural-language theorem into definitions and lemmas that can be formalized
  • Checking a Lean file that compiles but may still contain sorry
  • Deciding whether a Lean statement is a faithful version of the original claim

Example prompts

  • “Formalize this lemma about even numbers in Lean 4 and check it with the kernel.”
  • “Check proofs/Basic.lean for sorry placeholders and tell me if it can be called kernel-checked.”
  • “The Lean build timed out, so record what is still unproven without calling the claim false.”

Requirements

  • A Lean toolchain with lean, elan and lake
  • Mathlib for proofs that use the library

What it can do on your machine

Read from SKILL.md and the folder at commit 81fc7ae. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • rg

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Math Formalization loads about 717 tokens when it runs, and up to ~1.7k if it reads all its reference files. Until then it costs about 39 tokens; SKILL.md has 185 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~39
When it runs · the whole SKILL.md, loaded when a task matches
~717
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from tradecatlabs/vibe-coding-cn at commit 81fc7ae, republished under its MIT licence (© tradecatlabs). 185 words, ~717 tokens.

Download SKILL.mdSave it as .claude/skills/math-formalization/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
math-formalization
description
数学形式化与 proof-assistant 验证。用户要求 Lean 4/Mathlib、formal proof、kernel check、无 sorry 编译,或需要把自然语言定理切成可形式化定义和引理时使用。缺少 Lean 工具链时必须 fail-closed。

Math Formalization

把数学主张转成可由 proof assistant 内核检查的最小切片;当前环境缺工具时只产出计划,不伪造验证。

Position in the Method Map

Lean 是形式化方法中的依赖类型理论型交互式定理证明平台,主战场属于“演绎验证 / 定理证明”,不是形式化方法的同义词。先用 governance/standards/FORMAL-METHODS-MAP.md 固定规格与语义,再进行 Lean 语言/elaboration、proof engineering、自动化、Mathlib library engineering 和应用形式化。simp、grind、SMT 或符号执行可以辅助找证明,但最终的 kernel 检查和 statement-faithfulness 审查必须分开记录。

When to Use This Skill

  • 用户明确要求 Lean 4、Mathlib 或机器检查证明。
  • 自然语言证明已经稳定,需要验证关键引理或高风险步骤。
  • 需要建立 definitions/imports/lemmas/theorem 的形式化依赖结构。

Not For / Boundaries

  • CandidateObservation 或 formal-conjectures 条目只有在明确用户形式化请求或 active ProblemContract 下才能进入形式化;benchmark statement/build 不创建数学 Result。
  • formal-conjectures 只使用 vendor lock 固定 commit/immutable benchmark snapshot;其上游也明确要求人工审查 misformalization,固定或编译成功不替代 statement faithfulness。
  • 每次任务开始时运行时探测 lean、elan 和 lake;所需工具缺失时才 fail-closed 为 calibration/blocked,不得把主机安装状态缓存为 skill 事实。
  • 含 sorry、admit、未授权 axiom 或编译失败的文件不得标记 kernel-checked。
  • 不采用归档 skill 中未经验证的 lean_agent Python API。
  • 形式化成功证明 Lean 陈述成立,不自动证明它忠实表达原自然语言命题;必须做 faithfulness audit。
  • verified=false、timeout、unsupported、编译错误和基础设施错误都不是数学反例;必须保留失败类别。
  • 调用者自报的 verified、历史 PASS 或只存在的 receipt 文件没有通过权;证据必须绑定当前输入、工具链和真实产物。

Quick Reference

bash
command -v lean
command -v lake
lean --version
lake env lean Path/To/File.lean
rg -n '\b(sorry|admit)\b' .

形式化包必须包含:原命题、Lean 陈述、定义映射、imports、证明义务、实际命令、退出码、Lean/Mathlib 版本、axiom/sorry 审计和 faithfulness 状态。

验证 receipt 至少记录:当前请求/输入 digest、形式化产物或 theorem digest、checker 与 toolchain、请求和实际建立的 claim strength、未闭合义务、assurance mode、结构化结果状态与错误类别。claimEstablished 不得强于真实证据,也不得强于 claimRequested。

只有命令真实返回成功、无占位证明且陈述忠实审计完成,才能写 kernel-checked。

Examples

Example 1:工具缺失
  • 输入:“把这个引理用 Lean 验证。”
  • 动作:运行预检,发现 lean 缺失;输出安装前置和形式化切片。
  • 验收:状态是 blocked,不创建伪编译日志。
Example 2:含 sorry
  • 输入:一个能够编译但包含 sorry 的 Lean 文件。
  • 动作:扫描占位符并阻止通过。
  • 验收:不能标记 kernel-checked,报告具体文件/位置。
Example 3:陈述失真
  • 输入:Lean 证明了比原命题更弱的结论。
  • 动作:proof check 与 faithfulness audit 分开裁决。
  • 验收:内核检查可 PASS,但总体状态仍因表达不忠实而 BLOCK。
Example 4:验证超时
  • 输入:proof assistant adapter 超时并返回 verified=false。
  • 动作:记录 timeout、预算、工具链和未闭合义务。
  • 验收:状态为 blocked/timeout,不把原命题标记 refuted。

References

  • references/source-map.md:Lean Skill、receipt、adapter 与 faithfulness checker 的来源和限制。
  • references/pressure-tests.md:占位证明、证据新鲜度、claim strength、失败分类与陈述忠实性压力场景。

Maintenance

  • Sources:wentor-research-plugins、leanprover-skills、mathevidence、itpeval、atp-checkers;只吸收方法、不变量和反例,不直接激活上游代码。
  • Last updated:2026-08-26。
  • Verification:安装后必须用当前 Lean/Mathlib 官方工具运行最小无 sorry vertical slice。

© tradecatlabs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in research/vibe-mathing-cn-public/.codex/skills/math-formalization of tradecatlabs/vibe-coding-cn.

  • SKILL.md
  • CHANGELOG.md
  • VERSION
  • references/index.md
  • references/pressure-tests.md
  • references/source-map.md

Open the folder on GitHubat commit 81fc7ae

Compare with similar skills

Math Formalization next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Math Formalization compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Math Formalization this skilltradecatlabs/vibe-coding-cn17k—~717Automated safety check: PassMIT
SympyzLanqing/codex-claude-academic-skills4.6k16 repos~3.4kAutomated safety check: PassMIT
Edu Analytic Geometrywy51ai/edulab1.4k1 repos~1.6kAutomated safety check: PassApache-2.0
Edu Solid Geometrywy51ai/edulab1.4k1 repos~1.1kAutomated safety check: PassApache-2.0
Math Modeling Competition WorkflowXiaoMaColtAI/math-modeling-skill1.9k—~1.2kAutomated safety check: PassNone
Math Toolsananddtyagi/cc-marketplace6872 repos~1.3kAutomated safety check: PassNone

Similar skills

  • Sympy

    zLanqing/codex-claude-academic-skills

    A skill your agent uses when working with symbolic mathematics in Python.

    4.6k GitHub starsUsed in 16 repos~3.4k tokens
    Research & ScienceAuto-check passed
  • 把一道解析几何题解成一个自包含的交互教学网页:左栏题面 + 动态控制台(一个 可变参数滑块驱动实时重算的几何量 + 理论范围/定值指示),中栏 KaTeX 分步解析,右栏 2D Canvas 动态几何画板(椭圆/双曲线/抛物线/圆 + 动直线/动点 + 向量 + 标注 + 画笔涂鸦)。

    1.4k GitHub starsUsed in 1 repo~1.6k tokens
    Research & ScienceAuto-check passed
  • Edu Solid Geometry

    wy51ai/edulab

    把一道立体几何题解成一个自包含的交互教学网页:左侧 MathJax 分步解析, 右侧 Three.js 可交互 3D 模型(分步高亮 + 镜头切换)。支持三种入口——给定文字题目、 随机出题、上传题目图片识别后解题。覆盖正方体/长方体、棱锥/棱柱、圆柱/圆锥上的线面角、 二面角、异面直线夹角、点到平面距离、体积等题型,统一用"建系+向量法",并由 sympy 精确 计算驱动(答案、3D…

    1.4k GitHub starsUsed in 1 repo~1.1k tokens
    Research & ScienceAuto-check passed
  • Math Modeling Competition Workflow

    XiaoMaColtAI/math-modeling-skill

    Three-role workflow for math modeling contests: problem analysis, code and results, then a paper, with independent subagent checks at each stage gate.

    1.9k GitHub stars~1.2k tokensUpdated today
    Research & ScienceAuto-check passed
  • Math Tools

    ananddtyagi/cc-marketplace

    Deterministic mathematical computation using SymPy. An agent skill from ananddtyagi/cc-marketplace.

    687 GitHub starsUsed in 2 repos~1.3k tokens
    Research & ScienceAuto-check passed
  • Proof Run Orchestrator

    wanshuiyin/Auto-claude-code-research-in-sleep

    Runs a mathematical proof project as a stateful pipeline of run directories: a local attempt first, then a manual GPT Pro handoff package, with an optional DeepSeek audit.

    17k GitHub starsUsed in 1 repo~4.7k tokens
    Research & ScienceAuto-check passed

More from tradecatlabs/vibe-coding-cn

All 17 skills in this repo
  • Auto Skill Builder

    tradecatlabs/vibe-coding-cn

    Meta-skill that turns docs, APIs, code or specs into a reusable skill with references and a quality gate, and refactors skills that are unclear or misfire.

    17k GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed
  • Web3 Smart Contract Grep Arsenal

    tradecatlabs/vibe-coding-cn

    A master set of ten grep command blocks that surface likely vulnerability classes in Solidity source within the first 30 minutes of auditing a new protocol.

    17k GitHub starsUsed in 2 repos~3.3k tokens
    Auto-check passed
  • Auto tmux Operator

    tradecatlabs/vibe-coding-cn

    Operates tmux sessions like an administrator: reads pane output, sends keys, inspects many panes at once, and coordinates multiple AI terminals through a swarm state script, built on oh-my-tmux.

    17k GitHub stars~4.7k tokensUpdated today
    Auto-check passed
  • Web3 Bug Bounty AI Tools

    tradecatlabs/vibe-coding-cn

    A selection guide to AI-driven tools for Web3 bug bounty work, from autonomous web pentesters to smart contract bug finders, with notes on authorization.

    17k GitHub starsUsed in 2 repos~3.9k tokens
    Auto-check: warnings
  • Runs Slither and Mythril against Solidity contracts to find reentrancy, overflow and access-control bugs before mainnet deployment, then triages and reports findings.

    17k GitHub starsUsed in 1 repo~738 tokens
    Auto-check passed
  • Math Computation

    tradecatlabs/vibe-coding-cn

    Runs reproducible math computations and counterexample searches with SymPy, NumPy and mpmath, logging evidence without presenting results as proofs.

    17k GitHub stars~881 tokensUpdated today
    Auto-check passed

Questions about Math Formalization

What does Math Formalization do?

Turns a mathematical claim into a small Lean 4 and Mathlib formalization checked by the proof assistant kernel, and refuses to report a pass without real evidence. The skill cuts a mathematical statement into the smallest pieces a proof assistant kernel can check: definitions, imports, lemmas and a theorem, with the original claim mapped to its Lean statement. At the start of each task the agent probes for lean, elan and lake.

When should I use Math Formalization?

Math Formalization fits situations like: verifying a key lemma with Lean 4 and Mathlib; splitting a natural-language theorem into definitions and lemmas that can be formalized; checking a Lean file that compiles but may still contain sorry; deciding whether a Lean statement is a faithful version of the original claim.

How do I install Math Formalization in Claude Code?

Run `npx skills add tradecatlabs/vibe-coding-cn --skill math-formalization -a claude-code`. Or copy the skill folder (research/vibe-mathing-cn-public/.codex/skills/math-formalization in tradecatlabs/vibe-coding-cn) into .claude/skills/math-formalization in your project. Claude Code loads it when a task matches its description.

How do I install Math Formalization in Codex?

Run `npx skills add tradecatlabs/vibe-coding-cn --skill math-formalization -a codex`. Or copy the skill folder (research/vibe-mathing-cn-public/.codex/skills/math-formalization in tradecatlabs/vibe-coding-cn) into .agents/skills/math-formalization in your project. Codex loads it when a task matches its description.

Can I use Math Formalization in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tradecatlabs/vibe-coding-cn --skill math-formalization -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/math-formalization, .gemini/skills/math-formalization, .github/skills/math-formalization and .opencode/skills/math-formalization in your project.

What does Math Formalization need to run?

Going by SKILL.md and its folder, Math Formalization needs the command-line tools its instructions call (rg). Our summary lists: A Lean toolchain with lean, elan and lake; Mathlib for proofs that use the library.

Does Math Formalization access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Math Formalization safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Math Formalization use?

Math Formalization is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Math Formalization use?

About 717 tokens (SKILL.md is roughly 2.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1k tokens, read only when the agent opens those files.

What are the alternatives to Math Formalization?

Skills that share tags, products or a category with Math Formalization: Sympy (zLanqing/codex-claude-academic-skills, 4.6k stars), Edu Analytic Geometry (wy51ai/edulab, 1.4k stars), Edu Solid Geometry (wy51ai/edulab, 1.4k stars) and Math Modeling Competition Workflow (XiaoMaColtAI/math-modeling-skill, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Math Formalization?

tradecatlabs (a GitHub user) maintains it in tradecatlabs/vibe-coding-cn, which has 17,236 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 8, 2026.

Source: tradecatlabs/vibe-coding-cn on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.