Generic local execution laws over interaction trees #
This file introduces the execution-side counterpart to Spec.SyntaxOver.
Spec.InteractionOver is a local operational law for agent-indexed node
objects. It says how a whole profile of local objects, one for each agent, is
combined at a single protocol node in order to choose the next move and
continue the interaction. The node-local information seen by those objects is
packaged as a realized Spec.Node.Context.
The role-based prover/verifier runners used elsewhere in the library are specializations of this more general notion, obtained by choosing suitable node contexts and syntax objects.
Just as SyntaxOver reindexes contravariantly along node-context morphisms,
InteractionOver.comap transports a local execution law along the same kind
of context change.
Naming note:
InteractionOver keeps the suffix form for the same reason as ShapeOver:
it is the primary generalized execution notion, while Interaction is its
trivial-data specialization rather than a base value that InteractionOver
depends on.
InteractionOver Agent Γ syn m is the most general local execution
law for agent-indexed participant objects.
It answers the following question:
Suppose we are standing at one protocol node with move space
X. Every agentahas a local node object of typesyn.Node a X γ (Cont a). How do we execute this node, choose the next movex : X, and continue with the continuation values of all agents at thatx?
So:
SyntaxOverdescribes the local syntax available to each agent;InteractionOverdescribes the local operational semantics for one protocol step built from that syntax.
This is the level at which the execution discipline lives:
who chooses the move, how it is sampled or observed, how the local node objects
synchronize, and how effects in m are used.
- interact {X : Type u} {γ : Γ X} {Cont : Agent → X → Type w} {Result : Type w} : ((agent : Agent) → syn.Node agent X γ (Cont agent)) → ((x : X) → ((agent : Agent) → Cont agent x) → m Result) → m Result
interactexecutes one protocol node.Inputs:
- a move space
X; - realized node-local context
γ : Γ X; - for each agent
a, a local node objectsyn.Node a X γ (Cont a); - a continuation
kexplaining how to proceed once a movex : Xhas been chosen and each agent supplies its continuation value at thatx.
Output:
- one monadic step of type
m Result.
In other words,
interactis the one-step execution rule for the whole agent profile at this node. - a move space
Instances For
Interaction Agent syn m is the specialization of InteractionOver with no
node-local context.
This is the right facade when the protocol tree carries no node metadata at
all. Equivalently, it is
InteractionOver Agent Spec.Node.Context.empty syn m.
Instances For
Reindex a local execution law contravariantly along a node-context morphism.
If f : Γ → Δ, then an execution law for Δ-contexts can be reused on
Γ-contexts by first viewing the local syntax through SyntaxOver.comap f.
At each node, the translated context value f X γ is what the original
execution law sees.
Instances For
Reindex a local execution law contravariantly along a schema morphism, using the underlying realized context morphism.
Instances For
Execute a whole protocol tree using the local one-step law interact.
Inputs:
specis the underlying interaction tree;ctxs : Decoration Γ specsupplies the realized node context at each node;Out : Agent → Transcript spec → Type uis the final output family for each agent;profilesupplies, for every agent, that agent's whole-tree participant object induced bysyn.
Output:
- a monadic computation producing
- a concrete transcript
tr, and - for each agent
a, the final outputOut a trobtained by following that transcript.
- a concrete transcript
So run is the whole-tree execution induced by the local execution law
InteractionOver.interact. It is the generic profile-level analogue of the
specialized two-party runners elsewhere in the library.
This first executable version is intentionally specialized to the common
single-universe setting used throughout the current interaction layer. The
underlying SyntaxOver and InteractionOver abstractions remain more general.