Documentation

CslibFrontier.Crypto.Computational.PedersenCommitment

Pedersen commitments over a prime-order group family #

Over a PrimeOrderGroupFamily, Pedersen's commitment scheme ([Ped92], Section 3, Theorem 3.1; [BS23], Section 8.12, Definition 8.8, Section 10.6.1, Fact 10.3 and Theorem 10.4, and Exercise 20.5) uses a group description d and a public commitment key h = α • g : F.Carrier d generated by a secret exponent α : ZMod (F.order d). To commit to a message m : ZMod (F.order d) with randomness r : ZMod (F.order d), the committer computes

pedersenCommit d h m r = m • g + r • h.

On encoded group elements and natural-number exponents, encodePedersenCommit computes F.encode d (F.pedersenCommit d h m r) in polynomial time from (d, encode h, m, r) using F.encode d (F.generator d), F.smul, and F.add.

At a fixed group, pedersen d is the scheme as a typed Commitment.Scheme with keys, commitments in F.Carrier d, messages and openings in ZMod (F.order d). It is correct (pedersen_correct) and perfectly hiding at every key h ≠ 0 (pedersen_perfectlyHidingAt). Its hiding advantage is at most 1 / q, with the event α = 0 as the only loss (advantage_pedersen_hidingExperiment_le). Breaking its binding reduces exactly to the discrete-logarithm experiment dlExperiment (succProbability_pedersen_bindingExperiment_le).

The family results below are stated for the word-level CommitmentScheme instance pedersenScheme, with canonical binary message words (ValidPedersenMessage), commitment-and-opening pair law (pedersenCommitPairLaw) and verification algorithm pedersenVerify (V(m, c, o)). Its games draw d and then run the experiments of pedersen d (pedersenHidingGame_eq, pedersenBindingGame_eq), and its hiding bound is derived from the typed one. We establish:

  1. Algebraic and homomorphic laws (pedersenCommit_zero, pedersenCommit_add, pedersenCommit_neg, pedersenCommit_sub, pedersenCommit_smul) and polynomial-time encoded evaluation (encodePedersenCommit, encodePedersenCommit_encode, computableInPolyTime_encodePedersenCommit).
  2. Unconditional hiding (pedersenCommitLaw_eq_uniform_of_ne_zero, pedersenCommitLaw_eq_of_ne_zero, pedersen_perfectlyHidingAt, advantage_pedersen_hidingExperiment_le, pedersenHidingForKey_eq_of_ne_zero, advantage_pedersenHidingGame_le, negligible_advantage_pedersenHidingGame_ideal, pedersenScheme_statisticalHiding_ideal): for every non-identity commitment key h ≠ 0, a uniform blinding exponent r ← PMF.uniformOfFintype (ZMod (F.order d)) makes pedersenCommit d h m r uniformly distributed on F.Carrier d and independent of m. Consequently, at any fixed d and h ≠ 0, the chosen-message hiding distributions for bit = false and bit = true in F.pedersenScheme.hidingForKey ⟨d, h⟩ are identical against every (even computationally unbounded) two-stage adversary Encryption.WordAdversary. When the key exponent α ← PMF.uniformOfFintype (ZMod (F.order d)) is drawn uniformly from all of ZMod (F.order d) (matching discreteLogGame and [BS23], Exercise 20.5), the degenerate key α = 0 occurs with probability 1 / F.order d, bounding any unbounded adversary's hiding advantage in F.pedersenScheme.hidingGame (F.pedersenKeyDist setup) by 1 / m whenever supported groups have order at least m. That game draws the key exponent and the commitment randomness exactly uniformly at the PMF level, so its asymptotic hiding theorems are ideal-sampling steps; the hiding bound for the fair-coin samplers is negligible_advantage_pedersenHidingProbGame in CslibFrontier/Crypto/Computational/PedersenCommitment/ProbComp.lean.
  3. Computational binding under the discrete-logarithm assumption (pedersenVerify, inv_mul_eq_of_pedersenCommit_eq, succProbability_pedersen_bindingExperiment_le, extractNat_eq_of_pedersenCommit_eq, pedersenToDLAdversary, pedersenToDLAdversary_encode, succProbability_pedersenBindingGame_le_discreteLogGame, isPPTOn_pedersenToDLAdversary): any verified double opening (c, (m₀, o₀), (m₁, o₁)) with m₀ ≠ m₁ and pedersenVerify d h mᵢ c oᵢ = true for i ∈ {0, 1} under h = α • g has (ofBits m₀ : ZMod q) ≠ (ofBits m₁ : ZMod q), forces (ofBits o₀ : ZMod q) ≠ (ofBits o₁ : ZMod q), and yields α = (o₁ - o₀)⁻¹ * (m₀ - m₁) modulo q ([Ped92], Section 3, Theorem 3.1; [BS23], Section 10.6.1, Fact 10.3 and Theorem 10.4), computed in polynomial time via Fermat's little theorem as extractNat (F.order d) o₁ m₀ o₀ m₁ (CslibFrontier.Crypto.Computational.DiscreteLog.Extract). This gives an exact zero-loss reduction from F.pedersenScheme.bindingGame to discreteLogGame. The word reduction pedersenToDLAdversary checks the collision with the encoded verifier encodePedersenVerify and is, on every key, the typed reduction pedersenToDL run on the adversary read through pedersenCollisionOf (pedersenToDLAdversary_encode), so the word bound is the typed one at each group. The asymptotic binding theorem, for the fair-coin key law pedersenKeyDistProb, is DiscreteLog.pedersenScheme_binding_pedersenKeyDistProb in CslibFrontier/Crypto/Computational/PedersenCommitment/ProbComp.lean.

