Documentation

VCVio.CryptoFoundations.HardnessAssumptions.LWE

Learning With Errors #

This file gives a general definition of the LWE problem. It is parameterized by the following:

(errSamp can potentially be replaced with χ : PMF (Fin p) instead, to be used with evalDistWhen with non-uniform distributions)

We define the (decision) LWE problem as a security experiment on an oracle that takes as input:

The adversary wins if it can correctly guess which case the distribution is.

The search LWE problem instead asks that the adversary given A and u = s * A + e outputs the secret s.

def LWE_Distr (n m p : ) [NeZero p] (errSamp : ProbComp (Fin p)) :
ProbComp (Matrix (Fin n) (Fin m) (Fin p) × Vector (Fin p) m)

The LWE distribution (A, s * A + e)

Equations
    Instances For
      def LWE_Uniform_Distr (n m p : ) [NeZero p] :
      ProbComp (Matrix (Fin n) (Fin m) (Fin p) × Vector (Fin p) m)

      The uniform distribution (A, u)

      Equations
        Instances For
          def LWE_Adversary (n m p : ) :

          An adversary for the decisional LWE problem. Takes in a pair (A, u) and outputs a boolean.

          Equations
            Instances For
              def LWE_Experiment (n m p : ) [NeZero p] (errSamp : ProbComp (Fin p)) (adv : LWE_Adversary n m p) :

              The decisional LWE experiment. If b = true, the distribution is LWE, otherwise it is uniform.

              Equations
                Instances For
                  noncomputable def LWE_Advantage (n m p : ) [NeZero p] (errSamp : ProbComp (Fin p)) (adv : LWE_Adversary n m p) :
                  Equations
                    Instances For
                      def LWE_Game_0 (n m p : ) [NeZero p] (errSamp : ProbComp (Fin p)) (adv : LWE_Adversary n m p) :

                      The first game of the decisional LWE assumption, where the distribution is LWE.

                      (we map true to () and false to failure)

                      Equations
                        Instances For
                          def LWE_Game_1 (n m p : ) [NeZero p] (adv : LWE_Adversary n m p) :

                          The second game of the decisional LWE assumption, where the distribution is uniform.

                          (we map true to () and false to failure)

                          Equations
                            Instances For
                              def LWE_Search_Adversary (n m p : ) :

                              An adversary for the search LWE problem. Takes in a pair (A, u) and outputs a vector s.

                              Equations
                                Instances For
                                  def LWE_Search_Experiment (n m p : ) [NeZero p] (errSamp : ProbComp (Fin p)) (adv : LWE_Search_Adversary n m p) :

                                  The search LWE experiment. The adversary wins if it can correctly guess the secret s.

                                  Equations
                                    Instances For
                                      noncomputable def LWE_Search_Advantage (n m p : ) [NeZero p] (errSamp : ProbComp (Fin p)) (adv : LWE_Search_Adversary n m p) :
                                      Equations
                                        Instances For
                                          theorem LWE_Experiment_eq_LWE_Game_01 {n m p : } [NeZero p] {errSamp : ProbComp (Fin p)} {adv : LWE_Adversary n m p} :
                                          2 * (LWE_Experiment n m p errSamp adv).advantage' = (LWE_Game_0 n m p errSamp adv).advantage₂' (LWE_Game_1 n m p adv)

                                          The two ways of defining the decisional LWE assumption (via a single experiment or via two games) are equivalent.

                                          (probably not correct)