Documentation

CslibFrontier.Crypto.Computational.GenericGroup.Basic

The group oracle of a generic cyclic group #

In the generic group model of [BS23], Section 16.3 (p. 693), a cyclic group of order q is reached only through an oracle. The oracle holds an injective labeling function L : ZMod q → S and answers two kinds of query. A labeling query β gets L β. A group operation (ℓ₁, ℓ₂, κ₁, κ₂) gets L (κ₁ * β₁ + κ₂ * β₂) when ℓ₁ = L β₁ and ℓ₂ = L β₂, and is rejected when ℓ₁ or ℓ₂ is not a label. The label L β stands for the group element g^β, so a group operation computes (g^β₁)^κ₁ · (g^β₂)^κ₂.

Groups are written additively, as in CslibFrontier.Crypto.Computational.DiffieHellman.Finite: the book's g^β is β • g in a ZMod q-module.

The book takes S to be a set of bit strings with |S| ≥ q and lets the oracle choose L at random. Here S is any type and L is a parameter; a game that draws L does so itself, and the results about answer assume of L only what they use. The book's reject is none. The names GroupQuery, GroupOracleSpec, answer, groupAnswer and GroupQuery.IsProduct are this library's.

Main definitions #

Main results #

References #

A query to the group oracle of a generic cyclic group of order q with labels in S ([BS23], Section 16.3, p. 693).

  • label {q : ℕ} {S : Type} (β : ZMod q) : GroupQuery q S

    Labeling query: ask for the label of β.

  • op {q : ℕ} {S : Type} (ℓ₁ ℓ₂ : S) (κ₁ κ₂ : ZMod q) : GroupQuery q S

    Group operation: ask for the label of κ₁ * β₁ + κ₂ * β₂, where ℓᵢ is the label of βᵢ.

@[reducible, inline]

The reply types of the group oracle: a label for a labeling query, and a label or none (the book's reject) for a group operation.

noncomputable def Cslib.Crypto.GenericGroup.answer {q : ℕ} {S : Type} (L : ZMod q → S) (query : GroupQuery q S) :
GroupOracleSpec q S query

The group oracle determined by the labeling L. A labeling query β gets L β. A group operation (ℓ₁, ℓ₂, κ₁, κ₂) gets L (κ₁ * β₁ + κ₂ * β₂) for preimages L β₁ = ℓ₁ and L β₂ = ℓ₂, which are unique when L is injective, and none when ℓ₁ or ℓ₂ is not a label. For injective L this is the oracle of [BS23], Section 16.3 (p. 693).

def Cslib.Crypto.GenericGroup.groupAnswer (q : ℕ) {G : Type} [AddCommGroup G] [Module (ZMod q) G] (g : G) (query : GroupQuery q G) :
GroupOracleSpec q G query

The group oracle of a ZMod q-module G with base point g, whose labels are the elements of G. A labeling query β gets β • g, the book's g^β, and a group operation (ℓ₁, ℓ₂, κ₁, κ₂) gets κ₁ • ℓ₁ + κ₂ • ℓ₂; it never rejects.

The query is a group operation with κ₁ = κ₂ = 1: it asks for the product of two labelled elements, one multiplication in the group.

@[simp]
theorem Cslib.Crypto.GenericGroup.answer_label {q : ℕ} {S : Type} (L : ZMod q → S) (β : ZMod q) :

A labeling query gets the label.

theorem Cslib.Crypto.GenericGroup.answer_op {q : ℕ} {S : Type} (L : ZMod q → S) (ℓ₁ ℓ₂ : S) (κ₁ κ₂ : ZMod q) :
answer L (GroupQuery.op ℓ₁ ℓ₂ κ₁ κ₂) = (Function.partialInv L ℓ₁).bind fun (β₁ : ZMod q) => Option.map (fun (β₂ : ZMod q) => L (κ₁ * β₁ + κ₂ * β₂)) (Function.partialInv L ℓ₂)

A group operation gets the label of κ₁ * β₁ + κ₂ * β₂ for preimages L β₁ = ℓ₁ and L β₂ = ℓ₂, and none when there is none.

theorem Cslib.Crypto.GenericGroup.answer_op_label {q : ℕ} {S : Type} {L : ZMod q → S} (hL : Function.Injective L) (β₁ β₂ κ₁ κ₂ : ZMod q) :
answer L (GroupQuery.op (L β₁) (L β₂) κ₁ κ₂) = some (L (κ₁ * β₁ + κ₂ * β₂))

The accepting clause of the group operation ([BS23], Section 16.3, p. 693): for an injective labeling L, a group operation on the labels of β₁ and β₂ gets the label of κ₁ * β₁ + κ₂ * β₂.

theorem Cslib.Crypto.GenericGroup.groupAnswer_eq_answer {q : ℕ} {G : Type} [AddCommGroup G] [Module (ZMod q) G] {g : G} (hg : Function.Surjective fun (β : ZMod q) => β • g) :
groupAnswer q g = answer fun (β : ZMod q) => β • g

When every element of G is a multiple of g, as in a cyclic group of order q generated by g ([BS23], Section 16.1.1), the oracle of G is the generic group oracle of the labeling β ↦ β • g. The labeling need not be injective.