Documentation

CslibFrontier.Crypto.Computational.PedersenCommitment.ProbComp

Fair-coin realization of Pedersen commitments and key generation #

PrimeOrderGroupFamily.pedersenCommitProb and PrimeOrderGroupFamily.pedersenKeyGenProb sample their exponents using the bounded sampleExp program (ProbComp.sampleModNat) and evaluate the public commitment and key-generation operations. Their native strict-PPT certificates charge the unary accuracy parameter, the group description or advertised public-key encoding pedersenScheme.encodeKey, and the message word. Each sampleExp draw uses n + |encNat q| fair bits for q = F.order d, within statistical distance 1 / 2 ^ n of exact uniform on ZMod q, and every opening has at most |encNat q| bits.

Replacing ideal commitment sampling (pedersenScheme.commitDist) with pedersenCommitProb, or ideal key generation (pedersenKeyDist) with pedersenKeyDistProb, changes any randomized Boolean continuation by at most 1 / 2 ^ n. Combining this with the exact hiding and binding reductions in PedersenCommitment.lean yields concrete and asymptotic hiding and binding bounds for:

Main definitions #

Main results #

Ideal-sampling step #

pedersenScheme.hidingGame (F.pedersenKeyDistProb setup) draws the commitment randomness exactly uniformly at the PMF level, so the results about it are steps toward negligible_advantage_pedersenHidingProbGame, not the cited result.

Sample a bounded approximately uniform exponent, then evaluate Pedersen's public commitment operations on its canonical bit representation. The accuracy parameter controls the sampling error; the ideal law remains pedersenScheme.commitDist.

The sampled output is the existing Pedersen commitment-and-opening map applied to the approximately uniform residue law.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_bind_pedersenCommitProb_le (F : PrimeOrderGroupFamily) (n : ℕ) (key : F.PedersenKey) (message : List Bool) (continuation : List Bool × List Bool → Game) :
Game.advantage ((F.pedersenCommitProb n key message).eval.bind continuation) ((F.pedersenScheme.commitDist key message).bind continuation) ≤ 1 / 2 ^ n

Every randomized Boolean continuation changes by at most 1 / 2 ^ n when the sampled commitment is replaced with the existing ideal commitment law.

A sampled commitment and opening verify whenever the message is valid.

Every supported opening has at most the bit length of the public group order.

Bounded fair-coin Pedersen key generation #

Sample a bounded approximately uniform key exponent α ← F.sampleExp n d and return the Pedersen commitment key ⟨d, (α : ZMod (F.order d)) • F.generator d⟩.

theorem Cslib.Crypto.PrimeOrderGroupFamily.eval_pedersenKeyGenProb (F : PrimeOrderGroupFamily) (n : ℕ) (d : F.Desc) :
(F.pedersenKeyGenProb n d).eval = PMF.map (fun (α : ZMod (F.order d)) => { desc := d, element := α • F.generator d }) (PMF.map Nat.cast (F.sampleExp n d).eval)

The output law of pedersenKeyGenProb n d is the key map α ↦ ⟨d, α • g⟩ applied to the approximately uniform residue law (ProbComp.eval (F.sampleExp n d)).map Nat.cast.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_bind_pedersenKeyGenProb_le (F : PrimeOrderGroupFamily) (n : ℕ) (d : F.Desc) (continuation : F.PedersenKey → Game) :
Game.advantage ((F.pedersenKeyGenProb n d).eval.bind continuation) ((Probability.PMF.uniformOfFintype (ZMod (F.order d))).bind fun (α : ZMod (F.order d)) => continuation { desc := d, element := α • F.generator d }) ≤ 1 / 2 ^ n

Every randomized Boolean continuation changes by at most 1 / 2 ^ n when pedersenKeyGenProb is replaced by an exact uniform exponent α ← PMF.uniformOfFintype (ZMod (F.order d)).

