Documentation

CslibFrontier.Crypto.Protocols.VOLE.Native

List programs for masked VOLE receiver simulation #

The ring is fixed. A layout map extracts the wire count and gate list from the full runtime input. Receiver callbacks retain that input and explicit state through initialization, challenge selection, reply processing and termination. Their first-message carrier is supplied independently. Receiver.strategy adapts them to the existing strategy type, reading the same cached receiver share in each phase. This is a first-order subclass of receivers, not a representation of arbitrary higher-order strategy trees. The simulator samples one fresh affine mask per execution.

Receiver.mapFirst can preprocess corrections using public input and the receiver's own share. The exact law retains the raw correction-based View and concerns the resulting receiver adapter. It does not assert that an arbitrary transformed message is sender-realizable. A protocol that sends a richer first message needs its own reconstruction law before expanding this raw view.

Main definitions #

Main results #

The realization results here are original; the ideal algebra and source mapping are in VOLE.AdaptiveMulCheck and VOLE.MaskedMulCheck.

One multiplication gate of a native circuit, with left, right, and output wire indices.

  • left : ℕ

    Left input wire index.

  • right : ℕ

    Right input wire index.

  • output : ℕ

    Output product wire index.

Instances For
    theorem Cslib.Crypto.Protocols.VOLE.Native.Gate.ext {x y : Gate} (left : x.left = y.left) (right : x.right = y.right) (output : x.output = y.output) :
    x = y

    Runtime wire count and ordered multiplication gates.

    • wires : ℕ

      Number of witness wires before the fresh mask wire.

    • gates : List Gate

      Ordered multiplication gates.

    Instances For
      theorem Cslib.Crypto.Protocols.VOLE.Native.Input.ext {x y : Input} (wires : x.wires = y.wires) (gates : x.gates = y.gates) :
      x = y

      Receiver key and tags, including the final fresh-mask tag.

      • key : F

        Global VOLE key held by the receiver.

      • tags : List F

        Receiver tags for each witness wire and the trailing fresh mask.

      Instances For
        theorem Cslib.Crypto.Protocols.VOLE.Native.Share.ext {F : Type} {x y : Share F} (key : x.key = y.key) (tags : x.tags = y.tags) :
        x = y
        @[instance_reducible]
        @[instance_reducible]

        Receiver share, raw corrections, normalized weights, affine reply and terminal private result.

        • share : Share F

          Receiver's sampled VOLE key and tags.

        • corrections : List F

          Raw commitment corrections for each witness wire.

        • weights : List F

          Normalized challenge weight per gate.

        • reply : F × F

          Blinded affine reply (a, b).

        • result : Result

          Terminal private output of the receiver callback.

        Instances For
          theorem Cslib.Crypto.Protocols.VOLE.Native.View.ext {F Result : Type} {x y : View F Result} (share : x.share = y.share) (corrections : x.corrections = y.corrections) (weights : x.weights = y.weights) (reply : x.reply = y.reply) (result : x.result = y.result) :
          x = y
          @[instance_reducible]
          instance Cslib.Crypto.Protocols.VOLE.Native.instDecidableEqView {F✝ Result✝ : Type} [DecidableEq F✝] [DecidableEq Result✝] :
          DecidableEq (View F✝ Result✝)
          def Cslib.Crypto.Protocols.VOLE.Native.instDecidableEqView.decEq {F✝ Result✝ : Type} [DecidableEq F✝] [DecidableEq Result✝] (x✝ x✝¹ : View F✝ Result✝) :
          Decidable (x✝ = x✝¹)
          @[instance_reducible]
          instance Cslib.Crypto.Protocols.VOLE.Native.instReprView {F✝ Result✝ : Type} [Repr F✝] [Repr Result✝] :
          Repr (View F✝ Result✝)
          def Cslib.Crypto.Protocols.VOLE.Native.instReprView.repr {F✝ Result✝ : Type} [Repr F✝] [Repr Result✝] :
          View F✝ Result✝ → ℕ → Std.Format
          @[instance_reducible]
          instance Cslib.Crypto.Protocols.VOLE.Native.instInhabitedView {a✝ : Type} [Inhabited a✝] {a✝¹ : Type} [Inhabited a✝¹] :
          Inhabited (View a✝ a✝¹)
          structure Cslib.Crypto.Protocols.VOLE.Native.Receiver (F I First State Result : Type) :

          Explicit-state receiver callbacks. Each phase receives the public input and its own private setup share. Private randomness may be saved in State for subsequent phases.

          • init : I → Share F → ProbComp State

            Initialization before receiving the corrections.

          • challenge : I → Share F → State → First → ProbComp (List F × State)

            Adaptive public weights and retained state after the supplied first message.

          • receive : I → Share F → State → F × F → ProbComp State

            Process the affine reply.

          • terminal : I → Share F → State → ProbComp Result

            Return the receiver's private result.

          def Cslib.Crypto.Protocols.VOLE.Native.Receiver.mapFirst {F I First State Result Message : Type} (receiver : Receiver F I First State Result) (first : I → Share F → Message → First) :
          Receiver F I Message State Result

          Preprocess only the receiver's first-message callback. The map may use the receiver's own share; this operation alone makes no claim that a sender can produce the transformed message.

          @[simp]
          theorem Cslib.Crypto.Protocols.VOLE.Native.Receiver.mapFirst_id {F I First State Result : Type} (receiver : Receiver F I First State Result) :
          (receiver.mapFirst fun (x : I) (x_1 : Share F) (message : First) => message) = receiver

          Identity preprocessing leaves every callback and its captured state unchanged.

          Exactly count weights: missing entries are zero and excess entries are discarded.

          def Cslib.Crypto.Protocols.VOLE.Native.checkValue {F : Type} [CommRing F] (input : Input) (share : Share F) (d r : List F) :
          F

          Total list evaluation. Gate indices are looked up in the existing lists; their numeric values never determine an allocation or loop bound. The wire count selects the fresh mask's tag.

          def Cslib.Crypto.Protocols.VOLE.Native.simulate {F I First State Result : Type} [CommRing F] (sample : ProbComp F) (receiver : Receiver F I First State Result) (layout : I → Input) (first : I → Share F → List F → First) (input : I) :
          ProbComp (View F Result)

          The supplied sampler is called independently for the key, each tag/correction, and the final affine coefficient. Exactness and efficient realization are separate sampler hypotheses. The first message map preprocesses only the receiver callback; the returned view retains raw corrections.

          def Cslib.Crypto.Protocols.VOLE.Native.Receiver.strategy {F I First State Result : Type} [CommRing F] {Message Index : Type} (receiver : Receiver F I First State Result) (n : ℕ) (encodeFirst : Message → First) (index : Index → ℕ) (input : I) :

          The adapter reads the actual cached share at every phase, rather than passing setup state through the prover interface. The returned strategies retain the sampled callback state. The first-message encoder and weight-index map specify the typed message carriers; this semantic adapter alone carries no runtime certificate for those maps.

          def Cslib.Crypto.Protocols.VOLE.Native.inputOfMaps {n m : ℕ} (left right output : Fin m → Fin n) :

          Public input representing finite wire maps; binary indices retain repeated wires.

          def Cslib.Crypto.Protocols.VOLE.Native.viewToLists {F Result : Type} {n m : ℕ} :
          (F × (Fin (n + 1) → F)) × (maskedMulCheckSpec F (Fin m) n).Transcript × Result → View F Result

          List representation of the full typed receiver view, including its private share.

          theorem Cslib.Crypto.Protocols.VOLE.Native.weights_eq_ofFn {F : Type} [CommRing F] (count : ℕ) (r : List F) :
          weights count r = List.ofFn fun (i : Fin count) => r.getD (↑i) 0

          The transmitted list is precisely the adapter's finite weight vector.

          Normalization leaves an already correctly sized vector unchanged.

          theorem Cslib.Crypto.Protocols.VOLE.Native.checkValue_ofFn {F : Type} [CommRing F] {n m : ℕ} (left right output : Fin m → Fin n) (delta : F) (q : Fin (n + 1) → F) (d : Fin n → F) (r : Fin m → F) :
          checkValue (inputOfMaps left right output) { key := delta, tags := List.ofFn q } (List.ofFn d) (List.ofFn r) = maskedMulCheckValue left right output delta q d r

          The total list algorithm agrees with the existing algebraic check on valid wire maps.

          theorem Cslib.Crypto.Protocols.VOLE.Native.eval_simulate {F I First State Result : Type} [CommRing F] [Fintype F] {n m : ℕ} (left right output : Fin m → Fin n) (sample : ProbComp F) (hsample : sample.eval = Probability.PMF.uniformOfFintype F) (receiver : Receiver F I First State Result) (layout : I → Input) (first : I → Share F → List F → First) (input : I) (hlayout : layout input = inputOfMaps left right output) :
          (simulate sample receiver layout first input).eval = PMF.map viewToLists (maskedMulCheckReceiverSimulate left right output ((receiver.mapFirst first).strategy n List.ofFn Fin.val) input).eval

          The native program realizes the existing typed simulator, including all private callback state effects. The public input and vector dimensions are tied by the explicit layout equality.

          theorem Cslib.Crypto.Protocols.VOLE.Native.receiverView_eq_eval_simulate {F I First State Result : Type} [CommRing F] [Fintype F] [DecidableEq F] {n m : ℕ} (left right output : Fin m → Fin n) (sample : ProbComp F) (hsample : sample.eval = Probability.PMF.uniformOfFintype F) (receiver : Receiver F I First State Result) (layout : I → Input) (first : I → Share F → List F → First) (input : I) (hlayout : layout input = inputOfMaps left right output) (w : Fin n → F) (hw : ∀ (i : Fin m), w (left i) * w (right i) = w (output i)) :
          PMF.map viewToLists (maskedMulCheckReceiverView left right output ((receiver.mapFirst first).strategy n List.ofFn Fin.val) w input) = (simulate sample receiver layout first input).eval

          Exact native full-view simulation for satisfying witnesses and supplied receiver callbacks. The actual cached World runs the receiver with first-message preprocessing. The returned view retains the raw corrections; a sender-realizable transformed transcript needs a separate law.