LNSym
Also known as LNSym (Lean Native-code Symbolic simulator)
Prove Armv8 (AArch64) machine code correct in Lean 4 by symbolic simulation over a hand-written model; aimed at AWS-LC cryptographic routines.
Use it if
- You want to reason about AArch64 crypto assembly in Lean 4 and can work with a research-stage tool.
- Your code uses general-purpose, Advanced SIMD and crypto-extension instructions that LNSym already models.
Look elsewhere if
- You need finished, reusable proofs; the AWS-LC proofs in the repository still contain sorry.
- Your code uses floating-point arithmetic, system registers, exceptions or SVE; these are not modeled.
How it works
From your code to an accepted proof. Each step either has to be trusted or is checked by something else.
- Input AArch64 code
- Front end Opcode lists copied from objdump into Lean definitions Trusted Separate ELF tests extract AWS-LC symbols from a built library, but as far as we could tell they are not tied to the program definitions used in the proofs.
- Semantics LNSym AArch64 model (hand-written in Lean 4) Validated A subset of AArch64; co-simulated against Apple silicon (macOS runner) in CI with random tests per instruction class.
- Translation Symbolic simulation tactics and bv_decide Checked
- Checker Lean 4 kernel Trusted bv_decide steps also rely on Lean's compiler through the Lean.ofReduceBool axiom.
Verified or checked: outside the trusted base Validated per run or by tests Trusted without proof
- AArch64: Armv8 user-mode code, mainly AWS-LC routines (SHA-512, AES-GCM, GCM).
Trust
What a proof from this toolchain relies on: the trusted computing baseTrusted computing base (TCB). Everything that must be correct for a proof to mean what it says., one part at a time. How these are rated.
- Checker What has the final word on a proof?Strong
The Lean kernel checks proofs; bv_decide steps also trust Lean's compiler.
bv_decide checks SAT certificates with a verified checker run as compiled code (Lean.ofReduceBool).
- Semantics Is the tool's model of the language the real language?Partial
Hand-written AArch64 subset; random co-simulation against real Arm CPUs in CI.
We found no published report of the co-simulation results.
- Frontend How does your source get into the model?Partial
Opcodes are pasted from objdump into Lean; not linked to the binary by a proof.
- Binary gap Does the proof cover what actually runs?Strong
Proofs are about the machine code itself; no compiler is trusted.
- Escape hatches Can a proof silently rest on unchecked assumptions?Partial
sorry is used in several proofs; Lean warns and
What it can prove
Kinds of guarantees, not how easy they are to get.
| Feature | Support | Notes |
|---|---|---|
| No undefined behavior Memory safety and absence of runtime errors: no out-of-bounds access, use-after-free, overflow traps, panics or undefined behavior on any input allowed by the precondition. | UnknownUnknown.Proofs show no decoding error or unmodeled instruction is reached. The memory-safety part of the GCM init specification is commented out; we found no finished memory-safety proofs. Source | Proofs show no decoding error or unmodeled instruction is reached. The memory-safety part of the GCM init specification is commented out; we found no finished memory-safety proofs. source |
| Functional correctness The code meets a written specification of its results, for example “returns the sorted list” or “implements this RFC”. | PartialPartial.Functional specifications can be stated and proved, but the main AWS-LC proofs are unfinished: SHA-512 and AES-GCM proofs contain sorry, and the GCM init proof covers one output register with the memory results commented out. Source | Functional specifications can be stated and proved, but the main AWS-LC proofs are unfinished: SHA-512 and AES-GCM proofs contain sorry, and the GCM init proof covers one output register with the memory results commented out. source |
| Equivalence Two programs (an optimized and a reference version, or code before and after a change) are proved to behave the same, or one refines the other. | Unknown | |
| Information flow Secrets do not influence public outputs, timing or memory access patterns (constant-time code, non-interference). | UnknownUnknown.We found no constant-time or secrecy reasoning in the repository. | We found no constant-time or secrecy reasoning in the repository. |
| Concurrency Correctness of code with threads or shared memory: absence of data races, deadlock freedom, linearizability of concurrent data structures. | Not supportedNot supported.The machine state is a single sequential processor. Source | The machine state is a single sequential processor. source |
| Termination and liveness Every run finishes, or the system keeps making progress (liveness). | Unknown |
Language coverage
Which parts of AArch64 it handles. Hover or focus a mark for details.
ISA-level features
| Feature | Support | Notes |
|---|---|---|
| User-level instructions The ordinary integer, memory and branch instructions programs use. | PartialPartial.A subset of AArch64 instruction classes (branches, data processing, loads and stores) needed for the target code; new instructions are added as needed. Source | A subset of AArch64 instruction classes (branches, data processing, loads and stores) needed for the target code; new instructions are added as needed. source |
| Floating-point instructions Scalar floating-point instructions. | Not supportedNot supported.Only FMOV between general and floating-point registers; no floating-point arithmetic. Source | Only FMOV between general and floating-point registers; no floating-point arithmetic. source |
| Vector / SIMD instructions Vector and SIMD extensions. | PartialPartial.A subset of Advanced SIMD plus AES, SHA-512 and polynomial-multiply crypto instructions; no SVE. Source | A subset of Advanced SIMD plus AES, SHA-512 and polynomial-multiply crypto instructions; no SVE. source |
| Privileged mode Privilege levels, control registers, traps and exceptions. | Not supportedNot supported.The state has no exception levels or system registers. Source | The state has no exception levels or system registers. source |
| Virtual memory Page tables and address translation. | Not supportedNot supported.Memory is a flat map from 64-bit addresses to bytes; no address translation. Source | Memory is a flat map from 64-bit addresses to bytes; no address translation. source |
| Concurrency memory model The multiprocessor memory model (for example x86-TSO, Arm, RVWMO). | Not supportedNot supported.Single processor; no memory ordering. Source | Single processor; no memory ordering. source |
Stage
Computed from the evidence below; see the criteria. 2criteria are missing for Stage 1.
- Met: Released or updated in the last 12 months Latest release: main@49f8a1d, 2026-11-06. evidence
- Met: Installs and runs on current platforms CI passes on main with Lean v4.35.0 (November 2026). The repository had no commits from December 2024 to November 2026; work resumed in November 2026. It is not archived. evidence
- Not met: User documentation or tutorial The README covers building and testing, and a short guide covers adding instructions; there is no guide to specifying and proving programs. evidence
- Not met: Used by a group other than its authors None found.
- Not met: Verified code in production at two or more independent organizations None recorded.
- Met: Checker axis is not red
- Met: Semantics axis is not red
- Met: Public channel for soundness bugs Public issue tracker. evidence
In use
Verified code in production, and notable verification projects.
In production
None recorded. Know one? Add it with a source.
Facts and sources
- Effort
- Interactive: You write proofs step by step in a proof assistant.
- Licence
- Open source, Apache-2.0
- Maintained by
- Amazon Web Services (copyright holder; repository in the leanprover GitHub organization)
- Latest release
- main@49f8a1d (6 Nov 2026) source
- Last checked
- 26 Nov 2026
Further sources
- LNSym README · accessed 26 Nov 2026
- Commits (Dec 2024 gap; resumed Nov 2026) · accessed 26 Nov 2026
- LNSym contribution guidelines · accessed 26 Nov 2026
- SHA-512 loop proof (contains sorry) · accessed 26 Nov 2026
- GCM init proof · accessed 26 Nov 2026