Documentation

CatCryptCore.Crypto.PairingGroup

Bilinear Pairing Groups #

This file defines bilinear pairing groups (Type III pairings) integrated with Mathlib's algebraic hierarchy.

Main definitions #

References #

Pairing Group Class #

A bilinear pairing group (Type III setting).

Groups are in multiplicative notation with CommGroup instances. The pairing e : G₁G₂GT is bilinear and non-degenerate.

Instances

    Nonempty instances #

    Basic pairing lemmas #

    Power lemmas #

    The key bilinearity theorem: e(g₁^a, g₂^b) = e(g₁, g₂)^(a*b)

    theorem CatCrypt.Crypto.PairingGroup.e_zpow_zpow {P : PairingGroup} (a b : ) :
    e (g₁ ^ a) (g₂ ^ b) = e (g₁ ^ b) (g₂ ^ a)

    Pairing is symmetric in exponents

    ZMod exponentiation #

    Exponentiate by a ZMod P.p element via its value representative

    Equations
    Instances For
      Equations
      Instances For
        noncomputable def CatCrypt.Crypto.PairingGroup.zpowZModT {P : PairingGroup} (x : GT) (a : ZMod p) :
        Equations
        Instances For

          Notation: x ^ᵍ a for ZMod exponentiation in G₁.

          The exponent binds tighter than relational/arithmetic operators, so g ^ᵍ s = a * pk ^ᵍ c parses as (g ^ᵍ s) = (a * (pk ^ᵍ c)).

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Notation: x ^ʰ a for ZMod exponentiation in G₂ (same precedence as ^ᵍ).

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Generator order #

              g₁ has order p (since it generates G₁ of cardinality p)

              g₁ ^ n = g₁ ^ (n % p)

              g₂ ^ n = g₂ ^ (n % p)

              zpowZMod lemmas #

              Any element of G₁ raised to p is 1

              theorem CatCrypt.Crypto.PairingGroup.pow_mod_G₁ {P : PairingGroup} (x : G₁) (n : ) :
              x ^ n = x ^ (n % p)

              Any element of G₁: x ^ n = x ^ (n % p)

              Composition: (x ^ᵍ a) ^ᵍ b = x ^ᵍ (a * b) for any x in G₁

              g₁ ^ᵍ a = g₁ ^ a.val (ℕ version)

              g₂ ^ʰ a = g₂ ^ a.val (ℕ version)

              g₁ ^ᵍ (a + b) = (g₁ ^ᵍ a) * (g₁ ^ᵍ b)

              g₂ ^ʰ (a + b) = (g₂ ^ʰ a) * (g₂ ^ʰ b)

              (g₁ ^ᵍ a)⁻¹ = g₁ ^ᵍ (-a)

              (g₂ ^ʰ a)⁻¹ = g₂ ^ʰ (-a)

              g₁ ^ᵍ (a - b) = g₁ ^ᵍ a * (g₁ ^ᵍ b)⁻¹

              g₂ ^ʰ (a - b) = g₂ ^ʰ a * (g₂ ^ʰ b)⁻¹

              g₁ ^ᵍ (a * b) = g₁ ^ (a.val * b.val) mod p

              theorem CatCrypt.Crypto.PairingGroup.zpowZMod₁_finprod {P : PairingGroup} {ι : Type u_1} [DecidableEq ι] (f : ιZMod p) (s : Finset ι) :
              is, zpowZMod₁ g₁ (f i) = zpowZMod₁ g₁ (∑ is, f i)

              Product of zpowZMod₁ over a finset equals zpowZMod₁ of the sum

              theorem CatCrypt.Crypto.PairingGroup.zpowZMod₁_finprod_univ {P : PairingGroup} {n : } (f : Fin nZMod p) :
              i : Fin n, zpowZMod₁ g₁ (f i) = zpowZMod₁ g₁ (∑ i : Fin n, f i)

              Product of zpowZMod₁ over Fin univ

              e(g₁, g₂) ^ n = e(g₁, g₂) ^ (n % p)

              Pairing with zpowZMod: e(g₁^ᵍa, g₂^ʰb) = e(g₁,g₂)^(a.val * b.val)

              Key: e(g₁ ^ᵍ (a*b), g₂) = e(g₁ ^ᵍ a, g₂ ^ʰ b)

              General power lemmas (for arbitrary group elements) #

              theorem CatCrypt.Crypto.PairingGroup.e_pow_left_general {P : PairingGroup} (x : G₁) (n : ) (y : G₂) :
              e (x ^ n) y = e x y ^ n

              e(x^n, y) = e(x, y)^n for every x ∈ G₁

              theorem CatCrypt.Crypto.PairingGroup.e_zpow_left_general {P : PairingGroup} (x : G₁) (n : ) (y : G₂) :
              e (x ^ n) y = e x y ^ n

              e(x^n, y) = e(x, y)^n for integer exponent

              theorem CatCrypt.Crypto.PairingGroup.e_zpowZMod_left {P : PairingGroup} (x : G₁) (a : ZMod p) (y : G₂) :
              e (zpowZMod₁ x a) y = e x y ^ a.val

              e(zpowZMod₁ x a, y) = e(x, y) ^ a.val for any x ∈ G₁

              Order-theoretic lemmas #

              e(g₁, g₂) has order p in GT

              Non-degeneracy gives first-argument injectivity: if e(x, g₂) = 1, then x = 1.

              theorem CatCrypt.Crypto.PairingGroup.e_first_arg_eq_one_general {P : PairingGroup} (x : G₁) (c : ZMod p) (hc : c 0) (h : e x (zpowZMod₂ g₂ c) = 1) :
              x = 1

              Generalized non-degeneracy: e(x, g₂^c) = 1 and c ≠ 0 implies x = 1.

              Power bijection #

              x ↦ x ^ᵍ sk is a bijection on G₁ when sk ≠ 0.

              The inverse is x ↦ x ^ᵍ sk⁻¹. This uses the composition law zpowZMod₁_zpowZMod₁ and the fact that ZMod p is a field.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                SRS (Structured Reference String) #

                noncomputable def CatCrypt.Crypto.PairingGroup.srs₁ {P : PairingGroup} (α : ZMod p) (t : ) :
                Fin (t + 1)G₁

                The Structured Reference String for KZG: [g₁, g₁^α, g₁^(α²), ..., g₁^(αᵗ)]

                Equations
                Instances For

                  SRS in G₂: [g₂, g₂^α] (just two elements needed for verification)

                  Equations
                  Instances For