Draw d ← setup n and run F.pedersenKeyGenProb n d to sample a Pedersen key using bounded fair-coin exponent sampling.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_bind_pedersenKeyDistProb_le (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (n : ℕ) (continuation : F.PedersenKey → Game) :
Game.advantage ((F.pedersenKeyDistProb setup n).bind continuation) ((F.pedersenKeyDist setup n).bind continuation) ≤ 1 / 2 ^ n

Replacing pedersenKeyDistProb setup n with the ideal key distribution pedersenKeyDist setup n changes any Boolean game continuation by at most 1 / 2 ^ n.

Chosen-message hiding and binding for pedersenCommitProb and pedersenKeyDistProb #

Chosen-message hiding at a fixed Pedersen key key when the challenger samples the challenge commitment using F.pedersenCommitProb n key msg instead of the ideal commitDist.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_pedersenHidingProbForKey_le_of_ne_zero (F : PrimeOrderGroupFamily) (d : F.Desc) {h : F.Carrier d} (hh : h ≠ 0) (adversary : Encryption.WordAdversary) (n : ℕ) :
(F.pedersenHidingProbForKey { desc := d, element := h } adversary false n).advantage (F.pedersenHidingProbForKey { desc := d, element := h } adversary true n) ≤ 2 / 2 ^ n

For any non-identity commitment key h ≠ 0, any (even computationally unbounded) Encryption.WordAdversary has distinguishing advantage at most 2 / 2 ^ n between bit = false and bit = true in pedersenHidingProbForKey ⟨d, h⟩.

Chosen-message hiding game where both key generation (pedersenKeyDistProb setup n) and challenge commitment sampling (pedersenCommitProb) use bounded fair-coin exponent sampling.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_pedersenHidingProbGame_le (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : Encryption.WordAdversary) (n m : ℕ) (hm0 : 0 < m) (hm : ∀ d ∈ (setup n).support, m ≤ F.order d) :
(F.pedersenHidingProbGame setup adversary false n).advantage (F.pedersenHidingProbGame setup adversary true n) ≤ 1 / ↑m + 4 / 2 ^ n

Unconditional hiding bound for pedersenHidingProbGame: when every supported group at parameter n has order at least m > 0, any (even computationally unbounded) Encryption.WordAdversary has distinguishing advantage at most 1 / m + 4 / 2 ^ n in pedersenHidingProbGame.

theorem Cslib.Crypto.PrimeOrderGroupFamily.negligible_advantage_pedersenHidingProbGame (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : Encryption.WordAdversary) {m : ℕ → ℕ} (hm0 : ∀ (n : ℕ), 0 < m n) (hm : ∀ (n : ℕ), ∀ d ∈ (setup n).support, m n ≤ F.order d) (hinv : Negligible fun (n : ℕ) => 1 / ↑(m n)) :
Negligible fun (n : ℕ) => (F.pedersenHidingProbGame setup adversary false n).advantage (F.pedersenHidingProbGame setup adversary true n)

Asymptotic unconditional hiding for pedersenHidingProbGame: when every supported group at parameter n has order at least m n > 0 and 1 / m n is negligible, every (even computationally unbounded) Encryption.WordAdversary has negligible advantage in pedersenHidingProbGame.

Executable ProbComp Bool hiding experiment at group description d: sample a key with pedersenKeyGenProb n d, run adversary.choose on the encoded key, check message validity with validPedersenMessageBool, sample the challenge commitment with pedersenCommitProb, and run adversary.guess.

Evaluating pedersenHidingProbExperiment at a fixed group description d runs pedersenKeyGenProb n d followed by pedersenHidingProbForKey.

theorem Cslib.Crypto.PrimeOrderGroupFamily.bind_eval_pedersenHidingProbExperiment (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : Encryption.WordAdversary) (bit : Bool) (n : ℕ) :
((setup n).bind fun (d : F.Desc) => (F.pedersenHidingProbExperiment adversary bit n d).eval) = F.pedersenHidingProbGame setup adversary bit n

Averaging pedersenHidingProbExperiment over d ← setup n yields pedersenHidingProbGame.

pedersenHidingProbExperiment is uniformly strict PPT in (n, d) whenever adversary is a uniform strict PPT Encryption.WordAdversary.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_pedersenHidingGame_pedersenKeyDistProb_le (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : Encryption.WordAdversary) (n m : ℕ) (hm0 : 0 < m) (hm : ∀ d ∈ (setup n).support, m ≤ F.order d) :
(F.pedersenScheme.hidingGame (F.pedersenKeyDistProb setup) adversary false n).advantage (F.pedersenScheme.hidingGame (F.pedersenKeyDistProb setup) adversary true n) ≤ 1 / ↑m + 2 / 2 ^ n

Unconditional hiding bound for pedersenScheme under pedersenKeyDistProb: when every supported group at parameter n has order at least m > 0, any (even computationally unbounded) Encryption.WordAdversary has distinguishing advantage at most 1 / m + 2 / 2 ^ n in F.pedersenScheme.hidingGame (F.pedersenKeyDistProb setup).

theorem Cslib.Crypto.PrimeOrderGroupFamily.negligible_advantage_pedersenHidingGame_ideal_pedersenKeyDistProb (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : Encryption.WordAdversary) {m : ℕ → ℕ} (hm0 : ∀ (n : ℕ), 0 < m n) (hm : ∀ (n : ℕ), ∀ d ∈ (setup n).support, m n ≤ F.order d) (hinv : Negligible fun (n : ℕ) => 1 / ↑(m n)) :

Ideal-sampling step toward negligible_advantage_pedersenHidingProbGame, not the cited result: when every supported group at parameter n has order at least m n > 0 and 1 / m n is negligible, every (even computationally unbounded) Encryption.WordAdversary has negligible advantage in F.pedersenScheme.hidingGame (F.pedersenKeyDistProb setup), which samples the key with sampleExp but draws the commitment randomness exactly uniformly at the PMF level. The native CommitmentScheme form is blocked on #6133.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenScheme_statisticalHiding_ideal_pedersenKeyDistProb (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) {m : ℕ → ℕ} (hm0 : ∀ (n : ℕ), 0 < m n) (hm : ∀ (n : ℕ), ∀ d ∈ (setup n).support, m n ≤ F.order d) (hinv : Negligible fun (n : ℕ) => 1 / ↑(m n)) :

Ideal-sampling step toward negligible_advantage_pedersenHidingProbGame, not the cited result: pedersenScheme is statistically hiding (CommitmentScheme.StatisticalHiding) under the key law pedersenKeyDistProb setup, which samples the key with sampleExp, while pedersenScheme.commitDist still draws the commitment randomness exactly uniformly at the PMF level, because CommitmentScheme.commitDist takes no security parameter (#6133).

Binding-to-discrete-logarithm bound under pedersenKeyDistProb: at parameter n, the binding success probability under pedersenKeyDistProb setup is at most the discrete-logarithm success probability of pedersenToDLAdversary adversary plus 1 / 2 ^ n.

Computational binding (CommitmentScheme.Binding) of pedersenScheme under pedersenKeyDistProb and the discrete-logarithm assumption.