Categorical algebra
Catlab.CategoricalAlgebra.FreeDiagrams
— ModuleFree diagrams in a category.
A free diagram in a category is a diagram whose shape is a free category. Examples include the empty diagram, pairs of objects, discrete diagrams, parallel morphisms, spans, and cospans. Limits and colimits are most commonly taken over free diagrams.
Catlab.CategoricalAlgebra.FreeDiagrams.BipartiteFreeDiagram
— TypeA free diagram that is bipartite.
Such diagrams include most of the fixed shapes, such as spans, cospans, and parallel morphisms. They are the generic shape of diagrams for limits and colimits arising from undirected wiring diagrams. For limits, the boxes correspond to vertices in $V₁$ and the junctions to vertics in $V₂$. Colimits are dual.
Catlab.CategoricalAlgebra.FreeDiagrams.Cospan
— TypeCospan of morphisms in a category.
A common special case of Multicospan
. See also Span
.
Catlab.CategoricalAlgebra.FreeDiagrams.DiscreteDiagram
— TypeDiscrete diagram: a diagram whose only morphisms are identities.
Catlab.CategoricalAlgebra.FreeDiagrams.FixedShapeFreeDiagram
— TypeAbstract type for free diagram of fixed shape.
Catlab.CategoricalAlgebra.FreeDiagrams.Multicospan
— TypeMulticospan of morphisms in a category.
A multicospan is like a Cospan
except that it may have a number of legs different than two. A limit of this shape is a pullback.
Catlab.CategoricalAlgebra.FreeDiagrams.Multispan
— TypeMultispan of morphisms in a category.
A multispan is like a Span
except that it may have a number of legs different than two. A colimit of this shape is a pushout.
Catlab.CategoricalAlgebra.FreeDiagrams.ParallelMorphisms
— TypeParallel morphims in a category.
Parallel morphisms are just morphisms with the same domain and codomain. A (co)limit of this shape is a (co)equalizer.
For the common special case of two morphisms, see ParallelPair
.
Catlab.CategoricalAlgebra.FreeDiagrams.ParallelPair
— TypePair of parallel morphisms in a category.
A common special case of ParallelMorphisms
.
Catlab.CategoricalAlgebra.FreeDiagrams.Span
— TypeCatlab.CategoricalAlgebra.FreeDiagrams.bundle_legs
— MethodBundle together legs of a multi(co)span.
For example, calling bundle_legs(span, SVector((1,2),(3,4)))
on a multispan with four legs gives a span whose left leg bundles legs 1 and 2 and whose right leg bundles legs 3 and 4. Note that in addition to bundling, this function can also permute legs and discard them.
The bundling is performed using the universal property of (co)products, which assumes that these (co)limits exist.
Catlab.CategoricalAlgebra.Limits
— ModuleLimits and colimits in a category.
Catlab.CategoricalAlgebra.Limits.AbstractColimit
— TypeAbstract type for colimit in a category.
The standard concrete subtype is Colimit
, although for computational reasons certain categories may use different subtypes to include extra data.
Catlab.CategoricalAlgebra.Limits.AbstractLimit
— TypeAbstract type for limit in a category.
The standard concrete subtype is Limit
, although for computational reasons certain categories may use different subtypes to include extra data.
Catlab.CategoricalAlgebra.Limits.Colimit
— TypeColimit in a category.
Catlab.CategoricalAlgebra.Limits.ColimitAlgorithm
— TypeAlgorithm for computing colimits.
Catlab.CategoricalAlgebra.Limits.ComposeCoproductCoequalizer
— TypeCompute pushout by composing a coproduct with a coequalizer.
See also: ComposeProductEqualizer
.
Catlab.CategoricalAlgebra.Limits.ComposeProductEqualizer
— TypeCompute pullback by composing a product with an equalizer.
See also: ComposeCoproductCoequalizer
.
Catlab.CategoricalAlgebra.Limits.Limit
— TypeLimit in a category.
Catlab.CategoricalAlgebra.Limits.LimitAlgorithm
— TypeAlgorithm for computing limits.
Catlab.CategoricalAlgebra.Limits.colimit
— FunctionColimit of a diagram.
To define colimits in a category with objects Ob
, override the method colimit(::FreeDiagram{Ob})
for general colimits or colimit(::D)
with suitable type D <: FixedShapeFreeDiagram{Ob}
for colimits of specific shape, such as coproducts or coequalizers.
See also: limit
Catlab.CategoricalAlgebra.Limits.limit
— FunctionLimit of a diagram.
To define limits in a category with objects Ob
, override the method limit(::FreeDiagram{Ob})
for general limits or limit(::D)
with suitable type D <: FixedShapeFreeDiagram{Ob}
for limits of specific shape, such as products or equalizers.
See also: colimit
Catlab.CategoricalAlgebra.Limits.pullback
— MethodPullback of a pair of morphisms with common codomain.
To implement for a type T
, define the method limit(::Cospan{T})
and/or limit(::Multicospan{T})
or, if you have already implemented products and equalizers, rely on the default implementation.
Catlab.CategoricalAlgebra.Limits.pushout
— MethodPushout of a pair of morphisms with common domain.
To implement for a type T
, define the method colimit(::Span{T})
and/or colimit(::Multispan{T})
or, if you have already implemented coproducts and coequalizers, rely on the default implementation.
Catlab.CategoricalAlgebra.Limits.universal
— FunctionCatlab.Theories.coequalizer
— MethodCoequalizer of morphisms with common domain and codomain.
To implement for a type T
, define the method colimit(::ParallelPair{T})
or colimit(::ParallelMorphisms{T})
.
Catlab.Theories.copair
— MethodCopairing of morphisms: universal property of coproducts/pushouts.
To implement for coproducts of type T
, define the method universal(::BinaryCoproduct{T}, ::Cospan{T})
and/or universal(::Coproduct{T}, ::Multicospan{T})
and similarly for pushouts.
Catlab.Theories.coproduct
— MethodCoproduct of objects.
To implement for a type T
, define the method colimit(::ObjectPair{T})
and/or colimit(::DiscreteDiagram{T})
.
Catlab.Theories.create
— MethodUnique morphism out of an initial object.
To implement for a type T
, define the method universal(::Initial{T}, ::SMulticospan{0,T})
.
Catlab.Theories.delete
— MethodUnique morphism into a terminal object.
To implement for a type T
, define the method universal(::Terminal{T}, ::SMultispan{0,T})
.
Catlab.Theories.equalizer
— MethodEqualizer of morphisms with common domain and codomain.
To implement for a type T
, define the method limit(::ParallelPair{T})
and/or limit(::ParallelMorphisms{T})
.
Catlab.Theories.factorize
— MethodFactor morphism through (co)equalizer, via the universal property.
To implement for equalizers of type T
, define the method universal(::Equalizer{T}, ::SMultispan{1,T})
. For coequalizers of type T
, define the method universal(::Coequalizer{T}, ::SMulticospan{1,T})
.
Catlab.Theories.initial
— MethodInitial object.
To implement for a type T
, define the method colimit(::EmptyDiagram{T})
.
Catlab.Theories.pair
— MethodPairing of morphisms: universal property of products/pullbacks.
To implement for products of type T
, define the method universal(::BinaryProduct{T}, ::Span{T})
and/or universal(::Product{T}, ::Multispan{T})
and similarly for pullbacks.
Catlab.Theories.product
— MethodProduct of objects.
To implement for a type T
, define the method limit(::ObjectPair{T})
and/or limit(::DiscreteDiagram{T})
.
Catlab.Theories.terminal
— MethodTerminal object.
To implement for a type T
, define the method limit(::EmptyDiagram{T})
.
Catlab.CategoricalAlgebra.FinSets
— ModuleThe category of finite sets and functions, and its skeleton.
Catlab.CategoricalAlgebra.FinSets.FinDomFunction
— TypeFunction out of a finite set.
This class of functions is convenient because it is exactly the class that can be represented explicitly by a vector of values from the codomain.
Catlab.CategoricalAlgebra.FinSets.FinFunction
— TypeFunction between finite sets.
The function can be defined implicitly by an arbitrary Julia function, in which case it is evaluated lazily, or explictly by a vector of integers. In the vector representation, the function (1↦1, 2↦3, 3↦2, 4↦3), for example, is represented by the vector [1,3,2,3].
This type is mildly generalized by FinDomFunction
.
Catlab.CategoricalAlgebra.FinSets.FinSet
— TypeFinite set.
This generic type encompasses the category FinSet of finite sets and functions, through types FinSet{S} where S <: AbstractSet
, as well as the skeleton of this category, through the type FinSet{Int}
. In the latter case, the object FinSet(n)
represents the set ${1,...,n}$.
Catlab.CategoricalAlgebra.FinSets.HashJoin
— TypeHash join algorithm.
Catlab.CategoricalAlgebra.FinSets.JoinAlgorithm
— TypeAlgorithm for limit of spans or multispans out of finite sets.
In the context of relational databases, such limits are joins.
Catlab.CategoricalAlgebra.FinSets.NestedLoopJoin
— TypeNested-loop join algorithm.
This is the naive algorithm for computing joins.
Catlab.CategoricalAlgebra.FinSets.SmartJoin
— TypeMeta-algorithm for joins that attempts to pick an appropriate algorithm.
Catlab.CategoricalAlgebra.FinSets.SortMergeJoin
— TypeSort-merge join algorithm.
Catlab.CategoricalAlgebra.FinSets.force
— MethodForce evaluation of lazy function or relation.
Catlab.CategoricalAlgebra.FinSets.is_indexed
— MethodWhether the given function is indexed, i.e., supports efficient preimages.
Catlab.CategoricalAlgebra.FinSets.preimage
— MethodThe preimage (inverse image) of the value y in the codomain.
Catlab.CategoricalAlgebra.FinRelations
— ModuleThe category of finite sets and relations, and its skeleton.
Catlab.CategoricalAlgebra.FinRelations.BoolRig
— TypeThe rig of booleans.
This struct is needed because in base Julia, the product of booleans is another boolean, but the sum of booleans is coerced to an integer: true + true == 2
.
Catlab.CategoricalAlgebra.FinRelations.FinRel
— TypeObject in the category of finite sets and relations.
See also: FinSet
.
Catlab.CategoricalAlgebra.FinRelations.FinRelation
— TypeBinary relation between finite sets.
A morphism in the category of finite sets and relations. The relation can be represented implicitly by an arbitrary Julia function mapping pairs of elements to booleans or explicitly by a matrix (dense or sparse) taking values in the rig of booleans (BoolRig
).
Catlab.CategoricalAlgebra.FinRelations.FinRelationCallable
— TypeRelation in FinRel defined by a callable Julia object.
Catlab.CategoricalAlgebra.FinRelations.FinRelationMatrix
— TypeRelation in FinRel represented by a boolean matrix.
Boolean matrices are also known as logical matrices or relation matrices.
Catlab.CategoricalAlgebra.CSets
— ModuleCategories of C-sets and attributed C-sets.
Catlab.CategoricalAlgebra.CSets.ACSetTransformation
— TypeTransformation between attributed C-sets.
A morphism of C-sets is a natural transformation: a transformation between functors C -> Set satisfying the naturality axiom for all morphisms in C. This struct records the data of a transformation; it does not enforce naturality.
The transformation has a component for every object in C. When C-sets have attributes, the data types are assumed to be fixed. Thus, the naturality axiom for data attributes is a commutative triangle, rather than a commutative square.
Catlab.CategoricalAlgebra.CSets.generate_json_acset
— MethodSerialize an ACSet object to a JSON string
Catlab.CategoricalAlgebra.CSets.is_natural
— MethodIs the transformation between C-sets a natural transformation?
Uses the fact that to check whether a transformation is natural, it suffices to check the naturality equation on a generating set of morphisms.
Catlab.CategoricalAlgebra.CSets.migrate!
— MethodPullback functorial data migration from one ACSet to another.
Note that this operation is contravariant: the data is transferred from X
to Y
but the functor, represented by two dictionaries, maps the schema for Y
to the schema for X
.
When the functor is the identity, this function is equivalent to copy_parts!
.
Catlab.CategoricalAlgebra.CSets.parse_json_acset
— MethodDeserialize a dictionary from a parsed JSON string to an object of the given ACSet type
Catlab.CategoricalAlgebra.CSets.parse_json_acset
— MethodDeserialize a JSON string to an object of the given ACSet type
Catlab.CategoricalAlgebra.CSets.read_json_acset
— MethodRead a JSON file to an object of the given ACSet type
Catlab.CategoricalAlgebra.CSets.write_json_acset
— MethodSerialize an ACSet object to a JSON file
Catlab.CategoricalAlgebra.StructuredCospans
— ModuleStructured cospans.
This module provides a generic interface for structured cospans with a concrete implementation for attributed C-sets.
Catlab.CategoricalAlgebra.StructuredCospans.StructuredCospan
— TypeStructured cospan.
The first type parameter L
encodes a functor L: A → X from the base category A
, often FinSet, to a category X
with "extra structure." An L-structured cospan is then a cospan in X whose feet are images under L of objects in A. The category X is assumed to have pushouts.
Structured cospans form a double category with no further assumptions on the functor L. To obtain a symmetric monoidal double category, L must preserve finite coproducts. In practice, L usually has a right adjoint R: X → A, which implies that L preserves all finite colimits. It also allows structured cospans to be constructed more conveniently from an object x in X plus a cospan in A with apex R(x).
See also: StructuredMulticospan
.
Catlab.CategoricalAlgebra.StructuredCospans.StructuredCospan
— MethodConstruct structured cospan in R-form.
Catlab.CategoricalAlgebra.StructuredCospans.StructuredCospan
— MethodConstruct structured cospan in L-form.
Catlab.CategoricalAlgebra.StructuredCospans.StructuredCospanOb
— TypeObject in the category of L-structured cospans.
Catlab.CategoricalAlgebra.StructuredCospans.StructuredMulticospan
— TypeStructured multicospan.
A structured multicospan is like a structured cospan except that it may have a number of legs different than two.
See also: StructuredCospan
.
Catlab.CategoricalAlgebra.StructuredCospans.StructuredMulticospan
— MethodConstruct structured multicospan in R-form.
Catlab.CategoricalAlgebra.StructuredCospans.OpenACSetTypes
— MethodCreate types for open attributed C-sets from an attributed C-set type.
The resulting types, for objects and morphisms, each have the same type parameters for data types as the original type.
See also: OpenCSetTypes
.
Catlab.CategoricalAlgebra.StructuredCospans.OpenCSetTypes
— MethodCreate types for open C-sets from a C-set type.
Returns two types, for objects, a subtype of StructuredCospanOb
, and for morphisms, a subtype of StructuredMulticospan
.
See also: OpenACSetTypes
.