State-indexed dependent chains (Spec.stateChain) #
An n-stage state-indexed composition: at each stage i, the interaction is spec i s
where s : Stage i is the current state. After the stage completes with transcript tr,
the state advances to advance i s tr : Stage (i + 1).
This file provides the spec-level state chain (Spec.stateChain), a transcript telescope type
(Transcript.stateChain), flattening operations (Transcript.stateChainJoin /
stateChainUnjoin), type-level lifting (Transcript.stateChainLiftJoin,
Transcript.stateChainFamily), decorations, and strategy composition along state chains.
For the primary (stateless, continuation-style) chain API see Spec.Chain in
VCVio.Interaction.Basic.Chain.
n-stage dependent composition: run spec i s, then advance to state
advance i s tr and repeat for n total stages.
Instances For
replicate is stateChain with trivial state PUnit.
Decompose a (n+1)-stage state chain transcript into the first-stage transcript and
the remainder. Specialization of Transcript.split to the state chain structure.
Instances For
Combine a first-stage transcript with a remainder state chain transcript into a
(n+1)-stage state chain transcript. Specialization of Transcript.append to
state chains.
Instances For
Splitting after appending at the state chain level recovers the components.
N-ary transcript operations #
Dependent telescope of per-stage transcripts: a sequence of individual-stage
transcripts where each stage determines the next via advance. Mirrors Spec.stateChain
at the transcript level.
Instances For
Flatten a transcript telescope into the combined state chain transcript,
concatenating each per-stage transcript via Transcript.stateChainAppend.
The n-ary analog of Transcript.append, mirroring List.join.
Instances For
Decompose a combined state chain transcript into a telescope of per-stage
transcripts. Inverse of Transcript.stateChainJoin.
Instances For
stateChainUnjoin after stateChainJoin is the identity on telescope transcripts.
stateChainJoin after stateChainUnjoin is the identity on combined state chain
transcripts.
Lift a family indexed by the transcript telescope to a family on the combined
state chain transcript. Uses Transcript.liftAppend at each stage, ensuring that
stateChainLiftJoin ... F (stateChainJoin ... trs) reduces definitionally
to F trs.
Instances For
Per-node labels along a state chain: at each stage, use deco i s.
Instances For
Dependent decoration layer along a state chain, fibered over
Decoration.stateChain.
Instances For
Over.map commutes with Over.stateChain.
State chain families #
The output type of state chain composition. Given a per-stage family Family i s,
this computes the type at the terminal stage by threading through Transcript.liftAppend
at each step. Reduces definitionally when the transcript is built via
Transcript.append, avoiding Nat-arithmetic casts.
This is the canonical output type for Strategy.stateChainComp and
Counterpart.stateChainComp.
Instances For
A constant family is unaffected by stateChainFamily.
Strategy composition along state chains #
Compose per-stage strategies along a state chain. At each stage, the step function
transforms Family i s into a strategy whose output is Family (i+1) (advance i s tr).
The full state chain output is Transcript.stateChainFamily Family.