{
  "id": "lnsym",
  "name": "LNSym",
  "aka": [
    "LNSym (Lean Native-code Symbolic simulator)"
  ],
  "summary": "Prove Armv8 (AArch64) machine code correct in Lean 4 by symbolic simulation over a hand-written model; aimed at AWS-LC cryptographic routines.",
  "use_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."
  ],
  "avoid_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."
  ],
  "effort": "interactive",
  "open": "open-source",
  "license": "Apache-2.0",
  "maintainers": [
    "Amazon Web Services (copyright holder; repository in the leanprover GitHub organization)"
  ],
  "links": {
    "repo": "https://github.com/leanprover/LNSym",
    "docs": "https://github.com/leanprover/LNSym#readme"
  },
  "components": [
    {
      "role": "frontend",
      "name": "Opcode lists copied from objdump into Lean definitions",
      "assurance": "trusted",
      "note": "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."
    },
    {
      "role": "semantics",
      "name": "LNSym AArch64 model (hand-written in Lean 4)",
      "assurance": "validated",
      "note": "A subset of AArch64; co-simulated against Apple silicon (macOS runner) in CI with random tests per instruction class."
    },
    {
      "role": "translation",
      "name": "Symbolic simulation tactics and bv_decide",
      "assurance": "checked"
    },
    {
      "role": "checker",
      "name": "Lean 4 kernel",
      "ref": "lean4",
      "ref_kind": "prover",
      "assurance": "trusted",
      "note": "bv_decide steps also rely on Lean's compiler through the Lean.ofReduceBool axiom."
    }
  ],
  "verifies": [
    {
      "target": "aarch64",
      "note": "Armv8 user-mode code, mainly AWS-LC routines (SHA-512, AES-GCM, GCM)."
    }
  ],
  "properties": {
    "no-ub": {
      "status": "unknown",
      "note": "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": "https://github.com/leanprover/LNSym/blob/main/Proofs/AES-GCM/GCMInitV8Sym.lean"
    },
    "functional": {
      "status": "partial",
      "note": "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": "https://github.com/leanprover/LNSym/tree/main/Proofs"
    },
    "equivalence": {
      "status": "unknown"
    },
    "info-flow": {
      "status": "unknown",
      "note": "We found no constant-time or secrecy reasoning in the repository."
    },
    "concurrency": {
      "status": "none",
      "note": "The machine state is a single sequential processor.",
      "source": "https://github.com/leanprover/LNSym/blob/main/Arm/State.lean"
    },
    "termination": {
      "status": "unknown"
    }
  },
  "features": {
    "isa.user": {
      "status": "partial",
      "note": "A subset of AArch64 instruction classes (branches, data processing, loads and stores) needed for the target code; new instructions are added as needed.",
      "source": "https://github.com/leanprover/LNSym/blob/main/doc/add_new_inst.md"
    },
    "isa.fp": {
      "status": "none",
      "note": "Only FMOV between general and floating-point registers; no floating-point arithmetic.",
      "source": "https://github.com/leanprover/LNSym/blob/main/Arm/Insts/DPSFP/Conversion_between_FP_and_Int.lean"
    },
    "isa.simd": {
      "status": "partial",
      "note": "A subset of Advanced SIMD plus AES, SHA-512 and polynomial-multiply crypto instructions; no SVE.",
      "source": "https://github.com/leanprover/LNSym/tree/main/Arm/Insts/DPSFP"
    },
    "isa.privileged": {
      "status": "none",
      "note": "The state has no exception levels or system registers.",
      "source": "https://github.com/leanprover/LNSym/blob/main/Arm/State.lean"
    },
    "isa.mmu": {
      "status": "none",
      "note": "Memory is a flat map from 64-bit addresses to bytes; no address translation.",
      "source": "https://github.com/leanprover/LNSym/blob/main/Arm/State.lean"
    },
    "isa.memory-model": {
      "status": "none",
      "note": "Single processor; no memory ordering.",
      "source": "https://github.com/leanprover/LNSym/blob/main/Arm/State.lean"
    }
  },
  "trust": {
    "checker": {
      "level": "green",
      "summary": "The Lean kernel checks proofs; bv_decide steps also trust Lean's compiler.",
      "note": "bv_decide checks SAT certificates with a verified checker run as compiled code (Lean.ofReduceBool).",
      "source": "https://github.com/leanprover/LNSym/blob/main/Proofs/AES-GCM/GCMInitV8Sym.lean"
    },
    "semantics": {
      "level": "amber",
      "summary": "Hand-written AArch64 subset; random co-simulation against real Arm CPUs in CI.",
      "note": "We found no published report of the co-simulation results.",
      "source": "https://github.com/leanprover/LNSym/blob/main/.github/workflows/ci.yml"
    },
    "frontend": {
      "level": "amber",
      "summary": "Opcodes are pasted from objdump into Lean; not linked to the binary by a proof.",
      "source": "https://github.com/leanprover/LNSym/blob/main/Tests/AES-GCM/GCMInitV8Program.lean"
    },
    "binary_gap": {
      "level": "green",
      "summary": "Proofs are about the machine code itself; no compiler is trusted."
    },
    "escape_hatches": {
      "level": "amber",
      "summary": "sorry is used in several proofs; Lean warns and",
      "source": "https://github.com/leanprover/LNSym/blob/main/Proofs/SHA512/SHA512Prelude.lean"
    }
  },
  "stage_evidence": {
    "public_artifact": {
      "met": true,
      "evidence": "https://github.com/leanprover/LNSym"
    },
    "published_use": {
      "met": true,
      "evidence": "https://github.com/leanprover/LNSym/tree/main/Proofs",
      "note": "Only the proofs in the repository: complete for small examples (for example popcount), unfinished for the AWS-LC routines. We found no paper or report."
    },
    "installs_on_current": {
      "met": true,
      "evidence": "https://github.com/leanprover/LNSym/actions/workflows/ci.yml",
      "note": "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."
    },
    "user_docs": {
      "met": false,
      "evidence": "https://github.com/leanprover/LNSym#readme",
      "note": "The README covers building and testing, and a short guide covers adding instructions; there is no guide to specifying and proving programs."
    },
    "external_users": {
      "met": false,
      "note": "None found."
    },
    "soundness_channel": {
      "met": true,
      "evidence": "https://github.com/leanprover/LNSym/issues",
      "note": "Public issue tracker."
    }
  },
  "production_users": [],
  "last_release": {
    "version": "main@49f8a1d",
    "date": "2026-11-06",
    "source": "https://github.com/leanprover/LNSym/commits/main"
  },
  "used_for": [
    {
      "name": "AWS-LC SHA-512 (sha512_block_armv8), unfinished",
      "url": "https://github.com/leanprover/LNSym/tree/main/Proofs/SHA512"
    },
    {
      "name": "AWS-LC AES-GCM and GCM routines, partly proved",
      "url": "https://github.com/leanprover/LNSym/tree/main/Proofs/AES-GCM"
    }
  ],
  "last_checked": "2026-11-26",
  "attestation": "maintainer",
  "claimed_by_authors": false,
  "sources": [
    {
      "url": "https://github.com/leanprover/LNSym",
      "title": "LNSym README",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/leanprover/LNSym/commits/main",
      "title": "Commits (Dec 2024 gap; resumed Nov 2026)",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/leanprover/LNSym/blob/main/CONTRIBUTING.md",
      "title": "LNSym contribution guidelines",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/leanprover/LNSym/blob/main/Proofs/SHA512/SHA512Loop.lean",
      "title": "SHA-512 loop proof (contains sorry)",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/leanprover/LNSym/blob/main/Proofs/AES-GCM/GCMInitV8Sym.lean",
      "title": "GCM init proof",
      "accessed": "2026-11-26"
    }
  ],
  "computed": {
    "kind": "toolchains",
    "methodology_version": "0.1",
    "built": "2026-11-26",
    "links": {
      "html": "/toolchains/lnsym/",
      "json": "/toolchains/lnsym.json",
      "markdown": "/toolchains/lnsym.md"
    },
    "stage": {
      "stage": 0,
      "name": "Research",
      "criteria": [
        {
          "key": "public_artifact",
          "stage": 0,
          "label": "Publicly available",
          "met": true,
          "evidence": "https://github.com/leanprover/LNSym",
          "computed": false
        },
        {
          "key": "published_use",
          "stage": 0,
          "label": "At least one published verification uses it",
          "met": true,
          "evidence": "https://github.com/leanprover/LNSym/tree/main/Proofs",
          "note": "Only the proofs in the repository: complete for small examples (for example popcount), unfinished for the AWS-LC routines. We found no paper or report.",
          "computed": false
        },
        {
          "key": "recent_release",
          "stage": 1,
          "label": "Released or updated in the last 12 months",
          "met": true,
          "evidence": "https://github.com/leanprover/LNSym/commits/main",
          "note": "Latest release: main@49f8a1d, 2026-11-06.",
          "computed": true
        },
        {
          "key": "installs_on_current",
          "stage": 1,
          "label": "Installs and runs on current platforms",
          "met": true,
          "evidence": "https://github.com/leanprover/LNSym/actions/workflows/ci.yml",
          "note": "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.",
          "computed": false
        },
        {
          "key": "user_docs",
          "stage": 1,
          "label": "User documentation or tutorial",
          "met": false,
          "evidence": "https://github.com/leanprover/LNSym#readme",
          "note": "The README covers building and testing, and a short guide covers adding instructions; there is no guide to specifying and proving programs.",
          "computed": false
        },
        {
          "key": "external_users",
          "stage": 1,
          "label": "Used by a group other than its authors",
          "met": false,
          "note": "None found.",
          "computed": false
        },
        {
          "key": "production_users",
          "stage": 2,
          "label": "Verified code in production at two or more independent organizations",
          "met": false,
          "note": "None recorded.",
          "computed": true
        },
        {
          "key": "checker_not_red",
          "stage": 2,
          "label": "Checker axis is not red",
          "met": true,
          "computed": true
        },
        {
          "key": "semantics_not_red",
          "stage": 2,
          "label": "Semantics axis is not red",
          "met": true,
          "computed": true
        },
        {
          "key": "soundness_channel",
          "stage": 2,
          "label": "Public channel for soundness bugs",
          "met": true,
          "evidence": "https://github.com/leanprover/LNSym/issues",
          "note": "Public issue tracker.",
          "computed": false
        }
      ],
      "missing_for_next": [
        "user_docs",
        "external_users"
      ]
    }
  }
}