@@ -5,7 +5,9 @@ import Basic.Category
55import Basic.Functor
66import Product.ProductCategory
77import Permutations.Permutations
8+ import Permutations.SwapDown
89import Cartographer.Hypergraph
10+ import Cartographer.GoodHypergraphCategory
911import Cartographer.HypergraphStrictMonoidalCategory
1012import MonoidalCategory.StrictMonoidalCategory
1113
@@ -79,26 +81,34 @@ Codomain m (Mor i) = snd $ index i m
7981PetriPath : Nat -> Nat -> Type
8082PetriPath places k = Tree (Fin places) (Fin k)
8183
82- everything : (spec : PetriSpec k) -> (path : PetriPath (Places spec) k)
83- -> Maybe (mor (cat (hypergraphSMC (Fin k)
84- (\ m => fst $ index m (Edges spec))
85- (\ m => snd $ index m (Edges spec))))
84+ 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))))
8688 (Domain (Edges spec) path)
8789 (Codomain (Edges spec) path))
88- everything s (Tensor lt rt) = [| everything s lt `add` everything s rt | ]
89- everything s (Sequence lt rt) {k} = do
90- lt' <- everything s lt
91- rt' <- everything s rt
92- case decEq (Domain (Edges s) rt) (Codomain (Edges s) lt) of
93- Yes p => let rt'' = replace
94- {P = (\n ewDom => Hypergraph (Fin k)
90+ goodMapping s (Tensor x y) = do
91+ x' <- goodMapping s x
92+ y' <- goodMapping s y
93+ pure $ Element (getWitness x' `add` getWitness y') (VComp (getProof x') (getProof y'))
94+ goodMapping s (Sequence x y) {k} = do
95+ x' <- goodMapping s x
96+ y' <- goodMapping s y
97+ case decEq (Domain (Edges s) y) (Codomain (Edges s) x) of
98+ Yes p => let y'' = replace
99+ {P = (\n ewDom => Subset (Hypergraph (Fin k)
95100 (\m => fst $ index m (Edges s))
96101 (\m => snd $ index m (Edges s))
97102 newDom
98- (Codomain (Edges s) rt))
103+ (Codomain (Edges s) y))
104+ GoodHypergraph)
99105 }
100- p rt' in pure (compose lt' rt'' )
106+ p y'
107+ in pure $ Element (Hypergraph . compose (getWitness x') (getWitness y'' )) (HComp (getProof x' ) (getProof y'' ))
101108 No _ => Nothing
102- everything _ (Sym a b) = Just (permutation (swap [a] [b]))
103- everything _ (Id o) = Just (Hypergraph.identity [o])
104- everything _ (Mor m) = Just (Hypergraph.singleton m)
109+
110+ goodMapping s (Sym a b) = Just $ Element (permutation (swap [a] [b]))
111+ (GoodHypergraphCategory.Permutation (Ins (Ins Nil HereS) (ThereS HereS)))
112+ goodMapping s (Id x) = Just $ Element (Hypergraph.identity [x])
113+ (GoodHypergraphCategory.Permutation (Ins Nil HereS))
114+ goodMapping s (Mor x) = Just $ Element (Hypergraph.singleton x) (Singleton x)
0 commit comments