Browse Source

Updated Petri and Catlab APIs (#252)

* Updated Petri and Catlab APIs

* Added compat entries and version bump for final release

* Removed v1.0 test
pull/253/head v0.4.0
Micah Halter 5 months ago
committed by GitHub
parent
commit
ec65e7efc5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 25 deletions
  1. +1
    -1
      .github/workflows/test.yml
  2. +5
    -1
      Project.toml
  3. +1
    -1
      src/CategoryTheory.jl
  4. +2
    -2
      src/OpenPetris.jl
  5. +11
    -11
      src/PetriCospans.jl
  6. +2
    -2
      src/RelOlogModels.jl
  7. +1
    -1
      src/WiringDiagrams.jl
  8. +3
    -3
      test/epidemics.jl
  9. +3
    -3
      test/petricospans.jl

+ 1
- 1
.github/workflows/test.yml View File

@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: ['1.0', '1.3', '1.4']
julia-version: ['1.3', '1.4']
os: [ubuntu-latest]
steps:


+ 5
- 1
Project.toml View File

@ -1,7 +1,7 @@
name = "SemanticModels"
uuid = "f5ac2a72-33c7-5caf-b863-f02fefdcf428"
authors = ["James Fairbanks <james.fairbanks@gtri.gatech.edu>", "Micah Halter <micah.halter@gtri.gatech.edu>"]
version = "0.3.0"
version = "0.4.0"
[deps]
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
@ -10,6 +10,10 @@ MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"
[compat]
Catlab = "^0.7.0"
LightGraphs = "^1.3.3"
MacroTools = "^0.5.5"
Petri = "^1.0.0"
julia = "1.0"
[extras]


+ 1
- 1
src/CategoryTheory.jl View File

@ -2,7 +2,7 @@
module CategoryTheory
using SemanticModels
import Catlab.Doctrines: dom, codom
import Catlab.Theories: dom, codom
import Base: append!, push!, deleteat!, delete!
export , AbstractMorph, FinSetMorph, dom, codom, verify, func, Decorated, decorations, undecorate, AbstractSpan, leftob, rightob, apexob, Span, left, right, DoublePushout, AbstractCospan, Cospan, pushout


+ 2
- 2
src/OpenPetris.jl View File

@ -5,8 +5,8 @@ import SemanticModels.PetriModels: PetriModel
import SemanticModels.OpenModels: OpenModel
using ModelingToolkit
import ModelingToolkit: Constant
using Catlab.Doctrines
import Catlab.Doctrines: , compose, otimes
using Catlab.Theories
import Catlab.Theories: , compose, otimes
export OpenPetri, eye,


+ 11
- 11
src/PetriCospans.jl View File

@ -1,7 +1,7 @@
module PetriCospans
using Catlab
using Catlab.Doctrines
using Catlab.Theories
using Catlab.WiringDiagrams
# using Catlab.Programs
import Base: (==), length, show
@ -10,7 +10,7 @@ using ..PetriModels
using ..CategoryTheory
import ..CategoryTheory: undecorate,
import Catlab.Doctrines:
import Catlab.Theories:
Ob, Hom, dom, codom, compose, , , id, oplus, otimes, , , munit, mzero, braid,
dagger, dunit, dcounit, mcopy, Δ, delete, , mmerge, , create, ,
plus, zero, coplus, cozero, meet, top, join, bottom
@ -25,11 +25,11 @@ export Epidemiology, FreeEpidemiology, spontaneous, exposure, death,
death(A)::Hom(A, munit()) A::Ob
end
spontaneous(A::Ports, B::Ports) = singleton_diagram(Epidemiology.Hom, Box(:, A, B))
exposure(A::Ports, B::Ports, C::Ports) = singleton_diagram(Epidemiology.Hom, Box(:exposure, A⊗B, C⊗B))
death(A::Ports) = singleton_diagram(Epidemiology.Hom, Box(:𝗫, A, Ports([])))
mcopy(A::Ports{Epidemiology.Hom}, Symbol) = implicit_mcopy(A, 2)
mmerge(A::Ports{Epidemiology.Hom}, Symbol) = implicit_mmerge(A, 2)
spontaneous(A::Ports, B::Ports) = singleton_diagram(Box(:, A, B))
exposure(A::Ports, B::Ports, C::Ports) = singleton_diagram(Box(:exposure, A⊗B, C⊗B))
death(A::Ports) = singleton_diagram(Box(:𝗫, A, Ports([])))
mcopy(A::Ports{Epidemiology}, Symbol) = implicit_mcopy(A, 2)
mmerge(A::Ports{Epidemiology}, Symbol) = implicit_mmerge(A, 2)
@syntax FreeEpidemiology(ObExpr, HomExpr) Epidemiology begin
@ -41,8 +41,8 @@ mmerge(A::Ports{Epidemiology.Hom}, Symbol) = implicit_mmerge(A, 2)
copair(f::Hom, g::Hom) = (f g) (codom(f))
proj1(A::Ob, B::Ob) = id(A) (B)
proj2(A::Ob, B::Ob) = (A) id(B)
incl1(A::Ob, B::Ob) = id(A) (B)
incl2(A::Ob, B::Ob) = (A) id(B)
coproj1(A::Ob, B::Ob) = id(A) (B)
coproj2(A::Ob, B::Ob) = (A) id(B)
otimes(A::Ob, B::Ob) = associate_unit(new(A,B), munit)
otimes(f::Hom, g::Hom) = associate(new(f,g))
end
@ -221,8 +221,8 @@ end
proj1(A::FinSet,B::FinSet) = otimes(id(A), delete(B))
proj2(A::FinSet,B::FinSet) = otimes(delete(A), id(B))
incl1(A::FinSet,B::FinSet) = otimes(id(A), create(B))
incl2(A::FinSet,B::FinSet) = otimes(create(A), id(B))
coproj1(A::FinSet,B::FinSet) = otimes(id(A), create(B))
coproj2(A::FinSet,B::FinSet) = otimes(create(A), id(B))
spontaneous(A::FinSet, B::FinSet) = begin
M, N = length(A), length(B)


+ 2
- 2
src/RelOlogModels.jl View File

@ -4,8 +4,8 @@ module RelOlogModels
using Catlab
using Catlab.Syntax
using Catlab.WiringDiagrams
using Catlab.Doctrines
import Catlab.Doctrines.
using Catlab.Theories
import Catlab.Theories.
using SemanticModels
import SemanticModels: model


+ 1
- 1
src/WiringDiagrams.jl View File

@ -3,7 +3,7 @@
module WiringDiagrams
using Catlab.WiringDiagrams
using Catlab.Doctrines
using Catlab.Theories
using Catlab.Graphics
using Catlab.Graphics.Graphviz
using MacroTools


+ 3
- 3
test/epidemics.jl View File

@ -1,6 +1,6 @@
module TestEpidemics
using Catlab
using Catlab.Doctrines
using Catlab.Theories
using Catlab.Graphics
using Catlab.WiringDiagrams
using Catlab.Programs
@ -18,7 +18,7 @@ import SemanticModels.PetriCospans: otimes_ipm, compose_pushout
println("Done Importing SemanticModels")
import Catlab.Doctrines:
import Catlab.Theories:
Ob, Hom, dom, codom, compose, , , id, oplus, otimes, , , munit, mzero, braid,
dagger, dunit, dcounit, mcopy, Δ, delete, , mmerge, , create, ,
plus, zero, coplus, cozero, meet, top, join, bottom
@ -199,7 +199,7 @@ Pseird = PetriModel(
([3],[2]), # onset
([2],[4]), # recovery
([2],[5]), # death
], missing, missing))
]))
inputs = FinSetMorph(1:5, [1,2,3])
outputs = FinSetMorph(1:5, [1,2,3])
Fcityd = PetriCospan(Cospan(Decorated(inputs, Pseird),


+ 3
- 3
test/petricospans.jl View File

@ -1,7 +1,7 @@
module TestPetriCospans
using Catlab
using Catlab.Doctrines
using Catlab.Theories
using Catlab.WiringDiagrams
using Catlab.Programs
import Base.Multimedia: display
@ -14,7 +14,7 @@ using SemanticModels.PetriModels
using SemanticModels.PetriCospans
import SemanticModels.PetriCospans: otimes_ipm, compose_pushout
import Catlab.Doctrines:
import Catlab.Theories:
Ob, Hom, dom, codom, compose, , , id, oplus, otimes, , , munit, mzero, braid,
dagger, dunit, dcounit, mcopy, Δ, delete, , mmerge, , create, ,
plus, zero, coplus, cozero, meet, top, join, bottom
@ -28,7 +28,7 @@ Cospan(f,g), Cospan(f′, g′)
pushout(Span(g,f′))
spon = PetriModel(Petri.Model([1,2], [([1], [2])], missing, missing))
spon = PetriModel(Petri.Model([1,2], [([1], [2])]))
f = Decorated(FinSetMorph(1:2, [2]), [spon])
g = Decorated(FinSetMorph(1:2, [1]), [spon])
s = Span(g,f)


Loading…
Cancel
Save