Documentation

CslibFrontier.Crypto.Protocols.SigmaProtocol.UniqueResponses

Unique Responses and Strong Special Soundness for Sigma Protocols #

Formalizes unique responses and strong special soundness for SigmaProtocol ([BS23], Exercises 19.14(a)–(c) and 19.15(a), pp. 813–814).

Unique responses at a statement y (UniqueResponsesAt P y) ask that an accepting commitment and challenge determine the response uniquely; UniqueResponses P asks for this at every statement. StrongSpecialSoundness P R extract strengthens SpecialSoundness so the extractor succeeds on any two accepting conversations with the same commitment whose (c, z) pairs differ, not only when c ≠ c'.

For the generic linear protocol linear ψ u ι, linear_uniqueResponsesAt_iff characterizes unique responses at y as injectivity of ψ y when C is nonempty, giving specializations for schnorr, chaumPedersen, and linearSystem (where the homogeneous system has only the zero solution), together with schnorr_strongSpecialSoundness for prime q and g ≠ 0. Exercises 19.14(d), 19.15(b), and 19.16 (computational strong special soundness) are outside the scope of this module.

Main definitions #

Main results #

References #

Unique responses at one statement ([BS23], Exercise 19.14): two accepting conversations for y with the same commitment and the same challenge have the same response.

Unique responses ([BS23], Exercise 19.14): unique responses at every statement.

def Cslib.Crypto.Protocols.SigmaProtocol.StrongSpecialSoundness {X Y T C Z : Type u} (P : SigmaProtocol X Y T C Z) {W : Type u_1} (R : W → Y → Prop) (extract : Y → T → C → Z → C → Z → W) :

Strong special soundness ([BS23], Exercise 19.15): the extractor returns a witness from two accepting conversations with the same commitment that differ in the challenge or in the response.

theorem Cslib.Crypto.Protocols.SigmaProtocol.UniqueResponsesAt.challenge_ne {X Y T C Z : Type u} {P : SigmaProtocol X Y T C Z} {y : Y} (hu : P.UniqueResponsesAt y) {t : T} {c c' : C} {z z' : Z} (hne : (c, z) ≠ (c', z')) (hz : P.Accepts y t c z) (hz' : P.Accepts y t c' z') :
c ≠ c'

With unique responses at y, two accepting conversations with the same commitment and distinct (c, z) pairs must differ in the challenge.

theorem Cslib.Crypto.Protocols.SigmaProtocol.StrongSpecialSoundness.specialSoundness {X Y T C Z : Type u} {P : SigmaProtocol X Y T C Z} {W : Type u_1} {R : W → Y → Prop} {extract : Y → T → C → Z → C → Z → W} (h : P.StrongSpecialSoundness R extract) :
P.SpecialSoundness R extract

Strong special soundness implies special soundness, with the same extractor.

theorem Cslib.Crypto.Protocols.SigmaProtocol.SpecialSoundness.strong {X Y T C Z : Type u} {P : SigmaProtocol X Y T C Z} {W : Type u_1} {R : W → Y → Prop} {extract : Y → T → C → Z → C → Z → W} (h : P.SpecialSoundness R extract) (hu : P.UniqueResponses) :

Exercise 19.15(a) ([BS23], p. 814): special soundness and unique responses give strong special soundness, with the same extractor.

theorem Cslib.Crypto.Protocols.SigmaProtocol.linear_uniqueResponsesAt {q : ℕ} {M N Y C : Type u} [AddCommGroup M] [Module (ZMod q) M] [Fintype M] [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → M →ₗ[ZMod q] N) (u : Y → N) (ι : C ↪ ZMod q) {y : Y} (h : Function.Injective ⇑(ψ y)) :

The sufficient direction of linear_uniqueResponsesAt_iff, kept separately because it needs no [Nonempty C] hypothesis.

theorem Cslib.Crypto.Protocols.SigmaProtocol.linear_uniqueResponsesAt_iff {q : ℕ} {M N Y C : Type u} [AddCommGroup M] [Module (ZMod q) M] [Fintype M] [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → M →ₗ[ZMod q] N) (u : Y → N) (ι : C ↪ ZMod q) [Nonempty C] {y : Y} :

Exercise 19.14(c) ([BS23], p. 814): when C is nonempty, the linear protocol has unique responses at y exactly when ψ y is injective (its homogeneous system has only the trivial solution). The exercise asks for the sufficient direction; linearSystem_uniqueResponsesAt_iff states it for the book's systems.

theorem Cslib.Crypto.Protocols.SigmaProtocol.schnorr_uniqueResponses {q : ℕ} [NeZero q] {G C : Type} [AddCommGroup G] [Module (ZMod q) G] [DecidableEq G] {ι : C ↪ ZMod q} {g : G} (hg : Function.Injective fun (r : ZMod q) => r • g) :

Exercise 19.14(a) ([BS23], p. 813): Schnorr's protocol has unique responses when r ↦ r • g is injective.

With at least one challenge, unique responses of Schnorr's protocol at any single statement force r ↦ r • g to be injective.

Exercise 19.14(b) ([BS23], p. 813): the Chaum–Pedersen protocol has unique responses when r ↦ r • g is injective, at every statement (Diffie–Hellman triple or not).

theorem Cslib.Crypto.Protocols.SigmaProtocol.linearSystem_uniqueResponsesAt_iff {q : ℕ} [NeZero q] {G C : Type} [AddCommGroup G] [Module (ZMod q) G] [DecidableEq G] {ι : C ↪ ZMod q} [Nonempty C] {m n : ℕ} {s : (Fin m → Fin n → G) × (Fin m → G)} :
(linearSystem ι m n).UniqueResponsesAt s ↔ ∀ (α : Fin n → ZMod q), (∀ (i : Fin m), ∑ j : Fin n, α j • s.1 i j = 0) → α = 0

Exercise 19.14(c) ([BS23], p. 814) for linearSystem: when C is nonempty, unique responses hold at the system s exactly when its homogenized form has only the trivial solution. The exercise asks for the sufficient direction and prints the unique solution as α_j = 1; the trivial solution, which is what this condition states, has every α_j = 0.

theorem Cslib.Crypto.Protocols.SigmaProtocol.schnorr_strongSpecialSoundness {q : ℕ} [NeZero q] {G C : Type} [AddCommGroup G] [Module (ZMod q) G] [DecidableEq G] {ι : C ↪ ZMod q} {g : G} [Fact (Nat.Prime q)] (hg : g ≠ 0) :
(schnorr ι g).StrongSpecialSoundness (fun (α : ZMod q) (u : G) => α • g = u) (linearExtract ι)

Schnorr's protocol has strong special soundness ([BS23], Exercises 19.14(a) and 19.15(a), pp. 813–814) with linearExtract. Exercise 19.17(a) ([BS23], p. 815) derives strongly secure Fiat–Shamir signatures from special soundness and unique responses; the library does not yet prove it.