Skip to content

Trusted Base

Reference for what Lema v0.2 proves in the Lean kernel (Checked), what it validates by testing and static analysis (Tested), and what it assumes (Assumed).

Every claim in Lema belongs to one of three explicit evidence tiers: Checked, Tested, or Assumed. This page enumerates the exact boundary between machine-checked kernel proofs, tested compiler and runtime components, and the underlying trusted computing base (TCB) in Lema v0.2.

TierBadgeMeaning
Checked Proof checked Replayed from source-free lema.core/v4 objects by the pinned Lean 4.34.1 kernel within the store’s axiom policy.
Tested Tested, not proved Enforced by Rust static analysers, differential oracle tests, conformance vector suites, and store governance gates, without a formal Lean proof of the Rust implementation.
Assumed Assumed Part of the trusted computing base (kernel, hardware, OS primitives) or an explicit mathematical/hardware premise on a theorem.

Checked: proved in the Lean 4.34.1 kernel

The following components are written in restricted Lean (audit/inputs/), stored as lema.core/v4 objects, and verified by the Lean 4.34.1 kernel:

  • Program core and concurrency (Core): Soundness of Prog, Contract, Impl, Safe, Implements, Simulates, sound, replacement, safe_bind, safe_interp, safe_mono, Handles, Tickets, Parallel, Actor, ActorBridge, Replies, Durable, Channels, and Sessions.
  • Layer 1 wire protocol and contracts (Frames, Capability): Exact round-trip decoding (decodeRequest_encodeRequest, decodeReply_encodeReply) for all LC\x02 frames and the operational state-machine contracts for tcp, udp, block, random, clock, and secret.
  • Crash-safe storage (BlockStore, BlockCrash, BlockStoreLaws, Record, ActorJournal, ActorCrash): All-or-nothing atomic file persistence (recover_sound, commit_all_or_nothing, writeAtomic_all_or_nothing_frame, writeAtomic_ok_frame) and linearizable actor crash recovery (crash_recovery, restart_keeps_replied, journaled_linearizable) under the explicit CrashIntegrity block-device premise.
  • Cryptography (ChaCha20Poly1305, Sha256, Sha512, Hmac, SigV4, Field25519, X25519, Ed25519, P256Verify, RsaVerify, ConstantTime): Functional equivalence to RFC 8439, FIPS 180-4, FIPS 198-1, AWS SigV4, GF(2^255 - 19) arithmetic, RFC 7748 Montgomery ladder, RFC 8032 Ed25519 signing/verification, FIPS 186-5 P-256 verification, and RFC 8017 RSA-PSS/PKCS#1 verification.
  • Network protocols and applications (X509, Tls13KeySchedule, Tls13, Noise, Http1, S3, SecretPolicy, SecretExchange, ServeVerified, Collector, Escrow): Bounded X.509 chain validation, RFC 8446 TLS 1.3 handshake and record layer, Noise XX handshake/transport, bounded HTTP/1.1 framing and CRLF rejection, role-admitted secret usage, and application invariants.

Tested: verified by static analysers, differential oracles, and test suites

