Documentation

CslibFrontier.Crypto.Computational.Kilian.Soundness

Computational soundness of Kilian's protocol #

A cheating prover for Kilian's protocol (KilianProver) is a two-stage program, as in CommitmentReceiver: on the security parameter n and the hash key k it outputs a statement x, a root and a saved state; on the state and the verifier's random strings it outputs the openings. It chooses x after seeing the key. The soundness experiment (kilianSoundnessGame) accepts when x ∉ L and the verifier accepts; membership in L is decided classically, and no reduction ever decides it. Kilian's protocol is computationally sound (KilianSound) when every uniform strict PPT cheating prover wins with negligible probability.

The reduction. kilianBindingAdversary P runs the first stage of P once and the second stage twice, on independent challenges, and outputs the first pair of openings, one from each run, of a common position to different bits (kilianBindingOutput). When both runs are accepted, these are two accepted openings of one position of one root to different one-bit leaves (merkleBreaksBinding_kilianBindingOutput): a break of MerklePositionBinding with the leaf space of one-bit words. The reduction is strict PPT (isPPT_kilianBindingAdversary).

The exact bound (succProbability_kilianSoundnessGame_le). If every statement that P can output at parameter n has a compact table of at most M entries, then

Pr[x ∉ L ∧ accept] ≤ 2⁻ⁿ + M · √Adv^bind(kilianBindingAdversary P, n).

The proof is Cslib.Probability.Rewinding.le_add_mul_sqrt_disagreement: at each saved state, a run that accepts while its opened bits agree with a fixed table makes the PCP verifier accept the proof spelled by that table on all n independent random strings, which happens with probability at most 2⁻ⁿ when x ∉ L (IsPCPVerifier.sound); otherwise two runs disagree. Composing with succProbability_merkleBindingGame_le bounds the advantage by that of the collision finder merkleCollisionFinder H (kilianBindingAdversary P), for a hash whose digests have the length of the key.

Asymptotics. For a polynomial-time PCP verifier for L with O(log n) random bits and a HashFamily H, every efficient prover outputs statements of polynomial length, so M is polynomial, and Kilian's protocol is computationally sound (HashFamily.kilianSound), while the generated verifier input—and hence verifier time and space—is polynomial in n (length_kilianVerifierInput_of_isPPT_le, computableInTimeAndSpace_kilianVerify_of_isPPT). With the PCP theorem, every NP relation has such a verifier together with a polynomial-time honest witness compiler (CslibFrontier.Crypto.Computational.Kilian.NP).

Relation to [BG01]. Construction 3.4 is analysed there in Lemma 3.5 as a weak proof of knowledge against non-uniform provers, with a reverse-sampling extractor for oracles of superpolynomial length. Here statements and tables have polynomial length, adversaries are uniform (as in CollisionResistant), and the bound is computational soundness with an explicit loss; the statement and its constants are our own packaging. Succinctness accounting (communication and verifier time) is in CslibFrontier.Crypto.Computational.Kilian.Succinct.

Main definitions #

Main results #

References #

Cheating provers and the soundness experiment #

A cheating prover's first message: the statement it chose and the root it committed to.

  • stmt : α

    The statement.

  • root : List Bool

    The committed Merkle root.

A cheating prover's commitment: its first message and the state it saves for the second stage.

theorem Cslib.Crypto.encKilianMessage_mk_inO {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn enc T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { stmt := x0 x, root := x1 x }) encIn (encKilianMessage enc) (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.encKilianMessage_mk_polyTime {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {x1 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn enc) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { stmt := x0 x, root := x1 x }) encIn (encKilianMessage enc)

The encoding of a first message: the framed statement, then the root.

theorem Cslib.Crypto.encKilianMessage_root_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → KilianMessage α} :
theorem Cslib.Crypto.encKilianMessage_mk_deg {α : Type} (enc : α ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : α × List Bool) => { stmt := p.1, root := p.2 }) (encKilianMessageFields enc) (encKilianMessage enc) 1 1
theorem Cslib.Crypto.encKilianMessage_root_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianMessage α} :
theorem Cslib.Crypto.encKilianMessage_stmt_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → KilianMessage α} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encKilianMessage enc) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc
@[reducible, inline]

