The cyclic system has perfect secrecy
OpenShannonSecrecy.cyclic_cipher_perfect_secrecyShannon 1949, §10, p. 681, Fig. 5. Perfect secrecy is attainable with exactly as many keys as messages.
Number the messages and the cryptograms and take equally likely keys, the key acting by
Then, whatever the a priori message distribution, every cryptogram has probability and the a posteriori probability of each message equals its a priori probability, so the system has perfect secrecy. This is the finite one-time pad: it shows that the bound "at least as many keys as messages" is attained.
Formalization Note The messages, keys and cryptograms are all for , the enciphering map is , and the key distribution is uniform, . Perfect secrecy is the property quantified over all a priori message distributions, so the statement is not about one particular distribution of messages.
import Definitions.Def_shannon_secrecy_system
namespace ShannonSecrecy
theorem cyclic_cipher_perfect_secrecy (n : ℕ) [NeZero n] :
PerfectSecrecy (cyclicCipher n) := by sorry
end ShannonSecrecyRead-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) — NON-BLIND: same agent that drafted the statement
Provenance note — this read-back is NOT independent testimony. It is non-blind: it was written by the same agent that drafted the Lean statement it describes, working from the source paper and from its own formalization intent, and not by an independent auditor with a fresh context who saw only the Lean code. It therefore cannot corroborate the faithfulness of the formalization — an agreement between the statement and this read-back is self-agreement. Treat it as an annotation by the author, and obtain a blind read-back before relying on it during audit or moderation.
Fix a natural number with . Consider the cipher whose message, key and cryptogram sets are all , whose enciphering map is computed in , and whose key weights are the constant .
The statement asserts that this cipher has the perfect-secrecy property: for every function with for all and , for every such that
and for every ,
The claim is made for a single fixed family of ciphers — one for each — and quantifies over all a priori distributions . The case is included: there is then exactly one message, one key and one cryptogram. Nothing is asserted about other ciphers, and no minimality of the number of keys is part of the statement.