| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Category.Monoidal.Hypergraph
Contents
Description
Synopsis
- class (CommutativeMonoid a, CocommutativeComonoid a) => Frobenius (a :: k)
- spider :: forall {k} (n :: Nat) (m :: Nat) (a :: k). (Frobenius a, SNatI n, SNatI m) => NFold n a ~> NFold m a
- spiderS :: forall {k} (n :: Nat) (m :: Nat) (a :: k). (Frobenius a, SNatI n, SNatI m) => NFoldS n a ~> NFoldS m a
- cup :: forall {k} (a :: k). Frobenius a => (Unit :: k) ~> (a ** a)
- cupS :: forall {a1} (a2 :: a1). Frobenius a2 => ('[] :: [a1]) ~> '[a2, a2]
- cap :: forall {k} (a :: k). Frobenius a => (a ** a) ~> (Unit :: k)
- capS :: forall {k} (a :: k). Frobenius a => '[a, a] ~> ('[] :: [k])
- class (Supplies Frobenius k, CompactClosed k) => Hypergraph k
- class CategoryOf k => Sized k where
- dualHG :: forall {k} (a :: k) (b :: k). Hypergraph k => (a ~> b) -> b ~> a
- linDistHG :: forall {k} (a :: k) (b :: k) (c :: k). (Hypergraph k, Ob a, Ob b) => ((a ** b) ~> c) -> a ~> (b ** c)
- linDistInvHG :: forall {k} (a :: k) (b :: k) (c :: k). (Hypergraph k, Ob b, Ob c) => (a ~> (b ** c)) -> (a ** b) ~> c
- traceHG :: forall {k} (u :: k) (x :: k) (y :: k). (Hypergraph k, Ob x, Ob y, Ob u) => ((u ** x) ~> (u ** y)) -> x ~> y
- type ExpHG (a :: k) (b :: k) = a ** b
- curryHG :: forall {k} (a :: k) (b :: k) (c :: k). (Hypergraph k, Ob a, Ob b) => ((a ** b) ~> c) -> a ~> ExpHG b c
- applyHG :: forall {k} (b :: k) (c :: k). (Hypergraph k, Ob b, Ob c) => (ExpHG b c ** b) ~> c
- type FrobeniusStructures = '[Monoidal, SymMonoidal, Supplies Monoid, Supplies Comonoid]
Documentation
class (CommutativeMonoid a, CocommutativeComonoid a) => Frobenius (a :: k) Source Github #
A special commutative Frobenius algebra: a commutative monoid and cocommutative comonoid
satisfying speciality (mappend . comult = id) and the Frobenius law. A Hypergraph category
supplies this structure at every object, and with it the spider from n-fold a to m-fold a
is the unique connected map (commutativity/cocommutativity make
fanIn/fanOut independent of wiring order). The bare notion of a Frobenius monoid needs
neither (co)commutativity, but the library only ever uses the special commutative one.
Instances
| KnownNat a => Frobenius (a :: Nat) Source Github # | |
Defined in Proarrow.Category.Instance.ZX | |
| SNatI a => Frobenius ('FR a :: FINREL) Source Github # | |
Defined in Proarrow.Category.Instance.FinRel | |
| Ob as => Frobenius ('D as :: DOT) Source Github # | The points are spiders: on each wire, merging and copying are the special commutative Frobenius structure. |
Defined in Proarrow.Tools.Diagrams.Dot | |
| Ob as => Frobenius ('S as :: SVG) Source Github # | |
Defined in Proarrow.Tools.Diagrams.Svg | |
| (Num a, IsNat n) => Frobenius ('M n :: MatK a) Source Github # | |
Defined in Proarrow.Category.Instance.Mat | |
| (HasPullbacks k, HasProducts k, Ob a) => Frobenius ('SP a :: SPAN k) Source Github # | |
Defined in Proarrow.Category.Instance.Span | |
| (Scalar e, KnownListOf KnownNat ns) => Frobenius ('TN ns :: TNET e) Source Github # | |
Defined in Proarrow.Category.Instance.TensorNetwork | |
| (HasPushouts k, HasCoproducts k, Alternative f, Ob a) => Frobenius ('DC a :: DECCOSPAN f) Source Github # | |
Defined in Proarrow.Category.Instance.DecoratedCospan | |
| (CommutativeMonoid a, CocommutativeComonoid a) => Frobenius (a :: FREE cs p) Source Github # | In the free category the supply generators (see |
Defined in Proarrow.Category.Monoidal.Hypergraph | |
spider :: forall {k} (n :: Nat) (m :: Nat) (a :: k). (Frobenius a, SNatI n, SNatI m) => NFold n a ~> NFold m a Source Github #
spiderS :: forall {k} (n :: Nat) (m :: Nat) (a :: k). (Frobenius a, SNatI n, SNatI m) => NFoldS n a ~> NFoldS m a Source Github #
class (Supplies Frobenius k, CompactClosed k) => Hypergraph k Source Github #
A hypergraph category has a special frobenius algebra for every object, and the frobenius algebra of any tensor product X ⊗ Y is induced in the canonical way from those of X and Y.
Instances
class CategoryOf k => Sized k where Source Github #
How many values an object stands for, such as the dimension of a vector space or the number of
elements of a set: what readBack weighs a wire by
when choosing contraction order and estimating swap cost in layered read-back.
Sizes should be nonnegative and invariant under isomorphism. For monoidal categories, prefer
a unit size of 1 and a tensor size equal to the product of the factors' sizes.
These are recommendations rather than laws: sizes may also be heuristic weights. A category
without a natural size can give every object size 2; the planner multiplies the weights of
separate wires in a bundle, even when sizeOf itself does not preserve tensor products.
Instances
| Sized FINREL Source Github # | The size of |
| Sized DOT Source Github # | |
| Sized SVG Source Github # | |
| Num a => Sized (MatK a) Source Github # | The size of |
| Scalar e => Sized (TNET e) Source Github # | The size of an object is the product of its dimensions. |
| (HasPushouts k, Alternative f) => Sized (DECCOSPAN f) Source Github # | |
dualHG :: forall {k} (a :: k) (b :: k). Hypergraph k => (a ~> b) -> b ~> a Source Github #
A hypergraph category is self-dual compact closed.
linDistHG :: forall {k} (a :: k) (b :: k) (c :: k). (Hypergraph k, Ob a, Ob b) => ((a ** b) ~> c) -> a ~> (b ** c) Source Github #
linDistInvHG :: forall {k} (a :: k) (b :: k) (c :: k). (Hypergraph k, Ob b, Ob c) => (a ~> (b ** c)) -> (a ** b) ~> c Source Github #
traceHG :: forall {k} (u :: k) (x :: k) (y :: k). (Hypergraph k, Ob x, Ob y, Ob u) => ((u ** x) ~> (u ** y)) -> x ~> y Source Github #
A hypergraph category has a trace.
curryHG :: forall {k} (a :: k) (b :: k) (c :: k). (Hypergraph k, Ob a, Ob b) => ((a ** b) ~> c) -> a ~> ExpHG b c Source Github #
applyHG :: forall {k} (b :: k) (c :: k). (Hypergraph k, Ob b, Ob c) => (ExpHG b c ** b) ~> c Source Github #
type FrobeniusStructures = '[Monoidal, SymMonoidal, Supplies Monoid, Supplies Comonoid] Source Github #
The structures the laws of a category supplying special commutative Frobenius algebras are stated for: the monoids and comonoids, together.
Orphan instances
| Laws FrobeniusStructures Source Github # | The supplied monoids and comonoids are special and satisfy the Frobenius law. Their monoid and comonoid laws, and their commutativity, are separate instances, in Proarrow.Monoid. |