Functorial local syntax over interaction trees #
This file introduces the functorial refinement of the local syntax core.
Spec.SyntaxOver in Basic/Syntax is the most general local syntax object: it
describes which node object an agent has at one protocol node, with no
assumption that recursive continuations can be reindexed generically.
Spec.ShapeOver is the functorial refinement of that base notion:
it equips a SyntaxOver with a continuation map. This is exactly the extra
structure needed to define generic output transport such as
ShapeOver.mapOutput.
Many important interaction objects are syntax without being shapes in this
sense: if recursive continuations are hidden under an opaque outer constructor,
then a generic continuation map may not exist. This is why SyntaxOver is the
semantic base layer, while ShapeOver is the stronger interface used when
continuations are exposed functorially enough.
Naming note:
ShapeOver keeps the suffix form because it is the primary functorial
refinement of syntax, with plain Shape recovered as the trivial-context
specialization. This differs from Decoration.Over, which is literally
dependent data over a fixed base decoration value.
ShapeOver Agent Γ is a functorial local-syntax object over realized node
contexts Γ.
It answers the following question:
Suppose we are standing at one protocol node whose move space is
X. The node carries realized node-local contextγ : Γ X. If the protocol continues with familyCont : X → Type w, what is the type of the local object that agentastores at this node?
Unlike bare SyntaxOver, a ShapeOver also provides a generic continuation
map. So a shape is syntax that is functorial in its recursive continuations.
This is the right abstraction when node objects support a generic reindexing of their continuation payload, for example when those continuations remain exposed or are stored under constructors with a functorial action.
- map {agent : Agent} {X : Type u} {γ : Γ X} {A B : X → Type w} : ((x : X) → A x → B x) → self.Node agent X γ A → self.Node agent X γ B
mapexpresses that a node object is functorial in its continuation family.If we know how to transform each continuation value
A xinto a continuation valueB x, then we can transform a local node object with continuation familyAinto one with continuation familyB.Importantly,
mapdoes not change:- the agent,
- the move space,
- the node-local context,
- or the move
xthat will eventually be chosen.
It only reinterprets what happens after each possible move. This is the local ingredient needed to define the generic whole-tree
ShapeOver.mapOutputbelow.
Instances For
Reindex a local syntax object contravariantly along a node-context morphism.
If f : Γ → Δ, then any shape over Δ can be viewed as a shape over Γ by
first viewing its underlying syntax through SyntaxOver.comap f.
Instances For
Reindex a local syntax object contravariantly along a schema morphism, using the underlying realized context morphism.
Instances For
Whole-tree families for a shape are inherited from the underlying
SyntaxOver.
Instances For
ShapeOver.mapOutput lifts a pointwise transformation of leaf outputs to a
transformation of whole-tree participant objects.
This is the recursive global form of the local ShapeOver.map field.
It leaves the underlying interactive structure unchanged and only rewrites the
terminal output family.
Instances For
Whole-tree families for shape.comap f are exactly families for shape
evaluated on the mapped decoration Decoration.map f ctxs.