The following components are implemented in Rust and validated by automated test suites and static analysis passes rather than formal proofs of the Rust code:

  • Store-native LemaIR compiler (crates/lema-ir): Lowers lema.core/v4 declarations to lema.ir/v1 and runs optimization passes. Tested against the kernel-checked Lema.Ir.Semantics operational semantics across the IrOracleCore, IrOraclePrims, and IrOracleCorpus suites.
  • Register VM (crates/lema-vm): Executes lema.ir/v1 bytecode with deterministic instruction, allocation, bigint-bit, and call-depth counters. Differential-tested against Lema.Ir.evalEntry and RFC/FIPS cryptographic test vectors.
  • Static VM guarantee analysers (crates/lema-vm-runner/src/guarantee/mod.rs): Rust static passes verifying NoCopySliceCall, NoBigIntPrimitives, NoBoxOrCtorInCycles, FlatMessage, ExclusiveActorLoop, ConstantTime (LEMA-355), and SecretFlow.* (LEMA-384, LEMA-421) over compiled LemaIR.
  • Capability host and Layer 0 substrate (crates/lema-cap, crates/lema-vm-runner): Enforces Domain, SharedBudget, Lease, Region/Slice busy locks, Ring, HandleId generation counters, LC\x02 wire dispatch, and OS socket/file/clock/CSPRNG operations.
  • Store and governance engine (crates/lema-core, crates/lema-store, crates/lema-http): Canonical JSON validation (R1-R21, S1-S4, D1-D3), zero-Lean contract re-derivation (view::rederive), Store::check_witness, semantic merges, and release policy gates.
  • Linux sandbox runtime (crates/lema-native-runtime): Bubblewrap (bwrap), systemd-run --user --scope, SHA-256 binary pinning, ledger.jsonl, and fail-closed HALTED latches.

Assumed: the trusted computing base and explicit theorem premises

Trusted software and hardware components

ComponentRole in the trusted computing base
Pinned Lean 4.34.1 kernel & Init (5045d005...)Type-checks lema.core/v4 objects during replay (crates/lema-lean-check).
crates/lema-core & crates/lema-lean-checkTranslates lema.core/v4 JSON into kernel environment calls and checks axiom footprints.
crates/lema-ir, crates/lema-vm, crates/lema-vm-runner, crates/lema-capCompiles lema.core/v4 declarations to LemaIR, executes bytecode, and mediates Layer 0 / Layer 1 host I/O.
Linux kernel, glibc, bwrap, systemd, CPU & RAMEnforces process isolation, cgroup limits, file locks, TCP/UDP sockets, fsync durability, /dev/urandom, and instruction execution.

Explicit mathematical and environmental hypotheses

Where a proof depends on a mathematical fact not yet mechanized in audit/inputs/ or on a physical property of storage hardware, Lema states that assumption as an explicit theorem parameter (hypothesis) rather than hiding it in an axiom. The store’s axiom policy remains restricted to propext, Quot.sound, and Classical.choice:

Hypothesis nameModuleWhat it states
DhCommutes / X25519CommLema.Std.X25519, Lema.Cap.Tls13, Lema.Cap.NoiseCommutativity of Montgomery scalar multiplication on Curve25519 (dh a (publicKey b) = dh b (publicKey a)).
FermatLema.Std.P256VerifyFermat’s little theorem for the NIST P-256 prime p_256 = 2^256 - 2^224 + 2^192 + 2^96 - 1 (a^(p - 2) * a ≡ 1 (mod p) for 0 < a < p).
CrashIntegrityLema.Cap.BlockCrash, Lema.Cap.BlockStoreLawsBacking block storage writes individual 4096-byte sectors atomically with respect to power loss and preserves all sectors written prior to a completed block.flush (0x03).

What Lema v0.2 does not claim

  • Computational hardness: Lema proves that its cryptographic implementations equal their mathematical RFC/FIPS specifications (for example, that ChaCha20Poly1305.seal computes RFC 8439 ChaCha20-Poly1305 and that Sha256.digest computes FIPS 180-4 SHA-256). It does not prove that SHA-256 is collision-resistant or that discrete logarithms on Curve25519 are intractable.
  • Microarchitectural timing immunity: The ConstantTime VM guarantee proves that LemaIR bytecode contains no secret-dependent branches, memory indices, or variable-time division instructions. It does not model CPU microarchitectural side channels below the ISA/VM level (such as speculative execution or variable-latency hardware multiplier silicon).
  • Specification completeness: Kernel replay guarantees that an implementation satisfies the contract you selected. Auditing that the .lema contract itself captures your real-world business requirements remains a human responsibility, supported by zero-Lean rederive and lema.review-display/v1.

Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility