# Library Reference

`SemanticModels.SemanticModels`

— ModuleSemanticModels

provides the AbstractModel type and constructors for building metamodeling tooling for categorical model representations

`SemanticModels.AbstractModel`

— Type`AbstractModel`

a placeholder struct to dispatch on how to parse the expression tree into a model.

`SemanticModels.model`

— Methodmodel(::AbstractModel, x) dig into the expression that describes a model and break it down into components. This allows you to construct a structured representation of the modeling problem at the expression level. Just like how julia modeling frameworks build structured representations of the problems in data structures. This version builds them at the expression level. The first argument is the type you want to construct, the second argument is the model structure that you want to analyze. For example

`model(PetriModel, x::Petri.Model)::PetriModel`

### Category Theory

The following Category Theory operations ship with SemanticModels, you can use them as templates for defining your own model classes.

`SemanticModels.CategoryTheory.AbstractCospan`

— Type`AbstractCospan`

an abstract type for representing cospans. The essential API for subtypes of AbstractCospan are

- left(c)::M
- right(c)::M
- pullback(c)::S

where M is the type of morphisms in the cospan, and S is the type of span that solves the pullback defined by c. See Cospan for an example.

`SemanticModels.CategoryTheory.AbstractMorph`

— Type`AbstractMorph`

an abstract type for representing morphisms. The essential API for subtypes of AbstractMorph are

- dom(m)::T
- codom(m)::T
- func(m)::Function

where T is the type of the objects in the category. See FinSetMorph for an example.

`SemanticModels.CategoryTheory.AbstractSpan`

— Type`AbstractSpan`

an abstract type for representing spans. The essential API for subtypes of AbstractSpan are

- left(s)::M
- right(s)::M
- pushout(s)::C

where M is the type of morphisms in the span, and C is the type of cospan that solves a pushout of span s. See Span for an example.

`SemanticModels.CategoryTheory.Cospan`

— Type`Cospan{F,G} <: AbstractCospan`

a general cospan type where types F and G are types of morphisms in the cospan

`SemanticModels.CategoryTheory.Decorated`

— Type`Decorated{M,T}`

a decoration applied to the objects of a morphism, where M is a type of morphism and type T is the category of the decoration

`SemanticModels.CategoryTheory.FinSetMorph`

— Type`FinSetMorph{T,F}`

morphisms in the category of Finite Sets. The objects are of type UnitRange{Int}. func(m::FinSetMorph) is a function that takes `Int -> Int`

. FinSetMorphs can be constructed from a list of numbers. For example, `FinSetMorph([1,3,2,3])`

is the morphism that takes `1->1, 2->3, 3->2, 4->3`

on domain `1:4`

with codomain `1:3`

. When you define a morphism from a list of integers, the codomain is inferred from the largest element of the list. The domain must always be the `1:l`

where `l`

is the length of the input list.

`(f::FinSetMorph)(g::G) where G <: AbstractGraph`

lift a finite set morphism (list of integers) to a graph homomorphism by its action on the vertex set. The graph `h = f(g)`

is defined by taking the edges of `g`

and relabeling their src and dst according to the function of `f`

.

This method computes a valid graph homomorphism by definition.

`SemanticModels.CategoryTheory.Span`

— Type`Span{F,G} <: AbstractSpan`

a general span type where types F and G are types of morphisms in the span

`SemanticModels.CategoryTheory.:⊔`

— Method`⊔(f::FinSetMorph, g::FinSetMorph)`

the union of two morphisms in a finite set.

`SemanticModels.CategoryTheory.pushout`

— Method`pushout(s::Span{T, T}) where T <: Decorated`

treat f,g as a decorated span and compute the pushout that is, the cospan of f=(f⊔g) and g=(a⊔b), with the decoration of (f⊔g)(d)

`SemanticModels.CategoryTheory.pushout`

— Method`pushout(s::Span{T,T}) where T <: FinSetMorph`

treat f,g as a span and compute the pushout that is, the cospan of f=(f⊔g) and g=(a⊔b)

`SemanticModels.CategoryTheory.undecorate`

— Method`undecorate(s::Copan{T,T}) where T <: Decorated`

remove decorations of a cospan of decorated morphisms

`SemanticModels.CategoryTheory.undecorate`

— Method`undecorate(s::Span{T,T}) where T <: Decorated`

remove decorations of a span of decorated morphisms

### Model Classes

The following model class ship with SemanticModels, you can use them as templates for defining your own model classes.

```
Modules = [
SemanticModels.WiringDiagrams,
SemanticModels.PetriModels,
SemanticModels.RelOlogModels,
SemanticModels.OpenModels,
SemanticModels.OpenPetris,
SemanticModels.PetriCospans
]
```

## Index

`SemanticModels.SemanticModels`

`SemanticModels.AbstractModel`

`SemanticModels.CategoryTheory.AbstractCospan`

`SemanticModels.CategoryTheory.AbstractMorph`

`SemanticModels.CategoryTheory.AbstractSpan`

`SemanticModels.CategoryTheory.Cospan`

`SemanticModels.CategoryTheory.Decorated`

`SemanticModels.CategoryTheory.FinSetMorph`

`SemanticModels.CategoryTheory.Span`

`SemanticModels.ExprModels.Parsers.AbstractCollector`

`SemanticModels.ExprModels.Parsers.FuncCollector`

`SemanticModels.ExprModels.Parsers.MetaCollector`

`SemanticModels.CategoryTheory.:⊔`

`SemanticModels.CategoryTheory.pushout`

`SemanticModels.CategoryTheory.pushout`

`SemanticModels.CategoryTheory.undecorate`

`SemanticModels.CategoryTheory.undecorate`

`SemanticModels.ExprModels.Parsers.defs`

`SemanticModels.ExprModels.Parsers.findassign`

`SemanticModels.ExprModels.Parsers.findfunc`

`SemanticModels.ExprModels.Parsers.funcs`

`SemanticModels.ExprModels.Parsers.inexpr`

`SemanticModels.ExprModels.Parsers.parsefile`

`SemanticModels.ExprModels.Parsers.postwalk`

`SemanticModels.ExprModels.Parsers.prewalk`

`SemanticModels.model`