Main definitions #

Main results #

Ideal-sampling steps #

The games under the key law F.pedersenKeyDist setup draw the key exponent exactly uniformly at the PMF level, and the hiding game also draws the commitment randomness that way. These results are steps toward the theorems of CslibFrontier/Crypto/Computational/PedersenCommitment/ProbComp.lean, which sample with sampleExp, not the cited results.

References #

Algebraic and encoded Pedersen commitments #

Algebraic Pedersen commitment ([Ped92], Section 3; [BS23], Section 10.6.1 and Exercise 20.5): commit to message m : ZMod (F.order d) with randomness r : ZMod (F.order d) under commitment key h : F.Carrier d as m • g + r • h.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenCommit_add (F : PrimeOrderGroupFamily) (d : F.Desc) (h : F.Carrier d) (m₁ r₁ m₂ r₂ : ZMod (F.order d)) :
F.pedersenCommit d h (m₁ + m₂) (r₁ + r₂) = F.pedersenCommit d h m₁ r₁ + F.pedersenCommit d h m₂ r₂

Additive homomorphism of Pedersen commitments: committing to (m₁ + m₂, r₁ + r₂) equals the sum of the individual commitments.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenCommit_sub (F : PrimeOrderGroupFamily) (d : F.Desc) (h : F.Carrier d) (m₁ r₁ m₂ r₂ : ZMod (F.order d)) :
F.pedersenCommit d h (m₁ - m₂) (r₁ - r₂) = F.pedersenCommit d h m₁ r₁ - F.pedersenCommit d h m₂ r₂
theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenCommit_smul (F : PrimeOrderGroupFamily) (d : F.Desc) (h : F.Carrier d) (c m r : ZMod (F.order d)) :
F.pedersenCommit d h (c * m) (c * r) = c • F.pedersenCommit d h m r

Scalar-multiplication homomorphism of Pedersen commitments.

Under a commitment key h = α • g, pedersenCommit d (α • g) m r = (m + r * α) • g.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenCommit_smul_generator_eq_iff (F : PrimeOrderGroupFamily) (d : F.Desc) (α m₀ r₀ m₁ r₁ : ZMod (F.order d)) :
F.pedersenCommit d (α • F.generator d) m₀ r₀ = F.pedersenCommit d (α • F.generator d) m₁ r₁ ↔ m₀ + r₀ * α = m₁ + r₁ * α

Two openings (m₀, r₀) and (m₁, r₁) produce the same commitment under h = α • g if and only if m₀ + r₀ * α = m₁ + r₁ * α in ZMod (F.order d).

Pedersen commitment on encoded group elements: given (d, encode h, m, r), compute encode (m • g + r • h).

@[simp]

encodePedersenCommit computes F.encode d (F.pedersenCommit d h m r) on encoded group elements.

Unconditional hiding and CommitmentScheme packaging #

The distribution of F.pedersenCommit d h m r when r is drawn uniformly from ZMod (F.order d).

Perfect hiding for any non-identity commitment key h ≠ 0 ([Ped92], Section 3, Theorem 3.1): for every message m : ZMod (F.order d), F.pedersenCommitLaw d h m equals the uniform distribution (PMF.uniformOfFintype (ZMod (F.order d))).map (· • F.generator d) on F.Carrier d.

