Documentation

CslibFrontier.Crypto.Computational.GMW.PolyTime

Polynomial-time and PPT certificates for the 3-copy GMW protocol #

This module registers @[fun_prop] polynomial-time and strict-(oracle-)PPT certificates for the 3-copy masked-3SAT GMW protocol gadgets defined in CslibFrontier.Crypto.Computational.GMW.Protocol, proves that runTwoRound preserves strict PPT when driven by polynomial-time round functions and a strict oracle PPT verifier (isPPTOn_runTwoRound), defines the zero-knowledge simulator gmwSimulator (via gmwSampleSimCoins, gmwSimWithPads, gmwSimAttempt and firstSuccess), and certifies:

Main definitions #

Main results #

References #

Polynomial-time certificates for protocol gadgets #

PPT certificates for runTwoRound and honest interaction #

theorem Cslib.Crypto.GMW.encTwoRoundState_challenge_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TwoRoundState} :
theorem Cslib.Crypto.GMW.encTwoRoundState_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { round := x0 x, challenge := x1 x }) encIn encTwoRoundState (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.GMW.encTwoRoundState_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget x0 : γ → ℕ} {x1 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { round := x0 x, challenge := x1 x }) encIn encTwoRoundState budget

The state of runTwoRound: the round counter in unary, then the recorded challenge as a bit word. The round counter is framed.

theorem Cslib.Crypto.GMW.encTwoRoundState_round_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TwoRoundState} :
@[reducible, inline]

The tuple of the fields of encTwoRoundState.

theorem Cslib.Crypto.GMW.encProverCoins_seeds_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → ProverCoins} :

The prover's coins, as sampled for the honest prover by sampleHonestCoins or for the simulator by gmwSampleSimCoins: the committed bits as a bit word, then the list of commitment seeds, each a bit word. The bits are framed, and so is each seed.

theorem Cslib.Crypto.GMW.encProverCoins_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → List (List Bool)} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits) T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { bits := x0 x, seeds := x1 x }) encIn encProverCoins (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.GMW.encProverCoins_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → List Bool} {x1 : γ → List (List Bool)} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits) budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { bits := x0 x, seeds := x1 x }) encIn encProverCoins budget
theorem Cslib.Crypto.GMW.encProverCoins_bits_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → ProverCoins} :
@[reducible, inline]

The tuple of the fields of encProverCoins.

