Documentation

GaudisCrypt.Lib.EC.Group

Cyclic groups of prime order (EasyCrypt theories/algebra/Group.ec) #

What a development gets by

clone CyclicGroup as G.
axiom prime_p : IntDiv.prime G.order.
clone G.PowZMod as GP with lemma prime_order <- prime_p.
clone GP.FDistr as FD.

a cyclic group group with generator g, its exponents exp (the field Z/pZ of PowZMod), exponentiation x ^ k, the discrete logarithm loge, and the uniform distribution dt on the exponents (FDistr). Only what ported developments use is here. Names are EasyCrypt's.

The operations of the group and of the field are Mathlib's (CommGroup group, Field exp): EC's e, *, inv, / are 1, *, ⁻¹, /; the lemmas of EC's ZModpField on exp are those of a field (ring). The class Params group exp holds what Mathlib does not: the generator, the exponentiation by a field element, the logarithm and their laws. Its types are outParams, as for every theory: inside a development that clones it nothing is written.

EC's op g, op ( ^ ) : group -> exp -> group, op loge and their laws (expD, expM, expgK, loggK of PowZMod).

  • g : group
  • pow : group → exp → group
  • loge : group → exp
  • expD (x : group) (a b : exp) : pow x (a + b) = pow x a * pow x b
  • expM (x : group) (a b : exp) : pow x (a * b) = pow (pow x a) b
  • expgK (x : group) : pow g (loge x) = x
  • loggK (k : exp) : loge (pow g k) = k
Instances
    @[implicit_reducible, instance 100]

    EC's types are inhabited (witness): group by its unit.

    Equations
    @[implicit_reducible, instance 100]

    exp is inhabited, by its zero.

    Equations
    @[implicit_reducible]
    instance GaudisCrypt.EC.CyclicGroup.instHPow_gaudisCrypt {group exp : Type} [CommGroup group] [Field exp] [Params group exp] :
    HPow group exp group

    EC's x ^ k for an exponent k : exp.

    Equations
    theorem GaudisCrypt.EC.CyclicGroup.expD {group exp : Type} [CommGroup group] [Field exp] [Params group exp] (x : group) (a b : exp) :
    x ^ (a + b) = x ^ a * x ^ b

    lemma expD (x : group) (a b : exp) : x ^ (a + b) = x ^ a * x ^ b.

    theorem GaudisCrypt.EC.CyclicGroup.expM {group exp : Type} [CommGroup group] [Field exp] [Params group exp] (x : group) (a b : exp) :
    x ^ (a * b) = (x ^ a) ^ b

    lemma expM (x : group) (a b : exp) : x ^ (a * b) = x ^ a ^ b.

    theorem GaudisCrypt.EC.CyclicGroup.expgK {group exp : Type} [CommGroup group] [Field exp] [Params group exp] (x : group) :
    g ^ loge x = x

    lemma expgK x : g ^ (loge x) = x.

    theorem GaudisCrypt.EC.CyclicGroup.loggK {group exp : Type} [CommGroup group] [Field exp] [Params group exp] (k : exp) :
    loge (g ^ k) = k

    lemma loggK (k : exp) : loge (g ^ k) = k.

    FDistr #

    @[reducible, inline]
    noncomputable abbrev GaudisCrypt.EC.CyclicGroup.dt {exp : Type} [Field exp] [Fintype exp] :

    EC's op dt : exp distr = dunifin: the uniform distribution on the exponents (an abbreviation: EC's provers see through an operator's body, and so do the closers here).

    Equations
    Instances For