Skip to content

Add Lean (Aeneas) extraction of the crypto core - #3

Open
karthikbhargavan wants to merge 1 commit into
proverif-symbolic-analysisfrom
lean-aeneas-extraction
Open

Add Lean (Aeneas) extraction of the crypto core#3
karthikbhargavan wants to merge 1 commit into
proverif-symbolic-analysisfrom
lean-aeneas-extraction

Conversation

@karthikbhargavan

@karthikbhargavan karthikbhargavan commented Jul 15, 2026

Copy link
Copy Markdown

Adds a Lean 4 (Aeneas) extraction of the crypto core, alongside the existing F* and ProVerif lanes — a third, independent lifting of the same Rust via the hax aeneas-lean backend (rustc → charon → aeneas).

What extracts

The driver mirrors the ProVerif target set. Translated to Lean defs:

  • message::auth_enc / auth_dec (SD-APKE), metadata::encrypt / decrypt (SD-PKE)
  • sign::sign / verify (Ed25519), encrypt_decrypt::encrypt / decrypt
  • plus keygen and the ciphertext/key types

~5k lines of Lean, committed as a snapshot under proofs/aeneas-lean/.

Opaque for the Lean backend only

Aeneas can't yet translate a few constructs, so they're made opaque for the Lean backend only, via #[cfg_attr(hax_backend_lean, hax_lib::opaque)] — F* and normal builds are unaffected (cargo check clean):

Item Reason Upstream
DomainTag::tag returns &'static [u8] → "no bottoms in the value" aeneas#392
tagged_preimage builds the preimage from the opaque tag with Vec ops (same)
decrypt_with_sender trial-decrypt loop over Vec<&MessageKeyBundle> aeneas#464

Running

python3 proofs/proverif/hax.py extract-lean

Injects the dev hax-lib via a temporary [patch.crates-io] (restored afterwards), so the committed manifest stays on crates.io hax-lib 0.3.7.

Depends on (upstream, not yet merged)

Both are injected at extraction time; nothing here changes the F*/ProVerif lanes or normal builds:

  • cryspen/hax#2069into aeneas-lean sets target-side --cfg hax so cfg(hax)-gated deps (libcrux) compile under charon.
  • cryspen/hax#2071hax_lib::opaque/exclude emit charon's native attributes, enabling the hax_backend_lean markers above.

Stacked on #2 (ProVerif lane) since it extends the shared proofs/proverif/hax.py. See proofs/aeneas-lean/README.md for details.

A third extraction lane alongside F* and ProVerif: a functional-model lifting of
the SD-APKE / SD-PKE / Ed25519 crypto core to Lean 4 via the hax aeneas-lean
backend (rustc -> charon -> aeneas).

- proofs/proverif/hax.py `extract-lean`: runs `cargo hax into aeneas-lean` over
  the crypto-core `--start-from` set (mirrors the ProVerif targets), injecting a
  dev hax-lib (pending cryspen/hax#2069 + #2071) via a temporary [patch.crates-io]
  and restoring Cargo.toml/lock afterwards.
- Source: aeneas can't yet translate the `&'static` domain tags, `tagged_preimage`,
  or the `decrypt_with_sender` trial-decrypt loop, so these are made opaque for the
  Lean backend only via `#[cfg_attr(hax_backend_lean, hax_lib::opaque)]` — F* and
  normal builds are unaffected (verified with `cargo check`). `cfg(hax_backend_lean)`
  added to the workspace check-cfg allowlist.
- Snapshot of the generated Lean committed under proofs/aeneas-lean/ (llbc/ and the
  aeneas error log git-ignored); see its README for the toolchain pins and the
  upstream aeneas limitations (AeneasVerif/aeneas#392, #464).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant