Documentation

CslibFrontier.Crypto.Primitives.UHF.PolynomialPrediction

Predicting the variable-length polynomial hash #

In [BS23], Exercise 7.29, the adversary queries the empty message. Its Hxpoly digest is the key, so squaring it gives the digest of the singleton-zero message. The same argument works over every finite field. For prime fields the two stages have polynomial-time certificates on binary residues.

Main results #

theorem Cslib.Crypto.UHF.encPredictionGuess_message_polyTime {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encPredictionGuess encM encY) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).message) encIn✝ encM
@[simp]
theorem Cslib.Crypto.UHF.encPredictionGuess_message_budget {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encPredictionGuess encM encY) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).message) encIn✝ encM S✝
theorem Cslib.Crypto.UHF.encPredictionGuess_digest_polyTime {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encPredictionGuess encM encY) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).digest) encIn✝ encY
theorem Cslib.Crypto.UHF.encPredictionGuess_mk_budget {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → M} {x1 : γ → Y} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encM budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn encY budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { message := x0 x, digest := x1 x }) encIn (encPredictionGuess encM encY) budget
theorem Cslib.Crypto.UHF.encPredictionGuess_mk_deg {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : M × Y) => { message := p.1, digest := p.2 }) (encPredictionGuessFields encM encY) (encPredictionGuess encM encY) 1 1
theorem Cslib.Crypto.UHF.encPredictionGuess_mk_polyTime {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → M} {x1 : γ → Y} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn encM) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn encY) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { message := x0 x, digest := x1 x }) encIn (encPredictionGuess encM encY)
theorem Cslib.Crypto.UHF.encPredictionGuess_digest_budget {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encPredictionGuess encM encY) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).digest) encIn✝ encY S✝
@[reducible, inline]

The tuple of the fields of encPredictionGuess.

theorem Cslib.Crypto.UHF.encPredictionGuess_mk_inO {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → M} {T0 S0 : γ → ℕ} {x1 : γ → Y} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encM T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn encY T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { message := x0 x, digest := x1 x }) encIn (encPredictionGuess encM encY) (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x

Encode a prediction by framing its message followed by its digest.

@[reducible, inline]

A bounded block list has the same encoding as the underlying framed list of binary residues.

def Cslib.Crypto.UHF.xpolyPrediction {F : Type} [Field F] {ℓ : ℕ} (hℓ : 1 ≤ ℓ) :

Query the empty message and predict that the digest of [0] is the revealed digest squared.

theorem Cslib.Crypto.UHF.eval_predictionExperiment_xpolyHash {F : Type} [Field F] [Fintype F] [DecidableEq F] {ℓ : ℕ} (hℓ : 1 ≤ ℓ) :
(ProbComp.eval (predictionExperiment (fun (k : F) (m : { m : List F // m.length ≤ ℓ }) => Probability.xpolyHash k ↑m) (xpolyPrediction hℓ))) true = 1

Exercise 7.29 ([BS23], v0.6, printed p. 285). When one-block messages are allowed, the adversary wins Attack Game 7.5 against Hxpoly with probability one. The same program works over any finite field with a uniform key.

The winning adversary's actual deterministic choice and guess stages are polynomial time for each prime modulus. The guess stage uses binary multiplication and remainder.