Perfect hiding ([Ped92], Section 3, Theorem 3.1): for any h ≠ 0 and any two messages m₀, m₁ : ZMod (F.order d), the commitment distributions F.pedersenCommitLaw d h m₀ and F.pedersenCommitLaw d h m₁ are identical.

theorem Cslib.Crypto.PrimeOrderGroupFamily.uniform_pedersenCommit (F : PrimeOrderGroupFamily) {β : Type u_1} (d : F.Desc) {h : F.Carrier d} (hh : h ≠ 0) (m : ZMod (F.order d)) (f : F.Carrier d → PMF β) :
((Probability.PMF.uniformOfFintype (ZMod (F.order d))).bind fun (r : ZMod (F.order d)) => f (F.pedersenCommit d h m r)) = (Probability.PMF.uniformOfFintype (ZMod (F.order d))).bind fun (γ : ZMod (F.order d)) => f (γ • F.generator d)

Bind form of pedersenCommitLaw_eq_uniform_of_ne_zero: for any h ≠ 0 and message m, sampling r ← PMF.uniformOfFintype (ZMod (F.order d)) and passing F.pedersenCommit d h m r to a continuation f has the same distribution as sampling γ ← PMF.uniformOfFintype (ZMod (F.order d)) and passing γ • F.generator d.

Typed Pedersen commitments at a fixed group #

Pedersen's commitment scheme in the group F.Carrier d ([Ped92], Section 3; [BS23], Section 10.6.1 and Exercise 20.5). Key generation draws a uniform exponent α and publishes h = α • g. Committing to m draws a uniform opening r and returns pedersenCommit d h m r = m • g + r • h. Verification recomputes the commitment.

@[simp]
theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersen_verify (F : PrimeOrderGroupFamily) (d : F.Desc) (h c : F.Carrier d) (m r : ZMod (F.order d)) :
(F.pedersen d).verify h m c r = decide (F.pedersenCommit d h m r = c)

Pedersen commitments are correct: every honest opening verifies.

The Pedersen commitment to m under h is distributed as pedersenCommitLaw d h m.

Perfect hiding at a non-identity key ([Ped92], Section 3, Theorem 3.1): for h ≠ 0, the commitment is uniform on F.Carrier d whatever the message.

Key generation outputs the identity h = 0 exactly when it draws α = 0, which has probability 1 / q.

Hiding of Pedersen commitments ([Ped92], Section 3, Theorem 3.1; [BS23], Exercise 20.5). The only loss is the event that key generation draws α = 0 (succProbability_pedersen_keyGen_zero_eq_inv); every other key is perfectly hiding (pedersen_perfectlyHidingAt). So every adversary, even a computationally unbounded one, has hiding advantage at most 1 / q.

theorem Cslib.Crypto.PrimeOrderGroupFamily.ne_of_pedersenCommit_eq (F : PrimeOrderGroupFamily) {d : F.Desc} {α m₀ r₀ m₁ r₁ : ZMod (F.order d)} (hne : (m₀, r₀) ≠ (m₁, r₁)) (heq : F.pedersenCommit d (α • F.generator d) m₀ r₀ = F.pedersenCommit d (α • F.generator d) m₁ r₁) :
r₁ ≠ r₀

Two different openings of one Pedersen commitment under h = α • g use different randomness.

theorem Cslib.Crypto.PrimeOrderGroupFamily.inv_mul_eq_of_pedersenCommit_eq (F : PrimeOrderGroupFamily) {d : F.Desc} {α m₀ r₀ m₁ r₁ : ZMod (F.order d)} (hne : (m₀, r₀) ≠ (m₁, r₁)) (heq : F.pedersenCommit d (α • F.generator d) m₀ r₀ = F.pedersenCommit d (α • F.generator d) m₁ r₁) :
(r₁ - r₀)⁻¹ * (m₀ - m₁) = α

Two openings of one Pedersen commitment reveal the discrete logarithm ([Ped92], Section 3, Theorem 3.1; [BS23], Section 10.6.1, Fact 10.3): if (m₀, r₀) ≠ (m₁, r₁) give the same commitment under h = α • g, then α = (r₁ - r₀)⁻¹ * (m₀ - m₁).

A Pedersen binding collision under h = α • g reveals α.

