Documentation

CslibFrontier.Crypto.Computational.GenericGroup.RecursiveDlog

Recursive discrete logarithm in prime-power-order groups #

Algorithm RDL (recursiveDlog) of [BS23], Section 16.1.2.1 (pp. 684–686), over GroupOracleSpec n S: given a base g of order q ^ e, a target u = α • g, and a base-case program base for order q, recursiveDlog splits e into ⌊e / 2⌋ and e - ⌊e / 2⌋, computing u · g^(-β) as u · g^(q^e - β) via power and product.

Bounds count only oracle calls in the worst case over responses; every call is a product (GroupQuery.IsProduct) when base makes only products (queriesSatisfy_recursiveDlog). Constants 2 and 6 are this library's; exponent arithmetic and base-case table search are not costed, and no machine-model bound is claimed.

Main definitions #

Main results #

References #

@[irreducible]
def Cslib.Crypto.GenericGroup.recursiveDlog {n : ℕ} {S : Type} (base : S → S → OracleComp (GroupOracleSpec n S) ℕ) (q e : ℕ) (g u : S) :

Algorithm RDL ([BS23], Section 16.1.2.1, p. 685) over GroupOracleSpec n S.

Every query made by recursiveDlog is a product (GroupQuery.IsProduct) whenever base makes only product queries.

theorem Cslib.Crypto.GenericGroup.isQueryBounded_recursiveDlog {n : ℕ} {S : Type} {base : S → S → OracleComp (GroupOracleSpec n S) ℕ} {T : ℕ} (hbase : ∀ (g u : S), (base g u).IsQueryBounded T) {q : ℕ} (hq : 2 ≤ q) (e : ℕ) (he : 1 ≤ e) (g u : S) :
(recursiveDlog base q e g u).IsQueryBounded (e * T + 6 * e * Nat.clog 2 e * Nat.clog 2 q)

Product-query bound for recursiveDlog when 2 ≤ q and 1 ≤ e, in the worst case over all oracle responses. Constants 6 and 2 (in power) are this library's; exponent arithmetic and base-case table search are not costed, and no machine-model bound is claimed.

theorem Cslib.Crypto.GenericGroup.evalPure_recursiveDlog {n : ℕ} {S : Type} {L : ZMod n → S} {O : (query : GroupQuery n S) → GroupOracleSpec n S query} (hO : ∀ (β₁ β₂ : ZMod n), O (GroupQuery.op (L β₁) (L β₂) 1 1) = some (L (β₁ + β₂))) {base : S → S → OracleComp (GroupOracleSpec n S) ℕ} {q : ℕ} (hbase : ∀ (t : ZMod n), addOrderOf t = q → ∀ a < q, OracleComp.evalPure O (base (L t) (L (↑a * t))) = a) (e : ℕ) (he : 1 ≤ e) (s : ZMod n) (hs : addOrderOf s = q ^ e) (α : ℕ) (hα : α < q ^ e) :
OracleComp.evalPure O (recursiveDlog base q e (L s) (L (↑α * s))) = α

Correctness. For s of additive order q ^ e (1 ≤ e) and a base-case solver base correct on order q, recursiveDlog base q e (L s) (L (α * s)) outputs α for α < q ^ e.

theorem Cslib.Crypto.GenericGroup.recursiveDlog_two_pow {S : Type} [DecidableEq S] {ℓ : ℕ} (hℓ : 1 ≤ ℓ) {L : ZMod (2 ^ ℓ) → S} (hL : Function.Injective L) (α : ZMod (2 ^ ℓ)) :
OracleComp.evalPure (answer L) (recursiveDlog (subgroupDlog 2) 2 ℓ (L 1) (L α)) = α.val ∧ (recursiveDlog (subgroupDlog 2) 2 ℓ (L 1) (L α)).IsQueryBounded (2 * ℓ + 6 * ℓ * Nat.clog 2 ℓ)

Groups of order 2 ^ ℓ. Specialization of recursiveDlog with subgroupDlog 2 in ZMod (2 ^ ℓ) ([BS23], Section 16.1.2.2, p. 686, the case n = 2 ^ ℓ, using Algorithm RDL of Section 16.1.2.1, p. 685). Every query is a product by queriesSatisfy_recursiveDlog and queriesSatisfy_subgroupDlog; the constant 6 is this library's and no machine-model bound is claimed.

theorem Cslib.Crypto.GenericGroup.evalPure_groupAnswer_recursiveDlog {n : ℕ} [NeZero n] {G : Type} [AddCommGroup G] [Module (ZMod n) G] [DecidableEq G] {g : G} (hg : Function.Injective fun (β : ZMod n) => β • g) {q e : ℕ} (he : 1 ≤ e) (hq : q ^ e = n) (α : ZMod n) :

Correctness against groupAnswer. For a ZMod n-module G (n ≠ 0) and g of order q ^ e = n, recursiveDlog (subgroupDlog q) q e g (α • g) outputs α.val.