oxilean-runtime
Runtime System for the OxiLean Theorem Prover
oxilean-runtime implements the execution substrate for compiled OxiLean programs and proofs. It provides everything needed to evaluate terms that have already been type-checked by the kernel: memory management, closure representation, lazy evaluation, I/O, and parallel task scheduling.
Unlike the kernel -- which is the Trusted Computing Base (TCB) and must be auditable -- the runtime is untrusted: bugs here can cause incorrect evaluation results or crashes but never logical unsoundness (all terms are checked before reaching the runtime).
31,676 SLOC -- fully implemented runtime system (253 source files, 969 tests passing).
Part of the OxiLean project -- a Lean-compatible theorem prover implemented in pure Rust.
Overview
Module Reference
| Module | Description |
|---|---|
arena |
Typed and generational arena allocators (BumpArena, GenerationalArena, RegionManager) |
object |
Tagged-pointer runtime value representation (RtObject, TypeTag, TypeRegistry) |
rc |
Reference-counted smart pointers with elision analysis (Rc, RtArc, CowBox) |
closure |
Flat closure representation and partial application (Closure, Pap, FunctionTable) |
lazy_eval |
Call-by-need thunks with memoization (Thunk, SharedThunk, MemoFn) |
tco |
Trampoline-based tail-call optimization (trampoline, TailCallDetector) |
scheduler |
Work-stealing parallel task scheduler (Scheduler, Worker, WorkStealingDeque) |
io_runtime |
File, console, and string I/O (IoRuntime, IoExecutor, StringFormatter) |
bytecode_interp |
Bytecode interpreter for evaluation |
gc_strategies |
Pluggable garbage collection strategies |
memory_pool |
Pool-based allocator for fixed-size objects |
profiler |
Runtime profiling and statistics |
string_pool |
Interned string storage |
wasm_runtime |
WebAssembly-specific runtime adaptations |
Global Configuration
use RuntimeConfig;
let config = RuntimeConfig ;
Usage
Add to your Cargo.toml:
[]
= "0.1.1"
Arena Allocation
use ;
let mut arena = new;
let idx = arena.alloc;
Closures and Partial Application
use ;
// Build a partial application of a 2-argument function
let pap = new;
let result = pap.apply;
Lazy Evaluation
use ;
// Wrap a computation in a lazily evaluated thunk
let thunk = new;
let value = thunk.force; // computed only once, memoized thereafter
Dependencies
oxilean-kernel-- expression types and environment definitions
Testing
License
Copyright COOLJAPAN OU (Team Kitasan). Apache-2.0 -- See LICENSE for details.