The discrete-logarithm adversary built from a Pedersen binding adversary: run it with the instance h as the commitment key and read α off the two openings ([BS23], Section 10.6.1, Theorem 10.4).

Exact binding-to-discrete-logarithm reduction ([BS23], Section 10.6.1, Theorem 10.4; [Ped92], Section 3, Theorem 3.1): whenever the binding adversary opens one commitment to two messages, pedersenToDL outputs the discrete logarithm of the key.

A message word m : List Bool is a canonical Pedersen message for group description d if ofBits m < F.order d and m is the canonical binary representation (ofBits m).bits. Requiring canonical binary representation ensures that distinct message words in the message space represent distinct elements of ZMod (F.order d).

The distribution of (F.encode d (F.pedersenCommit d h m r), r.val.bits) (encoded commitment string and canonical binary opening string) when r is drawn uniformly from ZMod (F.order d).

@[simp]

The commitment-string marginal of pedersenCommitPairLaw is (pedersenCommitLaw d h m).map (F.encode d).

Pedersen commitment verification V(m, c, o) ([BS23], Section 8.12, p. 344, and Section 10.6.1, p. 414; [Ped92], Section 3): verify that m is a canonical message word for d (ofBits m < F.order d and (ofBits m).bits = m) and that recomputing the commitment from (ofBits m, ofBits o) under (d, h) yields c.

Correctness of pedersenVerify: every (c, o) in the support of pedersenCommitPairLaw d h (ofBits m) for a canonical message word m is accepted by pedersenVerify d h m c o.

Boolean decision procedure for ValidPedersenMessage d m (ofBits m < F.order d and (ofBits m).bits = m).

Pedersen verification from (description, encoded public element), message, commitment and opening words. The public element is already encoded; no discrete logarithm or semantic group value is supplied to this algorithm.

@[simp]

The encoded verifier computes exactly the verifier used by pedersenScheme.

A Pedersen commitment key over F: public group parameters desc : F.Desc together with a public commitment key element element : F.Carrier desc.

  • desc : F.Desc

    Public group parameters selecting the group, its prime order and generator.

  • element : F.Carrier self.desc

    Public commitment key element h : F.Carrier desc.

theorem Cslib.Crypto.PrimeOrderGroupFamily.encPedersenKey_mk_inO (F : PrimeOrderGroupFamily) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → F.Desc} {T0 S0 : γ → ℕ} {x1 : (c : γ) → F.Carrier (x0 c)} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn F.encDesc T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => F.encode (x0 c) (x1 c)) encIn Turing.MultiTapeTM.encBits T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { desc := x0 x, element := x1 x }) encIn F.encPedersenKey (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.PrimeOrderGroupFamily.encPedersenKey_mk_budget (F : PrimeOrderGroupFamily) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → F.Desc} {x1 : (c : γ) → F.Carrier (x0 c)} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn F.encDesc budget) (h1 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => F.encode (x0 c) (x1 c)) encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { desc := x0 x, element := x1 x }) encIn F.encPedersenKey budget

Encoding of a PedersenKey: the framed group description F.encDesc k.desc followed by the encoded public element F.encode k.desc k.element (encPedersenKey_apply).

theorem Cslib.Crypto.PrimeOrderGroupFamily.encPedersenKey_mk_polyTime (F : PrimeOrderGroupFamily) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → F.Desc} {x1 : (c : γ) → F.Carrier (x0 c)} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn F.encDesc) (h1 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => F.encode (x0 c) (x1 c)) encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { desc := x0 x, element := x1 x }) encIn F.encPedersenKey
theorem Cslib.Crypto.PrimeOrderGroupFamily.encPedersenKey_element_budget (F : PrimeOrderGroupFamily) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → F.PedersenKey} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ F.encPedersenKey S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => F.encode (g✝ c).desc (g✝ c).element) encIn✝ Turing.MultiTapeTM.encBits S✝
theorem Cslib.Crypto.PrimeOrderGroupFamily.encPedersenKey_desc_budget (F : PrimeOrderGroupFamily) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → F.PedersenKey} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ F.encPedersenKey S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).desc) encIn✝ F.encDesc S✝

Draw d ← setup n and a uniform key exponent α ← PMF.uniformOfFintype (ZMod (F.order d)), returning the Pedersen key ⟨d, α • g⟩ ([BS23], Exercise 20.5, pp. 843–844).

