Documentation

CslibFrontier.Crypto.Protocols.SigmaProtocol.LanguageReduction

Language reductions and derived Sigma protocols #

Pullback of a Sigma protocol P' for R' along a witness map f : X → Y → X' and a statement map g : Y → Y' ([BS23], Section 20.2, p. 829). The derived protocol P'.comap f g runs P' on (f x y, g y) for the prover and on g y for the verifier, keeping commitments, challenges and responses unchanged.

A LanguageReduction R R' f g requires: (i) (f x y, g y) is in R' whenever (x, y) is in R (map_rel); (ii) y has some witness in R whenever g y has one in R' (exists_of_exists_map).

Complete.comap and SpecialHVZK.comap depend only on condition (i). SpecialSoundness.comap transfers special soundness to the relation "w is a witness of g y" without hypotheses on the maps; SpecialSoundness.mapWitness maps the extracted witness back to R when a witness map k : W → Y → W' is given.

Unlike Cslib.Complexity.LevinReduction (CslibFrontier/Computability/Complexity/Reduction/Levin.lean) and ZKProof.withRelationWitness (CslibFrontier/Crypto/Computational/ZeroKnowledge/Levin.lean), which act on encoded NP relations and include a polynomial-time backward witness map, LanguageReduction works on typed relations without encodings or decision procedures and does not require recovering witnesses of y from witnesses of g y.

Main definitions #

Main results #

structure Cslib.Crypto.Protocols.SigmaProtocol.LanguageReduction {X : Type u_1} {Y : Type u_2} {X' : Type u_3} {Y' : Type u_4} (R : X → Y → Prop) (R' : X' → Y' → Prop) (f : X → Y → X') (g : Y → Y') :

A language reduction from R to R' ([BS23], Section 20.2): a curried witness map f : X → Y → X' (taking x and y separately rather than as a pair (x, y)) and a statement map g : Y → Y' such that (i) f sends a witness of y to a witness of g y, and (ii) g y is a true statement of R' only if y is a true statement of R. Unlike the book's maps, the predicate does not ask for f or g to be efficiently computable; word representations appear as hypotheses on the transfers in CslibFrontier/Crypto/Protocols/SigmaProtocol/LanguageReduction/Efficient.lean.

  • map_rel (x : X) (y : Y) : R x y → R' (f x y) (g y)

    Condition (i).

  • exists_of_exists_map (y : Y) : (∃ (x' : X'), R' x' (g y)) → ∃ (x : X), R x y

    Condition (ii).

theorem Cslib.Crypto.Protocols.SigmaProtocol.LanguageReduction.of_witnessMap {X : Type u_1} {Y : Type u_2} {X' : Type u_3} {Y' : Type u_4} {R : X → Y → Prop} {R' : X' → Y' → Prop} {f : X → Y → X'} {g : Y → Y'} (hf : ∀ (x : X) (y : Y), R x y → R' (f x y) (g y)) (k : X' → Y → X) (hk : ∀ (x' : X') (y : Y), R' x' (g y) → R (k x' y) y) :

A witness map back gives condition (ii).

def Cslib.Crypto.Protocols.SigmaProtocol.comap {X Y X' Y' T C Z : Type u} (P' : SigmaProtocol X' Y' T C Z) (f : X → Y → X') (g : Y → Y') :
SigmaProtocol X Y T C Z

The protocol for statements Y and witnesses X obtained from a protocol P' for statements Y' and witnesses X' along a witness map f and a statement map g ([BS23], Section 20.2): the prover on (x, y) is the prover of P' on (f x y, g y), and the verifier on y is the verifier of P' on g y. Commitments, challenges and responses are unchanged.

@[simp]
theorem Cslib.Crypto.Protocols.SigmaProtocol.comap_transcript {X Y X' Y' T C Z : Type u} (P' : SigmaProtocol X' Y' T C Z) (f : X → Y → X') (g : Y → Y') (x : X) (y : Y) (c : C) :
(P'.comap f g).transcript x y c = P'.transcript (f x y) (g y) c
theorem Cslib.Crypto.Protocols.SigmaProtocol.Complete.comap {X Y X' Y' T C Z : Type u} {P' : SigmaProtocol X' Y' T C Z} {f : X → Y → X'} {g : Y → Y'} {R : X → Y → Prop} {R' : X' → Y' → Prop} (h : P'.Complete R') (hf : ∀ (x : X) (y : Y), R x y → R' (f x y) (g y)) :
(P'.comap f g).Complete R

Completeness is inherited under condition (i).

theorem Cslib.Crypto.Protocols.SigmaProtocol.SpecialHVZK.comap {X Y X' Y' T C Z : Type u} {P' : SigmaProtocol X' Y' T C Z} {f : X → Y → X'} {g : Y → Y'} {R : X → Y → Prop} {R' : X' → Y' → Prop} {simulate : Y' → C → PMF (T × Z)} (h : P'.SpecialHVZK R' simulate) (hf : ∀ (x : X) (y : Y), R x y → R' (f x y) (g y)) :
(P'.comap f g).SpecialHVZK R fun (y : Y) => simulate (g y)

Special HVZK is inherited under condition (i), with the simulator of P' run on g y.

theorem Cslib.Crypto.Protocols.SigmaProtocol.SpecialSoundness.comap {X Y 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) (f : X → Y → X') (g : Y → Y') :
(P'.comap f g).SpecialSoundness (fun (w : W) (y : Y) => R' w (g y)) fun (y : Y) => extract (g y)

Special soundness is inherited for the relation "w is a witness of g y", with the extractor of P' run on g y. No condition on the maps is needed, and the extracted witness is one of R', not of R.

theorem Cslib.Crypto.Protocols.SigmaProtocol.SpecialSoundness.mapWitness {X Y T C Z : Type u} {P : SigmaProtocol X Y T C Z} {W : Type u_1} {W' : Type u_2} {R : W → Y → Prop} {R' : W' → Y → Prop} {extract : Y → T → C → Z → C → Z → W} (h : P.SpecialSoundness R extract) (k : W → Y → W') (hk : ∀ (w : W) (y : Y), R w y → R' (k w y) y) :
P.SpecialSoundness R' fun (y : Y) (t : T) (c : C) (z : Z) (c' : C) (z' : Z) => k (extract y t c z c' z') y

Post-process the extracted witness by a map that preserves the relation at every statement.

theorem Cslib.Crypto.Protocols.SigmaProtocol.LanguageReduction.complete {X Y X' Y' T C Z : Type u} {P' : SigmaProtocol X' Y' T C Z} {f : X → Y → X'} {g : Y → Y'} {R : X → Y → Prop} {R' : X' → Y' → Prop} (h : LanguageReduction R R' f g) (hP : P'.Complete R') :
(P'.comap f g).Complete R

A language reduction gives a complete protocol (this is Complete.comap at h.map_rel, which needs condition (i) only).

theorem Cslib.Crypto.Protocols.SigmaProtocol.LanguageReduction.specialHVZK {X Y X' Y' T C Z : Type u} {P' : SigmaProtocol X' Y' T C Z} {f : X → Y → X'} {g : Y → Y'} {R : X → Y → Prop} {R' : X' → Y' → Prop} (h : LanguageReduction R R' f g) {simulate : Y' → C → PMF (T × Z)} (hP : P'.SpecialHVZK R' simulate) :
(P'.comap f g).SpecialHVZK R fun (y : Y) => simulate (g y)

A language reduction gives a special HVZK protocol (this is SpecialHVZK.comap at h.map_rel, which needs condition (i) only).