Documentation

CslibFrontier.Crypto.Computational.Kilian.RawVerifier

Worst-case bounded-prefix raw verifier and raw prover soundness for Kilian's protocol #

kilianVerify takes an already-decoded KilianView α and charges polynomial time in the full length of the received view (computableInPolyTime_kilianVerify). Against an arbitrary unframed or oversized cheating prover message, the encoded view itself could be arbitrarily long before verification starts.

This module isolates the verifier's own inputs from the prover's untrusted raw transcript bits:

Main definitions #

Main results #

Challenge inputs and raw prover types #

The verifier's own inputs to Kilian verification: hash key, statement, and sampled PCP challenges, keeping prover-controlled commitment/response bits in the raw prover tape.

  • key : List Bool

    The hash key.

  • stmt : α

    The statement.

  • challenges : List (List Bool)

    The verifier's PCP challenge strings, one per repetition.

Instances For
    theorem Cslib.Crypto.KilianChallengeInput.ext {α : Type} {x y : KilianChallengeInput α} (key : x.key = y.key) (stmt : x.stmt = y.stmt) (challenges : x.challenges = y.challenges) :
    x = y
    @[instance_reducible]
    theorem Cslib.Crypto.encKilianChallengeInput_mk_polyTime {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {x1 : γ → α} {x2 : γ → List (List Bool)} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn Turing.MultiTapeTM.encBits) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn enc) (h2 : Turing.MultiTapeTM.ComputableInPolyTime x2 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) :
    Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { key := x0 x, stmt := x1 x, challenges := x2 x }) encIn (encKilianChallengeInput enc)
    theorem Cslib.Crypto.encKilianChallengeInput_mk_deg {α : Type} (enc : α ↪ List Bool) :
    Turing.MultiTapeTM.ComputableInDegree (fun (p : List Bool × α × List (List Bool)) => { key := p.1, stmt := p.2.1, challenges := p.2.2 }) (encKilianChallengeInputFields enc) (encKilianChallengeInput enc) 1 1
    theorem Cslib.Crypto.encKilianChallengeInput_key_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianChallengeInput α} :

    Encoding of KilianChallengeInput: framed hash key, framed statement, and challenges.

    @[reducible, inline]

    The tuple of the fields of encKilianChallengeInput.

    theorem Cslib.Crypto.encKilianChallengeInput_mk_budget {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → List Bool} {x1 : γ → α} {x2 : γ → List (List Bool)} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn enc budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits) budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { key := x0 x, stmt := x1 x, challenges := x2 x }) encIn (encKilianChallengeInput enc) budget
    theorem Cslib.Crypto.encKilianChallengeInput_mk_inO {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → α} {T1 S1 : γ → ℕ} {x2 : γ → List (List Bool)} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn enc T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits) T2 S2) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { key := x0 x, stmt := x1 x, challenges := x2 x }) encIn (encKilianChallengeInput enc) (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
    theorem Cslib.Crypto.encKilianChallengeInput_challenges_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianChallengeInput α} :
    theorem Cslib.Crypto.encKilianChallengeInput_stmt_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianChallengeInput α} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encKilianChallengeInput enc) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc S✝
    theorem Cslib.Crypto.encKilianChallengeInput_stmt_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → KilianChallengeInput α} :
    Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encKilianChallengeInput enc) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc

    A raw cheating prover's first-stage output: statement, raw root bitstring, and saved state.

    • stmt : α

      The statement chosen by the prover.

    • rawRoot : List Bool

      The raw root bitstring sent in the commitment message.

    • state : List Bool

      The saved state passed to the second stage.

    Instances For
      theorem Cslib.Crypto.KilianRawCommitment.ext {α : Type} {x y : KilianRawCommitment α} (stmt : x.stmt = y.stmt) (rawRoot : x.rawRoot = y.rawRoot) (state : x.state = y.state) :
      x = y
      @[instance_reducible]
      theorem Cslib.Crypto.encKilianRawCommitment_state_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianRawCommitment α} :
      theorem Cslib.Crypto.encKilianRawCommitment_mk_budget {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → α} {x1 x2 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn enc budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) :
      Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { stmt := x0 x, rawRoot := x1 x, state := x2 x }) encIn (encKilianRawCommitment enc) budget
      theorem Cslib.Crypto.encKilianRawCommitment_mk_inO {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn enc T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) :
      Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { stmt := x0 x, rawRoot := x1 x, state := x2 x }) encIn (encKilianRawCommitment enc) (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
      theorem Cslib.Crypto.encKilianRawCommitment_rawRoot_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianRawCommitment α} :
      theorem Cslib.Crypto.encKilianRawCommitment_stmt_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → KilianRawCommitment α} :
      Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encKilianRawCommitment enc) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc
      theorem Cslib.Crypto.encKilianRawCommitment_mk_polyTime {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {x1 x2 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn enc) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn Turing.MultiTapeTM.encBits) (h2 : Turing.MultiTapeTM.ComputableInPolyTime x2 encIn Turing.MultiTapeTM.encBits) :
      Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { stmt := x0 x, rawRoot := x1 x, state := x2 x }) encIn (encKilianRawCommitment enc)
      theorem Cslib.Crypto.encKilianRawCommitment_stmt_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianRawCommitment α} :
      Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encKilianRawCommitment enc) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc S✝
      @[reducible, inline]

      The tuple of the fields of encKilianRawCommitment.

      theorem Cslib.Crypto.encKilianRawCommitment_mk_deg {α : Type} (enc : α ↪ List Bool) :
      Turing.MultiTapeTM.ComputableInDegree (fun (p : α × List Bool × List Bool) => { stmt := p.1, rawRoot := p.2.1, state := p.2.2 }) (encKilianRawCommitmentFields enc) (encKilianRawCommitment enc) 1 1

      Encoding of KilianRawCommitment: framed statement, framed raw root, and saved state.

      A cheating prover sending raw bitstrings in Kilian's protocol (rawRoot in the first stage and an arbitrary raw response bitstring in the second stage).

      A raw cheating prover is strict PPT if both stages run in polynomial time in their full encoded inputs, saved state, and challenges.

      Total decoders for raw transcripts #

      Total polynomial-time decoder for a MerkleOpening Bool, inverting encKilianOpening.

      Total polynomial-time decoder for KilianResponse, inverting encKilianResponse.

      kilianProverMsgDecoder recovers (root, kilianResponseDecoder.decode rawResp) from an encoded pair of bit strings.

      Deterministic transcript length cap and bounded-prefix verifier #

      Upper bound on the encoded bit length of one MerkleOpening Bool whose authentication path has depth sibling labels each of length at most kLength.

      def Cslib.Crypto.kilianRawProverCap {α : Type} (V : Complexity.PCPVerifier α) (k : List Bool) (x : α) (ρs : List (List Bool)) :

      Deterministic cap on the encoded length of any valid raw prover message encPair encBits encKilianResponse (root, resp) with root.length ≤ k.length against verifier challenges (k, x, ρs). Oversized messages exceeding this cap are rejected immediately by kilianVerifyRawBounded.

      The verifier decision operating directly on verifier inputs ch and an arbitrary unframed or oversized raw prover bitstring rawProver. Rejects immediately if rawProver.length > cap, and otherwise decodes (root, resp) via kilianProverMsgDecoder and runs kilianVerify.

      Accepted transcripts fit under kilianRawProverCap: any transcript accepted by kilianVerify with root.length ≤ k.length has encoded pair length at most kilianRawProverCap V k x ρs.

      theorem Cslib.Crypto.length_encKilianProverMsg_honest_le_cap {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} (hlen : ∀ (k y : List Bool), (H k y).length = k.length) {x : α} {table : List Bool} (htable : V.tableVerifier (x, table) = true) (k : List Bool) {ρs : List (List Bool)} (hρs : ∀ ρ ∈ ρs, ρ.length = V.coins x) :

      Honest prover transcripts for digest-length hash functions fit strictly under kilianRawProverCap.

      Prefix truncation invariance: kilianVerifyRawBounded depends only on the first kilianRawProverCap V ch.key ch.stmt ch.challenges + 1 bits of rawProver.

      Oversized prover bitstrings exceeding kilianRawProverCap are always rejected.

      On any encoded pair (root, resp) with root.length ≤ ch.key.length, kilianVerifyRawBounded agrees unconditionally with kilianVerify.

      noncomputable def Cslib.Crypto.kilianHonestRawBoundedGame {α : Type} (H : List Bool → List Bool → List Bool) (V : Complexity.PCPVerifier α) (x : α) (table : List Bool) (n : ℕ) :

      Honest execution evaluated by the bounded-prefix raw-wire verifier.

      theorem Cslib.Crypto.eval_kilianHonestRawBoundedGame {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} (hlen : ∀ (k y : List Bool), (H k y).length = k.length) {x : α} {table : List Bool} (htable : V.tableVerifier (x, table) = true) (n : ℕ) :

      Perfect completeness under the bounded-prefix raw verifier: for a hash with key-length digests and any accepted table, kilianHonestRawBoundedGame accepts with probability 1.

      Polynomial-time certificate and bounded-prefix machine execution #

      Polynomial-time certificate for kilianVerifyRawBounded: decodes and verifies the raw prover bitstring within polynomial time in |(ch, rawProver)|.

      Worst-case verifier runtime and space on arbitrary unbounded raw provers (by verifier input length): there is one fixed binary MultiTapeTM computing kilianVerifyRawBounded on every (ch, rawProver) whose time and space depend only on (encKilianChallengeInput enc ch).length, for every rawProver : List Bool (even exponentially long or malformed).

      theorem Cslib.Crypto.computableInTimeAndSpace_kilianVerifyRawBounded_of_params {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} {enc : α ↪ List Bool} {c : ℕ} (hH : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : List Bool × List Bool) => H p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hlen : ∀ (k x : List Bool), (H k x).length = k.length) (hV : Complexity.PCPVerifier.PolyTime enc V) (hcoins : ∀ (a : α), V.coins a ≤ c * (Nat.log 2 (enc a).length + 1)) :

      Worst-case verifier runtime and space in n + |enc x| on ALL arbitrary raw provers: under a polynomial-time hash with key-length digests and a polynomial-time PCP verifier V with O(log |enc x|) random bits, there is one fixed binary multi-tape Turing machine computing kilianVerifyRawBounded whose step count and space on every (ch, rawProver) with key length ≤ n and ≤ n challenges of length ≤ V.coins ch.stmt are bounded by polynomials in n + |enc ch.stmt|, uniformly over all arbitrary unbounded rawProver : List Bool.

      Raw prover soundness #

      Convert a raw prover to a structured KilianProver by decoding its raw second-stage response with kilianResponseDecoder.

      Decoding a uniform strict PPT raw prover produces a uniform strict PPT KilianProver.

      noncomputable def Cslib.Crypto.kilianRawSoundnessGame {α : Type} (H : List Bool → List Bool → List Bool) (V : Complexity.PCPVerifier α) (L : Set α) (P : KilianRawProver α) (n : ℕ) :

      Soundness experiment for a raw cheating prover verified by kilianVerifyRawBounded.

      def Cslib.Crypto.KilianRawSound {α : Type} (H : List Bool → List Bool → List Bool) (V : Complexity.PCPVerifier α) (enc : α ↪ List Bool) (L : Set α) :

      Computational soundness against raw provers: every uniform strict PPT raw prover convinces kilianVerifyRawBounded of a false statement with negligible probability.

      theorem Cslib.Crypto.HashFamily.kilianRawSound {α : Type} {H : List Bool → List Bool → List Bool} (hH : HashFamily H) {V : Complexity.PCPVerifier α} {enc : α ↪ List Bool} {L : Set α} {c : ℕ} {q : ℕ → ℕ} (hV : Complexity.PCPVerifier.PolyTime enc V) (hpcp : Complexity.IsPCPVerifier enc (fun (m : ℕ) => c * (Nat.log 2 m + 1)) q V L) :
      KilianRawSound H V enc L

      Computational soundness of bounded-prefix raw Kilian under any HashFamily, polynomial-time O(log n)-coin PCP verifier V, and arbitrary uniform strict PPT raw provers.