Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The gate commitment c₀ · c₁ · c₂² · com(−2; 0) commits to b₀ + b₁ + 2b₂ − 2, and a 0/1 proof for it shows b₂ = ¬(b₀ ∧ b₁)

Proved
GOSNIZK.CircuitSound.gate_commitment

by mikedeng1 · Oct 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

circuit-satcommitment-schemescryptographyp2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let a homomorphic proof commitment scheme have message space M=Z/NZ\mathcal M=\mathbb Z/N\mathbb ZM=Z/NZ with N≥4N\ge4N≥4, and assume the homomorphic property, perfect binding and perfect soundness of the 0/1 proof.

  1. For every key ckckck of either mode, all messages m0,m1,m2m_0,m_1,m_2m0​,m1​,m2​ and randomizers r0,r1,r2r_0,r_1,r_2r0​,r1​,r2​,
com(m0;r0)⋅com(m1;r1)⋅com(m2;r2)2⋅com(−2;0)=com(m0+m1+2m2−2; r0+r1+2r2).\mathrm{com}(m_0;r_0)\cdot\mathrm{com}(m_1;r_1)\cdot\mathrm{com}(m_2;r_2)^2\cdot\mathrm{com}(-2;0)=\mathrm{com}(m_0+m_1+2m_2-2;\ r_0+r_1+2r_2).com(m0​;r0​)⋅com(m1​;r1​)⋅com(m2​;r2​)2⋅com(−2;0)=com(m0​+m1​+2m2​−2; r0​+r1​+2r2​).
  1. For every (ck,xk)(ck,xk)(ck,xk) output by KbindingK_{\mathrm{binding}}Kbinding​, all bits b0,b1,b2b_0,b_1,b_2b0​,b1​,b2​, randomizers r0,r1,r2r_0,r_1,r_2r0​,r1​,r2​ and every π\piπ: if
V01(ck, com(b0;r0) com(b1;r1) com(b2;r2)2 com(−2;0), π)=1,V_{01}\big(ck,\ \mathrm{com}(b_0;r_0)\,\mathrm{com}(b_1;r_1)\,\mathrm{com}(b_2;r_2)^2\,\mathrm{com}(-2;0),\ \pi\big)=1,V01​(ck, com(b0​;r0​)com(b1​;r1​)com(b2​;r2​)2com(−2;0), π)=1,

then b2=¬(b0∧b1)b_2=\neg(b_0\wedge b_1)b2​=¬(b0​∧b1​).

This is the gate check of Figure 3: the verifier can test a NAND gate on committed wires with one 0/1 proof.

Formalization Note Part 2 is the paper's sentence "A proof that this commitment contains 0 or 1 shows that b2=¬(b0∧b1)b_2=\neg(b_0\wedge b_1)b2​=¬(b0​∧b1​)", made precise: the proof is accepted on a binding key, and perfect binding identifies the message it certifies with b0+b1+2b2−2b_0+b_1+2b_2-2b0​+b1​+2b2​−2, to which Lemma 5 applies.

Preamble
import Mathlib
import Definitions.Def_GOSNIZK_CircuitSound_Protocol
Formal statement
namespace GOSNIZK.CircuitSound

/-- The gate commitment (Groth, Ostrovsky, Sahai, *New Techniques for Noninteractive
Zero-Knowledge*, J. ACM 59(3) (2012), authors' version of March 7, 2011, p. 14, after Lemma 5).
(1) Under the homomorphic property, on every key of either mode,
`com(b₀; r₀) · com(b₁; r₁) · com(b₂; r₂)² · com(−2; 0) = com(b₀ + b₁ + 2b₂ − 2; r₀ + r₁ + 2r₂)`.
(2) On a binding key, with message space of order at least 4, perfect binding and perfect soundness
of the 0/1 proof, an accepted 0/1 proof for this commitment, where `b₀, b₁, b₂` are bits, shows
`b₂ = ¬(b₀ ∧ b₁)`. -/
theorem gate_commitment {N : ℕ} {R C CK XK TK Rp Prf : Type} [AddCommGroup R] [Fintype R] [CommGroup C] [Fintype C]
    [Fintype Rp] [Nonempty Rp] (S : Scheme N R C CK XK TK Rp Prf)
    (hN : 4 ≤ N) (hhom : S.Homomorphic) (hbind : S.PerfectBinding)
    (hsound01 : S.PerfectSoundness01) :
    (∀ ck : CK, S.IsKey ck → ∀ (m₀ m₁ m₂ : ZMod N) (r₀ r₁ r₂ : R),
      S.gateCom ck (S.com ck m₀ r₀) (S.com ck m₁ r₁) (S.com ck m₂ r₂) =
        S.com ck (m₀ + m₁ + 2 * m₂ - 2) (r₀ + r₁ + 2 • r₂)) ∧
    (∀ (ck : CK) (xk : XK), (ck, xk) ∈ S.Kbind.support →
      ∀ (b₀ b₁ b₂ : Bool) (r₀ r₁ r₂ : R) (π : Prf),
        S.V01 ck (S.gateCom ck (S.com ck (ofBit b₀) r₀) (S.com ck (ofBit b₁) r₁)
          (S.com ck (ofBit b₂) r₂)) π = true →
        b₂ = !(b₀ && b₁)) := by sorry

end GOSNIZK.CircuitSound
Source
Groth, Ostrovsky, Sahai, New Techniques for Noninteractive Zero-Knowledge, J. ACM 59(3) (2012), authors' version of March 7, 2011, p. 14, paragraph after Lemma 5
Human review
  • Endorsed by Shuze Chen · Oct 7, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 7, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me