Dependent append of interaction specs #
Given two interactions where the second may depend on the outcome of the first,
Spec.append fuses them into a single interaction. The file provides the full
algebra around this operation:
- Transcript operations:
Transcript.append/splitconstruct and decompose combined transcripts, whileTranscript.liftAppendlifts a two-argument type family to a single-argument family on the combined transcript with definitional computation. - Strategy composition:
Strategy.comp(factored output vialiftAppend) andStrategy.compFlat(flat output viaTranscript.append). - Decoration / refinement append and their naturality lemmas.
Structural combinators #
Sequential composition of interactions: run s₁ first, then continue with
s₂ tr₁ where tr₁ records what happened in s₁.
Instances For
Lift a two-argument type family F tr₁ tr₂ (indexed by per-phase transcripts)
to a single-argument family on the combined transcript of s₁.append s₂.
Crucially, liftAppend s₁ s₂ F (Transcript.append s₁ s₂ tr₁ tr₂) reduces
definitionally to F tr₁ tr₂, which makes this the right combinator for
stage-dependent composition. Without this property, every composition combinator
would need explicit casts between the two-argument and single-argument views.
This combinator propagates up through the entire stack:
Transcript.stateChainFamilyuses it at each stage of a state chainChain.outputFamilyuses it at each round of a continuation chainStrategy.comp/Strategy.compWithRolesuse it for the output type- All security composition theorems factor through it
Instances For
liftAppend respects pointwise equality of the family F.
A constant family is unaffected by liftAppend.
Combine a first-phase transcript and a second-phase transcript into a transcript
of the composed interaction s₁.append s₂.
Instances For
liftAppend on an appended transcript reduces to the original two-argument
family.
Decompose a transcript of s₁.append s₂ into the first-phase prefix and the
second-phase continuation. Inverse of Transcript.append.
Instances For
Splitting after appending recovers the original components.
Appending the components produced by split recovers the original transcript.
liftAppend can be reconstructed from the transcript pieces returned by
Transcript.split.
Reinterpret a liftAppend value against the transcript pair recovered by split.
Defined by structural recursion mirroring liftAppend/split, so no explicit cast
appears in the definition.
Instances For
Transport a value of F tr₁ tr₂ to liftAppend s₁ s₂ F (append s₁ s₂ tr₁ tr₂).
Defined by structural recursion mirroring liftAppend/append, so no explicit cast
appears. This is the identity function in disguise — at each constructor step,
liftAppend s₁ s₂ F (append s₁ s₂ tr₁ tr₂) reduces to F tr₁ tr₂.
Instances For
Transport a liftAppend value back to the pair-indexed family.
Inverse of packAppend.
Instances For
Collapse a liftAppend family indexed by append tr₁ tr₂ back to the
fused transcript index. Defined by structural recursion, so no explicit cast
appears.
Instances For
Lift a family indexed by a split append transcript into a family indexed by the fused append transcript.
Instances For
Split a fused liftAppend value whose payload is a product into the product of
the separately lifted payloads.
Instances For
Inverse of liftAppendProd, fusing separately lifted payloads into a lifted
product payload.
Instances For
When tr = append tr₁ tr₂, the round-trip (packAppend then unliftAppend)
recovers the original pair-indexed relation value.
Lift a binary relation on pair-indexed type families to the fused transcript
of s₁.append s₂. Reduces definitionally when the transcript is
Transcript.append s₁ s₂ tr₁ tr₂, making it the right combinator for stating
composition theorems without visible casts.
Instances For
liftAppendRel is equivalent to applying R at the transcript pair
recovered by split, via unliftAppend.
Lift a unary predicate on a pair-indexed type family to the fused transcript
of s₁.append s₂. Reduces definitionally when the transcript is
Transcript.append s₁ s₂ tr₁ tr₂.
Instances For
liftAppendPred is equivalent to applying P at the transcript pair
recovered by split, via unliftAppend.
Monadic composition of strategies along Spec.append.
The output type is given as a two-argument family
F : Transcript s₁ → Transcript (s₂ tr₁) → Type u, lifted to the combined spec
via Transcript.liftAppend. The continuation receives the first-phase strategy's
output and produces a second-phase strategy whose output family is F tr₁.
This is the preferred composition form: liftAppend ensures the output type
reduces definitionally when combined with Transcript.append, which is essential
for dependent chain composition (see Strategy.stateChainComp).
Instances For
Monadic composition of strategies along Spec.append with a single output family
Output on the combined transcript. The continuation indexes into Output via
Transcript.append.
Use this when the output type is naturally expressed over the combined transcript
rather than as a two-argument family (e.g., constant output types, or when working
with Strategy.iterate). See also Strategy.comp.
Instances For
Extract the first-phase strategy from a strategy on a composed interaction.
At each first-phase transcript tr₁, the remainder is the second-phase strategy
with output indexed by Transcript.append.
Instances For
Concatenate per-node labels along Spec.append.
Instances For
Concatenate dependent decoration layers along Spec.append, over appended
base decorations.
Instances For
Decoration.Over.map commutes with Over.append.
Decoration.map commutes with Decoration.append.