AFTD Auto-Formalizing Theoretical Domains

Cslib.Crypto.Protocols.PerfectSecrecy.encrypt_key_injective

theoremverifiedformalizationimported Lean

If each message maps to a key that encrypts it to a common ciphertext, then the key assignment is injective (by correctness of decryption).

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open PMF ENNReal in
universe u in
variable {M K C : Type u} in
lemma Cslib.Crypto.Protocols.PerfectSecrecy.encrypt_key_injective (scheme : EncScheme M K C)
    (f : M → K) (c₀ : C)
    (hf_mem : ∀ m, f m ∈ scheme.gen.support)
    (hf_enc : ∀ m, c₀ ∈ (scheme.enc (f m) m).support) :
    Function.Injective f
Formalizes
CSLib, `Cslib.Crypto.Protocols.PerfectSecrecy.encrypt_key_injective`
Lean proof
By Samuel Schlesinger, from github.com/leanprover/cslib at 3951377e5a3f (Copyright (c) 2026 Samuel Schlesinger. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.
Verified
08 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
Used by 1

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open PMF ENNReal in
universe u in
variable {M K C : Type u} in
/-- If each message maps to a key that encrypts it to a common ciphertext, then the key assignment is injective (by correctness of decryption). -/
lemma Cslib.Crypto.Protocols.PerfectSecrecy.encrypt_key_injective (scheme : EncScheme M K C)
    (f : M → K) (c₀ : C)
    (hf_mem : ∀ m, f m ∈ scheme.gen.support)
    (hf_enc : ∀ m, c₀ ∈ (scheme.enc (f m) m).support) :
    Function.Injective f :=
  fun m₁ m₂ heq =>
    (scheme.correct _ (hf_mem m₁) m₁ c₀ (hf_enc m₁)).symm.trans
      (heq ▸ scheme.correct _ (hf_mem m₂) m₂ c₀ (hf_enc m₂))
See it in the graphDiscuss this resultChallenge it