Abstract Public-Key Encryption Scheme and CPA Games #
This file defines an abstract public-key encryption (PKE) scheme and the CPA$ security games, following the framework from "Mechanizing Nested Hybrid Arguments" (Larsen & Schurmann, CSF 2025, Fig. 5).
Overview #
The CPA$ game (ciphertext indistinguishability) has two variants:
- Real (b = true): Encrypt the queried message
- Ideal (b = false): Return a random ciphertext
This is equivalent to the standard IND-CPA definition but more convenient for hybrid arguments, as each encryption query can be independently switched.
Main Definitions #
PKEScheme- Abstract PKE scheme recordOT_CPA_real/OT_CPA_ideal- One-time CPA$ games (single query)OT_CPA_Advantage- One-time CPA$ advantageMT_CPA_real/MT_CPA_ideal- Many-time CPA$ games (q queries)hybrid_game- Hybrid game indexed by switch positionMT_CPA_bound- Main reduction: MT-CPA advantage ≤ q * OT-CPA advantage
References #
- [Larsen & Schurmann, Mechanizing Nested Hybrid Arguments, CSF 2025, Fig. 5-9]
- [Bellare et al., Relations Among Notions of Security for PKE]
PKE Scheme Definition #
Abstract public-key encryption scheme.
Following the CSF 2025 paper (Fig. 5):
keygenproduces a (secret key, public key) pairencencrypts a message under a public key (probabilistic)decdecrypts a ciphertext under a secret keysampleCipsamples a random ciphertext (for the ideal CPA$ game)
- SK : Type
Secret key type
- PK : Type
Public key type
- M : Type
Message type
- C : Type
Ciphertext type
Secret keys are finite
Secret keys are nonempty
Public keys are finite
Public keys are nonempty
Messages are finite
Messages are nonempty
Ciphertexts are finite
Ciphertexts are nonempty
- keygen : Core.SPComp (self.SK × self.PK)
Probabilistic key generation
- enc : self.PK → self.M → Core.SPComp self.C
Probabilistic encryption
- dec : self.SK → self.C → Core.SPComp (Option self.M)
Decryption (may fail)
- sampleCip : Core.SPComp self.C
Random ciphertext sampling (for CPA$ ideal game)
Instances For
Correctness #
Perfect correctness: decryption always recovers the message.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One-Time CPA$ Games #
One-time CPA$ real game: encrypt the message under the public key.
Equations
- CatCrypt.Examples.PKE.OT_CPA_real P pk m = P.enc pk m
Instances For
One-time CPA$ ideal game: return a random ciphertext.
Equations
- CatCrypt.Examples.PKE.OT_CPA_ideal P _pk _m = P.sampleCip
Instances For
One-time CPA$ advantage for a fixed public key and message.
Equations
- CatCrypt.Examples.PKE.OT_CPA_Advantage P pk m A = CatCrypt.Crypto.AdvantageA (CatCrypt.Examples.PKE.OT_CPA_real P pk m) (CatCrypt.Examples.PKE.OT_CPA_ideal P pk m) A
Instances For
Hybrid Games (SLIDE Construction) #
The hybrid game at index `i` samples random ciphertexts for positions `< i`
and encrypts the real message for positions `≥ i`. This is the SLIDE construction
from the CSF 2025 paper (Fig. 9).
We define this recursively with an explicit position counter.
Helper: process messages with position counter.
For position j: if j < i then sample random, else encrypt.
Equations
- One or more equations did not get rendered due to their size.
- CatCrypt.Examples.PKE.hybridLoop P pk i x✝ [] = CatCrypt.Core.SPComp.pure []
Instances For
Hybrid game: first i ciphertexts are random, remaining are encrypted.
hybrid_game pk msgs 0= all encrypted (real game)hybrid_game pk msgs msgs.length= all random (ideal game)
Equations
- CatCrypt.Examples.PKE.hybrid_game P pk msgs i = CatCrypt.Examples.PKE.hybridLoop P pk i 0 msgs
Instances For
Many-Time CPA$ Games #
The many-time game allows `q` encryption queries (one per message in the list).
These are defined recursively to match `hybridLoop`'s structure.
Many-time CPA$ real game: encrypt all messages under the public key.
Equations
- CatCrypt.Examples.PKE.MT_CPA_real P pk [] = CatCrypt.Core.SPComp.pure []
- CatCrypt.Examples.PKE.MT_CPA_real P pk (m :: ms) = do let c ← P.enc pk m let cs ← CatCrypt.Examples.PKE.MT_CPA_real P pk ms CatCrypt.Core.SPComp.pure (c :: cs)
Instances For
Many-time CPA$ ideal game: return random ciphertexts for all queries.
Equations
- CatCrypt.Examples.PKE.MT_CPA_ideal P [] = CatCrypt.Core.SPComp.pure []
- CatCrypt.Examples.PKE.MT_CPA_ideal P (m :: ms) = do let c ← P.sampleCip let cs ← CatCrypt.Examples.PKE.MT_CPA_ideal P ms CatCrypt.Core.SPComp.pure (c :: cs)
Instances For
Many-time CPA$ advantage.
Equations
- CatCrypt.Examples.PKE.MT_CPA_Advantage P pk msgs A = CatCrypt.Crypto.AdvantageA (CatCrypt.Examples.PKE.MT_CPA_real P pk msgs) (CatCrypt.Examples.PKE.MT_CPA_ideal P msgs) A
Instances For
Boundary Conditions #
Boundary: hybrid at 0 = all encrypted (real game).
Boundary: hybrid at length = all random (ideal game).
Adjacent Hybrid Lemmas #
Key structural lemma: adjacent hybrids differ only at position i. #
For positions `j < i`: both games sample random (identical).
For position `j = i`: game i encrypts, game i+1 samples random.
For positions `j > i`: both games encrypt (identical).
This means the advantage between adjacent hybrids reduces to a single
OT-CPA$ query at position i.
Pure PKE Schemes #
IsPure for Many-Time Games #
Many-time CPA$ real game is pure when the scheme is pure.
Many-time CPA$ ideal game is pure when the scheme is pure.
The hybrid game is pure when the scheme is pure.
Main Reduction Theorem #
Many-time to one-time CPA$ reduction (CSF 2025, Theorem 1).
The many-time CPA$ advantage is bounded by q * ε where q = msgs.length
and ε bounds each per-step hybrid advantage.
This uses the general advantage_hybrid_uniform theorem from
HybridArgument.lean.
Many-time to one-time CPA$ reduction with dependent bounds.
When per-step bounds differ, the total advantage is bounded by their sum.
Perfect security for many-time CPA$: when all hybrid steps are perfectly indistinguishable, the many-time advantage is 0.