The tuple of the fields of encKilianMessage.

theorem Cslib.Crypto.encKilianMessage_stmt_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianMessage α} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encKilianMessage enc) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc S✝
theorem Cslib.Crypto.encKilianMessage_mk_budget {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → α} {x1 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn enc budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { stmt := x0 x, root := x1 x }) encIn (encKilianMessage enc) budget
@[reducible, inline]

The tuple of the fields of encKilianCommitment.

theorem Cslib.Crypto.encKilianCommitment_mk_deg {α : Type} (enc : α ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : KilianMessage α × List Bool) => { toKilianMessage := p.1, state := p.2 }) (encKilianCommitmentFields enc) (encKilianCommitment enc) 1 1
theorem Cslib.Crypto.encKilianCommitment_mk_budget {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → KilianMessage α} {x1 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn (encKilianMessage enc) budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { toKilianMessage := x0 x, state := x1 x }) encIn (encKilianCommitment enc) budget
theorem Cslib.Crypto.encKilianCommitment_state_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianCommitment α} :

The encoding of a commitment: the first message as one framed word, then the state.

theorem Cslib.Crypto.encKilianCommitment_state_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → KilianCommitment α} :
theorem Cslib.Crypto.encKilianCommitment_toKilianMessage_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → KilianCommitment α} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encKilianCommitment enc) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).toKilianMessage) encIn✝ (encKilianMessage enc) S✝
theorem Cslib.Crypto.encKilianCommitment_mk_inO {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → KilianMessage α} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (encKilianMessage enc) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { toKilianMessage := x0 x, state := x1 x }) encIn (encKilianCommitment enc) (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.encKilianCommitment_mk_polyTime {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → KilianMessage α} {x1 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn (encKilianMessage enc)) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { toKilianMessage := x0 x, state := x1 x }) encIn (encKilianCommitment enc)
theorem Cslib.Crypto.encKilianCommitment_toKilianMessage_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → KilianCommitment α} :

A cheating prover for Kilian's protocol. The first stage commit n k receives the unary security parameter and the hash key, and outputs a statement, a root and a saved state; the second stage answer n state ρs receives the saved state and the verifier's random strings, and outputs the openings.

structure Cslib.Crypto.KilianProver.IsPPT {α : Type} (enc : α ↪ List Bool) (P : KilianProver α) :

A cheating prover is strict PPT if both stages run in polynomial time in their full encoded inputs, the saved state and the random strings included.

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

The soundness experiment of Kilian's protocol against P at security parameter n: the verifier samples a key, P chooses a statement and a root, the verifier samples its challenges, P answers, and P wins when the statement is outside L and the verifier accepts.

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

Computational soundness of Kilian's protocol for L: every uniform strict PPT cheating prover, which may choose its statement after seeing the hash key, convinces the verifier of a statement outside L with negligible probability.

The reduction to position binding #

The openings of a response, each with the PCP address it opens.

The first pair of openings, one from each list, of a common position to different bits.

def Cslib.Crypto.kilianBindingOutput {α : Type} (V : Complexity.PCPVerifier α) (x : α) (root : List Bool) (openings₁ openings₂ : List (ℕ × MerkleOpening Bool)) :

The binding adversary's output from two lists of openings against root: the conflicting pair found by kilianConflict, as two openings of its position with one-bit leaves.

The position-binding adversary built from a cheating prover: run its first stage once and its second stage on two independent challenges, and output a conflicting pair of openings.

theorem Cslib.Crypto.merkleVerify_of_mem_kilianOpenings {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} {k : List Bool} {x : α} {root : List Bool} {ρs : List (List Bool)} {response : KilianResponse} (h : kilianVerify H V k x root ρs response = true) {a : ℕ} {o : MerkleOpening Bool} (ho : (a, o) ∈ kilianOpenings V x ρs response) :

Every opening of an accepted response passes merkleVerify at its position.

