OpenMath Open Theorem
Instructions
Query the OpenMath library to discover and scaffold open theorems. The discovery scripts use OPENMATH_SITE_URL and OPENMATH_API_HOST when set, and otherwise fall back to the default production endpoints.
First-run gate
Before discovery on a new machine or workspace, check the shared openmath-env.json. Auto-discovery only checks ./.openmath-skills/openmath-env.json and ~/.openmath-skills/openmath-env.json.
This gate is mandatory. If openmath-env.json is missing, or if it exists but preferred_language is missing, stop. Do not query the OpenMath theorem list, theorem detail, or download APIs until setup is complete.
If no config exists, stop and ask the user where to create it, then collect at least:
- -
preferred_language: lean or INLINECODE9 - config visibility / save scope:
./.openmath-skills or INLINECODE11 - the submit/authz fields only if the user wants end-to-end submission later
Command:
CODEBLOCK0
Workflow checklist
- - [ ] Env: Run
check_openmath_env.py. If openmath-env.json is missing from ./.openmath-skills and ~/.openmath-skills, or preferred_language is missing, ask the user to finish setup before continuing. - [ ] Explore: Run
fetch_theorems.py [language] only after the first-run gate passes. If no language is passed, it uses preferred_language from openmath-env.json and must not fan out to other languages automatically. - [ ] Detail: Run
fetch_theorem_detail.py <id> only after the first-run gate passes. - [ ] Download: Run
download_theorem.py <id> only after the first-run gate passes. - [ ] Prove: Use the
openmath-lean-theorem skill for environment setup, preflight checks, and proving. - [ ] Submit: Use the
openmath-submit-theorem skill to hash and submit the proof. - [ ] Verify: Run
fetch_theorem_detail.py <id> and confirm your address is the prover and status is verified. - [ ] Claim: Use the
openmath-claim-reward skill to generate the withdrawal command.
Scripts
| Script | Command | Use when |
|---|
| Shared env check | INLINECODE26 | Mandatory first-run gate; validates shared config, preferred language, and the resolved OpenMath website/API endpoints. |
| List open theorems |
python3 scripts/fetch_theorems.py [--config <path>] [language] | Listing or filtering open theorems after the first-run gate passes.
language: optional
lean or
rocq. Without an explicit CLI language, query only the configured
preferred_language. |
| Theorem detail |
python3 scripts/fetch_theorem_detail.py [--config <path>] <id> | Need description, metadata, and formal definition (source) for a theorem ID; refuses to run until the first-run gate passes. |
| Download & scaffold |
python3 scripts/download_theorem.py [--config <path>] <id> [--output-dir <path>] [--force] | Creating a local Lean or Rocq proof workspace after the first-run gate passes. |
INLINECODE34 is the shared API client. openmath_env_config.py reads shared user preferences from openmath-env.json.
Notes
- - Endpoints: Default website is
https://openmath.shentu.org; default API host is https://openmath-be.shentu.org. Runtime overrides: OPENMATH_SITE_URL, OPENMATH_API_HOST. - Language: User-facing and API language naming is
rocq. - No fallback: If
preferred_language is lean, query only Lean by default. If no theorems are found, report that result and stop; do not automatically query Rocq, and vice versa. - Lean scaffold: Pins Lean and mathlib4 to
v4.28.0. Rocq scaffold is _CoqProject-based. - After download: Use the
openmath-lean-theorem skill for Lean environment setup, preflight, external skill installation, and the proving workflow.
References
Load when needed (one level from this file):
OpenMath 开放定理
使用说明
查询OpenMath库以发现并搭建开放定理。发现脚本在设置OPENMATHSITEURL和OPENMATHAPIHOST时会使用这些环境变量,否则将回退到默认的生产环境端点。
首次运行门控
在新机器或工作空间进行发现之前,请检查共享的openmath-env.json。自动发现仅检查./.openmath-skills/openmath-env.json和~/.openmath-skills/openmath-env.json。
此门控为强制要求。如果openmath-env.json缺失,或文件存在但缺少preferred_language,则停止。在设置完成之前,不要查询OpenMath定理列表、定理详情或下载API。
如果不存在配置,请停止并询问用户在哪里创建配置,然后至少收集以下信息:
- - preferred_language:lean或rocq
- 配置可见性/保存范围:./.openmath-skills或~/.openmath-skills
- 仅当用户后续需要端到端提交时才收集提交/授权字段
命令:
bash
python3 scripts/checkopenmathenv.py
工作流程检查清单
- - [ ] 环境:运行checkopenmathenv.py。如果./.openmath-skills和~/.openmath-skills中缺少openmath-env.json,或缺少preferredlanguage,请询问用户完成设置后再继续。
- [ ] 探索:仅在首次运行门控通过后运行fetchtheorems.py [language]。如果未传入语言,则使用openmath-env.json中的preferredlanguage,且不得自动扩展到其他语言。
- [ ] 详情:仅在首次运行门控通过后运行fetchtheoremdetail.py 。
- [ ] 下载:仅在首次运行门控通过后运行downloadtheorem.py 。
- [ ] 证明:使用openmath-lean-theorem技能进行环境设置、预检检查和证明。
- [ ] 提交:使用openmath-submit-theorem技能对证明进行哈希处理并提交。
- [ ] 验证:运行fetchtheoremdetail.py 并确认您的地址是证明者且状态为已验证。
- [ ] 领取:使用openmath-claim-reward技能生成提款命令。
脚本
| 脚本 | 命令 | 使用时机 |
|---|
| 共享环境检查 | python3 scripts/checkopenmathenv.py [--config <path>] | 强制性的首次运行门控;验证共享配置、首选语言以及解析后的OpenMath网站/API端点。 |
| 列出开放定理 |
python3 scripts/fetch
theorems.py [--config ] [language] | 在首次运行门控通过后列出或筛选开放定理。language:可选lean或rocq。如果没有显式的CLI语言参数,仅查询配置的preferredlanguage。 |
| 定理详情 | python3 scripts/fetch
theoremdetail.py [--config
] | 需要定理ID的描述、元数据和形式化定义(源代码);在首次运行门控通过前拒绝运行。 |
| 下载与搭建 | python3 scripts/download_theorem.py [--config ] [--output-dir ] [--force] | 在首次运行门控通过后创建本地Lean或Rocq证明工作空间。 |
openmathapi.py是共享的API客户端。openmathenv_config.py从openmath-env.json读取共享的用户偏好设置。
注意事项
- - 端点:默认网站为https://openmath.shentu.org;默认API主机为https://openmath-be.shentu.org。运行时覆盖:OPENMATHSITEURL、OPENMATHAPIHOST。
- 语言:面向用户和API的语言命名为rocq。
- 无回退:如果preferredlanguage为lean,默认仅查询Lean。如果未找到定理,报告该结果并停止;不要自动查询Rocq,反之亦然。
- Lean搭建:将Lean和mathlib4固定到v4.28.0版本。Rocq搭建基于CoqProject。
- 下载后:使用openmath-lean-theorem技能进行Lean环境设置、预检、外部技能安装和证明工作流程。
参考资料
需要时加载(相对于此文件的一级目录):