Expand description
Vernacular interface for the Kernel.
Provides a text-based command interface for interacting with the kernel:
Definition name : type := term.- Add a definitionCheck term.- Print the type of a termEval term.- Normalize and print a termInductive Name := C1 : T1 | C2 : T2.- Define an inductive type
§Surface extensions (they declare a SPELLING, never a global)
Notation "a ⊕ b" := ((myOp a) b).- Mixfix notation; identifier pieces are holesInfixl 65 "⋄" := f./Infixr/Prefix "∽" := neg./Postfix "‼" := bang.Macro "twice $e" := …./MacroRules "list![$x, $xs]" := ….- Pattern rewritingSection Name.…End Name.- Scope aLocal Notationto a section/-- doc -/,/-! module doc -/,-- line comment- Prose, which declares nothing
§Doors
Repl::execute reads ONE command and refuses a prefix; Repl::execute_document reads a
whole document and stops at the first block that does not check.
parse_command and parse_command_in read a command from TEXT ALONE. One surface cannot
be read from text alone — a literate Consider’s equation set has to be compiled against the
discriminant’s inductive, and the constructor list, its order and its arities live in the
kernel context — so parse_command_in_ctx is the door that has one.
§Literate Syntax (English-like alternative)
A Bool is either Yes or No.- Define an inductive type## To add (n: Nat) and (m: Nat) -> Nat:- Define a functionConsider x: When Zero: Yield m.- Pattern matching
Re-exports§
pub use match_compile::compile_clauses;pub use match_compile::compile_clauses_reporting;pub use match_compile::Clause;pub use match_compile::CompileReport;pub use match_compile::Pattern;pub use printer::print_command;pub use printer::print_term;pub use printer::print_term_in;pub use printer::PrintError;pub use surface::Assoc;pub use surface::OperatorForm;pub use surface::Surface;pub use surface::SurfaceDecl;
Modules§
- lean
- Lean 4 kernel export (NDJSON 3.1) as an input surface of the LOGOS kernel.
- literate_
parser - Literate Specification Parser for the Kernel.
- match_
compile - The equation compiler: surface patterns → the kernel’s positional
Matchtree. - printer
- The kernel’s surface, written back: the exact inverse of
term_parserandcommand_parser. - surface
- The SURFACE environment — user-declared notation, fixity and macros.
Structs§
- Binder
Surface - Everything the SURFACE says about ONE parameter that the kernel’s three-field
Term::Picannot hold: how it is supplied, and what fills it when the caller does not. - Declaration
Surface - A declared type split into the pure kernel type the context is keyed at and the per-parameter surface information that has to be recorded beside it.
- Inductive
Member - One member of an
Command::InductiveBlock. - Repl
- The Vernacular REPL.
- Term
Parser - Recursive descent parser for Term syntax.
Enums§
- Binder
Kind - How a parameter is SUPPLIED at a call site – Lean’s four binder kinds.
- Command
- A command in the Vernacular language.
- Interface
Error - Errors that can occur in the interface layer.
- Parse
Error - Parse errors for the Vernacular.
Functions§
- parse_
command - Parse ONE command, and require it to be the WHOLE input.
- parse_
command_ in_ ctx - Parse ONE command with the kernel CONTEXT available, and require it to be the whole input.
- parse_
command_ prefix_ in - Parse ONE command off the FRONT of
input, returning it with the number of bytes consumed. - parse_
command_ prefix_ in_ ctx - Parse ONE command off the FRONT of
inputwith the kernel CONTEXT available, returning it with the number of bytes consumed. - standard_
context - A context of its own for a REPL or a document to extend: a copy-on-write clone of the process’s
one standard library registration,
crate::prelude::StandardLibrary::context.