AlgebraicJulia / AlgebraicJulia/GATlab.jl
Designing nested contexts
- 主要言語
- Julia
- スター
- 43
- フォーク
- 4
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Just like ACSets, making a context struct has two steps. The first step is declaring the context (analogous to declaring the schema). We might also have an analogous naming convention to schema declaration, such as `CtxArena`.
```julia
CtxWrappedHom = @context ThCategory [dom::Ob, codom::Ob, morphism::Hom(dom, codom)]
```
The second step is to declare a struct that is based on that context. There are two options here. The first is to declare a model-specific struct, in which case we pass in a model as part of the struct declaration process, get the types associated with type constructors from that, and then only use the type parameters of the model as type parameters for the struct.
This might look something like:
```julia
@context_struct_concrete FinSetC FinFunction(CtxWrappedHom)
# =>
struct FinFunction
dom::Int
codom::Int
morphism::Vector{Int}
end
```
The second is to declare a model-generic struct, which has type parameters for each type constructor and then additionally a type parameter for the model.
```julia
@context_struct_abstract WrappedHom(CtxWrappedHom)
# =>
struct WrappedHom{Ob, Hom, M <: Model{ThCategory.T, Tuple{Ob, Hom}}}
dom::Ob
codom::Ob
morphism::Hom
end
```
We should also have an `AnonContext` struct, which wraps a `NamedTuple`, and then also a `DynamicContext` struct which wraps a `Vector{Any}`.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。