一键导入
erdos-prove
Step-by-step workflow for proving an Erdos problem in Lean 4 using Claude Code/Codex (subscription-first). Invoke as /erdos-prove <problem-id>.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Step-by-step workflow for proving an Erdos problem in Lean 4 using Claude Code/Codex (subscription-first). Invoke as /erdos-prove <problem-id>.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | erdos-prove |
| description | Step-by-step workflow for proving an Erdos problem in Lean 4 using Claude Code/Codex (subscription-first). Invoke as /erdos-prove <problem-id>. |
| user-invocable | true |
Target Problem: $ARGUMENTS
Tip: If no problem ID provided, check
CANDIDATES.mdfor the current focus problem (see Decision Log).
This workflow helps you prove Erdos problems in Lean 4 using your Claude Code/Codex subscription instead of paid API calls.
┌─────────────────────────────────────────────────────────────────┐
│ COST-FREE PROVING WORKFLOW │
├─────────────────────────────────────────────────────────────────┤
│ 1. Understand → Read problem statement (FREE) │
│ 2. Research → Gather literature context (FREE) │
│ 3. Formalize → Generate Lean skeleton (FREE) │
│ 4. Prove → Work with Claude Code (SUB) │
│ 5. Verify → Check Lean compilation (FREE) │
│ 6. Iterate → Fix errors with Claude Code (SUB) │
└─────────────────────────────────────────────────────────────────┘
First, let me read the problem statement and understand what we're trying to prove.
Action: I will read the problem details using:
data/problems_enriched.yaml (if present) or src/erdos/data/problems_enriched.yaml (built-in sample dataset)erdos show $ARGUMENTS output for formatted displayQuestions to answer:
Gather context from existing references without making API calls.
Local sources (FREE):
literature/manifests/$(printf '%04d' $ARGUMENTS).yaml - Reference metadata (IDs are zero-padded, e.g. 6 → 0006.yaml)literature/cache/ - Downloaded papers and sourcesresearch/problems/$(printf '%04d' $ARGUMENTS)/ - Research workspace (leads, hypotheses, tasks)uv run erdos search "relevant terms" --problem $ARGUMENTS (omit --problem to search globally)Optional API sources (rate-limited, mostly free):
uv run erdos refs zbmath --msc <relevant-code> - zbMATH (free)uv run erdos refs s2 citations <doi> - Semantic Scholar (rate-limited)uv run erdos ingest $ARGUMENTS --source openalex - Fetch refs by DOI/arXiv ID (free)Optional AI-powered discovery (PAID):
uv run erdos research exa search $ARGUMENTS "relevant query" --save-leads - Exa AI searchCreate the formal statement file:
uv run erdos lean formalize $ARGUMENTS
This creates: formal/lean/Erdos/Problem$(printf '%03d' $ARGUMENTS).lean (IDs are zero-padded, e.g. 6 → Problem006.lean)
What this generates:
sorry placeholder)Now we work together to fill in the proof. This is where your subscription pays off instead of API calls.
I will directly edit these files (no copy/paste needed):
formal/lean/Erdos/Problem$(printf '%03d' $ARGUMENTS).lean - The main proof filedata/problems_enriched.yaml - Update status when solvedMy workflow:
lean checkProof development strategies:
simp, ring, norm_num, omega)Check that the proof compiles:
PROBLEM3=$(printf '%03d' $ARGUMENTS)
uv run erdos lean check "formal/lean/Erdos/Problem${PROBLEM3}.lean"
Possible outcomes:
sorry remainingWhen compilation fails, show me the error output and I'll:
Common fixes:
# Generate skeleton (if not done)
uv run erdos lean formalize $ARGUMENTS
# Check compilation
PROBLEM3=$(printf '%03d' $ARGUMENTS)
uv run erdos lean check "formal/lean/Erdos/Problem${PROBLEM3}.lean"
# View problem details
uv run erdos show $ARGUMENTS
# Search related literature
uv run erdos search "relevant terms" --problem $ARGUMENTS # omit --problem to search globally
# Check formalization status
uv run erdos lean status $ARGUMENTS
# View execution logs
uv run erdos logs --problem-id $ARGUMENTS
Read & Analyze:
Edit & Write:
Research:
You: /erdos-prove 6
Claude: Let me start the proving workflow for Problem 6.
[Step 1] Reading problem statement...
Problem 6 is about... [explains math]
[Step 2] Checking existing literature...
Found 3 references in the manifest: [lists them]
[Step 3] I see formal/lean/Erdos/Problem006.lean exists. Let me read it...
Current state: Has `sorry` at line 42.
[Step 4] Here's my proposed proof approach:
1. We can use the pigeonhole principle
2. Apply Mathlib's Finset.card_le_card
3. Conclude with norm_num
Let me edit the file to add the proof...
[Makes edit]
[Step 5] Now run: uv run erdos lean check formal/lean/Erdos/Problem006.lean
You: [pastes error output]
Claude: I see the issue - we need to import Data.Nat.Prime.
Let me fix that...
[Makes edit]
Try again: uv run erdos lean check formal/lean/Erdos/Problem006.lean
| Traditional Approach | Subscription Approach |
|---|---|
erdos loop run 6 | Work with Claude Code |
| ~$0.50-5.00 per run | $0 (subscription) |
| Automated but costly | Interactive but free |
| Limited iterations | Unlimited iterations |
If you prefer hands-off automated proving via Harmonic's Aristotle API:
# 1. Install aristotlelib
uv sync --extra aristotle
# 2. Set API key (use export for direct CLI calls)
export ARISTOTLE_API_KEY=arstl-your-key
# 3. Run via erdos wrapper (recommended - auto-loads .env)
uv run erdos lean prove formal/lean/Erdos/Problem006.lean \
--output formal/lean/Erdos/Problem006_aristotle.lean
# Or direct CLI (requires exported env var)
uv run aristotle prove-from-file \
formal/lean/Erdos/Problem006.lean \
--output-file formal/lean/Erdos/Problem006_aristotle.lean
Cost: Paid per-problem. Use the subscription workflow above for unlimited iterations.
Tell me to start and I'll begin Step 1: reading and understanding Problem $ARGUMENTS.
Or if you want to jump to a specific step: