Skip to main content

A tool for checking transitions in cryptographic game-hopping proofs

Project description

ProofFrog logo

ProofFrog

A tool for checking transitions in cryptographic game-hopping proofs.

ProofFrog checks the validity of transitions in game-hopping proofs — the standard technique in provable security for showing that a cryptographic scheme satisfies a security property. Proofs are written in FrogLang, a domain-specific language for defining primitives, schemes, security games, and proofs. ProofFrog is designed to handle introductory-level proofs, trading expressivity and power for ease of use. The engine checks each hop by manipulating abstract syntax trees into a canonical form, with some help from other tools like Z3 and SymPy. ProofFrog's engine does not have any formal guarantees: the soundness of its transformations has not been verified.

ProofFrog can be used via a command-line interface, a browser-based editor, or an MCP server for integration with AI coding assistants. More info at prooffrog.github.io.

ProofFrog web interface

Installation

Requires Python 3.11+.

From PyPI

python3 -m venv .venv
source .venv/bin/activate
pip install proof_frog

After installing ProofFrog via pip, you may want to download the examples repository:

git clone https://github.com/ProofFrog/examples

From source

git clone https://github.com/ProofFrog/ProofFrog
cd ProofFrog
git submodule update --init
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -r requirements-dev.txt

Web Interface

proof_frog web [directory]

Starts a local web server (default port 5173) and opens the editor in your browser. The [directory] argument specifies the working directory for proof files; it defaults to the current directory.

The web interface lets you edit ProofFrog files (with syntax highlighting), validate proofs from the web editor, and explore the game state at each hop.

Command-Line Interface

Command Description
proof_frog parse <file> Parse a file and print its AST representation
proof_frog check <file> Type-check a file for well-formedness
proof_frog prove <file> Verify a game-hopping proof (-v for verbose output)
proof_frog web [dir] Launch the browser-based editor

When installed from source, use python3 -m proof_frog instead of proof_frog.

Writing a Proof in ProofFrog

Take a look at the guide for writing a proof in ProofFrog.

ProofFrog uses four file types to express the components of a cryptographic proof.

Primitives (.primitive)

A primitive defines the interface for a cryptographic operation — its parameters, types, and method signatures. Here's an example of the interface for a pseudorandom generator:

Primitive PRG(Int lambda, Int stretch) {
    Int lambda = lambda;
    Int stretch = stretch;

    BitString<lambda + stretch> evaluate(BitString<lambda> x);
}

Schemes (.scheme)

A scheme implements a primitive. Schemes can be built generically from other primitives. Here's an example of the one-time pad symmetric encryption scheme:

Scheme OTP(Int lambda) extends SymEnc {
    Set Key = BitString<lambda>;
    Set Message = BitString<lambda>;
    Set Ciphertext = BitString<lambda>;

    Key KeyGen() {
        Key k <- Key;
        return k;
    }

    Ciphertext Enc(Key k, Message m) {
        return k + m;
    }

    Message Dec(Key k, Ciphertext c) {
        return k + c;
    }
}

Games (.game)

A security property is defined as a pair of games (Left/Right). An adversary's inability to distinguish between the two games constitutes security. Here's an example of the security game for a PRG:

Game Real(PRG G) {
    BitString<G.lambda + G.stretch> Query() {
        BitString<G.lambda> s <- BitString<G.lambda>;
        return G.evaluate(s);
    }
}

Game Random(PRG G) {
    BitString<G.lambda + G.stretch> Query() {
        BitString<G.lambda + G.stretch> r <- BitString<G.lambda + G.stretch>;
        return r;
    }
}

export as Security;

Proofs (.proof)

A proof script declares assumptions, states a theorem, and lists a sequence of games. Each adjacent pair must be justified as either code-equivalent (verified automatically) or a reduction to an assumed security property. The following snippet shows the basic parts of a proof:

proof:

let:
    SymEnc proofE = SymEnc(ProofMessageSpace, ProofCiphertextSpace, ProofKeySpace);

assume:
    OneTimeUniformCiphertexts(proofE);

theorem:
    OneTimeSecrecy(proofE);

games:
    OneTimeSecrecy(proofE).Left against OneTimeSecrecy(proofE).Adversary;
    OneTimeUniformCiphertexts(proofE).Real compose R1(proofE) against OneTimeSecrecy(proofE).Adversary;
    OneTimeUniformCiphertexts(proofE).Random compose R1(proofE) against OneTimeSecrecy(proofE).Adversary;
    OneTimeUniformCiphertexts(proofE).Random compose R2(proofE) against OneTimeSecrecy(proofE).Adversary;
    OneTimeUniformCiphertexts(proofE).Real compose R2(proofE) against OneTimeSecrecy(proofE).Adversary;
    OneTimeSecrecy(proofE).Right against OneTimeSecrecy(proofE).Adversary;

Vibe-Coding a Proof

ProofFrog also provides an MCP server for integration with AI coding assistants like Claude Code. See the ProofFrog website for an example of vibe-coding a ProofFrog proof with Claude Code.

Examples

The examples/ repository contains primitives, schemes, games, and proofs largely adapted from The Joy of Cryptography by Mike Rosulek. See also the examples and tutorials on the ProofFrog website.

License

ProofFrog is released under the MIT License.

Acknowledgements

ProofFrog was created by Ross Evans and Douglas Stebila, building on the pygamehop tool created by Douglas Stebila and Matthew McKague. For more information about ProofFrog's design, see Ross Evans' master's thesis and eprint 2025/418.

NSERC logo

We acknowledge the support of the Natural Sciences and Engineering Research Council of Canada (NSERC).

Includes icons from the vscode-codicons project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proof_frog-0.3.1.tar.gz (378.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proof_frog-0.3.1-py3-none-any.whl (402.2 kB view details)

Uploaded Python 3

File details

Details for the file proof_frog-0.3.1.tar.gz.

File metadata

  • Download URL: proof_frog-0.3.1.tar.gz
  • Upload date:
  • Size: 378.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for proof_frog-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4aa5bfca4bc7aab2383bb9de89894de87da707c43b6ff0f94e87451a9fcb77e9
MD5 351fbf185559b27567512c83156c548b
BLAKE2b-256 31c5bf9452c54fb54fe89f82994046bb88e14b27a9e74e4fa4011779366d6e5b

See more details on using hashes here.

File details

Details for the file proof_frog-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: proof_frog-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 402.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for proof_frog-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 561a0c193fdf15172a9b3dd07b51fb4f6f5e62250c82dc8f6e343853673824ac
MD5 188adca7c9fc195584397275317bc1f6
BLAKE2b-256 14508a5d1c6982afa5fd2bfe40176bd30e491f2a6841a1841a4f17abdf386d62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page