verify¶
The output types and the shared verifier: compile a candidate project in a sandbox
and judge whether it compiles, is sorry-free, and is axiom-clean. Every prover
funnels its output through the Verifier.
- class open_atp.verify.VerificationReport(compiles, sorry_free, axioms=(), compile_log='', per_file=<factory>)[source]¶
Result of compiling a candidate project in a sandbox.
Produced by
Verifierand shared by every prover, including Aristotle.- Attributes:
- compilesbool
Whether the whole project built successfully.
- sorry_freebool
Whether the build is free of
sorry(no incomplete proofs remain).- axioms
tuple[str, …] Every axiom the compiled project depends on, as reported by Lean.
- compile_log
str The full build log. Omitted from
to_dict().- per_file
dict[str, bool] Per-file compile status, keyed by file path relative to the project root.
- non_standard_axioms
tuple[str, …] The axioms outside
STANDARD_AXIOMS– notablysorryAx, which means the proof is not actually complete.verifiedboolTrue iff the project compiles, has no sorry, and no foreign axioms.
- class open_atp.verify.ProofResult(prover, verification, output_dir, completed_files=<factory>, cost_usd=None, duration_s=None, metadata=<factory>, error=None)[source]¶
What a prover returns from
prove().The prover writes its artifacts into the caller-chosen
output_dir, laid out asoutput_dir/{wd,logs}/:wdis the completed lake project (the proof output) andlogsis the run record (the streamed agentstdout.txt,stderr.txt,result.json, and any harness-specific rich logs). This object just records where those live, plus the verification verdict and run metadata.- Attributes:
- prover
str Name of the prover that produced this result.
- verification
VerificationReportorNone The shared verification of the completed project, or
Nonewhen the run failed before a candidate could be verified (seeerror).- output_dir
pathlib.Path The run’s output directory. Holds the
wd(proof project) andlogs_dir(run record) subdirectories the prover populated.- completed_files
dict[str,str] The completed
.leansources, keyed by file path relative to the project root.- cost_usd
float, optional Estimated USD cost of the run.
Nonewhen the prover does not report cost.- duration_s
float, optional Wall-clock duration of the run, in seconds.
- metadata
dict[str,object] Harness-specific run metadata (token counts, run summaries, …).
- error
str, optional Set when the prover raised before producing a result (Docker down, API error, toolchain mismatch).
verificationisNoneandsuccessisFalse.wdpathlib.PathThe completed proof project (
output_dir/wd).logs_dirpathlib.PathThe run’s logs directory (
output_dir/logs).- successbool
True iff
verificationexists and isverified.
- prover
- open_atp.verify.STANDARD_AXIOMS = frozenset({'Classical.choice', 'Quot.sound', 'propext'})¶
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
- open_atp.verify.docker_verifier(image=Image(name='open-atp:latest', lean_toolchain='leanprover/lean4:v4.28.0', mathlib_rev='v4.28.0'))[source]¶
A
Verifierbacked by a local Docker sandbox runningimage.
- class open_atp.verify.Verifier(backend)[source]¶
Compiles projects in a
ComputeBackendand reports their status.- check_compatible(project)[source]¶
Reject a project whose pins differ from the backend image’s.
Matches the project’s
lean_toolchainagainst the image’slean_toolchain, and its lockedmathlib_rev(when the project records one) against the image’smathlib_rev. RaisesToolchainMismatchorMathlibRevMismatchon the first mismatch.Examples
>>> import tempfile >>> from pathlib import Path >>> from open_atp.backends.docker import DockerBackend, DockerConfig >>> from open_atp.images import Image >>> from open_atp.lean import LeanProject >>> from open_atp.verify import Verifier >>> root = Path(tempfile.mkdtemp()) >>> _ = (root / "lakefile.toml").write_text('name = "demo"\n') >>> _ = (root / "lean-toolchain").write_text("leanprover/lean4:v4.31.0\n") >>> project = LeanProject(root)
A matching pin passes silently:
>>> image = Image(lean_toolchain="leanprover/lean4:v4.31.0") >>> ok = Verifier(DockerBackend(DockerConfig(image=image))) >>> ok.check_compatible(project)
A differing pin is rejected up front:
>>> bad = Verifier(DockerBackend(DockerConfig(image=Image()))) >>> bad.check_compatible(project) Traceback (most recent call last): ... open_atp.lean.ToolchainMismatch: Project pins ...
- property image¶
The image the backend runs – the compatibility contract projects match.
- verify(project, *, session=None)[source]¶
Compile
projectand return aVerificationReport.Standalone (
session is None) the compile spins up its own sandbox viabackend.run– the path Aristotle and the split-backend case take. When a caller passes a livesession(the agent/verify backend-reuse path), the compile runs in that already-hot sandbox instead, avoiding a second spin-up.Examples
A real project compiles in the backend; a project with no
.leanfiles short-circuits to a trivial passing report without touching the sandbox:>>> import tempfile >>> from pathlib import Path >>> from open_atp.backends.docker import DockerBackend, DockerConfig >>> from open_atp.images import Image >>> from open_atp.lean import LeanProject >>> from open_atp.verify import Verifier >>> root = Path(tempfile.mkdtemp()) >>> _ = (root / "lakefile.toml").write_text('name = "demo"\n') >>> _ = (root / "lean-toolchain").write_text("leanprover/lean4:v4.31.0\n") >>> image = Image(lean_toolchain="leanprover/lean4:v4.31.0") >>> verifier = Verifier(DockerBackend(DockerConfig(image=image))) >>> report = verifier.verify(LeanProject(root)) >>> report.verified True