iCreatAI News
Skip to content
Hacker News AI· r0ze-at-hn·· 1 hr agoAI score72

Using AI+Lean to optimize and improve existing code

Using AI+Lean to optimize and improve existing code

AI summary

A one-day proof of concept rewrote shared Bitcoin app logic from Ledger's C (app-bitcoin) and Rust (vanadium) apps in Lean 4, compiling a single kernel to thumbv6m, thumbv8m.main and riscv32imac via turbo-lean and LLVM IR, with a 12-statement spec checked by Lean (0 sorryAx) covering 17 of 45 kernel functions. On Vanadium the patched build showed 14.6% fewer executed RV32 instructions and 14.61% lower PSBT signing latency, while on BOLOS latency was unchanged on Nano S+ and 6.34% higher on Nano X; the authors note measurements were taken under the Speculos emulator, not on hardware. Formalizing both implementations surfaced 11 bugs or spec divergences, all on the Vanadium side, including a BIP-379 andor branch-ordering error (VND-01) and a missing witness_utxo amount/script check (VND-03).

Source: Hacker News AI · share.thomas.md