Expand description
LOGOS source for an imported Lean environment: one literate .lg document — prose headings,
literate English forms where they express a declaration exactly, kernel vernacular for the rest —
plus the correspondence between Lean and LOGOS names. The document is reparsed and rechecked in a
fresh context before anyone may publish it.
§What is written
The target’s dependency CLOSURE, every declaration the kernel checked for it: inductives with their constructors, definitions (the importer’s sharing helpers and the recursors LOGOS derived included), theorems with their checked proofs, and axioms. Nothing is written as an assumption that the import checked as a proof, and nothing the import assumed is written as a proof.
§How it is checked
- While the document is built, every declaration is registered in a probe context the moment it is written and compared with the imported declaration, so a failure names the declaration.
- Before returning, the COMPLETE document is read by
Repl::execute_documentin a fresh context, the number of commands is counted, every declaration is compared with the imported one — kind, universe parameters, type, and body for a transparent definition, by strict α-equivalence — and the fresh context is searched for anything the document declared that the correspondence does not list. check_statementcompares the target’s reparsed type with an independent reference translation of the Lean type (competition rule R8).
Structs§
- Correspondence
- One Lean declaration and the LOGOS declaration that carries it.
- Emitted
Document - An emitted document.
Enums§
- Declaration
Kind - What a declaration is, as the kernel holds it.
- Emission
Fault - Why an emitted document does not reparse to the imported declarations. Every variant names the LOGOS declaration it concerns.
- Form
- Which surface carries a declaration in the document.
- Lean
Part - One component of a Lean name.
- Origin
- Where a LOGOS declaration came from.
- Published
- What a publication left in place.
Constants§
- DOCUMENT_
EXTENSION - The published document’s extension.
- FAILURE_
EXTENSION - The extension of a failed run’s diagnostic record.
- MAX_
SOURCE_ BYTES - The largest document the emitter writes.
Functions§
- check_
statement - Rule R8: the target’s REPARSED statement against
reference, an independent translation of the Lean declaration (reference::reference_declaration) in the importer’s names. The reference is carried into LOGOS names through the correspondence alone — the emitter’s own terms play no part — and must name the target, bind the same universe parameters in the same order, and state the same type up to α. - emit_
context emit_documentover any checked context whose constants carry the importer’s key scheme.proofshands back the checked proof of an opaque theorem, which a context does not keep.- emit_
document - The dependency closure of
target, as a LOGOS document. - publish
- Publish
outcomeunderdir/<stem>.lg, or its failure underdir/<stem>.failure.txt. - publish_
through publish, writing every file’s bytes throughwrite— the seam a test uses to make a write fail half way.- verify
- Reparse
document.sourcein a fresh context and compare every declaration with what it must be. Returns the checked context.