yarrow.functor.functor

Strict Symmetric Monoidal Hypergraph Functors of Diagrams.

This module consists of two classes.

The former is the generic interface that all functors must implement. If you wish to define a functor, it is strongly recommended to define a class which inherits from FrobeniusFunctor. That way, instead of mapping arbitrary diagrams, you can define your functor in terms of mapping generating operations.

class yarrow.functor.functor.Functor

A base class for implementing strict symmetric monoidal hypergraph functors.

A Functor must implement two things:

The latter is hard to write from scratch! Generally you will want to implement yarrow.functor.functor.FrobeniusFunctor. Then you only have to implement a mapping on generating operations, and the map_arrow function will be implemented for you.

abstract map_objects(objects: AbstractFiniteFunction) AbstractIndexedCoproduct

The object map F₀ of a functor F : Diagram_Σ Diagram_Ω maps between lists of generating objects F₀ : Σ₀* → Ω₀*. Given an array of generating objects encoded as a FiniteFunction:

objects : W → Σ₀

This function must return an indexed coproduct representing the lists to which each object was mapped:

sources : W            → Nat
values  : sum(sources) → Ω₀

(An “indexed coproduct” is basically a categorical name for a segmented array.)

abstract map_arrow(d: AbstractDiagram) AbstractDiagram

F.map_arrow(d) should apply the functor F to diagram d.

yarrow.functor.functor.apply_finite_object_map(finite_object_map: AbstractIndexedCoproduct, wn: AbstractFiniteFunction) AbstractIndexedCoproduct

Given an AbstractIndexedCoproduct f representing a family of K functions:

f_i : N_i → Ω₀*, i ∈ K

where f_i is the action of a functor F on generating object i, and an object wn = L(A) in the image of L, apply_finite_object_map(f, wn) computes the object F(wn) as a segmented array.

yarrow.functor.functor.map_half_spider(swn: AbstractIndexedCoproduct, f: AbstractFiniteFunction) AbstractFiniteFunction

Let swn = F.map_objects(f.type[1]) for some functor F, and suppose S(f) is a half-spider. Then S(map_half_spider(swn, f)) == F(S(f)).

yarrow.functor.functor.decomposition_to_operations(d: AbstractDiagram) Operations

Get the array of operations (and their types) from a Frobenius decomposition.

class yarrow.functor.functor.FrobeniusFunctor

A functor defined in terms of Frobenius decompositions. Instead of specifying map_arrow, the implementor can specify map_operations. This should map a tensoring of generators to a AbstractDiagram.

abstract map_objects(objects: AbstractFiniteFunction) AbstractIndexedCoproduct

The object map F₀ of a functor F : Diagram_Σ Diagram_Ω maps between lists of generating objects F₀ : Σ₀* → Ω₀*. Given an array of generating objects encoded as a FiniteFunction:

objects : W → Σ₀

This function must return an indexed coproduct representing the lists to which each object was mapped:

sources : W            → Nat
values  : sum(sources) → Ω₀

(An “indexed coproduct” is basically a categorical name for a segmented array.)

abstract map_operations(ops: Operations) AbstractDiagram

Given an array of generating operations:

xn : X → Σ₁

and their types:

s_type : sum_{i ∈ X} arity(xn(i))   → Σ₀
t_type : sum_{i ∈ X} coarity(xn(i)) → Σ₀

You must return an yarrow.diagram.AbstractDiagram representing the tensoring:

F₁(xn(0)) ● F₁(xn(1)) ... F₁(xn(X - 1))
map_arrow(d: AbstractDiagram) AbstractDiagram

Apply a functor to a diagram. NOTE: You do not need to implement this method

yarrow.functor.functor.identity_object_map(objects: AbstractFiniteFunction) AbstractIndexedCoproduct

The object map of the identity functor

class yarrow.functor.functor.Identity

The identity functor, whose map_arrow method is implemented by actually just returning the same diagram

map_objects(objects) AbstractIndexedCoproduct
map_arrow(d: AbstractDiagram) AbstractDiagram
class yarrow.functor.functor.FrobeniusIdentity

The identity functor, implemented using Frobenius decompositions. This is provided as a simple example of how to use the FrobeniusFunctor type: instead of implementing map_arrow directly, one can instead write a mapping on tensorings of operations. This is typically much easier, since for a strict monoidal functor F we have F(f₀ f₁ ... fn) = F(f₀) F(f₁) ... F(fn)

map_objects(objects: AbstractFiniteFunction)
map_operations(ops: Operations) AbstractDiagram