Documentation

CslibFrontier.Crypto.Computational.Encryption.Hybrid.CompositionCCA

Adaptive CCA security of hybrid encryption #

The KEM key is postprocessed by a native function whose uniform-seed law is exactly the symmetric cipher's actual key generator. The two KEM hops surround the actual-key DEM game. Challenge messages have length exactly the security parameter, as in SymmetricCipher. The conclusion is INDCCA2On with this admissibility rule, not unrestricted WordINDCCA2.

The results are steps toward [BS23], Exercise 12.5(a), printed p. 513, not the exercise itself. The proof constructs both reductions, a KEM distinguisher and a one-time symmetric CCA adversary, with their efficiency certificates, and enforces the KEM ciphertext space ctSpace (C_kem) in both kemCCAContinuation and hybridDecrypt (as well as in the reductions), so a KEM that is secure on C_kem is never queried outside C_kem. On the KEM side, however, kemCCARealGame and kemCCAIdealGame still strengthen the exercise's printed KEM game (p. 513) by giving the distinguisher (pk, (k, ct)), where the printed challenger sends only the key and the encapsulation (#5293; as the KEMINDCPA counterexample shows, hybrid security needs pk). On the DEM side, SymmetricCipher.ctSpace models the ciphertext space C (by decrypt_eq_none_of_ctSpace_eq_false, decrypt returns none outside C, which the oracle encodes as []), so SymmetricCipher.OneTimeINDCCA matches Attack Game 9.2 (printed p. 362) on an efficiently recognizable C (default C is all words).

The source's uniform key space is represented by uniform keyLen n-bit seeds followed by F n. An exact sampler identity relates this distribution to E.keyGen n; no uniformity of encoded symmetric keys is assumed. Both KEM games retain their existing postchallenge decapsulation schedule. The reduction answers the distinguished component locally before and after its own hybrid challenge; other components use bounded external replies. The real-hop commutation is conditional on the same original keypair and uses supported KEM correctness.

Security and perfect correctness are distinct. Correctness additionally needs postprocessed real encapsulation keys in the DEM's support. A total saved-coins evaluator supplies this for all seeds; a simple fixed-width key split instead needs a supported real-key length contract.

Main definitions #

Main results #

References #

noncomputable def Cslib.Crypto.Encryption.hybridKEMCCAHandler (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (F : ℕ → List Bool → List Bool) (decBound : ℕ → List Bool → ℕ) (n : ℕ) (key ctK : List Bool) (request : Unit × List Bool) :

Decrypt the distinguished component locally under the shown, postprocessed key when in ctSpace. Other canonical in-space components use a bounded decapsulation reply, preserving rejection and empty keys. This handler never queries outside ctSpace or on the distinguished KEM ciphertext.

noncomputable def Cslib.Crypto.Encryption.hybridKEMCCAContinuation (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (F : ℕ → List Bool → List Bool) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) (bit : Bool) (n : ℕ) (pk key ctK : List Bool) :

Simulate the two public-key phases using the shown key and ciphertext. The same local key override is present before challenge selection. After encryption, only the exact full challenge word is rejected; a different in-space KEM component with the same DEM component is allowed.

noncomputable def Cslib.Crypto.Encryption.hybridToKEMCCA (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (F : ℕ → List Bool → List Bool) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) (bit : Bool) :

Fixed-bit KEM distinguisher. The input is the existing (pk, (shownKey, ctK)) encoding; no secret key is available to the reduction.

theorem Cslib.Crypto.Encryption.run_hybridKEMCCAHandler (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (F : ℕ → List Bool → List Bool) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (decBound : ℕ → List Bool → ℕ) (n : ℕ) (sk key ctK : List Bool) (hbound : ∀ (ct : List Bool), ((Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits) (decaps n sk ct)).length ≤ decBound n ct) (request : Unit × List Bool) :
(OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (ProbComp.unifFin m)) (cca2Phase2Oracle Turing.MultiTapeTM.encBits (fun (n : ℕ) (sk q : List Bool) => if ctSpace n q = true then decaps n sk q else none) n sk ctK)) (hybridKEMCCAHandler E ctSpace F decBound n key ctK request)).run () = pure ((Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits) (hybridDecrypt ctSpace (fun (n : ℕ) (sk ct : List Bool) => if (ct == ctK) = true then some key else Option.map (F n) (decaps n sk ct)) E.decrypt n sk request.2), ())

