Documentation

CslibFrontier.Crypto.Computational.Pseudoentropy.MatrixExtraction

Repeated extraction with an executable matrix hash #

The three extractors in the pseudoentropy construction share this program. A client prepares the label list as one word; the extractor supplies a fresh matrix, hashes at the declared width, and retains every observation and the complete matrix seed. Width normalization specifies total behavior on malformed inputs without affecting the finite extraction laws.

Main definitions #

Main results #

References #

Adapted from the cslib crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8.

noncomputable def Cslib.Crypto.Pseudoentropy.extractMatrixLabels {Observation Label : Type} (inputBits outputBits : ℕ) (prepare : List Label → List Bool) (samples : List (Observation × Label)) :

Hash prepared labels with a fresh matrix, retaining the observations and full seed.

@[reducible, inline]
abbrev Cslib.Crypto.Pseudoentropy.extractedSeed {Obs : Type u_1} {Seed : Type u_2} {Digest : Type u_3} (r : Obs × Seed × Digest) :
Seed

The hash-seed component of an extraction result (observations, seed, digest).

@[reducible, inline]
abbrev Cslib.Crypto.Pseudoentropy.extractedDigest {Obs : Type u_1} {Seed : Type u_2} {Digest : Type u_3} (r : Obs × Seed × Digest) :
Digest

The hash-digest component of an extraction result (observations, seed, digest).

theorem Cslib.Crypto.Pseudoentropy.extractMatrixLabels_result {Observation Label : Type} (inputBits outputBits : ℕ) (prepare : List Label → List Bool) (samples : List (Observation × Label)) {result : List Observation × List Bool × List Bool} (hresult : result ∈ (extractMatrixLabels inputBits outputBits prepare samples).eval.support) :
result.1 = List.map Prod.fst samples ∧ (extractedSeed result).length = outputBits * inputBits ∧ (extractedDigest result).length = outputBits

Every result preserves the observations and has the declared seed and digest lengths.

noncomputable def Cslib.Crypto.Pseudoentropy.extractMatrixLabelsIdeal {Observation : Type} (source : ProbComp Observation) (count inputBits outputBits : ℕ) :

The comparison experiment preserves the observations and samples independent seed and bits.

theorem Cslib.Crypto.Pseudoentropy.isPPTOn_extractMatrixLabels {α Observation Label : Type} {input : α ↪ List Bool} {observation : Observation ↪ List Bool} {label : Label ↪ List Bool} {inputBits outputBits : α → ℕ} {prepare : α → List Label → List Bool} {samples : α → List (Observation × Label)} (hinput : Turing.MultiTapeTM.ComputableInPolyTime inputBits input Turing.MultiTapeTM.encUnary) (houtput : Turing.MultiTapeTM.ComputableInPolyTime outputBits input Turing.MultiTapeTM.encUnary) (hprepare : Turing.MultiTapeTM.ComputableInPolyTime (fun (pair : α × List Label) => prepare pair.1 pair.2) (Turing.MultiTapeTM.encPair input (Turing.MultiTapeTM.encList label)) Turing.MultiTapeTM.encBits) (hsamples : Turing.MultiTapeTM.ComputableInPolyTime samples input (Turing.MultiTapeTM.encList (Turing.MultiTapeTM.encPair observation label))) :

Runtime dimensions and a certified preparation function give an ordinary PPT program.

theorem Cslib.Crypto.Pseudoentropy.eval_extractMatrixLabels {Observation Label : Type} (inputBits outputBits : ℕ) (prepare : List Label → List Bool) (samples : List (Observation × Label)) :
(extractMatrixLabels inputBits outputBits prepare samples).eval = PMF.map (fun (result : List Observation × (Fin (outputBits * inputBits) → Bool) × (Fin outputBits → Bool)) => (result.1, List.ofFn (extractedSeed result), List.ofFn (extractedDigest result))) (extractLabels (ProbComp.uniform (BitString (outputBits * inputBits))) (fun (seed : BitString (outputBits * inputBits)) (labels : List Label) => BitString.LinearHash.hash (BitString.blocksEquiv seed) (BitString.ofList inputBits (prepare labels))) samples).eval

Word matrix sampling and hashing exactly realize the finite extraction experiment.

theorem Cslib.Crypto.Pseudoentropy.eval_extractMatrixLabelsIdeal {Observation : Type} (source : ProbComp Observation) (count inputBits outputBits : ℕ) :
(extractMatrixLabelsIdeal source count inputBits outputBits).eval = PMF.map (fun (result : List Observation × (Fin (outputBits * inputBits) → Bool) × (Fin outputBits → Bool)) => (result.1, List.ofFn (extractedSeed result), List.ofFn (extractedDigest result))) (extractLabelsIdeal source count (ProbComp.uniform (BitString (outputBits * inputBits))))

The ideal word program agrees with the finite ideal distribution, retaining the full seed.

theorem Cslib.Crypto.Pseudoentropy.eval_extractMatrixLabelsIdeal_bind {Observation Output : Type} (source : ProbComp Observation) (count inputBits outputBits : ℕ) (next : List Observation → List Bool → ProbComp Output) :
(do let result ← extractMatrixLabelsIdeal source count inputBits outputBits next result.1 (extractedSeed result ++ extractedDigest result)).eval = (do let observations ← OracleComp.replicate count source let bits ← BitString.sampleList (outputBits * inputBits + outputBits) next observations bits).eval

In the ideal experiment, the public matrix seed and digest together form one uniform word. The continuation may depend on all retained observations.

theorem Cslib.Crypto.Pseudoentropy.eval_extractMatrixLabelsIdeal_append {Observation : Type} (source : ProbComp Observation) (count inputBits outputBits : ℕ) (next : List Observation → ProbComp (List Bool)) :
(do let result ← extractMatrixLabelsIdeal source count inputBits outputBits (fun (front : List Bool) => front ++ (extractedSeed result ++ extractedDigest result)) <$> next result.1).eval = (do let observations ← OracleComp.replicate count source let front ← next observations let suffix ← BitString.sampleList (outputBits * inputBits + outputBits) pure (front ++ suffix)).eval

An independently uniform ideal hash can be sampled after processing the observations.