Documentation

CslibFrontier.Crypto.Computational.DiffieHellman.GapCDH.Assumption

The asymptotic Gap-CDH assumption on decodable prime-order group families #

For a DecodablePrimeOrderGroupFamily, the word-level gap computational Diffie–Hellman (Gap-CDH) experiment ([KL20], §12.4.4, p. 434) draws d ← setup n and independent uniform exponents a, b : ZMod (F.order d), gives the adversary the unary security parameter n, the group description d, and the encoded elements F.encode d (a • g) and F.encode d (b • g) (GapCDHInput), together with a word-level fixed-base decisional Diffie–Hellman oracle ddhWordOracle d b, and accepts when the adversary outputs F.encode d ((a * b) • g).

On a request word w, ddhWordOracle d y decodes w with ddhOracleQueryDecoder into candidate words (u, v) and returns encBool true if and only if w = encDDHOracleQuery ⟨u, v⟩, both u and v pass F.isElem, and their decoded group elements satisfy V = y • U; all non-canonical or out-of-group queries return encBool false.

DecodablePrimeOrderGroupFamily.GapCDH setup states that every uniform strict oracle-PPT adversary (IsOraclePPTOn (encGapCDHInput F.toPrimeOrderGroupFamily) encBits) wins gapCDHWordGame with negligible probability. Because any closed PPT word-level CDH solver lifts to an oracle-free Gap-CDH solver via ProbOracleComp.sample, GapCDH implies WordCDH, CDH, and DiscreteLog.

Main definitions #

Main results #

References #

A word-level fixed-base DDH oracle query (U, V), asking whether V = y • U for the challenger's hidden exponent y.

  • base : List Bool

    Encoded candidate base element U.

  • target : List Bool

    Encoded candidate target element V.

Encoding of DDHOracleQuery as the framed pair of its two word fields.

theorem Cslib.Crypto.encDDHOracleQuery_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 x1 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { base := x0 x, target := x1 x }) encIn encDDHOracleQuery budget
theorem Cslib.Crypto.encDDHOracleQuery_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { base := x0 x, target := x1 x }) encIn encDDHOracleQuery (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.encDDHOracleQuery_target_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → DDHOracleQuery} :
@[reducible, inline]

The tuple of the fields of encDDHOracleQuery.

theorem Cslib.Crypto.encDDHOracleQuery_base_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → DDHOracleQuery} :

Input (1^n, d, u, v) of a word-level Gap-CDH adversary over F: unary security parameter, group description d, and two candidate element words (F.encode d (a • g) and F.encode d (b • g) in the experiment).

  • secParam : ℕ

    The security parameter, given to machines in unary.

  • groupParameters : F.Desc

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

  • leftPublic : List Bool

    Encoded first public element (F.encode d (a • g) in the experiment).

  • rightPublic : List Bool

    Encoded second public element (F.encode d (b • g) in the experiment).

theorem Cslib.Crypto.encGapCDHInput_mk_inO (F : PrimeOrderGroupFamily) {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → F.Desc} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : γ → List Bool} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn F.encDesc T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encBits T3 S3) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { secParam := x0 x, groupParameters := x1 x, leftPublic := x2 x, rightPublic := x3 x }) encIn (encGapCDHInput F) (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
theorem Cslib.Crypto.encGapCDHInput_leftPublic_budget (F : PrimeOrderGroupFamily) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GapCDHInput F} :
theorem Cslib.Crypto.encGapCDHInput_secParam_budget (F : PrimeOrderGroupFamily) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GapCDHInput F} :
theorem Cslib.Crypto.encGapCDHInput_rightPublic_budget (F : PrimeOrderGroupFamily) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GapCDHInput F} :
theorem Cslib.Crypto.encGapCDHInput_mk_budget (F : PrimeOrderGroupFamily) {γ : Type} {encIn : γ ↪ List Bool} {budget x0 : γ → ℕ} {x1 : γ → F.Desc} {x2 x3 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn F.encDesc budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { secParam := x0 x, groupParameters := x1 x, leftPublic := x2 x, rightPublic := x3 x }) encIn (encGapCDHInput F) budget
@[reducible, inline]