An actual decapsulation reply is fully read. Neither the ctSpace guard nor the source KEM challenge exclusion interferes, since out-of-space words and the distinguished component are handled locally in both phases.

theorem Cslib.Crypto.Encryption.eval_kemCCAIdealGame_hybridToKEMCCA (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (F : ℕ → List Bool → List Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) (bit : Bool) (n : ℕ) (hlaw : PMF.map (F n) (BitString.uniformList (keyLen n)) = (E.keyGen n).eval) (hbound : ∀ keys ∈ (keyGen n).eval.support, ∀ (ct : List Bool), ((Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits) (decaps n keys.2 ct)).length ≤ decBound n ct) :
(kemCCAIdealGame ctSpace keyLen keyGen encaps decaps (hybridToKEMCCA E ctSpace F decBound adversary bit) n).eval = (hybridDEMGame E ctSpace keyGen (fun (n : ℕ) (pk : List Bool) => (fun (kc : List Bool × List Bool) => (F n kc.1, kc.2)) <$> encaps n pk) (fun (n : ℕ) (sk ct : List Bool) => Option.map (F n) (decaps n sk ct)) adversary bit n).eval

The ideal KEM hop uses the actual DEM sampler, through an exact postprocessing law. The original keypair and encapsulation retain their joint distribution.

theorem Cslib.Crypto.Encryption.eval_kemCCARealGame_hybridToKEMCCA (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (F : ℕ → List Bool → List Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) (bit : Bool) (n : ℕ) (hcorrect : ∀ keys ∈ (keyGen n).eval.support, ∀ kc ∈ (encaps n keys.1).eval.support, decaps n keys.2 kc.2 = some kc.1) (hbound : ∀ keys ∈ (keyGen n).eval.support, ∀ (ct : List Bool), ((Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits) (decaps n keys.2 ct)).length ≤ decBound n ct) :
(kemCCARealGame ctSpace keyGen encaps decaps (hybridToKEMCCA E ctSpace F decBound adversary bit) n).eval = (cca2GameOn (fun (n : ℕ) (x m0 m1 : List Bool) => m0.length == n && m1.length == n) Turing.MultiTapeTM.encBits keyGen (hybridEncrypt (fun (n : ℕ) (pk : List Bool) => (fun (kc : List Bool × List Bool) => (F n kc.1, kc.2)) <$> encaps n pk) E.encrypt) (hybridDecrypt ctSpace (fun (n : ℕ) (sk ct : List Bool) => Option.map (F n) (decaps n sk ct)) E.decrypt) adversary bit n).eval

Supported encapsulation correctness removes the local override in the real world. Encapsulation is commuted with Phase 1 only after the original keypair has been fixed.

Native implementation of bounded KEM reply reading, including the cost of ciphertext-space recognition, key postprocessing and decryption. The certificate holds for arbitrary external replies.

theorem Cslib.Crypto.Encryption.isOraclePPTOn_hybridKEMCCAContinuation (E : SymmetricCipher) {ctSpace : ℕ → List Bool → Bool} (hctSpace : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => ctSpace p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool) {F : ℕ → List Bool → List Bool} (hF : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => F p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) {decBound : ℕ → List Bool → ℕ} (hdecBound : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => decBound p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) {adversary : WordCCA2Adversary} (hA : adversary.IsPPT) {α : Type} {input : α ↪ List Bool} {n : α → ℕ} {pk key ctK : α → List Bool} {bit : α → Bool} (hn : Turing.MultiTapeTM.ComputableInPolyTime n input Turing.MultiTapeTM.encUnary) (hpk : Turing.MultiTapeTM.ComputableInPolyTime pk input Turing.MultiTapeTM.encBits) (hkey : Turing.MultiTapeTM.ComputableInPolyTime key input Turing.MultiTapeTM.encBits) (hctK : Turing.MultiTapeTM.ComputableInPolyTime ctK input Turing.MultiTapeTM.encBits) (hbit : Turing.MultiTapeTM.ComputableInPolyTime bit input Turing.MultiTapeTM.encBool) :
Probability.IsOraclePPTOn input Turing.MultiTapeTM.encBool fun (a : α) => hybridKEMCCAContinuation E ctSpace F decBound adversary (bit a) (n a) (pk a) (key a) (ctK a)

Native certificate for both simulated phases. All external reads have a unary-computable cap; subsequent ciphertext-space recognition, key postprocessing, decryption and challenge handling are charged.

The fixed-bit KEM reduction is uniform strict oracle PPT. It does not sample ideal keys, so its native certificate needs no efficiency assumption on the ideal key-length schedule.

noncomputable def Cslib.Crypto.Encryption.hybridToKEMCCAHiddenBit (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (F : ℕ → List Bool → List Bool) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) :

A single KEM reduction chooses the hybrid challenge bit privately and complements the answer in the true world. This retains the signed difference between the two KEM hops.

theorem Cslib.Crypto.Encryption.probability_kemCCARealGame_hybridToKEMCCAHiddenBit (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (F : ℕ → List Bool → List Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) (n : ℕ) :
↑(Game.succProbability (kemCCARealGame ctSpace keyGen encaps decaps (hybridToKEMCCAHiddenBit E ctSpace F decBound adversary) n).eval) = (1 + ↑(Game.succProbability (kemCCARealGame ctSpace keyGen encaps decaps (hybridToKEMCCA E ctSpace F decBound adversary false) n).eval) - ↑(Game.succProbability (kemCCARealGame ctSpace keyGen encaps decaps (hybridToKEMCCA E ctSpace F decBound adversary true) n).eval)) / 2

Exact signed real-world selector identity, before taking any absolute values.

theorem Cslib.Crypto.Encryption.probability_kemCCAIdealGame_hybridToKEMCCAHiddenBit (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (F : ℕ → List Bool → List Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) (n : ℕ) :
↑(Game.succProbability (kemCCAIdealGame ctSpace keyLen keyGen encaps decaps (hybridToKEMCCAHiddenBit E ctSpace F decBound adversary) n).eval) = (1 + ↑(Game.succProbability (kemCCAIdealGame ctSpace keyLen keyGen encaps decaps (hybridToKEMCCA E ctSpace F decBound adversary false) n).eval) - ↑(Game.succProbability (kemCCAIdealGame ctSpace keyLen keyGen encaps decaps (hybridToKEMCCA E ctSpace F decBound adversary true) n).eval)) / 2

Exact signed ideal-world selector identity, with the same bit and output conventions.

theorem Cslib.Crypto.Encryption.advantage_hybridCCA_le_two_mul (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (F : ℕ → List Bool → List Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (decBound : ℕ → List Bool → ℕ) (adversary : WordCCA2Adversary) (n : ℕ) (hlaw : PMF.map (F n) (BitString.uniformList (keyLen n)) = (E.keyGen n).eval) (hcorrect : ∀ keys ∈ (keyGen n).eval.support, ∀ kc ∈ (encaps n keys.1).eval.support, decaps n keys.2 kc.2 = some kc.1) (hbound : ∀ keys ∈ (keyGen n).eval.support, ∀ (ct : List Bool), ((Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits) (decaps n keys.2 ct)).length ≤ decBound n ct) :
have encaps' := fun (n : ℕ) (pk : List Bool) => (fun (kc : List Bool × List Bool) => (F n kc.1, kc.2)) <$> encaps n pk; have decaps' := fun (n : ℕ) (sk ct : List Bool) => Option.map (F n) (decaps n sk ct); Game.advantage (cca2GameOn (fun (n : ℕ) (x m0 m1 : List Bool) => m0.length == n && m1.length == n) Turing.MultiTapeTM.encBits keyGen (hybridEncrypt encaps' E.encrypt) (hybridDecrypt ctSpace decaps' E.decrypt) adversary false n).eval (cca2GameOn (fun (n : ℕ) (x m0 m1 : List Bool) => m0.length == n && m1.length == n) Turing.MultiTapeTM.encBits keyGen (hybridEncrypt encaps' E.encrypt) (hybridDecrypt ctSpace decaps' E.decrypt) adversary true n).eval ≤ 2 * Game.advantage (kemCCARealGame ctSpace keyGen encaps decaps (hybridToKEMCCAHiddenBit E ctSpace F decBound adversary) n).eval (kemCCAIdealGame ctSpace keyLen keyGen encaps decaps (hybridToKEMCCAHiddenBit E ctSpace F decBound adversary) n).eval + Game.advantage (hybridDEMGame E ctSpace keyGen encaps' decaps' adversary false n).eval (hybridDEMGame E ctSpace keyGen encaps' decaps' adversary true n).eval

The two KEM hops have total loss two, with one native hidden-bit KEM reduction. The middle advantage is the existing actual-key DEM experiment, whose exact reduction to one-time symmetric CCA is eval_hybridDEMGame.

theorem Cslib.Crypto.Encryption.hybrid_indcca2On (E : SymmetricCipher) {ctSpace : ℕ → List Bool → Bool} {keyLen : ℕ → ℕ} {F : ℕ → List Bool → List Bool} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)} {decaps : ℕ → List Bool → List Bool → Option (List Bool)} (hkem : Game.Indistinguishable (fun (B : OracleDistinguisher) (n : ℕ) => (kemCCARealGame ctSpace keyGen encaps decaps B n).eval) (fun (B : OracleDistinguisher) (n : ℕ) => (kemCCAIdealGame ctSpace keyLen keyGen encaps decaps B n).eval) (Probability.IsOraclePPT Turing.MultiTapeTM.encBool)) (hdem : E.OneTimeINDCCA) (hctSpace : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => ctSpace p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool) (hkeyGen : Probability.IsPPTOn Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) keyGen) (hencaps : Probability.IsPPTOn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) fun (p : ℕ × List Bool) => encaps p.1 p.2) (hdecaps : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool × List Bool) => match x with | (n, sk, ct) => decaps n sk ct) (encKeyedInput Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits)) (hF : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => F p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hlaw : ∀ (n : ℕ), PMF.map (F n) (BitString.uniformList (keyLen n)) = (E.keyGen n).eval) (hcorrect : ∀ (n : ℕ), ∀ keys ∈ (keyGen n).eval.support, ∀ kc ∈ (encaps n keys.1).eval.support, decaps n keys.2 kc.2 = some kc.1) :
INDCCA2On (fun (n : ℕ) (x m0 m1 : List Bool) => m0.length == n && m1.length == n) Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits keyGen (hybridEncrypt (fun (n : ℕ) (pk : List Bool) => (fun (kc : List Bool × List Bool) => (F n kc.1, kc.2)) <$> encaps n pk) E.encrypt) (hybridDecrypt ctSpace (fun (n : ℕ) (sk ct : List Bool) => Option.map (F n) (decaps n sk ct)) E.decrypt)

Adaptive CCA security of KEM–DEM encryption in the symmetric cipher's n-bit message model, from a KEM CCA premise on ctSpace and E.OneTimeINDCCA: a step toward [BS23], Exercise 12.5(a), not the cited result, because its KEM premise gives the distinguisher pk (#5293).

The proof constructs both reductions, hybridToKEMCCAHiddenBit and hybridToOneTimeCCAAdversary, with their efficiency certificates. Relative to the exercise's premises (printed p. 513):

  • KEM: ctSpace represents C_kem, and both kemCCAContinuation and hybridDecrypt (as well as hybridKEMCCAHandler) reject KEM ciphertexts outside ctSpace without calling decaps, matching the exercise's restriction of decapsulation queries to an efficiently recognizable C_kem. However, in kemCCARealGame and kemCCAIdealGame the distinguisher receives (pk, (k, ct)), where the printed challenger sends only the key and the encapsulation (#5293). The counterexample in the KEMINDCPA docstring (a KEM whose key is its public key) shows that the printed statement needs pk given to the distinguisher.
  • DEM: SymmetricCipher.ctSpace represents C, and E.decrypt_eq_none_of_ctSpace_eq_false forces queries outside C to be answered with the rejection [] = encOption encBits none. When C is efficiently recognizable, E.OneTimeINDCCA matches Attack Game 9.2 (Definition 9.6, printed pp. 362–363).

The same native postprocessor is used on the shown KEM key and on every successful decapsulation. Its ideal-key distribution is the actual symmetric key sampler, uniformly in the security parameter. KEM correctness is needed for the real-game hop. Correctness of hybrid decryption is a separate supported-output contract; the security statement does not assert unrestricted word-message CCA.

structure Cslib.Crypto.Encryption.HybridCCAReductions (E : SymmetricCipher) (ctSpace : ℕ → List Bool → Bool) (keyLen : ℕ → ℕ) (F : ℕ → List Bool → List Bool) (keyGen : ℕ → ProbComp (List Bool × List Bool)) (encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)) (decaps : ℕ → List Bool → List Bool → Option (List Bool)) (adversary : WordCCA2Adversary) :

The two reductions for the postprocessed KEM–DEM hybrid against adversary, in the library's games: a KEM CCA distinguisher kem and a one-time symmetric CCA adversary dem, both oracle PPT, such that at every n the hybrid's n-bit-message CCA advantage is at most twice kem's advantage between kemCCARealGame and kemCCAIdealGame on ctSpace plus dem's advantage in E.ccaOneTimeGame. Both kemCCAContinuation and hybridDecrypt reject KEM ciphertexts outside ctSpace, and E.ccaOneTimeGame rejects decryption queries outside E.ctSpace (decrypt_eq_none_of_ctSpace_eq_false). The KEM games still give the distinguisher pk, so this is a step toward the concrete bound of [BS23], Exercise 12.5(a), not that bound (exists_hybridCCA_reductions; #5293).

theorem Cslib.Crypto.Encryption.exists_hybridCCA_reductions (E : SymmetricCipher) {ctSpace : ℕ → List Bool → Bool} {keyLen : ℕ → ℕ} {F : ℕ → List Bool → List Bool} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)} {decaps : ℕ → List Bool → List Bool → Option (List Bool)} (hctSpace : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => ctSpace p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool) (hkeyGen : Probability.IsPPTOn Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) keyGen) (hencaps : Probability.IsPPTOn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) fun (p : ℕ × List Bool) => encaps p.1 p.2) (hdecaps : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool × List Bool) => match x with | (n, sk, ct) => decaps n sk ct) (encKeyedInput Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits)) (hF : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => F p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hlaw : ∀ (n : ℕ), PMF.map (F n) (BitString.uniformList (keyLen n)) = (E.keyGen n).eval) (hcorrect : ∀ (n : ℕ), ∀ keys ∈ (keyGen n).eval.support, ∀ kc ∈ (encaps n keys.1).eval.support, decaps n keys.2 kc.2 = some kc.1) (adversary : WordCCA2Adversary) (hA : adversary.IsPPT) :
Nonempty (HybridCCAReductions E ctSpace keyLen F keyGen encaps decaps adversary)

Native KEM and one-time symmetric CCA reductions for the postprocessed KEM–DEM hybrid, with hybrid advantage at most twice the KEM advantage plus the symmetric advantage at every n: a step toward the concrete bound of [BS23], Exercise 12.5(a), not the cited result, because the KEM games on its right-hand side give the distinguisher pk (#5293).

The proof constructs both reductions. The KEM advantage is measured in kemCCARealGame and kemCCAIdealGame on ctSpace, which reject queries outside ctSpace (C_kem) with [] and give the distinguisher (pk, (k, ct)), whereas the exercise's KEM challenger sends only the key and encapsulation (printed p. 513). The symmetric advantage is measured in E.ccaOneTimeGame, which rejects decryption queries outside E.ctSpace with [] (decrypt_eq_none_of_ctSpace_eq_false). The hybrid game on the left likewise rejects KEM components outside ctSpace and DEM components outside E.ctSpace. The reduction code and polynomial clocks are fixed before n. No security assumption is needed for this quantitative statement.

theorem Cslib.Crypto.Encryption.isPPTOn_hybridCCAGame (E : SymmetricCipher) {ctSpace : ℕ → List Bool → Bool} {F : ℕ → List Bool → List Bool} {keyGen : ℕ → ProbComp (List Bool × List Bool)} {encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)} {decaps : ℕ → List Bool → List Bool → Option (List Bool)} (hctSpace : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => ctSpace p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool) (hkeyGen : Probability.IsPPTOn Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) keyGen) (hencaps : Probability.IsPPTOn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) fun (p : ℕ × List Bool) => encaps p.1 p.2) (hdecaps : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : ℕ × List Bool × List Bool) => match x with | (n, sk, ct) => decaps n sk ct) (encKeyedInput Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits)) (hF : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : ℕ × List Bool) => F p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) {adversary : WordCCA2Adversary} (hA : adversary.IsPPT) (bit : Bool) :
Probability.IsPPTOn Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBool (cca2GameOn (fun (n : ℕ) (x m0 m1 : List Bool) => m0.length == n && m1.length == n) Turing.MultiTapeTM.encBits keyGen (hybridEncrypt (fun (n : ℕ) (pk : List Bool) => (fun (kc : List Bool × List Bool) => (F n kc.1, kc.2)) <$> encaps n pk) E.encrypt) (hybridDecrypt ctSpace (fun (n : ℕ) (sk ct : List Bool) => Option.map (F n) (decaps n sk ct)) E.decrypt) adversary bit)

Native runtime of the actual postprocessed hybrid game, including both decryption phases. No security or key-distribution assumption is required for runtime.

theorem Cslib.Crypto.Encryption.hybridDecrypt_postprocessed_hybridEncrypt (E : SymmetricCipher) {ctSpace : ℕ → List Bool → Bool} {F : ℕ → List Bool → List Bool} {encaps : ℕ → List Bool → ProbComp (List Bool × List Bool)} {decaps : ℕ → List Bool → List Bool → Option (List Bool)} {n : ℕ} {pk sk ct msg : List Bool} (hctSpace : ∀ kc ∈ (encaps n pk).eval.support, ctSpace n kc.2 = true) (hcorrect : ∀ kc ∈ (encaps n pk).eval.support, decaps n sk kc.2 = some kc.1) (hsupport : ∀ kc ∈ (encaps n pk).eval.support, F n kc.1 ∈ (E.keyGen n).eval.support) (hmsg : msg.length = n) (hct : ct ∈ (hybridEncrypt (fun (n : ℕ) (pk : List Bool) => (fun (kc : List Bool × List Bool) => (F n kc.1, kc.2)) <$> encaps n pk) E.encrypt n pk msg).eval.support) :
hybridDecrypt ctSpace (fun (n : ℕ) (sk ct : List Bool) => Option.map (F n) (decaps n sk ct)) E.decrypt n sk ct = some msg

Decryption correctness on supported ciphertexts requires supported encapsulations to lie in ctSpace and postprocessed real encapsulation keys to be supported by the DEM. An ideal-key sampler identity alone does not assert this real-key fact.