Strategies and scheduled execution #
Strategies use uniform slots at nodes and leaves. Execution uses InteractionOver.run
to collect the two terminal actions, then sequences those actions in the same boundary order.
Two actions commute if either order gives the same result under every continuation.
Equations
- Interaction.TwoParty.Lens.ActionsCommute p c = ∀ (R : Type ?u.1) (k : A → B → m R), (do let a ← p let b ← c k a b) = do let b ← c let a ← p k a b
Instances For
A pure right action commutes with every action in a lawful monad.
A pure left action commutes with every action in a lawful monad.
The unique trivial context decoration. Ownership is carried only by the lens.
Equations
- Interaction.TwoParty.Lens.contexts (PFunctor.FreeM.pure a) = PUnit.unit
- Interaction.TwoParty.Lens.contexts (PFunctor.FreeM.liftBind a rest) = (PUnit.unit, fun (b : P.B a) => Interaction.TwoParty.Lens.contexts (rest b))
Instances For
Node slots with a pure terminal payload, used to specify a pure prefix end.
Equations
- Interaction.TwoParty.Lens.PureEnd l m agent s Out = Interaction.StrategyOver (Interaction.TwoParty.Lens.paired l m) agent s (Interaction.TwoParty.Lens.contexts s) Out
Instances For
A strategy with an effect slot at every boundary, including the leaf.
Equations
- Interaction.TwoParty.Lens.Strategy l m agent s Out = Interaction.TwoParty.Lens.PureEnd l m agent s fun (tr : PFunctor.FreeM.PathAlong l s) => m (Out tr)
Instances For
Focal participant strategy.
Equations
Instances For
Counterpart participant strategy.
Equations
Instances For
Map pure terminal payloads, preserving every node slot.
Equations
- One or more equations did not get rendered due to their size.
- Interaction.TwoParty.Lens.PureEnd.mapOutput f p = f PUnit.unit p
Instances For
Include a strategy whose terminal action is pure in the uniform-slot API.
Equations
- p.toStrategy = Interaction.TwoParty.Lens.PureEnd.mapOutput (fun (x : PFunctor.FreeM.PathAlong l s) => pure) p
Instances For
Map the outputs of a strategy after its leaf action.
Equations
- Interaction.TwoParty.Lens.Strategy.mapOutput f p = Interaction.TwoParty.Lens.PureEnd.mapOutput (fun (tr : PFunctor.FreeM.PathAlong l s) => Functor.map (f tr)) p
Instances For
Merge an action constructing a strategy into that strategy's first slot.
Equations
Instances For
Execute the first slot and retain its payload in a pure slot of the returned strategy.
Instances For
Joining a split slot preserves the original action.
Participant-indexed terminal payloads.
Equations
Instances For
Collect the separate focal and counterpart outputs.
Equations
Instances For
The profile supplied to the generic runner.
Equations
Instances For
Run the generic interaction, then execute its collected leaf actions in boundary order.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute focal slot, counterpart slot, and move exchange at every boundary.
Equations
Instances For
Terminal actions execute in the selected schedule.
The node equation retains the generic interaction law and the runtime move.
Focal-first execution at a leaf runs both terminal actions.
Execute a node's two slots and continue along the runtime move.
Joining a focal construction slot preserves its execution before the counterpart slot.
Splitting the focal slot exposes exactly the effects before a joined counterpart slot.
A split focal slot may be executed before the rest of the run.
A pure terminal-output map leaves every boundary effect intact.
Mapping identity over the terminal action preserves a strategy.
Mapping both terminal outputs preserves the transcript and every scheduled effect.
Focal-first execution commutes with separate terminal output maps.
Lift a deterministic strategy by inserting pure slots at every boundary.
Instances For
Deterministic leaf lifting inserts a pure terminal action.
Deterministic node lifting preserves the move and lifts every continuation.
Sender execution runs the focal slot before the counterpart observation slot.
Receiver execution runs the focal observation slot before the counterpart choice slot.
A relation on the continuations selected by exchanging two pure slot payloads.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Selected-continuation relations are preserved by implication.
Recursively commuting slots. Each node factors its slots into actions and pure payload maps. The actions commute under arbitrary continuations, and every pair of their results selects recursively commuting strategies. At a leaf the two terminal actions commute. Factorizations allow invariants on returned payloads without a notion of monadic support.
Equations
- One or more equations did not get rendered due to their size.
- Interaction.TwoParty.Lens.SlotsCommute (PFunctor.FreeM.pure a) p c = Interaction.TwoParty.Lens.ActionsCommute p c
Instances For
Exchange factored slots when their actions commute and selected continuations agree.
Recursively commuting boundary slots make the two schedules agree.
Pure observer slots at every node, and a pure counterpart terminal action at each leaf. The owner slot may be effectful. Its payload map carries all possible selected continuations, so the recursive condition includes every move returned by that slot.
Equations
- One or more equations did not get rendered due to their size.
- Interaction.TwoParty.Lens.PureObservers (PFunctor.FreeM.pure a) p c = ∃ (out : x_6 PUnit.unit), c = pure out
Instances For
Pure observers and a pure counterpart end imply recursive slot commutation.
Schedules agree when observers react purely and the counterpart ends purely.