You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the provider seam from #87 in place, implement the lean generation method. It takes the program graphs SPECA already extracts in 01b — the .mmd subgraphs carrying RFC-2119 invariant annotations (e.g. INV-001: Precompile MUST NOT revert) — for a given EIP, encodes the relevant invariants as Lean 4 propositions, attempts the proofs, and emits two artifacts: properties in the 01e schema, and a Kurtosis devnet test per property that checks the same invariant against a running client.
Where Lean runs — dedicated external plugin
Lean 4 execution does not live in speca. It ships as a dedicated plugin repository, NyxFoundation/speca-lean4-plugin (the heavy lean/lake toolchain stays out of the core speca dependency tree). speca references it as a version-pinned, officially-certified plugin through the plugin boundary defined in #87; the lean provider in speca invokes the plugin across that seam. Build the plugin repo, then wire speca's lean provider to it.
Tasks
1. Create NyxFoundation/speca-lean4-plugin: a lake-built Lean 4 workspace reusing modeling patterns from NyxFoundation/gasper-lean4, exposing a stable invocation interface (subprocess / CLI contract) that speca's lean provider calls. Pin the lean / lake version in the plugin repo, and pin the plugin version from speca (resolution point from Pluggable property providers and reproduction backends #87). Make CI install/resolve it. — ✅ v0.1.0 リリース、speca 側 pin + CI 解決は PR #115。ただし pin の「強制」(checkout 照合)は未了 → Pluggable property providers and reproduction backends #87 の残項目
2. Take one pilot end to end before generalizing. — ✅ パイロットは EIP-7951 から gasper に変更(方針コメント参照)。gasper-lean4 Core 定理群 → 01e で一気通貫
3. Per invariant: generate the Lean proposition, run the proof attempt, and record the outcome — proved, counterexample, or unknown — next to the emitted property. — ✅ plugin の provenance パイプライン(collectAxioms で sorry-free 検証 → lean_status: proved | unknown)
4. Emit 01e-schema properties from the provider. Carry the proof status in a provider field (lean_status), never by mutating a core field. — ✅ additive lean_* フィールドとして実装、コアフィールド無変更を PR #115 レビューで検証済み
5. Emit a Kurtosis fixture per property under outputs/kurtosis/<eip>/<property_id>/ (devnet config + assertion), and reference the path from the property record. — ✅ speca 実行時の fixture 実出力を #135 で実装(scaffold まで。devnet 実行は Kurtosis reproduction of confirmed findings #92)
6. Wire provider: lean in speca (dispatching to speca-lean4-plugin) and add a CI job mirroring 01e-properties.yml. — ✅ PR #115(properties-lean smoke ジョブ含む)
7. Write docs/lean-direction.md in speca — one paragraph stating the Spec→Lean4 rationale for the EF check-in (see [M2] Milestone 2 tracking #86). — ✅ #135 でマージ済み
8. Tests on the pilot: at least one proved property with a runnable Kurtosis fixture; output validates against the 01e schema. — ⬜ proved property の emit とスキーマ検証は✅(CI smoke)だが、runnable Kurtosis fixture が未達(Task 5 待ち)
Interfaces & contracts
Output validates as 01e with core fields unchanged. Additive fields allowed: lean_status, lean_artifact (path to the .lean proof), kurtosis_test (fixture path).
uv run python3 scripts/run_phase.py --phase 01e with provider: lean on the pilot produces schema-valid properties + Kurtosis fixtures.(properties は✅ / fixtures が⬜)
At least one invariant is machine-proved in Lean and its property is emitted.(gasper Core: accountable safety k_safety'、slashable bound、plausible liveness ほか)
Re-running is deterministic (same inputs → same properties and paths).(未検証)
The pilot is documented well enough to add a second EIP without reading the PR.(統合パイプライン仕様は plugin PR #19 でレビュー中)
M2·track:2-D·lean— target 7/14 (step 1) · depends on the provider-seam issue (#87) · blocks the full-EIP generation (#90) and Kurtosis reproduction (#92) issues · part of #86Important
ステータス 2026-07-22 時点(正本 / タスク管理はこの issue を基準とする)
ゴール(gohan 確定): spec ごとに「実装即応で汎用な 01e チェックリスト」を作ることが成果物。品質は judge harness で solodit 参照バーと比較し、vuln dataset を教材にした自己改善で仕上げる。各 spec の 01e は 02c→04 まで走らせて findings を確認して検証する。02以降の本番実行は gohan マシン。
アーキテクチャ: ① Lean4 = critical な safety/liveness spec のみ形式化 → ② その定理を背骨に judge/improve ループで 01e を作る(eval は recall でなく LLM-as-judge の品質評価、vuln dataset は improve の教材)→ ③ 02c→04 を naive な speca で走らせて findings を見る。
手順(この順で回す):
今どこ: 手順1が第1ドラフト完了。手順2が未着手で、ここが次の critical path。
完了したもの:
emit-01e --property-provider leanで 76 properties(機械 lowering 61 + CHK-15)を emit。手書き項目がprovedを騙らない honesty 修正済み(descends-from-*)未達 / 留保(「バー到達 = 完了」ではない):
優先順位: P0 = 手順2(gasper 01e = CHK-15 を 02c→04 で実走し findings 確認、gohan マシン)+ 別系統 judge で自己選好チェック / P1 = 手順3(他 spec の 01e、#90 方向)/ P2 = #92 Kurtosis 配管
プロセス: author による self-merge 禁止(approve 後にレビュア側でマージ)。チェックボックス更新には根拠 PR + 検証内容を併記。
Background
With the provider seam from #87 in place, implement the
leangeneration method. It takes the program graphs SPECA already extracts in01b— the.mmdsubgraphs carrying RFC-2119 invariant annotations (e.g.INV-001: Precompile MUST NOT revert) — for a given EIP, encodes the relevant invariants as Lean 4 propositions, attempts the proofs, and emits two artifacts: properties in the01eschema, and a Kurtosis devnet test per property that checks the same invariant against a running client.Where Lean runs — dedicated external plugin
Lean 4 execution does not live in
speca. It ships as a dedicated plugin repository,NyxFoundation/speca-lean4-plugin(the heavylean/laketoolchain stays out of the corespecadependency tree).specareferences it as a version-pinned, officially-certified plugin through the plugin boundary defined in #87; theleanprovider inspecainvokes the plugin across that seam. Build the plugin repo, then wirespeca'sleanprovider to it.Tasks
NyxFoundation/speca-lean4-plugin: alake-built Lean 4 workspace reusing modeling patterns fromNyxFoundation/gasper-lean4, exposing a stable invocation interface (subprocess / CLI contract) thatspeca'sleanprovider calls. Pin thelean/lakeversion in the plugin repo, and pin the plugin version fromspeca(resolution point from Pluggable property providers and reproduction backends #87). Make CI install/resolve it. — ✅ v0.1.0 リリース、speca 側 pin + CI 解決は PR #115。ただし pin の「強制」(checkout 照合)は未了 → Pluggable property providers and reproduction backends #87 の残項目proved,counterexample, orunknown— next to the emitted property. — ✅ plugin の provenance パイプライン(collectAxiomsで sorry-free 検証 →lean_status: proved | unknown)01e-schema properties from the provider. Carry the proof status in a provider field (lean_status), never by mutating a core field. — ✅ additivelean_*フィールドとして実装、コアフィールド無変更を PR #115 レビューで検証済みoutputs/kurtosis/<eip>/<property_id>/(devnet config + assertion), and reference the path from the property record. — ✅ speca 実行時の fixture 実出力を #135 で実装(scaffold まで。devnet 実行は Kurtosis reproduction of confirmed findings #92)provider: leaninspeca(dispatching tospeca-lean4-plugin) and add a CI job mirroring01e-properties.yml. — ✅ PR #115(properties-leansmoke ジョブ含む)docs/lean-direction.mdinspeca— one paragraph stating the Spec→Lean4 rationale for the EF check-in (see [M2] Milestone 2 tracking #86). — ✅ #135 でマージ済み01eschema. — ⬜ proved property の emit とスキーマ検証は✅(CI smoke)だが、runnable Kurtosis fixture が未達(Task 5 待ち)Interfaces & contracts
01ewith core fields unchanged. Additive fields allowed:lean_status,lean_artifact(path to the.leanproof),kurtosis_test(fixture path).leanprovider talks tospeca-lean4-pluginonly through the Pluggable property providers and reproduction backends #87 plugin boundary — no Lean/lakedependency vendored intospeca.Done when
NyxFoundation/speca-lean4-pluginexists, is version-pinned, and is resolved byspecaas an official plugin.(pin の強制照合のみ Pluggable property providers and reproduction backends #87 残項目)uv run python3 scripts/run_phase.py --phase 01ewithprovider: leanon the pilot produces schema-valid properties + Kurtosis fixtures.(properties は✅ / fixtures が⬜)k_safety'、slashable bound、plausible liveness ほか)方針コメントのTODO対応状況(2026-07-02 コメント参照)
label_design.md確定、データセット本体も利用可(Refine the historical vulnerability dataset #89 close 済み)Review checklist
speca-lean4-plugin, not vendored intospeca; the boundary matches Pluggable property providers and reproduction backends #87.01efields unchanged; Lean / Kurtosis data is additive.unknownorcounterexampleis never silently dropped or relabeledproved.Out of scope
Full-set generation and bug-DB cross-check (#90). Running Kurtosis at scale (#92).