theorem Cslib.Crypto.merkleBreaksBinding_kilianBindingOutput {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} {n : ℕ} {k : List Bool} {x : α} {root : List Bool} {ρs₁ ρs₂ : List (List Bool)} {response₁ response₂ : KilianResponse} (h₁ : kilianVerify H V k x root ρs₁ response₁ = true) (h₂ : kilianVerify H V k x root ρs₂ response₂ = true) {a₁ a₂ : ℕ} {o₁ o₂ : MerkleOpening Bool} (ho₁ : (a₁, o₁) ∈ kilianOpenings V x ρs₁ response₁) (ho₂ : (a₂, o₂) ∈ kilianOpenings V x ρs₂ response₂) (hpos : kilianPosition V x a₁ = kilianPosition V x a₂) (hb : o₁.leaf ≠ o₂.leaf) :
merkleBreaksBinding H (fun (x : ℕ) (leaf : List Bool) => leaf.length == 1) n k (kilianBindingOutput V x root (kilianOpenings V x ρs₁ response₁) (kilianOpenings V x ρs₂ response₂)) = true

Two accepted runs that disagree break position binding: if two responses against one root are accepted and open some common position to different bits, the binding adversary's output breaks binding, with the leaf space of one-bit words.

Acceptance with a consistent table #

def Cslib.Crypto.kilianProof {α : Type} (V : Complexity.PCPVerifier α) (x : α) (π : ℕ → Bool) :

The PCP proof spelled by a table π of the positions of x: the bit at address a is the table's bit at the position of a. Only addresses up to the sum of the address table are spelled; the others are never queried.

theorem Cslib.Crypto.accepts_kilianProof {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} {k : List Bool} {x : α} {root : List Bool} {ρs : List (List Bool)} {response : KilianResponse} (h : kilianVerify H V k x root ρs response = true) {π : ℕ → Bool} (hcons : ∀ o ∈ kilianOpenings V x ρs response, o.2.leaf = π (kilianPosition V x o.1)) {ρ : List Bool} (hρ : ρ ∈ ρs) (hlen : ρ.length = V.coins x) :
V.accepts x (kilianProof V x π) ρ = true

An accepted response whose opened bits agree with the table π makes the PCP verifier accept the proof spelled by π on every random string of the right length.

The exact bound #

theorem Cslib.Crypto.toOuterMeasure_sampleList_accepts_le {α : Type} (V : Complexity.PCPVerifier α) {x : α} {π : List Bool} (hsound : 2 * Complexity.acceptCount (fun (y : α × List Bool) => V.accepts y.1 π y.2) x (V.coins x) ≤ 2 ^ V.coins x) :

One PCP repetition accepts a fixed candidate proof π of a statement x with soundness bound 2 * acceptCount ... ≤ 2 ^ V.coins x with probability at most 1 / 2 in ℝ≥0∞.

theorem Cslib.Crypto.toOuterMeasure_kilianChallenges_accepts_le {α : Type} (V : Complexity.PCPVerifier α) (m : ℕ) {x : α} {π : List Bool} (hsound : 2 * Complexity.acceptCount (fun (y : α × List Bool) => V.accepts y.1 π y.2) x (V.coins x) ≤ 2 ^ V.coins x) :
(kilianChallenges V m x).eval.toOuterMeasure {ρs : List (List Bool) | ∀ ρ ∈ ρs, V.accepts x π ρ = true} ≤ (1 / 2) ^ m

Across m independent PCP challenge strings kilianChallenges V m x, a fixed candidate proof π for x with per-repetition soundness error ≤ 1 / 2 is accepted on all m repetitions with probability at most (1 / 2) ^ m.

theorem Cslib.Crypto.succProbability_kilianSoundnessGame_le {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} (L : Set α) (P : KilianProver α) (n M : ℕ) (hsound : ∀ x ∉ L, ∀ (π : List Bool), 2 * Complexity.acceptCount (fun (y : α × List Bool) => V.accepts y.1 π y.2) x (V.coins x) ≤ 2 ^ V.coins x) (hM : ∀ (k : List Bool), k.length = n → ∀ c ∈ (P.commit n k).eval.support, (V.queryTable c.stmt).length ≤ M) :

Exact soundness of Kilian's protocol. For a PCP verifier whose soundness error on statements outside L is at most one half per repetition, and a cheating prover P all of whose statements at parameter n have compact tables of at most M entries, Pr[x ∉ L ∧ accept] ≤ 2⁻ⁿ + M · √Adv^bind(kilianBindingAdversary P, n). The proof is original packaging (see the module documentation); it makes no efficiency assumption.