Pedersen's commitment scheme as an instance of the general public-parameter CommitmentScheme ([BS23], Section 8.12, Definition 8.8, p. 344, and Section 10.6.1, p. 414; [Ped92], Section 3).

The typed hiding adversary run by a word-level one at the group d. It gives the word-level adversary the encoded key and reads its two message words as exponents, as pedersenScheme does. When either word is not a canonical message, both challenge messages are the first word, as hidingForKey commits to the first word then.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenHidingForKey_eq (F : PrimeOrderGroupFamily) (adversary : Encryption.WordAdversary) (b : Bool) (n : ℕ) (d : F.Desc) (h : F.Carrier d) :
F.pedersenScheme.hidingForKey { desc := d, element := h } adversary b n = ProbComp.eval (lrExperiment (fun (x : F.Carrier d) (x_1 x_2 : ZMod (F.order d)) => true) (F.pedersen d).commitment (F.pedersenHidingAdversary adversary n d) b h)

At the key ⟨d, h⟩, the word-level hiding experiment of pedersenScheme is the left-or-right experiment of pedersen d played by pedersenHidingAdversary.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenHidingGame_eq (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : Encryption.WordAdversary) (b : Bool) (n : ℕ) :
F.pedersenScheme.hidingGame (F.pedersenKeyDist setup) adversary b n = Game.withSetup (setup n) fun (d : F.Desc) => (F.pedersen d).hidingExperiment (F.pedersenHidingAdversary adversary n d) b

The word-level hiding game of pedersenScheme draws d, then runs the hiding experiment of pedersen d played by pedersenHidingAdversary.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenHidingForKey_eq_of_ne_zero (F : PrimeOrderGroupFamily) (d : F.Desc) {h : F.Carrier d} (hh : h ≠ 0) (adversary : Encryption.WordAdversary) (b₁ b₂ : Bool) (n : ℕ) :
F.pedersenScheme.hidingForKey { desc := d, element := h } adversary b₁ n = F.pedersenScheme.hidingForKey { desc := d, element := h } adversary b₂ n

For any non-identity commitment key h ≠ 0, F.pedersenScheme.hidingForKey ⟨d, h⟩ produces the exact same output distribution for any two hidden bits b₁ and b₂, against every (even computationally unbounded) Encryption.WordAdversary.

@[simp]
theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_pedersenHidingForKey_eq_zero (F : PrimeOrderGroupFamily) (d : F.Desc) {h : F.Carrier d} (hh : h ≠ 0) (adversary : Encryption.WordAdversary) (n : ℕ) :
(F.pedersenScheme.hidingForKey { desc := d, element := h } adversary false n).advantage (F.pedersenScheme.hidingForKey { desc := d, element := h } adversary true n) = 0

At any non-identity commitment key h ≠ 0, the hiding advantage of any (computationally unbounded) adversary between bit = false and bit = true is 0.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_pedersenHidingGame_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.pedersenKeyDist setup) adversary false n).advantage (F.pedersenScheme.hidingGame (F.pedersenKeyDist setup) adversary true n) ≤ 1 / ↑m

Unconditional hiding bound for Pedersen commitments: 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 in F.pedersenScheme.hidingGame (F.pedersenKeyDist setup). This is advantage_pedersen_hidingExperiment_le at each supported group.

theorem Cslib.Crypto.PrimeOrderGroupFamily.negligible_advantage_pedersenHidingGame_ideal (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.pedersenScheme.hidingGame (F.pedersenKeyDist setup) adversary false n).advantage (F.pedersenScheme.hidingGame (F.pedersenKeyDist setup) adversary true 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.pedersenKeyDist setup), whose key exponent and commitment randomness are drawn exactly uniformly at the PMF level (after [Ped92], Section 3, Theorem 3.1; [BS23], Section 8.12, Definition 8.8, and Exercise 20.5). The native CommitmentScheme form is blocked on #6133.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenScheme_statisticalHiding_ideal (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 F.pedersenKeyDist setup, where the key exponent and the commitment randomness are drawn exactly uniformly at the PMF level (after [Ped92], Section 3, Theorem 3.1; [BS23], Section 8.12, Definition 8.8, and Exercise 20.5). CommitmentScheme.commitDist takes no security parameter, so pedersenScheme cannot commit with the fair-coin sampler pedersenCommitProb (#6133).

Computational binding under the discrete-logarithm assumption #

