Entails
Browse documentation

Development roadmap

The proof workflow comparison tracks which ideas from other provers are relevant to Entails.

Standard library plan

Module Planned surface
io Line input, buffered byte input and output, files, and explicit EOF and I/O errors. The runtime’s line reader already powers run --stdin.
core Booleans, option and result types, comparisons, and common iterator operations.
numbers Fixed-width signed and unsigned integers, checked and wrapping arithmetic, conversions, and compact arbitrary-precision natural numbers.
bits Bit sequences, masks, shifts, and binary encodings for machine inputs and traces.
collections Contiguous arrays, slices, growable buffers, and maps.
text UTF-8 strings, byte and character traversal, parsing, and formatting.
machine and proof Machine inputs, clocked results, and reusable rules for invariants and induction.

The next library slice is a module system and typed calls so Entails source can call the I/O library directly. The current line reader is callable by the machine runtime in Python.

Syntax and native execution

Machine syntax now supports keep to write back the symbol just read and region state to admit both head regions. Both forms lower to the existing machine and certificate definitions. The next syntax work is imports, local bindings, operator precedence for arithmetic and comparisons, and compact expressions for common constructor matches. Specify each lowering and keep its source span for diagnostics and proof obligations.

The first bootstrap module is forest.entails. It turns Lean check evidence into a proof tree and renders nested outcomes, indentation, and terminal-width ellipses. The Python stage-zero host provides parsing, type checking for first-order functions and constructor matches, evaluation, text primitives, and the Lean process bridge. Next is module loading and moving frontend passes into Entails. Modules and packages use one lowercase word. Types use PascalCase.

The performance target is native throughput comparable to C, C++, and Rust on equivalent workloads. Lower typed executable code through MLIR to LLVM, with unboxed fixed-width values, contiguous arrays, direct calls, and proof erasure. Preserve the mathematical semantics of natural numbers with compact arbitrary-precision storage and use fixed-width code where a range proof or an explicit fixed-width type supports it. Benchmark optimized machine dispatch, integer loops, array traversal, and buffered I/O against equivalent optimized C, C++, and Rust implementations. Report throughput, allocation, and code size. The current Python replay is a reference interpreter. The first Entails lowering compiles the Proof Forest through MLIR’s function, control-flow, and LLVM dialects. It covers direct calls, recursive functions, constructor matches, and the text operations used by the forest. The runtime uses boxed values in an arena. It frees the arena after printing the result. This establishes native execution for the bootstrap subset. Fixed-width arithmetic, unboxing, and performance comparisons remain planned.

Build the Proof Forest as a native executable

Use a directory containing mlir-opt, mlir-translate, and clang. If those tools are already on PATH, omit --llvm-bin. The following program appends an executable entry point to the existing Entails renderer.

work=$(mktemp -d)
cat entails/forest.entails > "$work/forest.entails"
cat >> "$work/forest.entails" <<'EOF'

function main() -> Text:
    return print_check("original_safe", "original", check_succeeded,
        no_refutations, no_refutations, 72)
EOF
uv run entails build "$work/forest.entails" --llvm-bin /path/to/llvm/bin -o "$work/forest"
"$work/forest"

This renders supplied check evidence. To generate evidence from a machine and certificate, use entails check. The native executable needs neither Python nor Lean at runtime. entails build "$work/forest.entails" --emit mlir prints the generated MLIR for inspection. The native and reference renderers are compared byte for byte in the test suite, including failure and truncation.

The README animation is generated by docs/animate.py from simulator traces and fresh Lean results. Run it from the repository root with Pillow, pdflatex, and pdftoppm available. It uses the macOS fonts from the documentation palette.

Python is the stage-zero host. The exit milestone is a compiler written in Entails that rebuilds itself and passes the checks for the CLI, diagnostics, proof rendering, and Lean integration.

Bootstrap acceptance criteria

Prover performance measurements

Record compiler build time, cold and warm elaboration time, time to first checked proof, replay throughput, and native runtime separately. For tactic comparisons, keep the same goals, wall-clock budget, dependency revisions, hardware, and axiom policy. Report the solved fraction, median and 95th percentile time, peak memory, and proof size. Keep held-out projects out of both tactic training and tuning.

Use the guard obligations as a small deterministic baseline. Add arithmetic certificate replay and transition-system benchmarks as the corresponding proof rules land. As native types become available, compare generated code with equivalent optimized C and Rust workloads on the same inputs.