theorem Cslib.Crypto.GMW.isPPTOn_runTwoRound {α β Caller : Type} {enc : α ↪ List Bool} {encB : β ↪ List Bool} {input : Caller ↪ List Bool} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit β} {prepare : Caller → ℕ × α × List Bool} {reply1 reply2 : Caller × List Bool → List Bool} {bound : Caller → ℕ} (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) encB fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) (hprep : Turing.MultiTapeTM.ComputableInPolyTime prepare input (encInstanceAuxInput enc)) (hr1 : Turing.MultiTapeTM.ComputableInPolyTime reply1 (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hr2 : Turing.MultiTapeTM.ComputableInPolyTime reply2 (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hbound : Turing.MultiTapeTM.ComputableInPolyTime bound input Turing.MultiTapeTM.encUnary) (hle1 : ∀ (c : Caller) (q : List Bool), (reply1 (c, q)).length ≤ bound c) (hle2 : ∀ (c : Caller) (q : List Bool), (reply2 (c, q)).length ≤ bound c) :
Probability.IsPPTOn input (Turing.MultiTapeTM.encPair encB encTwoRoundState) fun (c : Caller) => runTwoRound (fun (q : List Bool) => reply1 (c, q)) (fun (q : List Bool) => reply2 (c, q)) (Vstar (prepare c).1 (prepare c).2.1 (prepare c).2.2) TwoRoundState.init
theorem Cslib.Crypto.GMW.isPPTOn_runTwoRound_prover {α β Caller : Type} {enc : α ↪ List Bool} {encB : β ↪ List Bool} {input : Caller ↪ List Bool} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit β} {generator : List Bool → List Bool} {n s m : Caller → ℕ} {a : Caller → α} {z : Caller → List Bool} {φ : Caller → Logic.PL.CNF ℕ} {openFlags bits ch_guess : Caller → List Bool} {seeds pads : Caller → List (List Bool)} (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) encB fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) (hg : Turing.MultiTapeTM.ComputableInPolyTime generator Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hn : Turing.MultiTapeTM.ComputableInPolyTime n input Turing.MultiTapeTM.encUnary) (hs : Turing.MultiTapeTM.ComputableInPolyTime s input Turing.MultiTapeTM.encUnary) (hm : Turing.MultiTapeTM.ComputableInPolyTime m input Turing.MultiTapeTM.encUnary) (ha : Turing.MultiTapeTM.ComputableInPolyTime a input enc) (hz : Turing.MultiTapeTM.ComputableInPolyTime z input Turing.MultiTapeTM.encBits) (hφ : Turing.MultiTapeTM.ComputableInPolyTime φ input Complexity.encCNF) (hopen : Turing.MultiTapeTM.ComputableInPolyTime openFlags input Turing.MultiTapeTM.encBits) (hbits : Turing.MultiTapeTM.ComputableInPolyTime bits input Turing.MultiTapeTM.encBits) (hch : Turing.MultiTapeTM.ComputableInPolyTime ch_guess input Turing.MultiTapeTM.encBits) (hseeds : Turing.MultiTapeTM.ComputableInPolyTime seeds input (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) (hpads : Turing.MultiTapeTM.ComputableInPolyTime pads input (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) :
Probability.IsPPTOn input (Turing.MultiTapeTM.encPair encB encTwoRoundState) fun (c : Caller) => runTwoRound (fun (r : List Bool) => proverReply1 generator (m c) r (openFlags c) (bits c) (seeds c) (pads c)) (fun (x : List Bool) => proverReply2 (s c) (φ c) (ch_guess c) (bits c) (seeds c)) (Vstar (n c) (a c) (z c)) TwoRoundState.init

GMW zero-knowledge simulator and its PPT certificate #

theorem Cslib.Crypto.GMW.computableInPolyTime_firstSuccess {α β : Type} {input : α ↪ List Bool} {enc : β ↪ List Bool} {d : α → β} {attempts : α → List (Option β)} (hd : Turing.MultiTapeTM.ComputableInPolyTime d input enc) (ha : Turing.MultiTapeTM.ComputableInPolyTime attempts input (Turing.MultiTapeTM.encList (Turing.MultiTapeTM.encOption enc))) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => firstSuccess (d a) (attempts a)) input enc

Sample the GMW simulator's random strings and commitment seeds for a guessed challenge ch_guess; the committed bits are simBits φ ch_guess r₀ r₁ r₂.

noncomputable def Cslib.Crypto.GMW.gmwSimWithPads {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : Probability.WordOracleComp Unit β) (pads : List (List Bool)) :

Run one simulated GMW attempt on prog with pre-sampled unopened pads pads, without any witness: guess the challenge, commit to simBits for that guess, and return the verifier's output when its challenge equals the guess.

noncomputable def Cslib.Crypto.GMW.gmwSimAttempt {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : Probability.WordOracleComp Unit β) :

One attempt of the GMW zero-knowledge simulator on prog, without any witness.

noncomputable def Cslib.Crypto.GMW.gmwSimulator {α : Type} (generator : List Bool → List Bool) (length : ℕ → ℕ) (f : α → Logic.PL.CNF ℕ) (Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)) (n : ℕ) (a : α) (z : List Bool) :

The GMW zero-knowledge simulator: run gmwSimAttempt n + 1 times and return the first successful view, or [] when every attempt failed.

theorem Cslib.Crypto.GMW.isPPTOn_gmwSimWithPads {α β : Type} {enc : α ↪ List Bool} {encB : β ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit β} (hg : Turing.MultiTapeTM.ComputableInPolyTime generator Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hlen : ∀ (s : List Bool), (generator s).length = length s.length) (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) encB fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) :
Probability.IsPPTOn (Turing.MultiTapeTM.encPair (encInstanceAuxInput enc) (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) (Turing.MultiTapeTM.encOption encB) fun (p : (ℕ × α × List Bool) × List (List Bool)) => gmwSimWithPads generator (p.1.1 + 7) (length (p.1.1 + 7)) (f p.1.2.1) (Vstar p.1.1 p.1.2.1 p.1.2.2) p.2
theorem Cslib.Crypto.GMW.isPPTOn_gmwSimAttempt {α β : Type} {enc : α ↪ List Bool} {encB : β ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit β} (hg : Turing.MultiTapeTM.ComputableInPolyTime generator Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hlen : ∀ (s : List Bool), (generator s).length = length s.length) (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) encB fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) :
Probability.IsPPTOn (encInstanceAuxInput enc) (Turing.MultiTapeTM.encOption encB) fun (p : ℕ × α × List Bool) => gmwSimAttempt generator (p.1 + 7) (length (p.1 + 7)) (f p.2.1) (Vstar p.1 p.2.1 p.2.2)
theorem Cslib.Crypto.GMW.isPPTOn_gmwSimulator {α : Type} {enc : α ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)} (hg : Turing.MultiTapeTM.ComputableInPolyTime generator Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hlen : ∀ (s : List Bool), (generator s).length = length s.length) (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) :
Probability.IsPPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => gmwSimulator generator length f Vstar n a z
theorem Cslib.Crypto.GMW.isPPTOn_gmwInteract {α : Type} {enc : α ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)} (hg : Turing.MultiTapeTM.ComputableInPolyTime generator Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hlen : ∀ (s : List Bool), (generator s).length = length s.length) (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) :
Probability.IsPPTOn (encInstanceWitnessAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool × List Bool) => match x with | (n, a, w, z) => gmwInteract generator (n + 7) (length (n + 7)) (f a) w (Vstar n a z)