Documentation

CslibFrontier.Crypto.Computational.DiffieHellman.ListCDH

The list form of the Computational Diffie–Hellman problem in a fixed group #

A list adversary receives a • g and b • g and returns a list of group elements; it wins when the Diffie–Hellman value (a * b) • g is among the first Q entries of its list. A CDH adversary that runs it and returns the entry at a uniformly chosen position below Q is right with at least 1 / Q of that probability, since it cannot recognize the right entry. This is the guessing step of [BS23] in Section 21.11.4 (p. 908), where the list is the adversary's random-oracle queries and the book states only a "non-negligible (though smaller)" chance, and in the proof of Theorem 11.4 (Section 11.5.1, pp. 446–448), where it is the source of the factor Q: choosing one of at most Q queries at random gives CDHadv[Bcdh, G] ≥ Pr[Z] / Q, equation (11.12).

The reduction listCDHToCDH takes its index sampler as an argument, and the analysis is general in its law: eval_listCDHExperiment_le_mul_add_of_index bounds the list experiment by c times the CDH experiment of listCDHToCDH plus ε for every index sampler such that, for each of the first Q entries of every list, c times the probability of selecting it, plus ε, is at least 1; eval_listCDHExperiment_le_mul is its case ε = 0. An exactly uniform index below Q gives c = Q and ε = 0 (listCDHAdvantage_le_mul_cdhAdvantage). A machine with fair coins cannot draw an exactly uniform index below every Q. It can draw Cslib.ProbComp.sampleModIndex width Q: the residue modulo Q of a number written with width fair coins, capped at Q (which matters only at Q = 0). Each position below Q is drawn with probability at least 1 / Q - 1 / 2 ^ width (Cslib.ProbComp.one_le_mul_eval_sampleModNat_add), so the reduction keeps the factor Q and adds the term Q / 2 ^ width (eval_listCDHExperiment_le_mul_add), for every width and every Q. The efficient reduction over a prime-order group family draws its index this way; it, its certificate, its bound and the conclusion under the CDH assumption are in CslibFrontier/Crypto/Computational/DiffieHellman/ListCDHFamily.lean.

No hypothesis restricts Q or the adversary's lists:

Differences from the book:

The book names neither the problem nor the reduction: "list CDH" and the names of all declarations here are this library's names.

Main definitions #

Main results #

References #

def Cslib.Crypto.listCDHToCDH {G : Type} (g : G) (index : ProbComp ℕ) (A : G → G → ProbComp (List G)) (s t : G) :

The guessing reduction of [BS23], Section 21.11.4 (p. 908) and the proof of Theorem 11.4 (p. 447), with its index sampler index: on the CDH instance (s, t), run the list adversary, draw a position from index and return the entry there, or g when the position is past the end of the list.

noncomputable def Cslib.Crypto.listCDHExperiment {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (Q : ℕ) (A : G → G → ProbComp (List G)) :

The list form of CDH in the group generated by g: the challenger draws uniform exponents a and b and gives the adversary a • g and b • g; the adversary wins when (a * b) • g is among the first Q entries of its list. The name is this library's.

noncomputable def Cslib.Crypto.listCDHAdvantage {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (Q : ℕ) (A : G → G → ProbComp (List G)) :

The success probability of A in listCDHExperiment.

theorem Cslib.Crypto.listCDHAdvantage_zero {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (A : G → G → ProbComp (List G)) :

At Q = 0 the list form of CDH is never won: no entry is among the first 0.

theorem Cslib.Crypto.eval_listCDHExperiment_le_mul_add_of_index {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (Q : ℕ) (index : ProbComp ℕ) {c ε : ENNReal} (hindex : ∀ (l : List G), ∀ x ∈ List.take Q l, 1 ≤ c * (PMF.map (fun (i : ℕ) => l.getD i g) index.eval) x + ε) (A : G → G → ProbComp (List G)) :

The guessing step for a general index sampler, with an additive term: if, for every list l and every member x of l.take Q, c times the probability that the entry of l at a position drawn from index (or g past the end) is x, plus ε, is at least 1, then the list experiment accepts with probability at most c times that of the CDH experiment for listCDHToCDH, plus ε. The hypothesis is on the index law alone.

theorem Cslib.Crypto.eval_listCDHExperiment_le_mul {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (Q : ℕ) (index : ProbComp ℕ) {c : ENNReal} (hindex : ∀ (l : List G), ∀ x ∈ List.take Q l, 1 ≤ c * (PMF.map (fun (i : ℕ) => l.getD i g) index.eval) x) (A : G → G → ProbComp (List G)) :

The guessing step for a general index sampler: if, for every list l, the entry of l at a position drawn from index (or g past the end) is each member of l.take Q with probability at least 1 / c, then the list experiment accepts with probability at most c times that of the CDH experiment for listCDHToCDH. The hypothesis is on the index law alone. This is the case ε = 0 of eval_listCDHExperiment_le_mul_add_of_index.

theorem Cslib.Crypto.listCDHAdvantage_le_mul_cdhAdvantage {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (Q : ℕ) (A : G → G → ProbComp (List G)) :

The list form of CDH loses at most a factor Q ([BS23], Section 21.11.4, p. 908, and equation (11.12) in the proof of Theorem 11.4, p. 448): the guessing reduction with the index Fin.val <$> ProbComp.unifFin (Q - 1), exactly uniform below Q when 0 < Q, solves CDH with at least 1 / Q of the list adversary's success probability. It holds for every Q, including 0, every list length and lists with repeated entries; beyond NeZero q and DecidableEq G, which the experiments need, there is no hypothesis on q or g. With the fair-coin index ProbComp.sampleModIndex width Q the factor stays Q and the term Q / 2 ^ width is added (eval_listCDHExperiment_le_mul_add).

theorem Cslib.Crypto.eval_listCDHExperiment_le_mul_add {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (width Q : ℕ) (A : G → G → ProbComp (List G)) :

The guessing step with a fair-coin index loses a factor Q plus Q / 2 ^ width: the guessing reduction of [BS23], Section 21.11.4 (p. 908) and equation (11.12) in the proof of Theorem 11.4 (p. 448), run with the index ProbComp.sampleModIndex width Q drawn from width fair coins, solves CDH with probability at least 1 / Q of the list adversary's success probability, minus 1 / 2 ^ width. The book draws the index exactly uniformly; the fair-coin index and the term Q / 2 ^ width are this library's. The factor is exactly Q: each position below Q is drawn with probability at least 1 / Q - 1 / 2 ^ width (ProbComp.one_le_mul_eval_sampleModNat_add), so whenever the Diffie–Hellman value is among the first Q entries the reduction returns it with at least that probability. It holds for every width and every Q, including Q = 0, where both sides are 0; beyond NeZero q and DecidableEq G there is no hypothesis on q or g.

theorem Cslib.Crypto.eval_listCDHExperiment_mono {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] {Q Q' : ℕ} (hle : Q ≤ Q') (A : G → G → ProbComp (List G)) :

More entries that count cannot hurt the adversary: if Q ≤ Q', the list experiment with bound Q' accepts with probability at least that with bound Q, since the first Q entries of a list are among its first Q'.