The tuple of the fields of encGapCDHInput.

theorem Cslib.Crypto.encGapCDHInput_mk_polyTime (F : PrimeOrderGroupFamily) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → ℕ} {x1 : γ → F.Desc} {x2 x3 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn Turing.MultiTapeTM.encUnary) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn F.encDesc) (h2 : Turing.MultiTapeTM.ComputableInPolyTime x2 encIn Turing.MultiTapeTM.encBits) (h3 : Turing.MultiTapeTM.ComputableInPolyTime x3 encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { secParam := x0 x, groupParameters := x1 x, leftPublic := x2 x, rightPublic := x3 x }) encIn (encGapCDHInput F)
theorem Cslib.Crypto.encGapCDHInput_mk_deg (F : PrimeOrderGroupFamily) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : ℕ × F.Desc × List Bool × List Bool) => { secParam := p.1, groupParameters := p.2.1, leftPublic := p.2.2.1, rightPublic := p.2.2.2 }) (encGapCDHInputFields F) (encGapCDHInput F) 1 1
theorem Cslib.Crypto.encGapCDHInput_groupParameters_budget (F : PrimeOrderGroupFamily) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GapCDHInput F} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encGapCDHInput F) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).groupParameters) encIn✝ F.encDesc S✝

Encoding of GapCDHInput F: unary secParam, groupParameters under F.encDesc, and the two element words under encBits, framed as a nested pair.

Query the external fixed-base DDH word oracle on candidate element words (u, v) and decode its Boolean answer bit via Decoder.bool.

queryDDHWord is uniform strict oracle-PPT whenever its two word arguments are computable in polynomial time: reading the first symbol of the reply requires only a 1-bit prefix (IsOraclePPTOn.query_take with limit 1).

Word-level fixed-base DDH test on candidate element words u and v: true iff both u and v are valid encodings in F.Carrier d and their decoded elements satisfy V = y • U.

@[simp]

On encoded group elements U, V : F.Carrier d, ddhOraclePred decides V = y • U.

Characterization of ddhOraclePred d y u v = true in terms of F.encode d.

Word-level fixed-base DDH oracle O_y ([KL20], §12.4.4, p. 434): on a canonical query word encDDHOracleQuery ⟨u, v⟩, returns encBool (F.ddhOraclePred d y u v); non-canonical words return encBool false.

@[reducible, inline]

A word-level Gap-CDH adversary over F maps GapCDHInput F.toPrimeOrderGroupFamily to a candidate word List Bool, with private coins and access to a single external word channel (O_b in gapCDHWordGame).

The word-level Gap-CDH game ([KL20], §12.4.4, p. 434): draw d ← setup n and independent uniform a, b : ZMod (F.order d), run adversary on ⟨n, d, F.encode d (a • g), F.encode d (b • g)⟩ against ddhWordOracle d b, and accept when the output word equals F.encode d ((a * b) • g).

The asymptotic Gap-CDH assumption ([KL20], §12.4.4, p. 434): every uniform strict oracle-PPT adversary on encGapCDHInput wins gapCDHWordGame with negligible probability.

Deviations from [KL20], §12.4.4, p. 434:

  • The textbook states the gap-CDH problem informally (computing g^{xy} from (g^x, g^y) given oracle O_y(U, V) = 1 ↔ V = U^y) without a standalone numbered definition; here it is cast in the library's uniform strict oracle-PPT model (IsOraclePPTOn).
  • Group parameters are drawn from an arbitrary setup : ℕ → PMF F.Desc rather than an efficient group generator G(1^n), matching DiscreteLog, CDH, and DDH.
  • Inputs, oracle queries, and outputs are bit strings; ddhWordOracle checks canonical pair framing and F.isElem membership, returning encBool false on malformed queries.

GapCDH implies word-level WordCDH: any closed PPT word-level CDH adversary lifts via ProbOracleComp.sample to an oracle-PPT Gap-CDH adversary that makes no DDH queries and has the exact same success probability.