Decorations and dependent decorations (Over) #
Spec.Decoration Γ spec is concrete nodewise metadata attached to a fixed
protocol tree spec, where Γ : Spec.Node.Context is the realized family of
node-local information. If a node of spec has move space X, then a
decoration provides one value of type Γ X at that node, and recursively
decorates every continuation subtree.
This is the basic way to say "the same protocol tree, but with extra data at each node". Typical examples include:
RoleDecoration, recording who controls a node;- monad decorations, recording which monad a local action uses at a node;
- oracle decorations, recording what oracle interface is available there.
A context may be written directly, or obtained from a telescope
Spec.Node.Schema via Spec.Node.Schema.toContext.
Decoration.Over is the dependent (displayed) variant:
its fibers may depend on the context value drawn from an existing decoration.
Naming note:
Decoration.Over is nested because it is literally a decoration over a fixed
base decoration value. By contrast, ShapeOver and InteractionOver keep the
suffix form because they are the primary generalized syntax and semantics
layers, not dependent objects over a fixed base Shape or Interaction.
Functorial map / map_id / map_comp for both layers are in this file.
Composition along Spec.append is in VCVio.Interaction.Basic.Append.
Because decorations are concrete tree data, they are covariant in node-local
contexts: a context morphism Γ → Δ induces a map from decorations by Γ
to decorations by Δ. The schema-facing API in Decoration.Schema packages
that same idea for realized contexts presented by schemas via
Spec.Node.Schema.SchemaMap.
This file also contains the bridge between the semantic and staged views of
node metadata: decorating a tree by an extended context Γ.extend A is
equivalent to giving a base decoration by Γ together with one dependent
Decoration.Over A layer on top of it.
In particular, if a schema is built as (Spec.Node.Schema.singleton Γ).extend A,
then Decoration.equivOver A spec is exactly the statement that a decoration
of that schema's realized context is the same as a base decoration by Γ
plus one displayed layer over it.
The file concludes by lifting this one-step bridge recursively to arbitrary
schemas: Spec.Decoration.Schema.View is the staged telescope view of a
decoration by S.toContext, and Spec.Decoration.Schema.equivView
identifies that staged view with an ordinary decoration of the realized
context.
Polynomial substrate (DecoratedSpec) #
Just as Spec is PFunctor.FreeM Spec.basePFunctor PUnit, the bundle
(spec, Decoration Γ spec) is PFunctor.FreeM (Γ.toPFunctor) PUnit:
DecoratedSpec Γ := PFunctor.FreeM (Γ.toPFunctor) PUnit
Γ.toPFunctor is the polynomial whose positions are Σ X : Type u, Γ X
and whose child family is Sigma.fst. A free term over this polynomial is
literally a tree where every internal node carries both a move space X
and a Γ-value, with continuations indexed by the move type.
Forgetting the Γ-component on positions yields a polynomial lens
Γ.toPFunctor → Spec.basePFunctor, whose lift to free monads is the
shape-forgetful map DecoratedSpec.shape : DecoratedSpec Γ → Spec. The
fiber of shape over a fixed spec : Spec is exactly Decoration Γ spec,
formalized as decoratedSpecEquiv : DecoratedSpec Γ ≃ Σ spec, Decoration Γ spec.
This makes precise the slogan "a Γ-decorated spec is the same data as a
spec together with a Γ-decoration on it". Downstream code can use either
view: the Spec-indexed Decoration family is convenient for talking
about decorations over a fixed protocol, while DecoratedSpec is the
right object when shape and metadata vary together (e.g. for the polynomial
coalgebraic semantics of ProcessOver).
Decoration Γ spec is concrete nodewise metadata on the fixed protocol
tree spec, for a realized node context Γ.
If a node of spec has move space X, then the decoration stores one value of
type Γ X at that node, and recursively stores decorations on every subtree.
This is different from Spec.SyntaxOver:
- a decoration is data on a tree;
- syntax is a specification of local participant objects that consumes such data;
Spec.ShapeOveris the functorial refinement of that syntax layer.
Instances For
Natural transformation between per-node decorations, applied recursively.
Instances For
Dependent decoration over d : Decoration Γ spec: at each node, data in
F X γ where γ is the context value from d, plus recursive decorations on
subtrees.
Instances For
Fiberwise map between dependent decoration families over the same base decoration.
Instances For
Transport a dependent decoration across a map of base contexts.
Given:
- a base-context morphism
f : Γ → Δ, and - a fiberwise map
gfromA X γtoB X (f X γ),
this sends a displayed decoration over d : Decoration Γ spec to a displayed
decoration over Decoration.map f spec d.
Instances For
Pack a base decoration and one dependent Over layer into a decoration of the
extended context Γ.extend A.
This is the tree-level realization of a single schema extension step.
Instances For
Unpack a decoration of the extended context Γ.extend A into:
- its base decoration by
Γ, and - its displayed
Decoration.Over Alayer above that base.
This is the inverse structural view to Decoration.ofOver.
Instances For
Equivalence between:
- decorating a tree by the extended context
Γ.extend A, and - decorating it by
Γtogether with oneDecoration.Over Alayer.
This is the main bridge from the semantic "single realized context" view to the staged schema/dependent-decoration view.
Concrete example:
if a schema is built as (Spec.Node.Schema.singleton Tag).extend Data, then
decorations of its realized context Node.Context.extend Tag Data are
equivalent to pairs consisting of:
tags : Decoration Tag spec, anddatas : Decoration.Over Data spec tags.
Instances For
Polynomial substrate DecoratedSpec #
A DecoratedSpec Γ is the free term of the polynomial Γ.toPFunctor at the
unit payload: a tree where every internal node carries both its move space
X and a Γ-value of type Γ X, with continuations indexed by X.
This is the polynomial substrate that justifies the Spec-indexed family
Decoration Γ spec: forgetting the Γ-component on positions yields a
polynomial lens Γ.toPFunctor → Spec.basePFunctor whose lift to free
monads gives DecoratedSpec.shape. The fiber of shape over a fixed
spec is exactly Decoration Γ spec, witnessed by decoratedSpecEquiv.
A Γ-decorated interaction spec, viewed polynomially.
This is the free monad on Γ.toPFunctor at the unit payload. Equivalently
(by decoratedSpecEquiv), it bundles a tree shape spec : Spec together
with a Decoration Γ spec on it.
Instances For
Forget the Γ-component on every position, leaving only the underlying
tree shape. This is the lift to free monads of the polynomial lens
Γ.toPFunctor → Spec.basePFunctor whose position map is Sigma.fst and
whose child map is the identity.
Instances For
Read off the per-node Γ-decoration of a decorated spec, indexed by
the spec's underlying shape. Together with shape, this exhibits the
fiberwise structure of DecoratedSpec Γ over Spec.
Instances For
Pack a tree shape together with a Γ-decoration on it into a single
decorated spec. Inverse to the pair (shape, decoration).
Instances For
The polynomial substrate equivalence: a Γ-decorated spec is the same
data as a tree shape together with a Γ-decoration on it.
This is the Spec-indexed fiberwise view of DecoratedSpec Γ. The forward
direction takes (shape, decoration); the backward direction is mk.
Instances For
Map decorations along a schema morphism.
This is just Decoration.map viewed through schema-level sources and targets.
Instances For
Decoration.Schema.telescope S spec packages the staged telescope view of
decorations for schema S, together with an equivalence from ordinary
decorations by the realized context S.toContext.
The resulting type is the recursively decomposed form of a decoration:
each snoc in the schema contributes one more displayed Decoration.Over
layer.
Instances For
Decoration.Schema.View S spec is the staged telescope view carried by the
recursive schema decomposition theorem Decoration.Schema.telescope.
Instances For
Unpack an ordinary decoration into the staged telescope view determined by a schema.
Instances For
Pack a staged schema-decoration view back into an ordinary decoration of the realized context.
Instances For
Map the staged telescope view of decorations along a schema morphism.
This is the schema-view analogue of Decoration.Schema.map: pack the staged
view into an ordinary decoration, map that decoration along the schema
morphism, then unpack it into the staged view for the target schema.
Instances For
Project decorations along a syntactic schema prefix.
This is the tree-level forgetting map induced by the schema morphism
Node.Schema.Prefix.toSchemaMap.
Instances For
Equivalence between an ordinary decoration by the realized context of S and
its staged telescope view.
This is the recursive schema-level form of Decoration.equivOver.