Expand description
The portable proof package (logos-lean-package/1 and /2) and its replay.
Pure: a package is a map from published relative path to bytes. Writing it to disk atomically
and running replay in a fresh process are the caller’s (largo lean); everything a replay
decides is decided here, from the bytes alone, with no importer state.
§Two proof contracts
The export decides which contract a package states, never the manifest. When the target’s
closure, as LOGOS checks it, re-derives Lean’s native_decide steps by kernel evaluation
(native_decide), the package is logos-lean-package/2; otherwise it
is logos-lean-package/1.
/1, the export’s proof as exported.lean_print_axioms, when the producing run observed Lean, names exactly thetransitiveassumptions./2, the export’s proof with every native decision of the target’s closure re-derived. Its two assumption sets are kept apart:lean_print_axiomsis Lean’s own report for the proof it replaced, required, namingELIMINATED_AXIOM; andtransitiveis what the checked replacement rests on, which is exactly Lean’s report without that escape. Every declaration holding re-derived steps is disclosed as oneINFORMATION_CATEGORYinformation change.
The schema is the result identity’s domain, so one set of files never carries both contracts’ identities.
§What a package holds
manifest.json schema, result id, the SHA-256 of every other file, source identity,
target (Lean name, kernel name, kind, universe parameters, statement,
LOGOS name), toolchain, transitive assumptions, information losses, the
trusted computing base, and the producing run's receipt
<Target>.lg the LOGOS document: literate prose, English forms and kernel vernacular
certificate.json the environment certificate (`logos-environment-certificate/1` or `/2`)
correspondence.json Lean name ↔ kernel name ↔ LOGOS name (and document lines)
source/export.ndjson the exact export the result was produced from
source/*.lean the original Lean source, when the producing run had it§What a replay establishes, and what it does not
A replay reads nothing but the package. Before any checking work it enforces the file-count, byte, path and term limits, verifies every digest and the result identity, and requires every JSON file to be in its one canonical encoding. Then:
primary_check— the certificate’s environment is rebuilt from the bare kernel, every inductive, constructor, definition, recursor, opaque theorem, structure η and quotient primitive kernel-validated under exact (not cumulative) conversion, with no obligation left.independent_recheck— every checked term was also inferred by the second kernel (recheck) to its declared type. A term outside that checker’s fragment makes the stageunsupported, neverpassed.translated— the statement is BOUND to the source: the reference translator (which shares no code with the importer) reads the target’s type fromsource/export.ndjson, and it must be exactly convertible with the certificate’s statement. Every other certificate declaration with a source counterpart is bound the same way, and the correspondence must agree. The manifest states the contract the carried export decides: its schema, and exactly the native re-derivations recomputed from the export.assumption_policy— the transitive assumptions of statement AND proof, traced through opaque theorems and definitions, are exactly Lean’spropext,Quot.soundandClassical.choicein their canonical form; an admission (sorryAxor anything of its universal-inhabitant shape) and an axiom stating the goal are refused by structure, not by spelling. Lean’s recorded report agrees with them as the contract says, and the manifest lists exactly them.emission_reparsed— the LOGOS document is exactly what the emitter writes for the rebuilt environment, it reparses in a fresh LOGOS session, and its target states the reference translation.fresh_replay— every stage above passed, from the package bytes alone.
lean_accepted is not_run: a replay never runs Lean. The producing run’s receipt is in the
manifest, and a replay repeats what it says without adopting it.
Structs§
- Assumption
Record - Build
- A built package and the producing run’s receipt. A build never claims more than its receipt:
assembleis the door that refuses to hand out a package whose receipt is not clean. - Build
Options - What the producing run knows that the export does not say.
- Correspondence
File - Correspondence
Row - Emission
Record - Information
Loss - LeanRun
- A pinned Lean toolchain’s run over the original source.
- Manifest
- Package
Limits - Limits enforced on a package before any work.
- Source
Identity - Stage
Record - Target
Identity - Toolchain
Constants§
- ALLOWED_
AXIOMS - Lean’s three standard axioms, in the kernel’s spelling of their Lean names — the only assumptions a verified result may rest on.
- CERTIFICATE
- CORRESPONDENCE
- CORRESPONDENCE_
SCHEMA - EXPORT
- MANIFEST
- NATIVE_
REDERIVED_ SCHEMA - The schema of a package whose proof is the export’s with the native decisions of the target’s closure re-derived by kernel evaluation.
- PACKAGE_
SCHEMA - The schema of a package whose proof is the export’s own, checked as exported.
- PACKAGE_
SCHEMAS - Every package schema this crate writes and replays.
- REPLAY_
SCHEMA - TRUSTED_
BASE - The trusted computing base shared by the checks a package’s receipt names. Two checkers that share this much are two implementations of typing, not two independent theorem provers, and the manifest says so in every package.
Functions§
- assemble
- Build the package for
targetfrom a Lean export, and require that every stage the producing run can establish passed. A package is returned only when it would replay clean. - assemble_
observed assemble_with, holding the result’s assumptions against what the pinned Lean’s own#print axiomsreported for the target (Lean names), as the package’s contract says: any difference in either direction, and a native-rederived proof without Lean’s report, is anassumption_disagreement, and no package is handed out.- assemble_
with assemblewith the producing run’s own evidence.- build
- Build a package and its producing receipt. Refuses only when no package can be formed at all (an export the importer does not accept, a target it does not declare); a package whose checks fail is returned with the failure on its receipt, so a refusal can be inspected and replayed.
- build_
observed build, with the pinned Lean’s#print axiomsfor the target when the producing run has it.- canonical_
certificate - The certificate’s canonical encoding: compact, newline-terminated.
- canonical_
json - The one canonical encoding of a package JSON file: pretty-printed, newline-terminated.
- document_
path - The document’s file name for a Lean target: its name with anything outside letters, digits,
_,-and.written as_, then.lg. - publish
- Write a package to
diratomically: every file is written and synced in a staging directory beside it, which is then renamed into place. An existingdiris never replaced — a published result is immutable — and a failure leaves nothing behind. - publishable
- The package of
build, when every stage the producing run can establish passed and the package replays clean in this process; otherwise the first stage that did not pass, as a refusal. - read_
directory - Read a package directory, enforcing the file-count, size and path limits before reading any content. Symbolic links and special files are refused.
- receipt_
document - The replay receipt as a
logos-lean-replay/1document. - replay
- Replay a package from its bytes alone, under the default limits.
- replay_
with - Replay a package from its bytes alone, under
limits. - result_
id - The result identity of a
logos-lean-package/1package: the target and every non-manifest file’s path and digest. - result_
id_ in - The result identity under
schema, which is the preimage’s domain: the same files under two contracts have two identities. - sha256_
hex - The lowercase hexadecimal SHA-256 of
bytes.
Type Aliases§
- Package
Files - A package’s files, keyed by published relative path.