Skip to main content
Glama

Shannon Prover

From a security theorem to an EasyCrypt proof.

Shannon Prover uses language-model agents to construct machine-checked cryptographic proofs in EasyCrypt. You supply the formal description of the scheme, its security assumptions, and the theorem you want to prove. Shannon Prover automates the search for both the proof decomposition and the proofs of its individual lemmas. It can introduce intermediate games and auxiliary lemmas, try to prove them, and revise the argument as EasyCrypt exposes what remains to be shown.

What does Shannon automate?

Think of formalizing a cryptographic security proof in three phases:

Phase

Work to do

With Shannon Prover

I — State the security problem

Define the scheme, adversary, security games, assumptions, and final theorem in EasyCrypt.

You provide these.

II — Build the security argument

Choose intermediate games, formulate auxiliary lemmas, and connect them to the final theorem.

Shannon proposes and revises this decomposition.

III — Prove each step

Write the detailed EasyCrypt proofs of the lemmas and the final theorem.

Shannon searches for proof scripts and checks them with EasyCrypt.

Phases II and III need not happen in a single forward pass. For example, while trying to justify a game hop, Shannon may discover that a proposed invariant is insufficient. It can refine the auxiliary lemma, try its proof again, and then return to the main argument. This feedback between designing the argument and proving its steps is what we mean by interleaved.

One agent works on the overall argument. It can write proofs directly and ask other agents to work on selected auxiliary lemmas. Their results feed back into the overall proof, which is checked again as a complete EasyCrypt file.

flowchart LR
    Input["You: scheme, assumptions,<br/>security games and theorem"] --> Plan["Shannon: propose games<br/>and auxiliary lemmas"]
    Plan --> Proof["Shannon: write and check<br/>EasyCrypt proofs"]
    Proof -->|"results and remaining goals"| Plan
    Proof --> Final["Check the complete<br/>EasyCrypt development"]

Related MCP server: Aristotle MCP Server

Install

Use macOS or Linux. Complete the steps below in order; after cloning, run all commands from the repository root. Installation needs network access and may take several minutes to build OCaml and EasyCrypt.

1. System dependencies and solvers

On Ubuntu/Debian, install the build tools and native libraries:

sudo apt-get update
sudo apt-get install -y git curl opam build-essential autoconf automake m4 pkg-config \
  libgmp-dev libmpfr-dev libpcre2-dev zlib1g-dev unzip

Install Z3 and CVC5 from their upstream releases rather than from apt, and put both on PATH: Z3 and CVC5. Ubuntu 22.04 and 24.04 package Z3 4.8.12, and 22.04 has no cvc5 package, so the single apt-get install line would fail there. .github/actions/easycrypt-toolchain/action.yml shows the downloads CI uses.

Install uv with its standalone installer, then reopen your terminal so uv is on PATH:

curl -LsSf https://astral.sh/uv/install.sh | sh

On macOS, install Xcode Command Line Tools (xcode-select --install if needed). With Homebrew, install:

brew install uv opam autoconf automake pkgconf gmp mpfr pcre2 zlib z3
brew install --cask cvc5/cvc5/cvc5

The CVC5 command uses its official Homebrew tap.

CI uses Z3 4.15.4 and CVC5 1.2.1. smt results depend on the solver versions, so a proof that passes in CI can fail with much older solvers. Check the commands before continuing:

uv --version
opam --version
z3 --version
cvc5 --version

For other package managers, see the vendored EasyCrypt installation guide. Bootstrap installs OCaml dependencies; it does not install these system libraries or solvers.

2. Clone and synchronize Python

Use a Git clone, not an unpacked archive. uv creates .venv, downloads the Python version in .python-version if needed, and installs the locked packages:

git clone https://github.com/SkyShannonProver/shannon-prover.git
cd shannon-prover
uv sync --frozen

Keep uv outside this project's .venv: synchronizing that environment can remove a launcher installed inside it. You do not need to activate .venv.

3. Repository-managed EasyCrypt

Shannon Prover is locked to EasyCrypt r2026.10. Bootstrap creates the managed opam root and switch and installs EasyCrypt at the pinned commit. Then install Alt-Ergo 2.4.3 in that same switch and refresh the installation record:

uv run python tools/bootstrap_easycrypt.py

SHANNON_OPAM_ROOT="$(uv run python -c \
  'from core.easycrypt.toolchain import managed_opam_root; print(managed_opam_root())')"
SHANNON_OPAM_SWITCH="$(uv run python -c \
  'from core.easycrypt.toolchain import managed_switch_name; print(managed_switch_name())')"
opam install --yes --root "$SHANNON_OPAM_ROOT" \
  --switch "$SHANNON_OPAM_SWITCH" alt-ergo.2.4.3

uv run python tools/bootstrap_easycrypt.py

The solver configuration lives in .toolchains/opam-r2026.10/why3.conf. Installing Alt-Ergo can cause opam to rebuild EasyCrypt dependencies. The second bootstrap records the resulting installation and refreshes solver detection. Python entry points select this environment automatically; your global opam switch and Why3 configuration are left alone.

4. Check the installation

Run this check before launching an agent. It uses no model or account login:

uv run python tools/bootstrap_easycrypt.py --verify-only
uv run python -m pytest -q \
  tests/public/core/test_easycrypt_native_state_projection.py::test_native_state_projects_pure_goal_without_changing_inputs \
  tests/public/core/test_easycrypt_native_semantics.py::test_native_smt_runs_the_scope_provers

Expect 2 passed, with no skipped tests. These checks build and run both native adapters and exercise an actual smt tactic. The first run compiles the adapters; later runs reuse their build cache. --verify-only alone checks the recorded toolchain identity and configuration, not native linking or SMT execution. If a check fails, follow environment troubleshooting.

For later toolchain or solver updates, see environment maintenance.

5. Agent login

Shannon defaults to Codex. Install the CLI using the official instructions, then check and sign in from the same terminal you will use to launch Shannon:

command -v codex
codex --version
codex login
codex login status

Use your ChatGPT account. Project-level runs require a stored account login and remove API-key variables from the agents' environment. If you explicitly select Claude, install Claude Code and sign in with your Claude account too. The project-level guide lists model settings and limits. Its preflight checks the selected CLI's capabilities and login; access to the configured model is also required.

Shannon starts these agents with its own settings, ignores your Codex configuration, and never asks you to approve an action. The project-level overall agent runs without a sandbox, with your user account's access to files, credentials, network and Git. Read SECURITY.md and run Shannon in a virtual machine, container or separate account.

Project-level proving

This workflow covers Phases II and III: Shannon constructs the proof decomposition and the proofs needed to reach your project's final theorem.

Put your EasyCrypt target and its local dependencies in one directory under projects/, for example projects/my-proof/Target.ec. The file should contain the security model and final theorem, with an unfinished proof. You do not need to supply auxiliary lemmas. Follow Prepare your project to create projects/my-proof/interleaved_project.json and set the agents and time limits.

Commit your project files and configuration: preflight and live runs both require a clean Git working tree. Then check the setup:

uv run python -m workflow.interleaved \
  --project projects/my-proof/interleaved_project.json \
  --preflight-only

If the check passes, run the same command without --preflight-only:

uv run python -m workflow.interleaved \
  --project projects/my-proof/interleaved_project.json

Shannon works on the target file in your checkout and prints the directory containing the run's results. The project-level proving guide explains how to read the outcome, continue partial work, and add checks that protect your original theorem and assumptions.

For a supplied cryptographic task, follow the ChaChaPoly example. It includes a security model and target theorem, without a human-supplied decomposition, and uses stricter checks that preserve the supplied problem.

What counts as a proof?

For an interleaved run, success requires a fresh EasyCrypt check of the complete target file, with no admit, admitted or weakening pragma Proofs left in it, and no change to any other file or to the EasyCrypt toolchain during the run. The run's manifest.json records status: "proved" and final_verification_passed: true; final_verification.json contains the final checking result. A completed auxiliary lemma alone does not establish the final theorem. A partial proof is reported as incomplete.

EasyCrypt checks the statements in the submitted development under its assumptions. You should also review that these are the security statement and assumptions you intended. The generic checker does not freeze the original definitions or prohibit new assumptions; projects needing those restrictions must supply additional checks. The ChaChaPoly example supplies them for its fixed task.

Single-lemma proving

This workflow covers Phase III for a lemma you have already stated.

Standalone runs default to Codex. Their model settings are separate from project-level runs; the Prove instructions list the defaults and the explicit command for selecting another model.

To watch a proof without preparing a file, run the bundled demo. It copies the supplied PIR example, removes the proof of PIR_correct, and asks Codex to prove it again. It runs on macOS and Linux and does not change your files:

uv run python -m eval_suite.run --suite eval_suite/suites/demo_pir.json

A single-lemma attempt stops after 30 minutes; small lemmas often finish in a few minutes.

If you already know the decomposition, you can ask Shannon to prove one lemma. Put its EasyCrypt file and local dependencies under projects/, leaving the selected lemma with an unfinished proof, for example:

lemma my_lemma : true.
proof.
  admit.
qed.

Run Codex from the repository and enter $prove my_lemma. In the Codex desktop app, type / and choose Prove from the skills list. It searches projects/ first, then the bundled eval/examples/. The bundled examples already contain complete proofs, so $prove PIR_correct only reports that the lemma is verified; use the demo above to watch one.

Claude Code has the corresponding command:

/prove my_lemma

These commands prove a selected lemma; they do not start the interleaved project-level workflow. The Codex command uses Codex, and the Claude command uses Claude. A generated proof is written back only after a fresh EasyCrypt verification succeeds. See the Prove instructions for the explicit-file command and other details.

Examples and research evaluation

The proof browser shows four case studies with their final proof files: three interleaved runs (ML-KEM, Dilithium and ChaChaPoly) and a historical staged campaign (MEE-CBC). It also shows recorded single-lemma attempts with their checked steps.

The final files of the four case studies are in eval/case_studies, which explains how to check them without a model.

Research evaluation is a different workflow

You do not need eval_suite to run an ordinary proof on your own project. Controlled evaluations additionally hide existing answers and fix the task, models, and budgets so results can be compared. Strict live evaluation currently requires Linux and bubblewrap when using the isolated benchmark suite; the ChaChaPoly reference has its own documented source-access policy. See the benchmark guide and ChaChaPoly reference guide.

Further reading

License and citation

Shannon Prover is released under the MIT License. The vendored EasyCrypt source has its own license; its inifiles library is under the LGPL 2.1, whose text is in licenses/. If you use Shannon Prover in research, please cite CITATION.cff:

@article{ma2026shannonprover,
  title   = {ShannonProver: Towards Automating Formal Cryptographic Proofs},
  author  = {Ma, Yiping and Tsai, Yu-Lin and Rathee, Mayank and Rathee,
             Deevashwer and Dupressoir, Fran\c{c}ois and Strub, Pierre-Yves
             and Popa, Raluca Ada},
  journal = {arXiv preprint arXiv:2607.02847},
  year    = {2026}
}

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that bridges LLMs with the Rocq (Coq) proof assistant via LSP, enabling interactive theorem proving with AI.
      10
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to load, inspect, test, and repair machine-checked cryptographic proof files by wrapping EasyCrypt's batch CLI in six tools that report open goals and diagnostics. Agents can try tactic snippets on temporary copies, then commit only the steps that check, while the file itself holds all proof state.
      MIT