Documentation

CslibFrontier.Crypto.Computational.Commitment.Basic

Public-parameter commitment schemes #

A CommitmentScheme specifies the exact commitment distribution and verification rule under public parameters. Its injective public encoding makes every honest operation depend on the parameters shown to the adversary. Efficient evaluation and realization of the ideal distributions are separate properties. Commitment/PublicOperations supplies certificates for deterministic evaluation on supplied randomness and verification, using exactly this public encoding.

Chosen-message hiding reuses Encryption.WordAdversary, with its explicit saved state and uniform strict-PPT certificates. Binding asks an adversary for two distinct messages and openings of the same commitment.

Main definitions #

Main results #

References #

A commitment scheme (C, V) with public parameters ([BS23], Section 8.12, p. 344, and Definition 8.8):

  • encodeKey k: the encoded public parameter string presented to the adversary for key k. This encoding is injective: equal public strings determine the same key and hence the same valid messages, commitment distributions, and verification results. Injectivity is an information-theoretic condition; decoding and evaluating honest operations from this string need separate efficiency certificates.
  • ValidMessage k m: predicate characterizing valid message words m in the message space for key k.
  • commitDist k msg: the distribution of (c, o) (encoded commitment string c and encoded opening string o) produced by C(msg) under key k. commitDist is modeled as a PMF rather than a ProbComp so that group-based schemes such as Pedersen commitment can use the exact uniform distribution on ZMod q (matching DiscreteLog's PMF setup; strict-PPT ProbComp machines sample ZMod q only approximately via sampleModNat).
  • verify k m c o: the deterministic verification algorithm V(m, c, o) returning true to accept or false to reject. Neither commitDist nor verify bundles a polynomial-time complexity certificate in CommitmentScheme, keeping the general scheme interface at the distributional layer; concrete instantiations certify their encoded evaluation and reduction algorithms separately (e.g., computableInPolyTime_encodePedersenCommit and isPPTOn_pedersenToDLAdversary).
  • validMessage_of_verify and verify_of_mem_support: verify accepts only valid message words and accepts every (c, o) in the support of commitDist k m for any valid message word m.

Chosen-message hiding reuses Encryption.WordAdversary (Encryption.AdversaryOf (List Bool) from CslibFrontier/Crypto/Computational/Encryption/Basic.lean), matching Boneh–Shoup's semantic-security formulation of commitment hiding.

noncomputable def Cslib.Crypto.CommitmentScheme.hidingForKey {Key : Type} (S : CommitmentScheme Key) (k : Key) (adversary : Encryption.WordAdversary) (bit : Bool) (n : ℕ) :

The chosen-message hiding experiment ([BS23], Section 8.12, p. 344, and Definition 8.8) at a fixed commitment key k : Key for hidden bit bit : Bool: the adversary receives S.encodeKey k, chooses ((m₀, m₁), st), and receives the commitment string c = co.1 (without the opening co.2) for co ← S.commitDist k m_bit. Following Boneh–Shoup Section 8.12 (m₀, m₁ ∈ M), the challenger commits to m_bit when both chosen words satisfy S.ValidMessage k, and defaults to m₀ otherwise so that invalid challenge pairs produce identical distributions in both worlds.

theorem Cslib.Crypto.CommitmentScheme.hidingForKey_eq_of_map_fst_commitDist_eq {Key : Type} (S : CommitmentScheme Key) {k : Key} (hk : ∀ (msg₁ msg₂ : List Bool), PMF.map Prod.fst (S.commitDist k msg₁) = PMF.map Prod.fst (S.commitDist k msg₂)) (adversary : Encryption.WordAdversary) (b₁ b₂ : Bool) (n : ℕ) :
S.hidingForKey k adversary b₁ n = S.hidingForKey k adversary b₂ n

If the commitment-string marginal (S.commitDist k msg).map Prod.fst is independent of the message word, then S.hidingForKey k produces the exact same output distribution for any two hidden bits b₁ and b₂, against every (even computationally unbounded) Encryption.WordAdversary.

theorem Cslib.Crypto.CommitmentScheme.advantage_hidingForKey_eq_zero {Key : Type} (S : CommitmentScheme Key) {k : Key} (hk : ∀ (msg₁ msg₂ : List Bool), PMF.map Prod.fst (S.commitDist k msg₁) = PMF.map Prod.fst (S.commitDist k msg₂)) (adversary : Encryption.WordAdversary) (n : ℕ) :
(S.hidingForKey k adversary false n).advantage (S.hidingForKey k adversary true n) = 0

When (S.commitDist k msg).map Prod.fst is independent of the message word, the hiding advantage of any (computationally unbounded) adversary at key k between bit = false and bit = true is 0.

noncomputable def Cslib.Crypto.CommitmentScheme.hidingGame {Key : Type} (S : CommitmentScheme Key) (keyDist : ℕ → PMF Key) (adversary : Encryption.WordAdversary) (bit : Bool) (n : ℕ) :

The chosen-message hiding experiment ([BS23], Section 8.12, p. 344, and Definition 8.8) under a key distribution keyDist : ℕ → PMF Key.

Statistical hiding ([BS23], Section 8.12, p. 344, and Definition 8.8): every (even computationally unbounded) Encryption.WordAdversary has negligible distinguishing advantage in S.hidingGame keyDist.

Computational hiding ([BS23], Section 8.12, p. 344, and Definition 8.8): every uniform strict PPT Encryption.WordAdversary has negligible distinguishing advantage in S.hidingGame keyDist.

Statistical hiding implies computational hiding against uniform strict PPT adversaries.

Boolean predicate testing whether (c, (m₀, o₀), (m₁, o₁)) is a valid binding collision under S.verify k ([BS23], Section 8.12, p. 344, and Definition 8.8): m₀ ≠ m₁ and both openings (m₀, o₀) and (m₁, o₁) are accepted by S.verify k for the commitment string c.

noncomputable def Cslib.Crypto.CommitmentScheme.bindingGame {Key : Type} (S : CommitmentScheme Key) (keyDist : ℕ → PMF Key) (adversary : ℕ → List Bool → ProbComp (List Bool × (List Bool × List Bool) × List Bool × List Bool)) (n : ℕ) :

The commitment binding experiment ([BS23], Section 8.12, p. 344, and Definition 8.8): draw k ← keyDist n, give S.encodeKey k to adversary, and accept when the output (c, (m₀, o₀), (m₁, o₁)) satisfies S.isBindingCollision k (m₀ ≠ m₁ and both openings verify under S.verify k).

def Cslib.Crypto.CommitmentScheme.Binding {Key : Type} (S : CommitmentScheme Key) (keyDist : ℕ → PMF Key) :

Computational binding ([BS23], Section 8.12, p. 344, and Definition 8.8): every uniform strict PPT adversary has negligible success probability in S.bindingGame keyDist.