Propose
Choose typed values from a closed, deterministic candidate list.
RESEARCH DRAFT · LEAN 4
A program sketch can change in carefully chosen places. Its specification stays fixed. This Lean interpretation of abstractification makes a correctness certificate the final condition for installation.
Based on Alperen Keleş’s Abstractification · Direction by Alok
Inductive certificate in Lean, including wrapping overflow and width zero.
01 / A CONCRETE SKETCH
Read from the least significant bit. Return a mask for the first zero, or zero if every bit is one.
An integer from 0 to 255
02 / THE MECHANISM
The optimizer proposes fills. It does not rewrite the reference, surrounding sketch, observer, or correctness checks.
Choose typed values from a closed, deterministic candidate list.
Replay known counterexamples, then run the fixed verifier. Failed candidates receive no score.
Compare passing candidates with a declared cost model for a declared workload.
Require a separate proof covering every input allowed by the boundary.
The demo starts with replay input 255. The wrong fill (0, 0) passes that example, but full verification discovers input 0. The next wrong proposal is rejected using the accumulated counterexample.
A deliberately replay-only search can select a bad fill. The independent all-input certificate gate still rejects it.
Inspect the search and negative controlTHE INSTALLATION OBLIGATION
Boundary.Valid fill :=
∀ input, pre input →
observe (sketch fill input) =
observe (reference input)
Installed boundary
fill : Fill
correct : boundary.Valid fillThe guarantee concerns the chosen observations, under the chosen precondition.
Read Boundary and Installed03 / WHAT THE PROOF SAYS
The original finite 8-bit certificate is extended by induction, rather than by checking more inputs.
goodFill_equivalent
∀ {w : Nat} (x : BitVec w),
sketch (goodFill w) x = reference xThe reference scans positions from low to high. The proof relates it to a recursive low-bit scan, then proves the filled expression agrees by induction through the two carry cases.
exact32 covers every BitVec 32. The audited installed32 packages the same proof for execution.
install% audits transitive dependencies. The universal certificate uses Lean’s standard propext, Classical.choice, and Quot.sound axioms. Admissions, custom axioms, and native-decision trust axioms are rejected.
The repository check suite builds, audits, replays modules with leanchecker, requires 14 negative fixtures to fail, and runs the demo.
04 / CORRECTNESS BEFORE COST
The demo counts one operation per bit inspection and four per bit expression. Both candidates are correct; only their scores change.
Toy operation counts only. These are not elapsed times, allocation results, or measured speedups.
Read the cost model and winner theoremsToy-cost winner: bit sketch
05 / SCOPE & OPEN WORK
Proofs make a specific promise. The boundary and the tools around it still matter.
draft_hole% name reports its expected type and local context, then fails elaboration. It cannot silently become an admitted or default executable value.
Agda-style refinement, case splitting, editor code actions, and a full interactive-hole rewrite remain future work.
The proof preserves declared observations on inputs satisfying the precondition. It does not establish that the specification captures every intended behavior.
The Installed type alone is not an axiom policy. Use the audited DSL or #audit_install and run the checks.
Lean elaboration is not an OS sandbox. These proofs do not verify foreign code, compiler substitutions, allocation failures, or compiler correctness.
The candidate proposer is finite and deterministic. There is no live LLM optimizer, and no benchmark reproducing the paper’s Rust allocation experiment.
More detail: Design and research scope · Verification and AI review
RUN THE ARTIFACT
Install elan and Python 3, then run the repository’s check suite. The pinned toolchain is Lean 4.34.1.
Open the repositorysh scripts/check.sh
# Build and run the demonstration
lake build
lake exe abstractificationDemo