Research Log 2026-08-20 — search_verified MCP + find_gaps + audit_gaps 三段 arc

段 2 + 段 3 + 段 4 MCP +3 tools 189/189 test PASS 4 commits pushed · 2026-08-19 合意 Order 原則 完走 + 初回 Mathlib mirror 実測

本 arc の位置づけ: 藤本さん質問 「私は最終的に Rei と claude 先生をロボットに組み込むのが最終目標なのでしょうか?」 展開中、 私 (Claude Code) が提案した 「Mathlib 依存グラフの空白を洗い出す tool = find_gaps」 を grep で 既に 段 1 (search_verified CLI) が 実装済み と発見 (前日 2026-08-19、 [[project-rei-memory-mcp-phase1-arc-2026-08-19]] と同期)。 藤本さん 「第二段 (MCP 化) と 第三段 (find_gaps) を お願い致します」 → 段階的実装 → v0.2 dep-graph 解析 の defer + name/path signals 実装 → 実 Mathlib mirror clone + 31 entry 実測。

Order 原則 (2026-08-19 合意) 4 段の到達点

内容日付commit状態
1search_verified CLI v0.1 (SEED_KERNEL + Rei Lean 4 index)2026-08-19既存
2search_verified MCP tool 追加2026-08-203484e266b
3find_gaps v0.1 engine + CLI + MCP tool2026-08-203484e266b
4audit_gaps v0.2 (Mathlib mirror scanner + gap cross-check)2026-08-200022af11e
初回 audit 実測 artifact (data/lean4-curated/audit-2026-08-20.json)2026-08-20cc50179ae

rei-aios MCP に追加された 3 tool (v2.5.0 → v2.7.0、 33 → 36 tools)

search_verified

