Skip to content

Commit a39618a

Browse files
Use general category operators
1 parent cf11736 commit a39618a

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/PetriGraph.idr

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,22 @@ Codomain m (Mor i) = snd $ index i m
8181
PetriPath : Nat -> Nat -> Type
8282
PetriPath places k = Tree (Fin places) (Fin k)
8383

84+
goodPetriSMC : (spec : PetriSpec k) -> StrictMonoidalCategory
85+
goodPetriSMC spec = goodHypergraphSMC (Fin k)
86+
(\m => fst $ index m (Edges spec))
87+
(\m => snd $ index m (Edges spec))
88+
8489
goodMapping : (spec : PetriSpec k) -> (path : PetriPath (Places spec) k)
85-
-> Maybe (mor (cat (goodHypergraphSMC (Fin k)
86-
(\m => fst $ index m (Edges spec))
87-
(\m => snd $ index m (Edges spec))))
88-
(Domain (Edges spec) path)
89-
(Codomain (Edges spec) path))
90+
-> Maybe (mor (cat (goodPetriSMC spec))
91+
(Domain (Edges spec) path)
92+
(Codomain (Edges spec) path))
9093
goodMapping s (Tensor x y) = do
9194
x' <- goodMapping s x
9295
y' <- goodMapping s y
93-
pure $ Element (getWitness x' `add` getWitness y') (VComp (getProof x') (getProof y'))
96+
pure $ mapMor (tensor (goodPetriSMC s))
97+
(Domain (Edges s) x, Domain (Edges s) y)
98+
(Codomain (Edges s) x, Codomain (Edges s) y)
99+
(MkProductMorphism x' y')
94100
goodMapping s (Sequence x y) {k} = do
95101
x' <- goodMapping s x
96102
y' <- goodMapping s y
@@ -104,11 +110,9 @@ goodMapping s (Sequence x y) {k} = do
104110
GoodHypergraph)
105111
}
106112
p y'
107-
in pure $ Element (Hypergraph.compose (getWitness x') (getWitness y'')) (HComp (getProof x') (getProof y''))
113+
in pure $ compose (cat (goodPetriSMC s)) _ _ _ x' y''
108114
No _ => Nothing
109-
115+
goodMapping s (Id x) = Just $ identity (cat (goodPetriSMC s)) [x]
110116
goodMapping s (Sym a b) = Just $ Element (permutation (swap [a] [b]))
111117
(GoodHypergraphCategory.Permutation (Ins (Ins Nil HereS) (ThereS HereS)))
112-
goodMapping s (Id x) = Just $ Element (Hypergraph.identity [x])
113-
(GoodHypergraphCategory.Permutation (Ins Nil HereS))
114118
goodMapping s (Mor x) = Just $ Element (Hypergraph.singleton x) (Singleton x)

0 commit comments

Comments
 (0)