Arrow Instances¶
The standard arrow instances over the V-enriched category of finite
sets: VRel, Function, and Stochastic.
instances
¶
Standard arrow instances for the typeclass tower.
Implements the arrow interfaces of quivers.arrows.typeclasses
against the V-enriched category of finite sets. Each instance carries
no per-instance state — every operation is a stateless construction
on the underlying Morphism algebra. The instances register
themselves against the relevant ABCs (Arrow, ArrowChoice,
ArrowApply, ArrowLoop) so isinstance works
transparently for the chart-parser's arrow-side dispatch.
Realisations:
VRel: the canonical V-enriched-relation arrow.composeis the V-Rel>>operator;arris the identity embedding;firstis the parallel-product factory;left_arris the coproduct functorial action;loop_arris the V-algebra iterative trace on the recurrent component.Function: restricts to deterministic V-relations (functions with point-mass tensors). Pure-functional operations.Stochastic: stochastic-matrix arrows wherefirst,left_arr, andloop_arrare the corresponding row-stochastic realisations.
VRel
didactic-model
¶
Bases: Model
The V-enriched-relation arrow on finite sets.
Hom-sets are V-Rel morphisms; composition is the standard
>>; arr is the identity embedding (every V-Rel morphism
is an arrow); first is the parallel pair; left_arr is
the coproduct functorial action; loop_arr is the V-algebra
iterative trace.
Function
didactic-model
¶
Bases: Model
Deterministic V-relation arrow (point-mass tensors only).
Restricts VRel to morphisms whose tensors are 0/1-valued
(function graphs). All operations preserve determinism — composition
of deterministic relations is deterministic; first and
left_arr are the standard functorial actions; loop_arr is
the least-fixed-point trace, computed by iterating the recurrent
component until a fixed point is reached.
loop_arr
¶
Least-fixed-point trace for deterministic functions.
Iterates the loop c_{n+1} := f.second_projection(a, c_n)
until c_{n+1} == c_n. In V-Rel terms this coincides with
the algebra-iterative trace when f is function-shaped.
Source code in src/quivers/arrows/instances.py
app
¶
Stochastic
didactic-model
¶
Bases: Model
Stochastic-matrix arrows.
Each arrow is a Morphism whose tensor rows are
probability distributions. Operations preserve row-stochasticity:
composition is matrix multiplication; first and left_arr
are the tensor-product / coproduct-product lifts; loop_arr is
the sampled / cartesian trace summed over the recurrent dimension.
loop_arr
¶
Cartesian trace: marginalise the recurrent component.
trace(f)(a, b) = ∑_c f((a, c), (b, c)) — the row-stochastic
analogue of the V-Rel iterative trace.