Issue #2549: Prove each copy-and-patch stencil against the processor’s Sail model, the proof replayed by our certificate checker

Open and answer this issue on GitHub.

emitter, blocked, future · opened 2026-11-21 · updated 2026-11-21 · 0 comments

Part of #1593 After #1593 Needs #1235

What it is

Obligation 2 of #1593: each stencil of the copy-and-patch backend does what its construct means, for every value in its holes. The stencil’s finished machine code is run symbolically against a formal model of the processor (the official Sail models for Arm and RISC-V, symbolic evaluation with Isla), with the holes kept symbolic; a solver shows over bitvectors that the result matches the semantics #1593 writes down. The goals are bit-blasted to SAT and the solver asked for an LRAT proof, which our own certificate checker replays (ADR-270 D5), so neither clang nor the solver is trusted. It waits for the backend (#1235).

To build

  1. A tools/*.nika behind a nikaia subcommand that takes one stencil, runs it symbolically against the Sail model of its architecture, states the goal of obligation 2 and writes the LRAT proof; its test a .nika program in tests/compiler/tests/ with a correct and a deliberately wrong stencil and the expected .stdout / .stderr. How the processor models (Sail, Isla, outside code) are brought into the build is decided at this step.
  2. Replay of those proofs by the certificate checker (ADR-270), with a test that a corrupted proof is refused.

Done when

One stencil’s proof against its architecture’s Sail model is written by the new subcommand and replayed by our certificate checker, a deliberately wrong stencil is refused, and a corrupted proof is refused by the replay; the report gives a Found: line per finding.

Files

New: the tools/*.nika of item 1 and its tests. No new Rust. The Rust backend and its output do not change.

Split from #1593 by Claude Code

Back to Open Issues