| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Channel
Description
Structural semantics for traced monoidal categories.
This module collects the structural superclass chain
Channel → Strength → Traced and all base instances for the standard
base arrows (->) and K m. These classes
describe the monoidal structure, tensorial strength, and feedback-fixing
trace that underlie the syntax in Circuit.Trace.
assoc and assoc' here reassociate rightward and leftward
respectively. The monomorphic helpers in Circuit.Tensor have the same
names but the opposite directions. Also, slide here is the slide
t a (t b c) -> t b (t a c); the symmetric braiding t a b -> t b a
lives in Circuit.Tensor as braid. Where both structures exist,
slide = assoc' .> tensor braid id .> assoc.
Kind-polymorphic: t and arr share object kind (inferred via PolyKinds).
Synopsis
- class Category arr => Channel (t :: k -> k -> k) (arr :: k -> k -> Type) where
- class Channel t arr => Strength (t :: k -> k -> k) (arr :: k -> k -> Type) where
- strength :: forall (b :: k) (c :: k) (a :: k). arr b c -> arr (t a b) (t a c)
- class Strength t arr => Traced (t :: k -> k -> k) (arr :: k -> k -> Type) where
- trace :: forall (a :: k) (b :: k) (c :: k). arr (t a b) (t a c) -> arr b c
Documentation
class Category arr => Channel (t :: k -> k -> k) (arr :: k -> k -> Type) where Source #
A monoidal structure on the tensor t internal to the category arr.
Provides the associator and braiding required to reassociate and braid nested tensor values inside an arrow. This is the structure that traced categories inherit as a superclass.
The previous quantified superclass that stated closure of an object
constraint under the tensor has been removed along with the Ob
apparatus; composite-object legitimacy is an audit concern.
Methods
assoc :: forall (a :: k) (b :: k) (c :: k). arr (t (t a b) c) (t a (t b c)) Source #
Reassociate to the right: t (t a b) c -> t a (t b c).
assoc' :: forall (a :: k) (b :: k) (c :: k). arr (t a (t b c)) (t (t a b) c) Source #
Inverse reassociation: t a (t b c) -> t (t a b) c.
slide :: forall (a :: k) (b :: k) (c :: k). arr (t a (t b c)) (t b (t a c)) Source #
Swap the two outer positions, leaving the inner payload in place:
t a (t b c) -> t b (t a c).
Instances
| Channel Either Process Source # | |
| Channel (,) Hyper Source # | |
| Channel (,) Process Source # | |
| Channel (,) Pullback Source # | Cartesian channel plumbing for pullbacks. |
| (Category arr, Channel t arr) => Channel (t :: Type -> Type -> Type) (AlgCat arr :: Type -> Type -> Type) Source # | |
| Monad m => Channel Either (K m :: Type -> Type -> Type) Source # | Cocartesian monoidal structure for |
| Channel Either (->) Source # | Cocartesian monoidal structure for
|
| Monad m => Channel These (K m :: Type -> Type -> Type) Source # | Inclusive monoidal structure for |
| Channel These (->) Source # | Inclusive monoidal structure for
|
| Monad m => Channel (,) (K m :: Type -> Type -> Type) Source # | Cartesian monoidal structure for |
| Monad m => Channel (,) (HyperA (K m) :: Type -> Type -> Type) Source # | |
| Channel (,) (->) Source # | Cartesian monoidal structure for
|
| (Category arr, Channel t arr) => Channel (t :: Type -> Type -> Type) (SMC w arr :: Type -> Type -> Type) Source # | |
| (Category arr, Channel t arr) => Channel (t :: Type -> Type -> Type) (Trace t arr :: Type -> Type -> Type) Source # | |
| Channel t arr => Channel (t :: k -> k -> k) (Dagger arr :: k -> k -> Type) Source # | |
Defined in Circuit.Dagger | |
| Channel t arr => Channel (t :: k -> k -> k) (Free arr :: k -> k -> Type) Source # | |
Defined in Circuit.Layer | |
class Channel t arr => Strength (t :: k -> k -> k) (arr :: k -> k -> Type) where Source #
Tensorial strength for a tensor t inside a category arr.
strength tensors a plain morphism with the ambient channel. It is
not a syntactic inverse of trace; it is the strength
("tensorial strength") of the tensor t acting on morphisms.
Instances
| Strength Either Process Source # | |
| Strength (,) Hyper Source # | |
| Strength (,) Process Source # | |
| Strength (,) Pullback Source # | |
| (Category arr, Strength t arr) => Strength (t :: Type -> Type -> Type) (AlgCat arr :: Type -> Type -> Type) Source # | |
| Monad m => Strength Either (K m :: Type -> Type -> Type) Source # | Traced for Iterates by feeding
This instance is |
| Strength Either (->) Source # | Either tensorial strength for |
| Monad m => Strength These (K m :: Type -> Type -> Type) Source # | Inclusive tensorial strength for |
| Strength These (->) Source # | Inclusive tensorial strength for
|
| Monad m => Strength (,) (K m :: Type -> Type -> Type) Source # | Traced for The lazy knot is tied via
|
| Monad m => Strength (,) (HyperA (K m) :: Type -> Type -> Type) Source # | |
| Strength (,) (->) Source # | Cartesian tensorial strength for The implementation uses explicit projections so that the result pair
constructor exists before the feedback channel is forced; this keeps
fused
|
Defined in Circuit.Channel | |
| (Strength t arr, Action w arr) => Strength (t :: Type -> Type -> Type) (SMC w arr :: Type -> Type -> Type) Source # | |
| (Strength t arr, Traced t arr) => Strength (t :: Type -> Type -> Type) (Trace t arr :: Type -> Type -> Type) Source # | |
| Strength t arr => Strength (t :: k -> k -> k) (Dagger arr :: k -> k -> Type) Source # | |
| Strength t arr => Strength (t :: k -> k -> k) (Free arr :: k -> k -> Type) Source # | Lift the A morphism is frozen before tensoring with the feedback channel. |
class Strength t arr => Traced (t :: k -> k -> k) (arr :: k -> k -> Type) where Source #
A trace over a morphism arr and tensor t.
trace closes the feedback loop, eliminating the tensor channel.
It extends the Strength structure with the feedback-fixing operation.
Object constraints on the feedback channel (a) used to let constrained
categories instance this class lawfully; those constraints are now
explicit at the instance site rather than inherited from a constraint
family.
Law note: the traced-category Sliding axiom is restricted in the
premonoidal setting. Benton & Hyland, "Traced Premonoidal Categories"
(2003, Def 3.2) replace unrestricted Sliding with Central Sliding:
a morphism g may slide past the trace only when g is central.
Dually, Centre Preservation says trace f is central whenever f is.
This class does not enforce the side-conditions at the type level; lawful
instances must guarantee them by construction. See the circuits-axioma
sliding oracles for witnesses that the side-condition is not vacuous.
Instances
| Traced Either Process Source # | |
| Traced (,) Hyper Source # | |
| Traced (,) Process Source # | |
| Traced (,) Pullback Source # | The cartesian trace for pullbacks. The body is a linear map (dx, db) = f (dx, dc) solved by the same lazy knot that a differentiable arrow uses. For
strict carriers with nonzero channel self-coupling this diverges,
exactly as the lazy differentiable trace does. Unlike the differentiable
case, though, the equation here is always affine —
|
| (Category arr, Traced t arr) => Traced (t :: Type -> Type -> Type) (AlgCat arr :: Type -> Type -> Type) Source # | |
| Traced Either (K IO) Source # | Traced for Each iteration re-establishes the prompt boundary. When
|
| Monad m => Traced Either (K m :: Type -> Type -> Type) Source # | |
| Traced Either (->) Source # | The Either trace iterates:
Vanishing (a): tracing over the unit does nothing. The unit is
Yanking: tracing a braid is the identity.
Tightening: payload morphisms pass freely through the trace.
|
| MonadFix m => Traced (,) (K m :: Type -> Type -> Type) Source # | |
| MonadFix m => Traced (,) (HyperA (K m) :: Type -> Type -> Type) Source # | |
| Traced (,) (->) Source # | The cartesian trace ties a lazy knot: the feedback value Only works in a lazy setting — the feedback value is a self-referential thunk. In a strict language this binding is circular and divergent. Haskell's lazy evaluation makes cyclic sharing possible without an explicit fixpoint operator.
Vanishing (a): tracing over the unit does nothing. The unit is
Yanking: tracing a braid is the identity.
Tightening: payload morphisms pass freely through the trace.
Sliding: a morphism on the channel slides from one side to the other.
Strength: an independent payload wire is invisible to the trace.
|
Defined in Circuit.Channel | |
| (Traced t arr, Action w arr) => Traced (t :: Type -> Type -> Type) (SMC w arr :: Type -> Type -> Type) Source # | |
| Traced t arr => Traced (t :: Type -> Type -> Type) (Trace t arr :: Type -> Type -> Type) Source # | |
| Traced t arr => Traced (t :: k -> k -> k) (Dagger arr :: k -> k -> Type) Source # | |
| Traced t arr => Traced (t :: k -> k -> k) (Free arr :: k -> k -> Type) Source # | Lift the A loop body in |