All proofs
Project-declaredLean 4.32.0 · mathlib@81a5d257

Cipher Given Msg uniform of uniform Key of unique Key

SymmEncAlg.cipherGivenMsg_uniform_of_uniformKey_of_uniqueKey

Project documentation

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.

Exact Lean statement

theorem cipherGivenMsg_uniform_of_uniformKey_of_uniqueKey
    (encAlg : SymmEncAlg m M K C) [Fintype K]
    (deterministicEnc : ∀ (k : K) (msg : M),
      ∃ c, support (encAlg.encrypt k msg) = {c})
    (hKeyUniform : ∀ k : K, Pr[= k | encAlg.keygen] =
        (Fintype.card K : ℝ≥0∞)⁻¹)
    (hUniqueKey : ∀ msg : M, ∀ c : C, ∃! k : K,
        k ∈ support encAlg.keygen ∧
        c ∈ support (encAlg.encrypt k msg))
    (msg : M) (σ : C) :
    Pr[= σ | encAlg.PerfectSecrecyCipherGivenMsgExp msg] =
      (Fintype.card K : ℝ≥0∞)⁻¹

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem cipherGivenMsg_uniform_of_uniformKey_of_uniqueKey    (encAlg : SymmEncAlg m M K C) [Fintype K]    (deterministicEnc :  (k : K) (msg : M),       c, support (encAlg.encrypt k msg) = {c})    (hKeyUniform :  k : K, Pr[= k | encAlg.keygen] =        (Fintype.card K : 0∞)⁻¹)    (hUniqueKey :  msg : M,  c : C, ! k : K,        k  support encAlg.keygen         c  support (encAlg.encrypt k msg))    (msg : M) (σ : C) :    Pr[= σ | encAlg.PerfectSecrecyCipherGivenMsgExp msg] =      (Fintype.card K : 0∞)⁻¹ := by  obtain k0, hk0, hk0uniq := hUniqueKey msg σ  have henc_one : Pr[= σ | encAlg.encrypt k0 msg] = 1 := by    obtain c0, hc0 := deterministicEnc k0 msg    obtain rfl : σ = c0 := by simpa [hc0] using hk0.2    exact probOutput_eq_one_iff.2 probFailure_of_liftM_PMF _, by simpa using hc0  simp only [PerfectSecrecyCipherGivenMsgExp, probOutput_bind_eq_tsum]  rw [tsum_eq_single k0 fun k hkne => mul_eq_zero.2 <|    (not_and_or.1 fun h => hkne (hk0uniq k h)).imp      probOutput_eq_zero_of_not_mem_support probOutput_eq_zero_of_not_mem_support]  simp [hKeyUniform k0, henc_one]
Project
VCVio
License
Apache-2.0
Commit
2ceb2d825ee3
Source
VCVio/CryptoFoundations/SymmEncAlg.lean:177-198

Reuse this declaration

Bring the exact result into your workflow

The import identifies the source module. Your project still needs the pinned package dependency shown on this page.

What this badge means

This completion status comes from the project or community source. It has not yet been represented here as an independent rebuild and axiom audit.

Continue in this project

Related declarations

Project-declaredLean 4.32.0

Expected Cost Nat eq sum tail probs of pathwise Cost At Most

AddWriterT.expectedCostNat_eq_sum_tail_probs_of_pathwiseCostAtMost

Plain-language statement

Finite tail-sum formula for natural-valued writer cost under a pathwise upper bound. If every execution path of oa incurs cost at most n, then the tail probabilities vanish above n, so the infinite tail sum truncates to Finset.range n.

program verificationseparation logiccryptography

Source project: VCVio

Person-level attribution pending.

View proof record
Project-declaredLean 4.32.0

IND CPA advantage to Real le sum step signed Advantage Real abs

AsymmEncAlg.IND_CPA_advantage_toReal_le_sum_step_signedAdvantageReal_abs

Plain-language statement

Planned generic one-time-to-many-time lift: bounded multi-query IND-CPA advantage is at most the sum of the extracted one-time signed advantages over the first q fresh LR queries.

program verificationseparation logiccryptography

Source project: VCVio

Person-level attribution pending.

View proof record