Role-dependent strategies and counterparts #
Spec.Strategy.withRoles is the prover / focal party: owned nodes are
effectful move/continuation packages, while non-owned nodes respond to the
other party's move. Spec.Counterpart is the dual type. withRolesAndMonads and
runWithRolesAndMonads extend this with per-node BundledMonad data from
MonadDecoration.
This module also contains the public-coin specialization needed for
verifier-side Fiat-Shamir. The ordinary Counterpart type is the right shape
for execution, but at receiver nodes it hides the continuation behind an
opaque monadic sample. Spec.PublicCoinCounterpart refines that node shape to
expose:
sample : m X— how the next public challenge is chosennext : (x : X) → ...— how the rest of the verifier depends on that challenge
This makes transcript replay definable without changing the core two-party interaction model.
- focal : ParticipantBase
- counterpart : ParticipantBase
Instances For
- tag : ParticipantBase
Instances For
Instances For
Instances For
Focal strategy: Role.Action at each decorated node (choose vs. respond).
Instances For
A generic counterpart family parameterized by separate sender- and receiver-side node representations.
Sender nodes model how the environment follows a move chosen by the focal
party. Receiver nodes model how the environment chooses a move itself. Both
ordinary Counterpart and replayable PublicCoinCounterpart are
specializations of this single recursion.
Instances For
Instances For
Counterpart / environment type with transcript-dependent output: dual actions at
each node, producing Output ⟨⟩ at .done. For a no-output counterpart (the old
behavior), use Counterpart m spec roles (fun _ => PUnit).
Instances For
Functorial output map for role-dependent strategies.
Instances For
Pointwise identity on outputs is the identity on role-dependent strategies.
Functorial output map for counterparts.
Instances For
A verifier counterpart with replayable public-coin receiver nodes.
An ordinary Counterpart m represents a receiver node as an opaque monadic
action returning both the sampled challenge and the continuation. That is the
right shape for execution, but it is too weak for verifier-side Fiat-Shamir:
given a prescribed challenge x, there is no way to recover the continuation
for x unless that continuation is exposed separately.
PublicCoinCounterpart factors each receiver node into:
sample : m X— how the verifier samples the next public challengenext : (x : X) → ...— how the rest of the verifier depends on that challenge
This is exactly the extra structure needed to replay a prescribed transcript through the verifier.
Instances For
Functorial output map for public-coin counterparts. The challenge samplers are unchanged; only the terminal output carried by continuations is mapped.
Instances For
Forget the public-coin factorization and recover the ordinary executable counterpart.
Instances For
Replay a prescribed transcript through a public-coin counterpart. Sender messages are read from the transcript; receiver samplers are ignored and the stored continuation family is followed at the recorded challenge.
Instances For
Pointwise identity on outputs is the identity on counterparts.
Lift a deterministic counterpart (Counterpart Id) into any monad.
At sender nodes the observational branch structure is unchanged. At receiver
nodes the chosen move and continuation are simply wrapped in pure. This is a
generic utility for reusing deterministic environments inside monadic execution
machinery such as runWithRoles.
Instances For
Execute withRoles against a Counterpart, producing transcript, prover output,
and counterpart output.
Instances For
Running runWithRoles after mapping both participant outputs is the same as
running first and mapping the final triple.
withRoles using the monad attached at each node (from MonadDecoration).
See Counterpart.withMonads for the dual.
Instances For
Counterpart with per-node monads and transcript-dependent output.
This is the primary type for oracle verifiers: OracleCounterpart (in
Oracle/Core.lean) is defined as Counterpart.withMonads with a
MonadDecoration computed from the oracle decoration via toMonadDecoration.
At sender nodes the monad is Id (pure observation); at receiver nodes it is
OracleComp with the accumulated oracle access. All generic
Counterpart.withMonads composition combinators (e.g., withMonads.append,
withMonads.stateChainComp) therefore apply directly to oracle counterparts.
Instances For
Map the transcript-indexed output of a monadic counterpart. This is the
counterpart-side analog of Strategy.mapOutputWithRoles, specialized to
Counterpart.withMonads.