Documentation

Complexity.Crypto.Computational.Pseudoentropy.WordExtraction

Executable extraction of repeated labels #

The program samples a flat Boolean matrix, hashes the labels, and retains every observation and the matrix seed. Its exact law agrees with the finite two-universal family used by the extraction theorems. The supplied input width also defines behavior on malformed sample lists: labels are truncated or padded with false before hashing.

Main definitions #

Main results #

References #

Adapted from the cslib crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8.

noncomputable def Cslib.Crypto.Pseudoentropy.extractWordLabels (count outputBits : ℕ) (samples : List (List Bool × Bool)) :

Extract labels using an explicitly sampled matrix, retaining observations and the full seed.

Instances For

    The comparison experiment keeps the observations and independently samples the hash seed and output bits.

    Instances For
      theorem Cslib.Crypto.Pseudoentropy.eval_extractWordLabels (count outputBits : ℕ) (samples : List (List Bool × Bool)) :
      (extractWordLabels count outputBits samples).eval = PMF.map (fun (result : List (List Bool) × BitString (outputBits * count) × BitString outputBits) => (result.1, List.ofFn result.2.1, List.ofFn result.2.2)) (extractLabels (ProbComp.uniform (BitString (outputBits * count))) (fun (seed : BitString (outputBits * count)) (bits : List Bool) => BitString.LinearHash.hash (BitString.blocksEquiv seed) (BitString.ofList count bits)) samples).eval

      The finite and word extractors have exactly the same law, even on malformed sample lists.

      theorem Cslib.Crypto.Pseudoentropy.eval_extractWordLabelsIdeal (source : ProbComp (List Bool)) (count outputBits : ℕ) :
      (extractWordLabelsIdeal source count outputBits).eval = PMF.map (fun (result : List (List Bool) × BitString (outputBits * count) × BitString outputBits) => (result.1, List.ofFn result.2.1, List.ofFn result.2.2)) (extractLabelsIdeal source count (ProbComp.uniform (BitString (outputBits * count))))

      The ideal word program agrees with the finite ideal distribution and retains the full seed.

      An ordinary word test after extraction gives the finite test required by the security theorem. Sampling, padding, hashing, and encoding the public data are all charged to PPT. The test and dimensions may depend on any encoded runtime parameter.

      theorem Cslib.Crypto.Pseudoentropy.SamplablePair.HasGap.extract_indexed_word_labels {pair : SamplablePair} {gap : ℕ → ℝ} (hpair : pair.HasGap gap) (realization : pair.SeedRealization) (choose : ℕ → ℕ) {candidates inverseSlack densityBound : ℕ → ℕ} {outputBits numerator : ℕ → ℕ → ℕ} (hcandidates : Turing.MultiTapeTM.ComputableTidilyInPolyTime candidates Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (houtput : Turing.MultiTapeTM.ComputableTidilyInPolyTime (fun (input : ℕ × ℕ) => outputBits input.1 input.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) Turing.MultiTapeTM.encUnary) (hslack : Turing.MultiTapeTM.ComputableTidilyInPolyTime inverseSlack Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hnumerator : Turing.MultiTapeTM.ComputableTidilyInPolyTime (fun (input : ℕ × ℕ) => numerator input.1 input.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) Turing.MultiTapeTM.encUnary) (hdensity : Turing.MultiTapeTM.ComputableTidilyInPolyTime densityBound Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hchoose : ∀ᶠ (n : ℕ) in Filter.atTop, choose n < candidates n) (hvalid : ∀ᶠ (n : ℕ) in Filter.atTop, 0 < numerator n (choose n) ∧ numerator n (choose n) ≤ Probability.dyadicSize (densityBound n) ∧ ↑(numerator n (choose n)) / ↑(Probability.dyadicSize (densityBound n)) ≤ Probability.PMF.conditionalEntropy (pair.joint n) + gap n) (hbudget : ∀ᶠ (n : ℕ) in Filter.atTop, ↑(outputBits n (choose n)) + 2 * ↑(ExtractionSchedule.slack n (realization.length n) (inverseSlack n)) ≤ ↑(ExtractionSchedule.count n (realization.length n) (inverseSlack n)) * (↑(numerator n (choose n)) / ↑(Probability.dyadicSize (densityBound n)))) (test : ℕ → ℕ → List (List Bool) × List Bool × List Bool → ProbComp Bool) (htest : Probability.IsPPTOn (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits))) Turing.MultiTapeTM.encBool fun (input : (ℕ × ℕ) × List (List Bool) × List Bool × List Bool) => test input.1.1 input.1.2 input.2) :
      have count := fun (n : ℕ) => ExtractionSchedule.count n (realization.length n) (inverseSlack n); Negligible fun (n : ℕ) => Game.advantage (do let samples ← OracleComp.replicate (count n) (pair.sample n) let result ← extractWordLabels (count n) (outputBits n (choose n)) samples test n (choose n) result).eval (extractWordLabelsIdeal (Prod.fst <$> pair.sample n) (count n) (outputBits n (choose n)) >>= test n (choose n)).eval

      An efficient indexed family of word extractors is computationally uniform along any bounded choice satisfying the entropy budget. The choice is used only in the proof and need not be efficient; the reduction certifies the whole family of tests.

      theorem Cslib.Crypto.Pseudoentropy.SamplablePair.HasGap.extract_word_labels {pair : SamplablePair} {gap : ℕ → ℝ} (hpair : pair.HasGap gap) (realization : pair.SeedRealization) {outputBits inverseSlack numerator densityBound : ℕ → ℕ} (houtput : Turing.MultiTapeTM.ComputableTidilyInPolyTime outputBits Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hslack : Turing.MultiTapeTM.ComputableTidilyInPolyTime inverseSlack Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hnumerator : Turing.MultiTapeTM.ComputableTidilyInPolyTime numerator Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hdensity : Turing.MultiTapeTM.ComputableTidilyInPolyTime densityBound Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hvalid : ∀ᶠ (n : ℕ) in Filter.atTop, 0 < numerator n ∧ numerator n ≤ Probability.dyadicSize (densityBound n) ∧ ↑(numerator n) / ↑(Probability.dyadicSize (densityBound n)) ≤ Probability.PMF.conditionalEntropy (pair.joint n) + gap n) (hbudget : ∀ᶠ (n : ℕ) in Filter.atTop, ↑(outputBits n) + 2 * ↑(ExtractionSchedule.slack n (realization.length n) (inverseSlack n)) ≤ ↑(ExtractionSchedule.count n (realization.length n) (inverseSlack n)) * (↑(numerator n) / ↑(Probability.dyadicSize (densityBound n)))) (test : ℕ → List (List Bool) × List Bool × List Bool → ProbComp Bool) (htest : Probability.IsPPTOn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits))) Turing.MultiTapeTM.encBool fun (input : ℕ × List (List Bool) × List Bool × List Bool) => test input.1 input.2) :
      have count := fun (n : ℕ) => ExtractionSchedule.count n (realization.length n) (inverseSlack n); Negligible fun (n : ℕ) => Game.advantage (do let samples ← OracleComp.replicate (count n) (pair.sample n) let result ← extractWordLabels (count n) (outputBits n) samples test n result).eval (extractWordLabelsIdeal (Prod.fst <$> pair.sample n) (count n) (outputBits n) >>= test n).eval

      Computational label extraction as two ordinary word programs. The client supplies the entropy budget and a certified test; matrix sampling, finite representations, and the uniform prediction reduction are discharged by the library.