Documentation

CslibFrontier.Crypto.Protocols.VOLE.Circuit

Binding VOLE checks to a public arithmetic circuit #

The circuit is the existing straight-line arithmetic circuit, with public inputs followed by private inputs. Linear MAC openings enforce the public inputs, addition and constant gates, and the designated public outputs. Multiplication gates use the existing masked batch check. Repeated wires accumulate coefficients in the linear rows, including in characteristic two.

Main definitions #

@[reducible, inline]

Multiplication-gate indices of the existing arithmetic circuit.

Instances For
    @[instance_reducible]

    A multiplication input wire in the flat input-then-gate layout.

    The multiplication gate's output in the same layout.

    The public linear equations: public inputs, nonmultiplication gates, then outputs. Multiplication rows are zero, so the row index is independent of filtering gate operations.

    def Cslib.Crypto.Protocols.VOLE.circuitLinearTargets {F : Type} {p k m : ℕ} [Zero F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) (x : Fin p → F) (y : Fin m → F) :
    Fin p ⊕ Fin C.size ⊕ Fin m → F

    Targets for the public input, gate and output rows.

    def Cslib.Crypto.Protocols.VOLE.circuitTrace {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) (x : Fin p → F) (w : Fin k → F) :
    Fin (p + k + C.size) → F

    The existing circuit trace, flattened into the VOLE input-then-gate vector.

    theorem Cslib.Crypto.Protocols.VOLE.circuitTrace_linear {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) (x : Fin p → F) (w : Fin k → F) (y : Fin m → F) (hy : C.eval (Circuits.arithInterpretation F) (Fin.append x w) = y) :

    The honest trace satisfies all public linear equations when its designated output is y.

    theorem Cslib.Crypto.Protocols.VOLE.circuitTrace_mul {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) (x : Fin p → F) (w : Fin k → F) (i : CircuitMulGate C) :

    The honest trace satisfies every multiplication gate, including shared input wires.

    theorem Cslib.Crypto.Protocols.VOLE.exists_witness_of_circuitChecks {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) (x : Fin p → F) (y : Fin m → F) (a : Fin (p + k + C.size) → F) (hlinear : (circuitLinearCoeffs C).mulVec a = circuitLinearTargets C x y) (hmul : ∀ (i : CircuitMulGate C), a (circuitMulInput C i 0) * a (circuitMulInput C i 1) = a (circuitMulOutput C i)) :
    ∃ (w : Fin k → F), C.eval (Circuits.arithInterpretation F) (Fin.append x w) = y

    A wire assignment satisfying all public linear equations and multiplication gates gives an actual private input witness for the public circuit output.

    @[reducible, inline]

    The circuit messages use the existing three-move shape: corrections and linear MAC masks, public multiplication weights, then the masked affine reply.

    noncomputable def Cslib.Crypto.Protocols.VOLE.circuitVerify {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) [DecidableEq F] (statement : (Fin p → F) × (Fin m → F)) (share : F × (Fin (p + k + C.size + 1) → F)) (first : (Fin (p + k + C.size) → F) × (Fin p ⊕ Fin C.size ⊕ Fin m → F)) (r : CircuitMulGate C → F) (reply : F × F) :

    The actual circuit verifier: homomorphic linear openings and the existing masked batch. The row equivalence merely presents the public matrix rows to voleVerifyOpening.

    noncomputable def Cslib.Crypto.Protocols.VOLE.circuitCheck {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) [Fintype F] [DecidableEq F] :
    Interactive.Reduction (voleSenderSpec F (p + k + C.size + 1)) (voleReceiverSpec F (p + k + C.size + 1)) (circuitCheckSpec C) ((Fin p → F) × (Fin m → F)) (Fin k → F) Unit Unit

    A public-circuit reduction in the same role-local cached VOLE world. The honest prover receives only sender vectors; linear openings are fixed together with corrections before weights.

    theorem Cslib.Crypto.Protocols.VOLE.circuitCheck_output {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) [Fintype F] [DecidableEq F] (statement : (Fin p → F) × (Fin m → F)) (t : (circuitCheckSpec C).Transcript) :
    (circuitCheck C).verifier.output statement t = do let share ← ProbOracleComp.query (Sum.inr ()) match t with | (first, r, reply, PUnit.unit) => pure (if circuitVerify C statement share first r reply = true then some () else none)

    The actual verifier reads only its own cached share and the public transcript.

    Linear MACs authenticate the assignment fixed by the sender's correction message.

    theorem Cslib.Crypto.Protocols.VOLE.circuitVerify_correct {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) [DecidableEq F] (x : Fin p → F) (w : Fin k → F) (y : Fin m → F) (hy : C.eval (Circuits.arithInterpretation F) (Fin.append x w) = y) (c : VOLECorrelation F (p + k + C.size + 1)) (hc : c.Valid) (r : CircuitMulGate C → F) :

    Honest circuit replies pass both linear openings and multiplication verification.

    theorem Cslib.Crypto.Protocols.VOLE.circuitCheck_complete {F : Type} {p k m : ℕ} [CommRing F] (C : Circuits.Circuit (Circuits.arithSignature F) (p + k) m) [Fintype F] [DecidableEq F] :
    Interactive.Reduction.Complete (voleWorld F (p + k + C.size + 1)) (circuitCheck C) (fun (statement : (Fin p → F) × (Fin m → F)) (w : Fin k → F) => C.eval (Circuits.arithInterpretation F) (Fin.append statement.1 w) = statement.2) Interactive.Accept 0

    The actual role-local reduction has perfect completeness for the public circuit relation.