The reduction is efficient #

The reduction is efficient: the binding adversary of a strict PPT cheating prover is strict PPT, for a polynomial-time PCP verifier with O(log n) random bits.

Computational soundness #

theorem Cslib.Crypto.succProbability_kilianSoundnessGame_le_collision {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} (hlen : ∀ (k y : List Bool), (H k y).length = k.length) (L : Set α) (P : KilianProver α) (n M : ℕ) (hsound : ∀ x ∉ L, ∀ (π : List Bool), 2 * Complexity.acceptCount (fun (y : α × List Bool) => V.accepts y.1 π y.2) x (V.coins x) ≤ 2 ^ V.coins x) (hM : ∀ (k : List Bool), k.length = n → ∀ c ∈ (P.commit n k).eval.support, (V.queryTable c.stmt).length ≤ M) :

The exact soundness bound composed with the reduction of CollisionResistantOn.merklePositionBinding, for a hash whose digests have the length of the key: Pr[x ∉ L ∧ accept] ≤ 2⁻ⁿ + M · √Adv^CR(merkleCollisionFinder H (kilianBindingAdversary P), n).

theorem Cslib.Crypto.HashFamily.kilianSound {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} (hH : HashFamily H) {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) :
KilianSound H V enc L

Kilian's protocol is computationally sound ([BG01], Construction 3.4 and Lemma 3.5, for uniform adversaries and compact tables): for a polynomial-time PCP verifier for L with O(log n) random bits and any number of queries, and a collision-resistant HashFamily, every uniform strict PPT cheating prover convinces the verifier of a statement outside L with negligible probability.

theorem Cslib.Crypto.length_kilianVerifierInput_of_isPPT_le {α : Type} {V : Complexity.PCPVerifier α} {enc : α ↪ List Bool} {c : ℕ} (hcoins : ∀ (a : α), V.coins a ≤ c * (Nat.log 2 (enc a).length + 1)) {P : KilianProver α} (hP : KilianProver.IsPPT enc P) :
∃ (p : ℕ → ℕ), PolynomiallyBounded p ∧ ∀ (n : ℕ) (k : List Bool), k.length = n → ∀ cm ∈ (P.commit n k).eval.support, ∀ ρs ∈ (kilianChallenges V n cm.stmt).eval.support, ∀ resp ∈ (P.answer n cm.state ρs).eval.support, ((encKilianView enc) { key := k, stmt := cm.stmt, root := cm.root, challenges := ρs, response := resp }).length ≤ p n

Verifier input size against strict PPT provers: for a PCP verifier using O(log |enc x|) random bits and any uniform strict PPT cheating prover P, every verifier view supported in kilianSoundnessGame at security parameter n has encoded length bounded by a polynomially bounded function of n.

theorem Cslib.Crypto.computableInTimeAndSpace_kilianVerify_of_isPPT {α : 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)) {P : KilianProver α} (hP : KilianProver.IsPPT enc P) :
∃ (k : ℕ) (State : Type) (_ : Finite State) (tm : Turing.MultiTapeTM k Bool State) (tAdv : ℕ → ℕ) (sAdv : ℕ → ℕ), PolynomiallyBounded tAdv ∧ PolynomiallyBounded sAdv ∧ ∀ (n : ℕ) (key : List Bool), key.length = n → ∀ cm ∈ (P.commit n key).eval.support, ∀ ρs ∈ (kilianChallenges V n cm.stmt).eval.support, ∀ resp ∈ (P.answer n cm.state ρs).eval.support, have view := { key := key, stmt := cm.stmt, root := cm.root, challenges := ρs, response := resp }; tm.ComputesInTimeAndSpace ((encKilianView enc) view) (Turing.MultiTapeTM.encBool (kilianVerify H V key cm.stmt cm.root ρs resp)) (tAdv n) (sAdv n)

Machine-level verifier runtime and space against strict PPT provers: under a polynomial-time hash with n-bit digests and a polynomial-time PCP verifier using O(log |enc x|) random bits, the fixed binary machine computing kilianVerify runs on every transcript supported in kilianSoundnessGame against a strict PPT prover P within time and space bounded by polynomially bounded functions of n.