theorem Cslib.Crypto.PrimeOrderGroupFamily.extractNat_eq_of_pedersenCommit_eq (F : PrimeOrderGroupFamily) (d : F.Desc) (α : ZMod (F.order d)) {m₀ r₀ m₁ r₁ : ℕ} (hne : (↑m₀, ↑r₀) ≠ (↑m₁, ↑r₁)) (heq : F.pedersenCommit d (α • F.generator d) ↑m₀ ↑r₀ = F.pedersenCommit d (α • F.generator d) ↑m₁ ↑r₁) :
↑(extractNat (F.order d) r₁ m₀ r₀ m₁) = α

Two openings of one Pedersen commitment reveal the discrete logarithm ([Ped92], Section 3, Theorem 3.1; [BS23], Section 10.6.1, Fact 10.3): if openings (m₀, r₀) ≠ (m₁, r₁), read in ZMod (F.order d), give the same commitment under h = α • g, then extractNat recovers α = (r₁ - r₀)⁻¹ * (m₀ - m₁). This is inv_mul_eq_of_pedersenCommit_eq on natural-number exponents.

Any valid Pedersen binding collision (c, (m₀, o₀), (m₁, o₁)) under h = α • g recovers α with extractNat ([Ped92], Section 3, Theorem 3.1; [BS23], Section 10.6.1, Fact 10.3).

Read a word-level double opening (c, (m₀, o₀), (m₁, o₁)) under the key ⟨d, h⟩ as a typed one. The messages and openings are read as exponents and the commitment is recomputed from the first opening. When the words are not a collision for pedersenScheme, the result is the trivial non-collision with equal messages.

@[simp]

The typed reading of a word-level double opening is a collision for pedersen d exactly when the words are a collision for pedersenScheme.

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenBindingGame_eq (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : ℕ → List Bool → ProbComp (List Bool × (List Bool × List Bool) × List Bool × List Bool)) (n : ℕ) :
F.pedersenScheme.bindingGame (F.pedersenKeyDist setup) adversary n = Game.withSetup (setup n) fun (d : F.Desc) => (F.pedersen d).bindingExperiment fun (h : F.Carrier d) => F.pedersenCollisionOf d h <$> adversary n (F.pedersenScheme.encodeKey { desc := d, element := h })

The word-level binding game of pedersenScheme draws d, then runs the binding experiment of pedersen d played by the word-level adversary read through pedersenCollisionOf.

Turn a pedersenScheme binding adversary into a discrete-logarithm adversary ([BS23], Section 10.6.1, Theorem 10.4, pp. 414–415). It gives the adversary the encoded Pedersen key encPair F.encDesc encBits input. When the reply (c, (m₀, o₀), (m₁, o₁)) is a binding collision, checked with encodePedersenVerify on the encoded key, it outputs α in binary, computed with extractNat from the two openings; otherwise it outputs [], the binary word of 0. On every key it is the typed reduction pedersenToDL run on the adversary read through pedersenCollisionOf (pedersenToDLAdversary_encode).

theorem Cslib.Crypto.PrimeOrderGroupFamily.pedersenToDLAdversary_encode (F : PrimeOrderGroupFamily) (adversary : ℕ → List Bool → ProbComp (List Bool × (List Bool × List Bool) × List Bool × List Bool)) (n : ℕ) (d : F.Desc) (h : F.Carrier d) :
F.pedersenToDLAdversary adversary n (d, F.encode d h) = (fun (α : ZMod (F.order d)) => α.val.bits) <$> F.pedersenToDL (fun (h : F.Carrier d) => F.pedersenCollisionOf d h <$> adversary n (F.pedersenScheme.encodeKey { desc := d, element := h })) h

The word reduction is the typed one: on the encoded key of any h, pedersenToDLAdversary runs the typed reduction pedersenToDL on the binding adversary read through pedersenCollisionOf, the reading of pedersenBindingGame_eq, and writes the exponent it outputs as the binary word of its canonical value.

Exact binding-to-discrete-logarithm reduction ([BS23], Section 10.6.1, Theorem 10.4, pp. 414–415; [Ped92], Section 3, Theorem 3.1): for every security parameter n, the success probability of adversary in F.pedersenScheme.bindingGame (F.pedersenKeyDist setup) is at most the discrete-logarithm success probability of pedersenToDLAdversary adversary. At each group d this is the typed bound succProbability_pedersen_bindingExperiment_le, through pedersenBindingGame_eq and pedersenToDLAdversary_encode.