Skip to content

odinfree/storm-ecdsa-harness / skills/fast-lean-proof-loop

fast-lean-proof-loop

Verified

Shorten Lean 4 proof iteration with a warm editor session, dependency-aware reverse-import build plans, and lemma lookup that Lean itself confirms, while a separate full build plus axiom audit stays the promotion gate.

FileKindSize
SKILL.mdskill md3.5 KB
agents/openai.yamlconfig324 B
references/promotion-gate.mdmarkdown1.1 KB
scripts/lean_fast_loop.pyexecutablescript10.3 KB
scripts/lean_symbol_check.pyexecutablescript6.3 KB
scripts/test_lean_fast_loop.pyexecutablescript3.8 KB
scripts/test_lean_symbol_check.pyexecutablescript2.6 KB

scripts/test_lean_fast_loop.py

View on GitHub
#!/usr/bin/env python3

from __future__ import annotations

import json
import pathlib
import subprocess
import tempfile
import unittest


SCRIPT = pathlib.Path(__file__).with_name("lean_fast_loop.py")


class LeanFastLoopTests(unittest.TestCase):
    def setUp(self) -> None:
        self.temp = tempfile.TemporaryDirectory()
        self.root = pathlib.Path(self.temp.name)
        source = self.root / "Demo"
        source.mkdir()
        (source / "Base.lean").write_text("def base := 1\n")
        (source / "Middle.lean").write_text("import Demo.Base\ndef middle := base\n")
        (source / "Other.lean").write_text("def other := 2\n")
        (source / "Solution.lean").write_text("import Demo.Middle\nimport Demo.Other\ndef solution := middle\n")

    def tearDown(self) -> None:
        self.temp.cleanup()

    def command(self, *args: str) -> subprocess.CompletedProcess[str]:
        return subprocess.run(
            ["python3", str(SCRIPT), *args], check=False, text=True,
            stdout=subprocess.PIPE, stderr=subprocess.PIPE,
        )

    def test_reverse_import_closure_and_root(self) -> None:
        output = self.root / "plan.json"
        proc = self.command(
            "plan", "--project-root", str(self.root), "--source-root", "Demo",
            "--changed", "Demo/Base.lean", "--output", str(output),
        )
        self.assertEqual(proc.returncode, 0, proc.stderr)
        plan = json.loads(output.read_text())
        self.assertEqual(
            plan["affected_modules_dependency_order"],
            ["Demo.Base", "Demo.Middle", "Demo.Solution"],
        )
        self.assertEqual(plan["build_targets"], ["Demo.Solution"])
        self.assertNotIn("Demo.Other", plan["affected_modules_dependency_order"])

    def test_leaf_change_builds_leaf_and_solution_root(self) -> None:
        output = self.root / "plan.json"
        proc = self.command(
            "plan", "--project-root", str(self.root), "--source-root", "Demo",
            "--changed", "Demo/Other.lean", "--output", str(output),
        )
        self.assertEqual(proc.returncode, 0, proc.stderr)
        plan = json.loads(output.read_text())
        self.assertEqual(plan["affected_modules_dependency_order"], ["Demo.Other", "Demo.Solution"])
        self.assertEqual(plan["build_targets"], ["Demo.Solution"])

    def test_dry_run_records_exact_command(self) -> None:
        output = self.root / "run.json"
        proc = self.command(
            "run", "--project-root", str(self.root), "--source-root", "Demo",
            "--changed", "Demo/Base.lean", "--output", str(output), "--dry-run",
        )
        self.assertEqual(proc.returncode, 0, proc.stderr)
        result = json.loads(output.read_text())
        self.assertEqual(result["command"], ["lake", "build", "Demo.Solution"])
        self.assertEqual(result["status"], "DRY_RUN")

    def test_unindexed_change_fails_closed(self) -> None:
        outside = self.root / "Outside.lean"
        outside.write_text("def outside := 0\n")
        output = self.root / "bad.json"
        proc = self.command(
            "plan", "--project-root", str(self.root), "--source-root", "Demo",
            "--changed", "Outside.lean", "--output", str(output),
        )
        self.assertNotEqual(proc.returncode, 0)
        self.assertIn("outside indexed source root", proc.stderr)

    def test_project_root_can_be_the_source_root(self) -> None:
        output = self.root / "whole-project-plan.json"
        proc = self.command(
            "plan", "--project-root", str(self.root), "--source-root", ".",
            "--changed", "Demo/Base.lean", "--output", str(output),
        )
        self.assertEqual(proc.returncode, 0, proc.stderr)
        plan = json.loads(output.read_text())
        self.assertEqual(plan["build_targets"], ["Demo.Solution"])


if __name__ == "__main__":
    unittest.main()
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall