Symmetric Encryption Schemes #
This file defines SymmEncAlg m M K C, a monad-generic symmetric encryption scheme with
message space M, key space K, and ciphertext space C.
The struct follows the same pattern as AsymmEncAlg, KEMScheme, MacAlg, etc.: it is
parameterized by an ambient monad m and uses plain Type parameters. Asymptotic security
statements are expressed externally by quantifying over a family
(sp : ℕ) → SymmEncAlg m (M sp) (K sp) (C sp).
Perfect secrecy is captured by perfectSecrecyAt (the canonical independence form), with
equivalent formulations perfectSecrecyPosteriorEqPriorAt (cross-multiplied posterior/prior
form) and perfectSecrecyJointFactorizationAt (factorization with named marginals); the
_iff_ lemmas record the equivalences. perfectSecrecyAtAllPriors is the strong PMF-level
quantification, equivalent to ciphertextRowsEqualAt over finite message spaces.
A monad-generic symmetric encryption scheme over an ambient monad m, with message
space M, key space K, and ciphertext space C.
- keygen : m K
Sample a key.
- encrypt : K → M → m C
Encrypt a message under a key.
- decrypt : K → C → m (Option M)
Decrypt a ciphertext under a key, returning
noneon failure.
Instances For
Round-trip experiment: sample a key, encrypt msg, then decrypt; used to state
correctness via Complete.
Instances For
An encryption scheme is complete if decryption recovers every message with
probability 1.
Instances For
Joint message/ciphertext experiment used to express perfect secrecy.
Instances For
Ciphertext marginal induced by the perfect-secrecy experiment.
Instances For
Ciphertext experiment conditioned on a fixed message.
Instances For
Strong perfect secrecy: ciphertexts are independent of messages for every prior distribution on messages (PMF-level quantification).
Instances For
Equivalent channel-style formulation: every message induces the same ciphertext distribution.
Instances For
Over a finite message space, strong perfect secrecy is equivalent to all ciphertext rows being equal.
Standard perfect secrecy expressed as independence:
Pr[(M, C)] = Pr[M] * Pr[C].
Instances For
Posterior-equals-prior form, written in cross-multiplied form to avoid division.
Instances For
Joint-factorization form (same mathematical statement as independence, with explicit named priors/marginals).
Instances For
Core uniformity lemma: uniform keygen plus unique key per (message, ciphertext) pair
implies every (message, ciphertext) conditional has probability (card K)⁻¹.
Both Shannon theorems follow from this.
Constructive Shannon direction: if keygen is uniform and each (message, ciphertext)
pair is realized by a unique key in support, then perfect secrecy holds.
deterministicEnc asserts encryption is deterministic in distribution
(singleton support for each fixed (key, message)).
Constructive Shannon direction for all priors: uniform keys plus uniqueness imply perfect secrecy for all prior distributions on messages.