Documentation

Starlib.OracleReduction.ProtocolSpec.Basic

Protocol Specifications for (Oracle) Reductions #

This file defines the ProtocolSpec type, which is used to specify the protocol between the prover and the verifier.

structure ProtocolSpec (n : ) :

A protocol specification for an interactive protocol with n steps consists of:

  • A vector of directions dir for each step, which is either .P_to_V (the prover sends a message to the verifier) or .V_to_P (the verifier sends a challenge to the prover).
  • A vector of types «Type» for each step, which is the type of the message or challenge sent in that step.
  • dir : Fin nDirection

    The direction of each message in the protocol.

  • Type : Fin nType

    The type of each message in the protocol.

Instances For
    theorem ProtocolSpec.ext_iff {n : } {x y : ProtocolSpec n} :
    x = y x.dir = y.dir x.Type = y.Type
    theorem ProtocolSpec.ext {n : } {x y : ProtocolSpec n} (dir : x.dir = y.dir) («Type» : x.Type = y.Type) :
    x = y
    @[implicit_reducible]
    @[reducible]

    The empty protocol specification, with no messages or challenges, written as !p[].

    Instances For

      The empty protocol specification, with no messages or challenges, written as !p[].

      Instances For
        @[reducible]

        Subtype of Fin n for the indices corresponding to messages in a protocol specification

        Instances For
          @[reducible]

          Subtype of Fin n for the indices corresponding to challenges in a protocol specification

          Instances For
            @[implicit_reducible]
            @[implicit_reducible]
            @[reducible, inline, specialize #[]]
            def ProtocolSpec.Message {n : } (pSpec : ProtocolSpec n) (i : pSpec.MessageIdx) :

            The type of the i-th message in a protocol specification.

            This does not distinguish between messages received in full or as an oracle.

            Instances For
              @[reducible, inline, specialize #[]]
              def ProtocolSpec.Message' {n : } (pSpec : ProtocolSpec n) (i : Fin n) :

              Unbundled version of Message, which supplies the proof separately from the index.

              Instances For
                @[reducible, inline, specialize #[]]
                def ProtocolSpec.Challenge {n : } (pSpec : ProtocolSpec n) (i : pSpec.ChallengeIdx) :

                The type of the i-th challenge in a protocol specification

                Instances For
                  @[reducible, inline, specialize #[]]
                  def ProtocolSpec.Challenge' {n : } (pSpec : ProtocolSpec n) (i : Fin n) :

                  Unbundled version of Challenge, which supplies the proof separately from the index.

                  Instances For
                    @[reducible, inline, specialize #[]]

                    The type of all messages in a protocol specification. Uncurried version of Message.

                    Instances For
                      @[reducible, inline, specialize #[]]

                      Unbundled version of Messages, which supplies the proof separately from the index.

                      Instances For
                        @[reducible, inline, specialize #[]]

                        The type of all challenges in a protocol specification

                        Instances For
                          @[reducible, inline, specialize #[]]

                          Unbundled version of Challenges, which supplies the proof separately from the index.

                          Instances For
                            @[reducible, inline, specialize #[]]

                            The (full)) transcript of an interactive protocol, which is a list of messages and challenges.

                            Note that this is definitionally equal to Transcript (Fin.last n) pSpec.

                            Instances For
                              def ProtocolSpec.take {n : } (m : ) (h : m n) (pSpec : ProtocolSpec n) :

                              Take the first m ≤ n rounds of a ProtocolSpec n

                              Instances For
                                def ProtocolSpec.rtake {n : } (m : ) (h : m n) (pSpec : ProtocolSpec n) :

                                Take the last m ≤ n rounds of a ProtocolSpec n

                                Instances For
                                  def ProtocolSpec.drop {n : } (m : ) (h : m n) (pSpec : ProtocolSpec n) :

                                  Drop the first m ≤ n rounds of a ProtocolSpec n

                                  Instances For
                                    def ProtocolSpec.rdrop {n : } (m : ) (h : m n) (pSpec : ProtocolSpec n) :

                                    Drop the last m ≤ n rounds of a ProtocolSpec n

                                    Instances For
                                      def ProtocolSpec.extract {n : } (start stop : ) (h1 : start stop) (h2 : stop n) (pSpec : ProtocolSpec n) :
                                      ProtocolSpec (stop - start)

                                      Extract the slice of the rounds of a ProtocolSpec n from start to stop - 1.

                                      Instances For
                                        @[implicit_reducible]
                                        instance ProtocolSpec.instSliceLTNatLe {n : } :
                                        SliceLT (ProtocolSpec n) (fun (x : ProtocolSpec n) (stop : ) => stop n) fun (x : ProtocolSpec n) (stop : ) (x_1 : stop n) => ProtocolSpec stop
                                        @[implicit_reducible]
                                        instance ProtocolSpec.instSliceGENatLeHSub {n : } :
                                        SliceGE (ProtocolSpec n) (fun (x : ProtocolSpec n) (start : ) => start n) fun (x : ProtocolSpec n) (start : ) (x_1 : start n) => ProtocolSpec (n - start)
                                        @[implicit_reducible]
                                        instance ProtocolSpec.instSliceNatAndLeHSub {n : } :
                                        Slice (ProtocolSpec n) (fun (x : ProtocolSpec n) (start stop : ) => start stop stop n) fun (x : ProtocolSpec n) (start stop : ) (x_1 : start stop stop n) => ProtocolSpec (stop - start)
                                        @[simp]
                                        theorem ProtocolSpec.take_dir {n m : } {h : m n} {pSpec : ProtocolSpec n} :
                                        pSpec:m.dir = pSpec.dir:m
                                        @[simp]
                                        theorem ProtocolSpec.take_Type {n m : } {h : m n} {pSpec : ProtocolSpec n} :
                                        pSpec:m.Type = pSpec.Type:m
                                        @[simp]
                                        theorem ProtocolSpec.drop_dir {n m : } {h : m n} {pSpec : ProtocolSpec n} :
                                        pSpecm:.dir = pSpec.dirm:
                                        @[simp]
                                        theorem ProtocolSpec.drop_Type {n m : } {h : m n} {pSpec : ProtocolSpec n} :
                                        pSpecm:.Type = pSpec.Typem:
                                        @[simp]
                                        theorem ProtocolSpec.extract_dir {n m start stop : } {h1 : start stop} {h2 : stop n} {pSpec : ProtocolSpec n} :
                                        pSpecstart:stop.dir = pSpec.dirstart:stop
                                        @[simp]
                                        theorem ProtocolSpec.extract_Type {n m start stop : } {h1 : start stop} {h2 : stop n} {pSpec : ProtocolSpec n} :
                                        pSpecstart:stop.Type = pSpec.Typestart:stop
                                        @[reducible, inline]
                                        abbrev ProtocolSpec.FullTranscript.take {n : } {pSpec : ProtocolSpec n} (m : ) (h : m n) (transcript : pSpec.FullTranscript) :

                                        Take the first m ≤ n rounds of a (full) transcript for a protocol specification pSpec

                                        Instances For
                                          @[reducible, inline]
                                          abbrev ProtocolSpec.FullTranscript.rtake {n : } {pSpec : ProtocolSpec n} (m : ) (h : m n) (transcript : pSpec.FullTranscript) :

                                          Take the last m ≤ n rounds of a (full) transcript for a protocol specification pSpec

                                          Instances For
                                            @[reducible, inline]
                                            abbrev ProtocolSpec.FullTranscript.drop {n : } {pSpec : ProtocolSpec n} (m : ) (h : m n) (transcript : pSpec.FullTranscript) :
                                            Instances For
                                              @[reducible, inline]
                                              abbrev ProtocolSpec.FullTranscript.rdrop {n : } {pSpec : ProtocolSpec n} (m : ) (h : m n) (transcript : pSpec.FullTranscript) :
                                              Instances For
                                                @[reducible, inline]
                                                abbrev ProtocolSpec.FullTranscript.extract {n : } {pSpec : ProtocolSpec n} (start stop : ) (h1 : start stop) (h2 : stop n) (transcript : pSpec.FullTranscript) :
                                                (ProtocolSpec.extract start stop h1 h2 pSpec).FullTranscript
                                                Instances For
                                                  @[implicit_reducible]
                                                  instance ProtocolSpec.FullTranscript.instSliceLTNatLeSliceLT {n : } {pSpec : ProtocolSpec n} :
                                                  SliceLT pSpec.FullTranscript (fun (x : pSpec.FullTranscript) (stop : ) => stop n) fun (x : pSpec.FullTranscript) (stop : ) (x_1 : stop n) => pSpec:stop.FullTranscript
                                                  @[implicit_reducible]
                                                  instance ProtocolSpec.FullTranscript.instSliceGENatLeSliceGEHSub {n : } {pSpec : ProtocolSpec n} :
                                                  SliceGE pSpec.FullTranscript (fun (x : pSpec.FullTranscript) (start : ) => start n) fun (x : pSpec.FullTranscript) (start : ) (x_1 : start n) => pSpecstart:.FullTranscript
                                                  @[implicit_reducible]
                                                  instance ProtocolSpec.FullTranscript.instSliceNatAndLeSliceHSub {n : } {pSpec : ProtocolSpec n} :
                                                  Slice pSpec.FullTranscript (fun (x : pSpec.FullTranscript) (start stop : ) => start stop stop n) fun (x : pSpec.FullTranscript) (start stop : ) (x_1 : start stop stop n) => pSpecstart:stop.FullTranscript
                                                  theorem ProtocolSpec.FullTranscript.take_eq_take {n m : } {h : m n} {pSpec : ProtocolSpec n} {transcript : pSpec.FullTranscript} :
                                                  transcript:m = take m h transcript
                                                  theorem ProtocolSpec.FullTranscript.rtake_eq_rtake {n m : } {h : m n} {pSpec : ProtocolSpec n} {transcript : pSpec.FullTranscript} :
                                                  transcriptm: = drop m h transcript
                                                  theorem ProtocolSpec.FullTranscript.extract_eq_extract {n m start stop m✝ start✝ stop✝ : } {h1 : start✝ stop✝} {h2 : stop✝ n} {pSpec : ProtocolSpec n} {transcript : pSpec.FullTranscript} :
                                                  transcriptstart✝:stop✝ = extract start✝ stop✝ h1 h2 transcript
                                                  @[reducible]
                                                  def ProtocolSpec.MessageIdxUpTo {n : } (k : Fin (n + 1)) (pSpec : ProtocolSpec n) :

                                                  Subtype of Fin k for the indices corresponding to messages in a protocol specification up to round k

                                                  Instances For
                                                    theorem ProtocolSpec.MessageIdxUpTo.eq_MessageIdx {n : } {k : Fin (n + 1)} {pSpec : ProtocolSpec n} :
                                                    MessageIdxUpTo k pSpec = { i : Fin k // pSpec.dir (Fin.castLE i) = Direction.P_to_V }
                                                    @[reducible]
                                                    def ProtocolSpec.ChallengeIdxUpTo {n : } (k : Fin (n + 1)) (pSpec : ProtocolSpec n) :

                                                    Subtype of Fin k for the indices corresponding to challenges in a protocol specification up to round k

                                                    Instances For
                                                      @[reducible, inline, specialize #[]]
                                                      def ProtocolSpec.MessageUpTo {n : } (k : Fin (n + 1)) (pSpec : ProtocolSpec n) (i : MessageIdxUpTo k pSpec) :

                                                      The indexed family of messages from the prover up to round k.

                                                      Instances For
                                                        @[reducible, inline, specialize #[]]
                                                        def ProtocolSpec.ChallengeUpTo {n : } (k : Fin (n + 1)) (pSpec : ProtocolSpec n) (i : ChallengeIdxUpTo k pSpec) :

                                                        The indexed family of challenges from the verifier up to round k.

                                                        Instances For
                                                          @[reducible, inline, specialize #[]]
                                                          def ProtocolSpec.MessagesUpTo {n : } (k : Fin (n + 1)) (pSpec : ProtocolSpec n) :

                                                          The type of all messages from the prover up to round k.

                                                          Instances For
                                                            @[reducible, inline, specialize #[]]
                                                            def ProtocolSpec.ChallengesUpTo {n : } (k : Fin (n + 1)) (pSpec : ProtocolSpec n) :

                                                            The type of all challenges from the verifier up to round k.

                                                            Instances For
                                                              @[reducible, inline, specialize #[]]
                                                              def ProtocolSpec.Transcript {n : } (k : Fin (n + 1)) (pSpec : ProtocolSpec n) :

                                                              A (partial) transcript of a protocol specification, indexed by some k : Fin (n + 1), is a list of messages from the protocol for all indices i less than k.

                                                              This is defined as the full transcript of the protocol specification up to round k.

                                                              Instances For
                                                                @[simp]
                                                                theorem ProtocolSpec.Transcript.def_eq {n : } {k : Fin (n + 1)} {pSpec : ProtocolSpec n} :
                                                                (take k pSpec).FullTranscript = ((i : Fin k) → pSpec.Type (Fin.castLE i))
                                                                @[implicit_reducible]

                                                                There is only one protocol specification with 0 messages (the empty one)

                                                                @[implicit_reducible]
                                                                @[implicit_reducible]
                                                                @[implicit_reducible]
                                                                @[implicit_reducible]
                                                                @[implicit_reducible]
                                                                @[implicit_reducible]
                                                                @[implicit_reducible]
                                                                instance ProtocolSpec.instFintypeMessageIdxUpTo {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} :
                                                                @[implicit_reducible]
                                                                instance ProtocolSpec.instFintypeChallengeIdxUpTo {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} :
                                                                def ProtocolSpec.MessagesUpTo.take {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} (j : Fin (k + 1)) (messages : MessagesUpTo k pSpec) :
                                                                MessagesUpTo (Fin.castLE j) pSpec

                                                                For a tuple of messages up to round k, take the messages up to round j : Fin (k + 1)

                                                                Instances For
                                                                  def ProtocolSpec.Messages.take {n : } {pSpec : ProtocolSpec n} (j : Fin (n + 1)) (messages : pSpec.Messages) :
                                                                  MessagesUpTo j pSpec

                                                                  Take the messages up to round j : Fin (n + 1)

                                                                  Instances For
                                                                    def ProtocolSpec.ChallengesUpTo.take {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} (j : Fin (k + 1)) (challenges : ChallengesUpTo k pSpec) :

                                                                    For a tuple of challenges up to round k, take the challenges up to round j : Fin (k + 1)

                                                                    Instances For
                                                                      def ProtocolSpec.Challenges.take {n : } {pSpec : ProtocolSpec n} (j : Fin (n + 1)) (challenges : pSpec.Challenges) :

                                                                      Take the challenges up to round j : Fin (n + 1)

                                                                      Instances For
                                                                        @[implicit_reducible]

                                                                        There is only one transcript for the empty protocol, represented as default : ProtocolSpec 0

                                                                        @[implicit_reducible]

                                                                        There is only one transcript for the empty protocol, represented as ![]

                                                                        @[implicit_reducible]

                                                                        There is only one transcript for any protocol specification with cutoff index 0

                                                                        def ProtocolSpec.MessagesUpTo.concat' {n : } {pSpec : ProtocolSpec n} {k : Fin n} (messages : (i : Fin k) → pSpec.dir (Fin.castLE i) = Direction.P_to_VpSpec.Type (Fin.castLE i)) (msg : (h : pSpec.dir k = Direction.P_to_V) → pSpec.Message k, h) (i : Fin (k + 1)) :
                                                                        pSpec.dir (Fin.castLE i) = Direction.P_to_VpSpec.Type (Fin.castLE i)
                                                                        Instances For
                                                                          def ProtocolSpec.MessagesUpTo.concat {n : } {pSpec : ProtocolSpec n} {k : Fin n} (messages : MessagesUpTo k.castSucc pSpec) (h : pSpec.dir k = Direction.P_to_V) (msg : pSpec.Message k, h) :

                                                                          Concatenate the k-th message to the end of the tuple of messages up to round k, assuming round k is a message round.

                                                                          Instances For
                                                                            def ProtocolSpec.MessagesUpTo.extend {n : } {pSpec : ProtocolSpec n} {k : Fin n} (messages : MessagesUpTo k.castSucc pSpec) (h : pSpec.dir k = Direction.V_to_P) :

                                                                            Extend the tuple of messages up to round k to up to round k + 1, assuming round k is a challenge round (so no message from the prover is sent).

                                                                            Instances For
                                                                              @[implicit_reducible]
                                                                              instance ProtocolSpec.MessagesUpTo.instDecidableEqOfMessage {n : } {pSpec : ProtocolSpec n} [inst : (i : pSpec.MessageIdx) → DecidableEq (pSpec.Message i)] {k : Fin (n + 1)} :
                                                                              @[implicit_reducible]

                                                                              There is only one transcript for the empty protocol, represented as default : ProtocolSpec 0

                                                                              @[implicit_reducible]

                                                                              There is only one transcript for the empty protocol, represented as ![]

                                                                              @[implicit_reducible]

                                                                              There is only one transcript for any protocol specification with cutoff index 0

                                                                              def ProtocolSpec.ChallengesUpTo.concat' {n : } {pSpec : ProtocolSpec n} {k : Fin n} (challenges : (i : Fin k) → pSpec.dir (Fin.castLE i) = Direction.V_to_PpSpec.Type (Fin.castLE i)) (chal : (h : pSpec.dir k = Direction.V_to_P) → pSpec.Challenge k, h) (i : Fin (k + 1)) :
                                                                              pSpec.dir (Fin.castLE i) = Direction.V_to_PpSpec.Type (Fin.castLE i)
                                                                              Instances For
                                                                                def ProtocolSpec.ChallengesUpTo.concat {n : } {pSpec : ProtocolSpec n} {k : Fin n} (challenges : ChallengesUpTo k.castSucc pSpec) (h : pSpec.dir k = Direction.V_to_P) (chal : pSpec.Challenge k, h) :

                                                                                Concatenate the k-th challenge to the end of the tuple of challenges up to round k, assuming round k is a challenge round.

                                                                                Instances For
                                                                                  def ProtocolSpec.ChallengesUpTo.extend {n : } {pSpec : ProtocolSpec n} {k : Fin n} (challenges : ChallengesUpTo k.castSucc pSpec) (h : pSpec.dir k = Direction.P_to_V) :

                                                                                  Extend the tuple of challenges up to round k to up to round k + 1, assuming round k is a message round (so no challenge from the verifier is sent).

                                                                                  Instances For
                                                                                    @[implicit_reducible]

                                                                                    There is only one transcript for the empty protocol

                                                                                    @[implicit_reducible]

                                                                                    There is only one transcript for the empty protocol, represented as ![]

                                                                                    @[implicit_reducible]

                                                                                    There is only one transcript for any protocol with cutoff index 0

                                                                                    @[reducible, inline]
                                                                                    abbrev ProtocolSpec.Transcript.concat {n : } {pSpec : ProtocolSpec n} {m : Fin n} (msg : pSpec.Type m) (T : Transcript m.castSucc pSpec) :

                                                                                    Concatenate a message to the end of a partial transcript. This is definitionally equivalent to Fin.snoc.

                                                                                    Instances For
                                                                                      def ProtocolSpec.Transcript.toMessagesUpTo {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} (transcript : Transcript k pSpec) :
                                                                                      MessagesUpTo k pSpec

                                                                                      Extract messages from a transcript up to round k

                                                                                      Instances For
                                                                                        def ProtocolSpec.Transcript.toChallengesUpTo {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} (transcript : Transcript k pSpec) :

                                                                                        Extract challenges from a transcript up to round k

                                                                                        Instances For
                                                                                          def ProtocolSpec.Transcript.toMessagesChallenges {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} (transcript : Transcript k pSpec) :
                                                                                          Instances For
                                                                                            def ProtocolSpec.Transcript.ofMessagesChallenges {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} (messages : MessagesUpTo k pSpec) (challenges : ChallengesUpTo k pSpec) :
                                                                                            Transcript k pSpec
                                                                                            Instances For

                                                                                              An equivalence between transcripts up to round k and the tuple of messages and challenges up to round k.

                                                                                              Instances For
                                                                                                @[simp]
                                                                                                theorem ProtocolSpec.Transcript.equivMessagesChallenges_apply {n : } {pSpec : ProtocolSpec n} {k : Fin (n + 1)} (transcript : Transcript k pSpec) :
                                                                                                @[reducible, inline, specialize #[]]
                                                                                                def ProtocolSpec.FullTranscript.messages {n : } {pSpec : ProtocolSpec n} (transcript : pSpec.FullTranscript) (i : pSpec.MessageIdx) :
                                                                                                pSpec.Type i
                                                                                                Instances For
                                                                                                  @[reducible, inline, specialize #[]]
                                                                                                  def ProtocolSpec.FullTranscript.challenges {n : } {pSpec : ProtocolSpec n} (transcript : pSpec.FullTranscript) (i : pSpec.ChallengeIdx) :
                                                                                                  pSpec.Type i
                                                                                                  Instances For
                                                                                                    @[implicit_reducible]

                                                                                                    There is only one full transcript (the empty one) for an empty protocol

                                                                                                    Convert a full transcript to the tuple of messages and challenges

                                                                                                    Instances For
                                                                                                      def ProtocolSpec.FullTranscript.ofMessagesChallenges {n : } {pSpec : ProtocolSpec n} (messages : pSpec.Messages) (challenges : pSpec.Challenges) :

                                                                                                      Convert the tuple of messages and challenges to a full transcript

                                                                                                      Instances For

                                                                                                        An equivalence between full transcripts and the tuple of messages and challenges.

                                                                                                        Instances For

                                                                                                          The specification of whether each message in a protocol specification is available in full (None) or received as an oracle (Some (instOracleInterface (pSpec.Message i))).

                                                                                                          This is defined as a type class for notational convenience.

                                                                                                          Instances
                                                                                                            @[reducible, inline, specialize #[]]

                                                                                                            Subtype of pSpec.MessageIdx for messages that are received as oracles

                                                                                                            Instances For
                                                                                                              @[implicit_reducible]

                                                                                                              The oracle interface instances for messages that are received as oracles

                                                                                                              @[reducible, inline, specialize #[]]
                                                                                                              def ProtocolSpec.PlainMessageIdx {n : } (pSpec : ProtocolSpec n) [inst : pSpec.OracleInterfaces] :

                                                                                                              Subtype of pSpec.MessageIdx for messages that are received in full

                                                                                                              Instances For
                                                                                                                @[reducible, inline, specialize #[]]
                                                                                                                def ProtocolSpec.PlainMessage {n : } (pSpec : ProtocolSpec n) [inst : pSpec.OracleInterfaces] (i : pSpec.PlainMessageIdx) :

                                                                                                                The type of messages that are received in full

                                                                                                                Instances For
                                                                                                                  @[reducible, inline, specialize #[]]
                                                                                                                  def ProtocolSpec.OracleMessage {n : } (pSpec : ProtocolSpec n) [inst : pSpec.OracleInterfaces] (i : pSpec.OracleMessageIdx) :

                                                                                                                  The type of messages that are received as oracles

                                                                                                                  Instances For
                                                                                                                    Instances For
                                                                                                                      Instances For
                                                                                                                        @[reducible, inline, specialize #[]]

                                                                                                                        Turn each verifier's challenge into an oracle, where querying a unit type gives back the challenge.

                                                                                                                        This is the default instance for the challenge oracle interface. It may be overridden by challengeOracleInterface{SR/FS} for state-restoration and/or Fiat-Shamir.

                                                                                                                        Instances For
                                                                                                                          @[reducible, inline, specialize #[]]
                                                                                                                          def ProtocolSpec.getChallenge {n : } (pSpec : ProtocolSpec n) (i : pSpec.ChallengeIdx) :

                                                                                                                          Query a verifier's challenge for a given challenge round i, given the default challenge oracle interface challengeOracleInterface.

                                                                                                                          This is the default version for getting challenges, where we query the default challengeOracleInterface, which accepts trivial input. In contrast, getChallenge{SR/FS} requires an input statement and prior messages up to that round.

                                                                                                                          Instances For

                                                                                                                            Define the query implementation for the verifier's challenge in terms of ProbComp.

                                                                                                                            This is a randomness oracle: it simply calls the selectElem method inherited from the SampleableType instance on the challenge types.

                                                                                                                            Instances For
                                                                                                                              @[reducible, inline, specialize #[]]

                                                                                                                              The oracle interface for state-restoration and (basic) Fiat-Shamir.

                                                                                                                              This is the version where we hash the input statement and the entire transcript up to the point of deriving a new challenge. To be precise:

                                                                                                                              • The domain of the oracle is Statement × pSpec.MessagesUpTo i.1.castSucc
                                                                                                                              • The range of the oracle is pSpec.Challenge i
                                                                                                                              • The oracle just returns the challenge
                                                                                                                              Instances For

                                                                                                                                Alias of ProtocolSpec.challengeOracleInterfaceSR.


                                                                                                                                The oracle interface for state-restoration and (basic) Fiat-Shamir.

                                                                                                                                This is the version where we hash the input statement and the entire transcript up to the point of deriving a new challenge. To be precise:

                                                                                                                                • The domain of the oracle is Statement × pSpec.MessagesUpTo i.1.castSucc
                                                                                                                                • The range of the oracle is pSpec.Challenge i
                                                                                                                                • The oracle just returns the challenge
                                                                                                                                Instances For
                                                                                                                                  @[reducible, inline]
                                                                                                                                  def ProtocolSpec.srChallengeOracle (Statement : Type) {n : } (pSpec : ProtocolSpec n) :

                                                                                                                                  The oracle interface for Fiat-Shamir.

                                                                                                                                  This is the (inefficient) version where we hash the input statement and the entire transcript up to the point of deriving a new challenge. To be precise:

                                                                                                                                  • The domain of the oracle is Statement × pSpec.MessagesUpTo i.1.castSucc
                                                                                                                                  • The range of the oracle is pSpec.Challenge i

                                                                                                                                  Some variants of Fiat-Shamir takes in a salt each round. We assume that such salts are included in the input statement (i.e. we can always transform a given reduction into one where every round has a random salt).

                                                                                                                                  Instances For
                                                                                                                                    def ProtocolSpec.fsChallengeOracle (Statement : Type) {n : } (pSpec : ProtocolSpec n) :

                                                                                                                                    Alias of ProtocolSpec.srChallengeOracle.


                                                                                                                                    The oracle interface for Fiat-Shamir.

                                                                                                                                    This is the (inefficient) version where we hash the input statement and the entire transcript up to the point of deriving a new challenge. To be precise:

                                                                                                                                    • The domain of the oracle is Statement × pSpec.MessagesUpTo i.1.castSucc
                                                                                                                                    • The range of the oracle is pSpec.Challenge i

                                                                                                                                    Some variants of Fiat-Shamir takes in a salt each round. We assume that such salts are included in the input statement (i.e. we can always transform a given reduction into one where every round has a random salt).

                                                                                                                                    Instances For
                                                                                                                                      @[implicit_reducible]

                                                                                                                                      Decidable equality for the state-restoration / (slow) Fiat-Shamir oracle

                                                                                                                                      @[implicit_reducible]
                                                                                                                                      @[implicit_reducible]
                                                                                                                                      @[reducible, inline, specialize #[]]
                                                                                                                                      def ProtocolSpec.srChallengeQueryImpl {n : } {Statement : Type} {pSpec : ProtocolSpec n} [(i : pSpec.ChallengeIdx) → SampleableType (pSpec.Challenge i)] :

                                                                                                                                      Define the query implementation for the state-restoration / (slow) Fiat-Shamir oracle (returns a challenge given messages up to that point) in terms of ProbComp.

                                                                                                                                      This is a randomness oracle: it simply calls the selectElem method inherited from the SampleableType instance on the challenge types. We may then augment this with withCaching to obtain a function-like implementation (caches and replays previous queries).

                                                                                                                                      For implementation with caching, we add withCaching.

                                                                                                                                      For implementation where the whole function is sampled ahead of time, and we answer with that function, see srChallengeQueryImpl'.

                                                                                                                                      Instances For
                                                                                                                                        @[reducible, inline, specialize #[]]
                                                                                                                                        def ProtocolSpec.srChallengeQueryImpl' {n : } {Statement : Type} {pSpec : ProtocolSpec n} [(i : pSpec.ChallengeIdx) → SampleableType (pSpec.Challenge i)] :
                                                                                                                                        QueryImpl (srChallengeOracle Statement pSpec) (StateT (QueryImpl (srChallengeOracle Statement pSpec) Id) ProbComp)

                                                                                                                                        Alternate version of query implementation that takes in a cached function f and returns the result and the updated function.

                                                                                                                                        TODO: upstream this as a more general construction in VCVio

                                                                                                                                        Instances For
                                                                                                                                          def ProtocolSpec.fsChallengeQueryImpl' {n : } {Statement : Type} {pSpec : ProtocolSpec n} [(i : pSpec.ChallengeIdx) → SampleableType (pSpec.Challenge i)] :
                                                                                                                                          QueryImpl (srChallengeOracle Statement pSpec) (StateT (QueryImpl (srChallengeOracle Statement pSpec) Id) ProbComp)

                                                                                                                                          Alias of ProtocolSpec.srChallengeQueryImpl'.


                                                                                                                                          Alternate version of query implementation that takes in a cached function f and returns the result and the updated function.

                                                                                                                                          TODO: upstream this as a more general construction in VCVio

                                                                                                                                          Instances For
                                                                                                                                            def ProtocolSpec.MessagesUpTo.deriveTranscriptSRAux {n : } {pSpec : ProtocolSpec n} {ι : Type} {oSpec : OracleSpec ι} {StmtIn : Type} (stmt : StmtIn) (k : Fin (n + 1)) (messages : MessagesUpTo k pSpec) (j : Fin (k + 1)) :
                                                                                                                                            OracleComp (oSpec + fsChallengeOracle StmtIn pSpec) (Transcript (Fin.castLE j) pSpec)

                                                                                                                                            Auxiliary function for deriving the transcript up to round k from the (full) messages, via querying the state-restoration / Fiat-Shamir oracle for the challenges.

                                                                                                                                            This is used to define deriveTranscriptFS.

                                                                                                                                            Instances For
                                                                                                                                              def ProtocolSpec.MessagesUpTo.deriveTranscriptSR {n : } {pSpec : ProtocolSpec n} {ι : Type} {oSpec : OracleSpec ι} {StmtIn : Type} (stmt : StmtIn) (k : Fin (n + 1)) (messages : MessagesUpTo k pSpec) :
                                                                                                                                              OracleComp (oSpec + fsChallengeOracle StmtIn pSpec) (Transcript k pSpec)

                                                                                                                                              Derive the transcript up to round k from the (full) messages, via querying the state-restoration / Fiat-Shamir oracle for the challenges.

                                                                                                                                              Instances For
                                                                                                                                                def ProtocolSpec.MessagesUpTo.deriveTranscriptFS {n : } {pSpec : ProtocolSpec n} {ι : Type} {oSpec : OracleSpec ι} {StmtIn : Type} (stmt : StmtIn) (k : Fin (n + 1)) (messages : MessagesUpTo k pSpec) :
                                                                                                                                                OracleComp (oSpec + fsChallengeOracle StmtIn pSpec) (Transcript k pSpec)

                                                                                                                                                Alias of ProtocolSpec.MessagesUpTo.deriveTranscriptSR.


                                                                                                                                                Derive the transcript up to round k from the (full) messages, via querying the state-restoration / Fiat-Shamir oracle for the challenges.

                                                                                                                                                Instances For
                                                                                                                                                  def ProtocolSpec.Messages.deriveTranscriptSR {n : } {pSpec : ProtocolSpec n} {ι : Type} {oSpec : OracleSpec ι} {StmtIn : Type} (stmt : StmtIn) (messages : pSpec.Messages) :
                                                                                                                                                  OracleComp (oSpec + fsChallengeOracle StmtIn pSpec) pSpec.FullTranscript

                                                                                                                                                  Derive the transcript up to round k from the (full) messages, via querying the state-restoration / Fiat-Shamir oracle for the challenges.

                                                                                                                                                  Instances For
                                                                                                                                                    def ProtocolSpec.Messages.deriveTranscriptFS {n : } {pSpec : ProtocolSpec n} {ι : Type} {oSpec : OracleSpec ι} {StmtIn : Type} (stmt : StmtIn) (messages : pSpec.Messages) :
                                                                                                                                                    OracleComp (oSpec + fsChallengeOracle StmtIn pSpec) pSpec.FullTranscript

                                                                                                                                                    Alias of ProtocolSpec.Messages.deriveTranscriptSR.


                                                                                                                                                    Derive the transcript up to round k from the (full) messages, via querying the state-restoration / Fiat-Shamir oracle for the challenges.

                                                                                                                                                    Instances For