Documentation

Complexity.Crypto.Computational.GoldreichLevin.WordDecoder

Polynomial-time word algorithms for Goldreich–Levin decoding #

The decoder is ordinary functional code: maps, filtering, folds and first-match search. Its deterministic certificates use the shared tidy TM calculus. A fixed precision degree keeps both the number of guesses and their complete encoded size polynomially bounded. Exact representation laws preserve candidate order, duplicates, the fallback and every mask tape.

The predictor may capture public data and saved coins. Its certificate must be uniform jointly in that environment and its query. Sampling and uniform PPT adversaries are connected in the subsequent reduction; this module certifies the deterministic decoder.

Main definitions #

Main results #

References #

Adapted from Crypto/Computational/GoldreichLevin/WordDecoder.lean on the cslib crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8.

theorem Cslib.Crypto.GoldreichLevin.polyTime_precision {α : Type} {input : α ↪ List Bool} {parameter : α → ℕ} (hparameter : Turing.MultiTapeTM.ComputableTidilyInPolyTime parameter input Turing.MultiTapeTM.encUnary) (degree : ℕ) :

A fixed precision degree is computable from a unary security parameter.

Computing the logarithmic mask count includes the unary precision arithmetic.

The selectors for nonempty subsets of the base masks.

Instances For

    The word selectors enumerate exactly the finite decoder's voting subsets, once each.

    At fixed precision, the complete encoded guess list has polynomial size.

    Enumerating at a fixed precision degree includes the cost of computing the mask count.

    def Cslib.Crypto.GoldreichLevin.wordCandidate (predictor : List Bool → Bool) (dimension : ℕ) (rows selectors : List (List Bool)) (guess : List Bool) :

    Decode one parity guess by mapping a corrected majority vote over the coordinates.

    Instances For

      Nested maps compose with any predictor certified jointly in its input and query.

      theorem Cslib.Crypto.GoldreichLevin.wordCandidate_eq_ofFn {n k : ℕ} (predictor : List Bool → Bool) (masks : Fin k → BitString n) (guess : BitString k) :
      wordCandidate predictor n (List.ofFn fun (i : Fin k) => List.ofFn (masks i)) (nonzeroSelectors k) (List.ofFn guess) = List.ofFn (candidate (fun (query : BitString n) => predictor (List.ofFn query)) masks guess)

      The word program computes exactly the finite decoder's candidate for the same guess.

      def Cslib.Crypto.GoldreichLevin.wordCandidates (predictor : List Bool → Bool) (dimension : ℕ) (rows guesses : List (List Bool)) :

      Generate a candidate for every guess, reusing the nonzero selectors across candidates.

      Instances For

        The guess-list certificate accounts for the number and size of candidate words.

        theorem Cslib.Crypto.GoldreichLevin.wordCandidates_eq_map {n k : ℕ} (predictor : List Bool → Bool) (masks : Fin k → BitString n) :
        wordCandidates predictor n (List.ofFn fun (i : Fin k) => List.ofFn (masks i)) (BitString.enumList k) = List.map List.ofFn (candidateList (fun (query : BitString n) => predictor (List.ofFn query)) masks)

        Candidate generation preserves the finite decoder's order and duplicates.

        def Cslib.Crypto.GoldreichLevin.wordCheckCandidates (f : List Bool → List Bool) (dimension : ℕ) (image : List Bool) (candidates : List (List Bool)) :

        Return the first matching candidate, defaulting to a zero word of the input dimension.

        Instances For

          Candidate checking composes evaluation, equality, captured search and a runtime fallback.

          theorem Cslib.Crypto.GoldreichLevin.wordCheckCandidates_eq_ofFn {n : ℕ} (f : List Bool → List Bool) (image : List Bool) (candidates : List (BitString n)) :
          wordCheckCandidates f n image (List.map List.ofFn candidates) = List.ofFn (checkCandidates (fun (bits : BitString n) => f (List.ofFn bits)) image candidates)

          Searching the word representation preserves the finite decoder's first-match behavior.

          def Cslib.Crypto.GoldreichLevin.wordDecode (f : List Bool → List Bool) (predictor : List Bool → Bool) (degree dimension : ℕ) (image masks : List Bool) :

          Decode a predictor using one mask tape, then check the candidates against the image. The predictor may capture arbitrary public data and saved coins independently of that image.

          Instances For

            The complete decoder is polynomial-time for each fixed precision degree.

            theorem Cslib.Crypto.GoldreichLevin.wordDecode_eq_ofFn (f : List Bool → List Bool) (predictor : List Bool → Bool) (degree dimension : ℕ) (image masks : List Bool) :
            wordDecode f predictor degree dimension image masks = List.ofFn (checkCandidates (fun (bits : BitString dimension) => f (List.ofFn bits)) image (candidateList (fun (query : BitString dimension) => predictor (List.ofFn query)) (BitString.ofList (maskCount dimension (precision degree dimension) * dimension) masks).block))

            The full word decoder agrees with its finite mathematical algorithm for every predictor and mask tape. No assumption about how the predictor obtains its auxiliary data is required.

            theorem Cslib.Crypto.GoldreichLevin.uniform_wordDecode (f : List Bool → List Bool) (predictor : List Bool → Bool) (degree dimension : ℕ) (image : List Bool) :
            PMF.map (wordDecode f predictor degree dimension image) (BitString.uniformList (maskCount dimension (precision degree dimension) * dimension)) = PMF.map List.ofFn (invertFixed (fun (bits : BitString dimension) => f (List.ofFn bits)) (fun (query : BitString dimension) => predictor (List.ofFn query)) (maskCount dimension (precision degree dimension)) image)

            Uniform mask bits give exactly the finite inversion experiment for a captured predictor.

            theorem Cslib.Crypto.GoldreichLevin.wordDecode_success_ge_half (f : List Bool → List Bool) (predictor : List Bool → Bool) (degree : ℕ) {n : ℕ} (x : BitString n) (h : 1 / 2 + 1 / ↑(precision degree n) / 2 ≤ agreement (fun (query : BitString n) => predictor (List.ofFn query)) x) :
            1 / 2 ≤ ((PMF.map (fun (masks : List Bool) => f (wordDecode f predictor degree n (f (List.ofFn x)) masks) == f (List.ofFn x)) (BitString.uniformList (maskCount n (precision degree n) * n))) true).toReal

            A sufficiently correlated word predictor yields a valid preimage with probability at least one half. Auxiliary data stay captured in predictor; the recovered preimage need not be x.