SEED_KERNEL 1,677 理論 + Rei Lean 4 axiom-free 資産 (合計 7,466 items) を substring 検索。 verified-index.db 未生成時は {indexMissing: true} を返し、 fake 検索結果を永久に生成しない。 v0.1 の Lean parser は regex-based、 lean4Verified は syntactic proxy (#print axioms guarantee ではない、 honest scope 継承)。

find_gaps

curated Mathlib gap registry (data/lean4-curated/ 3 tier / 31 entry) を substring + tier + area + difficulty + dfumt8 で filter 検索。 v0.1 は 手動 curated data のみ で Mathlib 依存グラフの自動解析は含まない (v0.2+ scope、 description で明示継承)。

audit_gaps

各 curated gap entry を local Mathlib mirror scan と cross-check、 5 status bucket で per-entry 結果を返す。 Mirror path 優先順: --mirror > MATHLIB_MIRROR env > default (<cwd>/../mathlib4-mirror)。 未存在時は {mirrorAvailable: false, reason} + reproduce 用 shallow-clone command を返し、 fake 判定を永久に生成しない

audit_gaps 5 status bucket + 3 段 confidence

status意味
file-path-present-and-name-match両 signal あり — POSSIBLY 埋まっている (人 grep 必須)
file-path-presentfile 位置のみ present — 中身未 verify
name-match宣言名 candidate hit のみ — substring 偽陽性リスク
no-signalcross-reference なし — 「無いことが確認できた」 ではなく 「何も見つからなかった」 のみ
mirror-unavailablemirror 未設定/未存在 — 手動 grep 継続

各 signal の confidence は 3 段:

finding #30/#31 discipline 継承 (drift 事前遮断)

Why: 2026-08-20 finding #30 (get_kernel_status description 「調和度・七値分布を含む」 vs 実 payload 5 field で 「調和度」 「七値分布」 両方不在) + finding #31 (rei-meta 自身の verdict/status drift) の直後、 本 arc で新規 3 tool を追加する。 同型 drift の再発防止が必須。

How: 両 tool の description に返却 payload の field 名を 全列挙 + test が 正規表現で description から field 名を抜き出し、 実際の payload に存在することを assert (test/step-find-gaps-v01-test.ts + test/step-audit-gaps-v02-test.ts)。 drift audit の機械化audit_gaps の場合 15 field 全て assert 済。

初回 Mathlib mirror 実測

Mirror 準備 (sparse + blob-filter で軽量化)

git clone --depth=1 --filter=blob:none --sparse \
  https://github.com/leanprover-community/mathlib4 \
  C:/Users/user/mathlib4-mirror
cd C:/Users/user/mathlib4-mirror
git sparse-checkout set Mathlib

結果: 8,350 .lean files / 229,933 declarations / 144 MB / scan 7.8 秒

Status counts (curated 31 entry)

bucketcount解釈
file-path-present-and-name-match0最強シグナル空 — curated name が散文で Lean identifier ではないため、 原理的
file-path-present5sorry-residual 8 件中 5 件 = 該当 file 現存 (中身の sorry 現況は手動 open 必要)
name-match9hint (evidence 昇格ゼロ、 discipline 保持)
no-signal17cross-reference なし
mirror-unavailable0

name-match 9 件の質 (全て偽陽性 — 設計通り hint 止まり)

curated entrymatched declaration実質
Fermat's Last TheoremFin2.last / MvPFunctor.last無関係 (last = 最後の要素)
Four Color TheoremCategoryTheory.four無関係 (ComposableArrows)
Riemann HypothesisBoxIntegral.RiemannRiemann 積分、 zeta ではない
Bremermann LimitAlgCat.limit / ModuleCat.limit圏論の極限
Classification Finite Simple GroupsADEInequality.classification無関係
Lebesgue DecompositionCategoryTheory.decomposition無関係
Stone-Weierstrass latticePeriodPair.latticeWeierstrass 楕円関数の周期格子
Discipline evidence: 9 件の名前 hit を 全て hint に留めた = evidence bucket 昇格ゼロ。 「NOTE: token substring match — false positive likely」 が detail に自動付与。 保守的設計が 実データで 100% 偽陽性を honest label で回避した実例。

no-signal 17 件の hand-grep verify (8 件抽出、 8/8 一致)

entrygrep 結果判定
Banach-Tarski0 files真に不在
Kepler (Flyspeck)0 files真に不在 (未 port)
Landauer0 files真に不在
BSD 予想0 files真に不在
SzemerédiRuzsaSzemeredi.lean + Regularity/* 部分 infrastructure部分 (registry 「Roth k=3 のみ」と整合)
Jordan curveAlgebra/Jordan/* は Jordan 代数、 曲線定理は不在真に不在
Poincaré 予想PBW + Poincaré disc、 予想は不在真に不在
Hodge 予想Perfectoid の Hodge-Tate 系、 予想は不在真に不在
8/8 一致 = curated registry の精度が高いこと + audit_gaps の保守的 signal 設計が 正しく機能していること、 両方 verify。 「gap 埋まっている」 主張は 一件も出していない (file-path-present 5 件も 中身の sorry 現況は 手動 open が primary)。

最も actionable な発見 (5 件の file-path-present)

  1. Mathlib/NumberTheory/Cyclotomic/Discriminant.lean
  2. Mathlib/CategoryTheory/Limits/Final.lean (Cofinal)
  3. Mathlib/ModelTheory/Order.lean (Omega Minimal)
  4. Mathlib/Analysis/Complex/UpperHalfPlane (Analytic Continuation)
  5. Mathlib/Probability/Martingale/Convergence.lean (L^p convergence)

該当 file が現行 mirror に存在する = curated description の 「sorry 残留」 が 現時点でも真かは、 この 5 file を 手で開いて中身 verify する価値。 audit_gaps 本 arc の 最も actionable な output。

Test 累計 189/189 PASS

Honest scope (譲れない線)

  1. name / path signals のみ — 「same theorem, different name」 は catch できない (最も厄介な case)。 v0.3 candidate: curator が leanIdentifierGuess field を entry に足すだけで name-match 偽陽性は大幅減、 LLM や semantic matching 不要かも。
  2. file-path-present-and-name-match が出ても 「gap 埋まっている」 と 主張してはいけない — signal に過ぎず、 中身検証は Mathlib 実 source を読む必要。
  3. load-bearing な 「Mathlib に無い」 主張の primary evidence は 依然 手動 grep (feedback_mathlib_grep_before_novel_gap_claim.md)。 audit_gaps は 補助 layer。
  4. Mirror snapshot 時点で 凍結 — 半年 stale なら 半年 stale の 結果を返す。
  5. find_gaps v0.1 の curated registry も lastUpdate: 2026-04-27 時点、 4 か月前の snapshot。 実際に埋まった gap は 再 curate まで反映されない。
  6. 本 arc は 新しい発見 ではなく、 既存 tool の 拡張 + 初回実 mirror 実測 record。 「Mathlib に FLT が無い」 は 30 年前から既知、 「Rei stack が それを 機械的に honest 検出できる」 のが 新規性。

Rei stack impact

関連 memory / commit