diff --git a/src/03_basic_sets/module.jl b/src/03_basic_sets/module.jl deleted file mode 100644 index e7a9c321c..000000000 --- a/src/03_basic_sets/module.jl +++ /dev/null @@ -1,15 +0,0 @@ -module BasicSets - -using Reexport - -include("01_sets/module.jl") # Categories -include("02_finsets/module.jl") # 1 -include("03_setfunctions/module.jl") # 2 -include("04_finfunctions/module.jl") # 3 - -@reexport using .Sets -@reexport using .FinSets -@reexport using .SetFunctions -@reexport using .FinFunctions - -end # module diff --git a/src/04_categorical_algebra/01_cats/module.jl b/src/04_categorical_algebra/01_cats/module.jl deleted file mode 100644 index 006a7de2f..000000000 --- a/src/04_categorical_algebra/01_cats/module.jl +++ /dev/null @@ -1,44 +0,0 @@ -module Cats - -using Reexport - -include("01_paths/Paths.jl") # [DEPS] -@reexport using .Paths - -include("02_categories/module.jl") # -@reexport using .Categories - -include("03_fincats/module.jl") # 2 -@reexport using .FinCats - -include("04_functors/module.jl") # 2 -@reexport using .Functors - -include("05_freediagrams/module.jl") # 3 -@reexport using .FreeDiagrams - -include("06_finfunctors/module.jl") # 2, 5 -@reexport using .FinFunctors - -include("07_cat_of_cat/CatOfCat.jl") # 2 -@reexport using .CatOfCat - -include("08_natural_transformations/module.jl") -@reexport using .Transformations - -include("09_limits_colimits/module.jl") # 4,5 -@reexport using .LimitsColimits - -include("10_commutative_diagrams/CommutativeDiagrams.jl") -@reexport using .CommutativeDiagrams - -include("11_diagrams/module.jl") # 5 -@reexport using .Diagrams - -include("12_slice/module.jl") -@reexport using .SliceCategories - -include("13_subobjects/Subobjects.jl") # Limits -@reexport using .Subobjects - -end # module diff --git a/src/04_categorical_algebra/03_pointwise/module.jl b/src/04_categorical_algebra/03_pointwise/module.jl deleted file mode 100644 index 09fe7ec08..000000000 --- a/src/04_categorical_algebra/03_pointwise/module.jl +++ /dev/null @@ -1,36 +0,0 @@ -module Pointwise -using Reexport - -include("01_acsettransformations/ACSetTransformations.jl") -@reexport using .ACSetTransformations - -include("02_csets/module.jl") -@reexport using .CSets - -include("03_pointwisecats/module.jl") -@reexport using .PointwiseCats - -include("04_limits_colimits/module.jl") -@reexport using .LimitsColimits - -include("05_homsearch/module.jl") -@reexport using .HomSearch - -include("06_catelements/CatElements.jl") -@reexport using .CatElements - -include("07_subcsets/SubCSets.jl") -@reexport using .SubCSets - - -include("08_chase/Chase.jl") -@reexport using .Chase - -include("09_datamigrations/module.jl") -@reexport using .FunctorialDataMigrations - - -include("10_structured_cospans/StructuredCospans.jl") -@reexport using .StructuredCospans - -end # module diff --git a/src/04_categorical_algebra/module.jl b/src/04_categorical_algebra/module.jl deleted file mode 100644 index 9f86fe8cb..000000000 --- a/src/04_categorical_algebra/module.jl +++ /dev/null @@ -1,18 +0,0 @@ -module CategoricalAlgebra - -using Reexport - -include("01_cats/module.jl") -@reexport using .Cats - -include("02_setcats/module.jl") # depends on Cats -@reexport using .SetCats - -include("03_pointwise/module.jl") # depends on Cats, SetCats -@reexport using .Pointwise - -include("04_misc/module.jl") # doesn't depend on the other three - -@reexport using .Misc - -end # module diff --git a/src/Catlab.jl b/src/Catlab.jl index 0e8567bd2..3db16ae3d 100644 --- a/src/Catlab.jl +++ b/src/Catlab.jl @@ -2,11 +2,11 @@ module Catlab using Reexport -include("01_theories/module.jl") +include("theories/module.jl") include("ACSetsGATsInterop.jl") # depends on Theories but is not a theory -include("02_graphs/Graphs.jl") -include("03_basic_sets/module.jl") -include("04_categorical_algebra/module.jl") +include("graphs/Graphs.jl") +include("basic_sets/module.jl") +include("categorical_algebra/module.jl") include("wiring_diagrams/WiringDiagrams.jl") include("graphics/Graphics.jl") include("programs/Programs.jl") diff --git a/src/03_basic_sets/04_finfunctions/FinFnDict.jl b/src/basic_sets/finfunctions/FinFnDict.jl similarity index 100% rename from src/03_basic_sets/04_finfunctions/FinFnDict.jl rename to src/basic_sets/finfunctions/FinFnDict.jl diff --git a/src/03_basic_sets/04_finfunctions/FinFnVector.jl b/src/basic_sets/finfunctions/FinFnVector.jl similarity index 100% rename from src/03_basic_sets/04_finfunctions/FinFnVector.jl rename to src/basic_sets/finfunctions/FinFnVector.jl diff --git a/src/03_basic_sets/04_finfunctions/FinForce.jl b/src/basic_sets/finfunctions/FinForce.jl similarity index 100% rename from src/03_basic_sets/04_finfunctions/FinForce.jl rename to src/basic_sets/finfunctions/FinForce.jl diff --git a/src/03_basic_sets/04_finfunctions/FinFunctions.jl b/src/basic_sets/finfunctions/FinFunctions.jl similarity index 100% rename from src/03_basic_sets/04_finfunctions/FinFunctions.jl rename to src/basic_sets/finfunctions/FinFunctions.jl diff --git a/src/03_basic_sets/04_finfunctions/module.jl b/src/basic_sets/finfunctions/module.jl similarity index 100% rename from src/03_basic_sets/04_finfunctions/module.jl rename to src/basic_sets/finfunctions/module.jl diff --git a/src/03_basic_sets/02_finsets/EitherFinSet.jl b/src/basic_sets/finsets/EitherFinSet.jl similarity index 100% rename from src/03_basic_sets/02_finsets/EitherFinSet.jl rename to src/basic_sets/finsets/EitherFinSet.jl diff --git a/src/03_basic_sets/02_finsets/EmptySets.jl b/src/basic_sets/finsets/EmptySets.jl similarity index 100% rename from src/03_basic_sets/02_finsets/EmptySets.jl rename to src/basic_sets/finsets/EmptySets.jl diff --git a/src/03_basic_sets/02_finsets/FinSetHash.jl b/src/basic_sets/finsets/FinSetHash.jl similarity index 100% rename from src/03_basic_sets/02_finsets/FinSetHash.jl rename to src/basic_sets/finsets/FinSetHash.jl diff --git a/src/03_basic_sets/02_finsets/FinSetInts.jl b/src/basic_sets/finsets/FinSetInts.jl similarity index 100% rename from src/03_basic_sets/02_finsets/FinSetInts.jl rename to src/basic_sets/finsets/FinSetInts.jl diff --git a/src/03_basic_sets/02_finsets/FinSetVect.jl b/src/basic_sets/finsets/FinSetVect.jl similarity index 100% rename from src/03_basic_sets/02_finsets/FinSetVect.jl rename to src/basic_sets/finsets/FinSetVect.jl diff --git a/src/03_basic_sets/02_finsets/FinSets.jl b/src/basic_sets/finsets/FinSets.jl similarity index 100% rename from src/03_basic_sets/02_finsets/FinSets.jl rename to src/basic_sets/finsets/FinSets.jl diff --git a/src/03_basic_sets/02_finsets/ProdFinSets.jl b/src/basic_sets/finsets/ProdFinSets.jl similarity index 100% rename from src/03_basic_sets/02_finsets/ProdFinSets.jl rename to src/basic_sets/finsets/ProdFinSets.jl diff --git a/src/03_basic_sets/02_finsets/SIngletonSets.jl b/src/basic_sets/finsets/SingletonSets.jl similarity index 100% rename from src/03_basic_sets/02_finsets/SIngletonSets.jl rename to src/basic_sets/finsets/SingletonSets.jl diff --git a/src/03_basic_sets/02_finsets/SumFinSets.jl b/src/basic_sets/finsets/SumFinSets.jl similarity index 100% rename from src/03_basic_sets/02_finsets/SumFinSets.jl rename to src/basic_sets/finsets/SumFinSets.jl diff --git a/src/03_basic_sets/02_finsets/TabularSet.jl b/src/basic_sets/finsets/TabularSet.jl similarity index 100% rename from src/03_basic_sets/02_finsets/TabularSet.jl rename to src/basic_sets/finsets/TabularSet.jl diff --git a/src/03_basic_sets/02_finsets/module.jl b/src/basic_sets/finsets/module.jl similarity index 100% rename from src/03_basic_sets/02_finsets/module.jl rename to src/basic_sets/finsets/module.jl diff --git a/src/basic_sets/module.jl b/src/basic_sets/module.jl new file mode 100644 index 000000000..c1ca2b54d --- /dev/null +++ b/src/basic_sets/module.jl @@ -0,0 +1,17 @@ +module BasicSets + +using Reexport + +include("sets/module.jl") +@reexport using .Sets + +include("finsets/module.jl") +@reexport using .FinSets + +include("setfunctions/module.jl") +@reexport using .SetFunctions + +include("finfunctions/module.jl") +@reexport using .FinFunctions + +end # module diff --git a/src/03_basic_sets/03_setfunctions/Callable.jl b/src/basic_sets/setfunctions/Callable.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/Callable.jl rename to src/basic_sets/setfunctions/Callable.jl diff --git a/src/03_basic_sets/03_setfunctions/CompFunction.jl b/src/basic_sets/setfunctions/CompFunction.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/CompFunction.jl rename to src/basic_sets/setfunctions/CompFunction.jl diff --git a/src/03_basic_sets/03_setfunctions/ConstEither.jl b/src/basic_sets/setfunctions/ConstEither.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/ConstEither.jl rename to src/basic_sets/setfunctions/ConstEither.jl diff --git a/src/03_basic_sets/03_setfunctions/ConstFn.jl b/src/basic_sets/setfunctions/ConstFn.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/ConstFn.jl rename to src/basic_sets/setfunctions/ConstFn.jl diff --git a/src/03_basic_sets/03_setfunctions/Force.jl b/src/basic_sets/setfunctions/Force.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/Force.jl rename to src/basic_sets/setfunctions/Force.jl diff --git a/src/03_basic_sets/03_setfunctions/IdFunction.jl b/src/basic_sets/setfunctions/IdFunction.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/IdFunction.jl rename to src/basic_sets/setfunctions/IdFunction.jl diff --git a/src/03_basic_sets/03_setfunctions/PredFn.jl b/src/basic_sets/setfunctions/PredFn.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/PredFn.jl rename to src/basic_sets/setfunctions/PredFn.jl diff --git a/src/03_basic_sets/03_setfunctions/SetFunctions.jl b/src/basic_sets/setfunctions/SetFunctions.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/SetFunctions.jl rename to src/basic_sets/setfunctions/SetFunctions.jl diff --git a/src/03_basic_sets/03_setfunctions/module.jl b/src/basic_sets/setfunctions/module.jl similarity index 100% rename from src/03_basic_sets/03_setfunctions/module.jl rename to src/basic_sets/setfunctions/module.jl diff --git a/src/03_basic_sets/01_sets/EitherSets.jl b/src/basic_sets/sets/EitherSets.jl similarity index 100% rename from src/03_basic_sets/01_sets/EitherSets.jl rename to src/basic_sets/sets/EitherSets.jl diff --git a/src/03_basic_sets/01_sets/PredSet.jl b/src/basic_sets/sets/PredSet.jl similarity index 100% rename from src/03_basic_sets/01_sets/PredSet.jl rename to src/basic_sets/sets/PredSet.jl diff --git a/src/03_basic_sets/01_sets/ProdSets.jl b/src/basic_sets/sets/ProdSets.jl similarity index 100% rename from src/03_basic_sets/01_sets/ProdSets.jl rename to src/basic_sets/sets/ProdSets.jl diff --git a/src/03_basic_sets/01_sets/Sets.jl b/src/basic_sets/sets/Sets.jl similarity index 100% rename from src/03_basic_sets/01_sets/Sets.jl rename to src/basic_sets/sets/Sets.jl diff --git a/src/03_basic_sets/01_sets/SumSets.jl b/src/basic_sets/sets/SumSets.jl similarity index 100% rename from src/03_basic_sets/01_sets/SumSets.jl rename to src/basic_sets/sets/SumSets.jl diff --git a/src/03_basic_sets/01_sets/TypeSet.jl b/src/basic_sets/sets/TypeSet.jl similarity index 100% rename from src/03_basic_sets/01_sets/TypeSet.jl rename to src/basic_sets/sets/TypeSet.jl diff --git a/src/03_basic_sets/01_sets/UnionSet.jl b/src/basic_sets/sets/UnionSet.jl similarity index 100% rename from src/03_basic_sets/01_sets/UnionSet.jl rename to src/basic_sets/sets/UnionSet.jl diff --git a/src/03_basic_sets/01_sets/module.jl b/src/basic_sets/sets/module.jl similarity index 100% rename from src/03_basic_sets/01_sets/module.jl rename to src/basic_sets/sets/module.jl diff --git a/src/04_categorical_algebra/01_cats/07_cat_of_cat/CatOfCat.jl b/src/categorical_algebra/cats/cat_of_cat/CatOfCat.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/07_cat_of_cat/CatOfCat.jl rename to src/categorical_algebra/cats/cat_of_cat/CatOfCat.jl diff --git a/src/04_categorical_algebra/01_cats/02_categories/Categories.jl b/src/categorical_algebra/cats/categories/Categories.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/02_categories/Categories.jl rename to src/categorical_algebra/cats/categories/Categories.jl diff --git a/src/04_categorical_algebra/01_cats/02_categories/CoproductCats.jl b/src/categorical_algebra/cats/categories/CoproductCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/02_categories/CoproductCats.jl rename to src/categorical_algebra/cats/categories/CoproductCats.jl diff --git a/src/04_categorical_algebra/01_cats/02_categories/DiscreteCats.jl b/src/categorical_algebra/cats/categories/DiscreteCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/02_categories/DiscreteCats.jl rename to src/categorical_algebra/cats/categories/DiscreteCats.jl diff --git a/src/04_categorical_algebra/01_cats/02_categories/OpCats.jl b/src/categorical_algebra/cats/categories/OpCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/02_categories/OpCats.jl rename to src/categorical_algebra/cats/categories/OpCats.jl diff --git a/src/04_categorical_algebra/01_cats/02_categories/TrivialCats.jl b/src/categorical_algebra/cats/categories/TrivialCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/02_categories/TrivialCats.jl rename to src/categorical_algebra/cats/categories/TrivialCats.jl diff --git a/src/04_categorical_algebra/01_cats/02_categories/TypeCats.jl b/src/categorical_algebra/cats/categories/TypeCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/02_categories/TypeCats.jl rename to src/categorical_algebra/cats/categories/TypeCats.jl diff --git a/src/04_categorical_algebra/01_cats/02_categories/module.jl b/src/categorical_algebra/cats/categories/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/02_categories/module.jl rename to src/categorical_algebra/cats/categories/module.jl diff --git a/src/04_categorical_algebra/01_cats/10_commutative_diagrams/CommutativeDiagrams.jl b/src/categorical_algebra/cats/commutative_diagrams/CommutativeDiagrams.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/10_commutative_diagrams/CommutativeDiagrams.jl rename to src/categorical_algebra/cats/commutative_diagrams/CommutativeDiagrams.jl diff --git a/src/04_categorical_algebra/01_cats/11_diagrams/Diagrams.jl b/src/categorical_algebra/cats/diagrams/Diagrams.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/11_diagrams/Diagrams.jl rename to src/categorical_algebra/cats/diagrams/Diagrams.jl diff --git a/src/04_categorical_algebra/01_cats/11_diagrams/Limits.jl b/src/categorical_algebra/cats/diagrams/Limits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/11_diagrams/Limits.jl rename to src/categorical_algebra/cats/diagrams/Limits.jl diff --git a/src/04_categorical_algebra/01_cats/11_diagrams/Monads.jl b/src/categorical_algebra/cats/diagrams/Monads.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/11_diagrams/Monads.jl rename to src/categorical_algebra/cats/diagrams/Monads.jl diff --git a/src/04_categorical_algebra/01_cats/11_diagrams/module.jl b/src/categorical_algebra/cats/diagrams/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/11_diagrams/module.jl rename to src/categorical_algebra/cats/diagrams/module.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/DiscreteFinCats.jl b/src/categorical_algebra/cats/fincats/DiscreteFinCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/DiscreteFinCats.jl rename to src/categorical_algebra/cats/fincats/DiscreteFinCats.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/FinCatCat.jl b/src/categorical_algebra/cats/fincats/FinCatCat.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/FinCatCat.jl rename to src/categorical_algebra/cats/fincats/FinCatCat.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/FinCatGraphs.jl b/src/categorical_algebra/cats/fincats/FinCatGraphs.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/FinCatGraphs.jl rename to src/categorical_algebra/cats/fincats/FinCatGraphs.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/FinCatPres.jl b/src/categorical_algebra/cats/fincats/FinCatPres.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/FinCatPres.jl rename to src/categorical_algebra/cats/fincats/FinCatPres.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/FinCats.jl b/src/categorical_algebra/cats/fincats/FinCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/FinCats.jl rename to src/categorical_algebra/cats/fincats/FinCats.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/FinCatsAsCats.jl b/src/categorical_algebra/cats/fincats/FinCatsAsCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/FinCatsAsCats.jl rename to src/categorical_algebra/cats/fincats/FinCatsAsCats.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/OpFinCat.jl b/src/categorical_algebra/cats/fincats/OpFinCat.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/OpFinCat.jl rename to src/categorical_algebra/cats/fincats/OpFinCat.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/PathCats.jl b/src/categorical_algebra/cats/fincats/PathCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/PathCats.jl rename to src/categorical_algebra/cats/fincats/PathCats.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/PreorderCats.jl b/src/categorical_algebra/cats/fincats/PreorderCats.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/PreorderCats.jl rename to src/categorical_algebra/cats/fincats/PreorderCats.jl diff --git a/src/04_categorical_algebra/01_cats/03_fincats/module.jl b/src/categorical_algebra/cats/fincats/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/03_fincats/module.jl rename to src/categorical_algebra/cats/fincats/module.jl diff --git a/src/04_categorical_algebra/01_cats/06_finfunctors/CompFinFunctor.jl b/src/categorical_algebra/cats/finfunctors/CompFinFunctor.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/06_finfunctors/CompFinFunctor.jl rename to src/categorical_algebra/cats/finfunctors/CompFinFunctor.jl diff --git a/src/04_categorical_algebra/01_cats/06_finfunctors/FinDomMap.jl b/src/categorical_algebra/cats/finfunctors/FinDomMap.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/06_finfunctors/FinDomMap.jl rename to src/categorical_algebra/cats/finfunctors/FinDomMap.jl diff --git a/src/04_categorical_algebra/01_cats/06_finfunctors/FinFunctors.jl b/src/categorical_algebra/cats/finfunctors/FinFunctors.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/06_finfunctors/FinFunctors.jl rename to src/categorical_algebra/cats/finfunctors/FinFunctors.jl diff --git a/src/04_categorical_algebra/01_cats/06_finfunctors/IdFinFunctor.jl b/src/categorical_algebra/cats/finfunctors/IdFinFunctor.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/06_finfunctors/IdFinFunctor.jl rename to src/categorical_algebra/cats/finfunctors/IdFinFunctor.jl diff --git a/src/04_categorical_algebra/01_cats/06_finfunctors/OpFinFunctor.jl b/src/categorical_algebra/cats/finfunctors/OpFinFunctor.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/06_finfunctors/OpFinFunctor.jl rename to src/categorical_algebra/cats/finfunctors/OpFinFunctor.jl diff --git a/src/04_categorical_algebra/01_cats/06_finfunctors/module.jl b/src/categorical_algebra/cats/finfunctors/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/06_finfunctors/module.jl rename to src/categorical_algebra/cats/finfunctors/module.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/Bipartite.jl b/src/categorical_algebra/cats/freediagrams/Bipartite.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/Bipartite.jl rename to src/categorical_algebra/cats/freediagrams/Bipartite.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/ComposableHoms.jl b/src/categorical_algebra/cats/freediagrams/ComposableHoms.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/ComposableHoms.jl rename to src/categorical_algebra/cats/freediagrams/ComposableHoms.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/Discrete.jl b/src/categorical_algebra/cats/freediagrams/Discrete.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/Discrete.jl rename to src/categorical_algebra/cats/freediagrams/Discrete.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/FreeDiagrams.jl b/src/categorical_algebra/cats/freediagrams/FreeDiagrams.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/FreeDiagrams.jl rename to src/categorical_algebra/cats/freediagrams/FreeDiagrams.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/FreeGraphs.jl b/src/categorical_algebra/cats/freediagrams/FreeGraphs.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/FreeGraphs.jl rename to src/categorical_algebra/cats/freediagrams/FreeGraphs.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/Multispans.jl b/src/categorical_algebra/cats/freediagrams/Multispans.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/Multispans.jl rename to src/categorical_algebra/cats/freediagrams/Multispans.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/ParallelHoms.jl b/src/categorical_algebra/cats/freediagrams/ParallelHoms.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/ParallelHoms.jl rename to src/categorical_algebra/cats/freediagrams/ParallelHoms.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/Specialize.jl b/src/categorical_algebra/cats/freediagrams/Specialize.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/Specialize.jl rename to src/categorical_algebra/cats/freediagrams/Specialize.jl diff --git a/src/04_categorical_algebra/01_cats/05_freediagrams/module.jl b/src/categorical_algebra/cats/freediagrams/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/05_freediagrams/module.jl rename to src/categorical_algebra/cats/freediagrams/module.jl diff --git a/src/04_categorical_algebra/01_cats/04_functors/CallFunctor.jl b/src/categorical_algebra/cats/functors/CallFunctor.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/04_functors/CallFunctor.jl rename to src/categorical_algebra/cats/functors/CallFunctor.jl diff --git a/src/04_categorical_algebra/01_cats/04_functors/CompFunctor.jl b/src/categorical_algebra/cats/functors/CompFunctor.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/04_functors/CompFunctor.jl rename to src/categorical_algebra/cats/functors/CompFunctor.jl diff --git a/src/04_categorical_algebra/01_cats/04_functors/Functors.jl b/src/categorical_algebra/cats/functors/Functors.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/04_functors/Functors.jl rename to src/categorical_algebra/cats/functors/Functors.jl diff --git a/src/04_categorical_algebra/01_cats/04_functors/IdFunctor.jl b/src/categorical_algebra/cats/functors/IdFunctor.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/04_functors/IdFunctor.jl rename to src/categorical_algebra/cats/functors/IdFunctor.jl diff --git a/src/04_categorical_algebra/01_cats/04_functors/OpFunctor.jl b/src/categorical_algebra/cats/functors/OpFunctor.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/04_functors/OpFunctor.jl rename to src/categorical_algebra/cats/functors/OpFunctor.jl diff --git a/src/04_categorical_algebra/01_cats/04_functors/module.jl b/src/categorical_algebra/cats/functors/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/04_functors/module.jl rename to src/categorical_algebra/cats/functors/module.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Coequalizers.jl b/src/categorical_algebra/cats/limits_colimits/Coequalizers.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Coequalizers.jl rename to src/categorical_algebra/cats/limits_colimits/Coequalizers.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Colimits.jl b/src/categorical_algebra/cats/limits_colimits/Colimits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Colimits.jl rename to src/categorical_algebra/cats/limits_colimits/Colimits.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Coproducts.jl b/src/categorical_algebra/cats/limits_colimits/Coproducts.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Coproducts.jl rename to src/categorical_algebra/cats/limits_colimits/Coproducts.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/EpiMono.jl b/src/categorical_algebra/cats/limits_colimits/EpiMono.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/EpiMono.jl rename to src/categorical_algebra/cats/limits_colimits/EpiMono.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Equalizers.jl b/src/categorical_algebra/cats/limits_colimits/Equalizers.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Equalizers.jl rename to src/categorical_algebra/cats/limits_colimits/Equalizers.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/FreeGraphs.jl b/src/categorical_algebra/cats/limits_colimits/FreeGraphs.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/FreeGraphs.jl rename to src/categorical_algebra/cats/limits_colimits/FreeGraphs.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Initials.jl b/src/categorical_algebra/cats/limits_colimits/Initials.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Initials.jl rename to src/categorical_algebra/cats/limits_colimits/Initials.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Limits.jl b/src/categorical_algebra/cats/limits_colimits/Limits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Limits.jl rename to src/categorical_algebra/cats/limits_colimits/Limits.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/LimitsColimits.jl b/src/categorical_algebra/cats/limits_colimits/LimitsColimits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/LimitsColimits.jl rename to src/categorical_algebra/cats/limits_colimits/LimitsColimits.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/MonoidalColimits.jl b/src/categorical_algebra/cats/limits_colimits/MonoidalColimits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/MonoidalColimits.jl rename to src/categorical_algebra/cats/limits_colimits/MonoidalColimits.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/MonoidalLimits.jl b/src/categorical_algebra/cats/limits_colimits/MonoidalLimits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/MonoidalLimits.jl rename to src/categorical_algebra/cats/limits_colimits/MonoidalLimits.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Products.jl b/src/categorical_algebra/cats/limits_colimits/Products.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Products.jl rename to src/categorical_algebra/cats/limits_colimits/Products.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Pullbacks.jl b/src/categorical_algebra/cats/limits_colimits/Pullbacks.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Pullbacks.jl rename to src/categorical_algebra/cats/limits_colimits/Pullbacks.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Pushouts.jl b/src/categorical_algebra/cats/limits_colimits/Pushouts.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Pushouts.jl rename to src/categorical_algebra/cats/limits_colimits/Pushouts.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Singletons.jl b/src/categorical_algebra/cats/limits_colimits/Singletons.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Singletons.jl rename to src/categorical_algebra/cats/limits_colimits/Singletons.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/Terminals.jl b/src/categorical_algebra/cats/limits_colimits/Terminals.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/Terminals.jl rename to src/categorical_algebra/cats/limits_colimits/Terminals.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/module.jl b/src/categorical_algebra/cats/limits_colimits/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/module.jl rename to src/categorical_algebra/cats/limits_colimits/module.jl diff --git a/src/04_categorical_algebra/01_cats/09_limits_colimits/other_limits/TrivialLimits.jl b/src/categorical_algebra/cats/limits_colimits/other_limits/TrivialLimits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/09_limits_colimits/other_limits/TrivialLimits.jl rename to src/categorical_algebra/cats/limits_colimits/other_limits/TrivialLimits.jl diff --git a/src/categorical_algebra/cats/module.jl b/src/categorical_algebra/cats/module.jl new file mode 100644 index 000000000..c76e3d93f --- /dev/null +++ b/src/categorical_algebra/cats/module.jl @@ -0,0 +1,44 @@ +module Cats + +using Reexport + +include("paths/Paths.jl") # [DEPS] +@reexport using .Paths + +include("categories/module.jl") # +@reexport using .Categories + +include("fincats/module.jl") # 2 +@reexport using .FinCats + +include("functors/module.jl") # 2 +@reexport using .Functors + +include("freediagrams/module.jl") # 3 +@reexport using .FreeDiagrams + +include("finfunctors/module.jl") # 2, 5 +@reexport using .FinFunctors + +include("cat_of_cat/CatOfCat.jl") # 2 +@reexport using .CatOfCat + +include("natural_transformations/module.jl") +@reexport using .Transformations + +include("limits_colimits/module.jl") # 4,5 +@reexport using .LimitsColimits + +include("commutative_diagrams/CommutativeDiagrams.jl") +@reexport using .CommutativeDiagrams + +include("diagrams/module.jl") # 5 +@reexport using .Diagrams + +include("slice/module.jl") +@reexport using .SliceCategories + +include("subobjects/Subobjects.jl") # Limits +@reexport using .Subobjects + +end # module diff --git a/src/04_categorical_algebra/01_cats/08_natural_transformations/IdTrans.jl b/src/categorical_algebra/cats/natural_transformations/IdTrans.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/08_natural_transformations/IdTrans.jl rename to src/categorical_algebra/cats/natural_transformations/IdTrans.jl diff --git a/src/04_categorical_algebra/01_cats/08_natural_transformations/MapTrans.jl b/src/categorical_algebra/cats/natural_transformations/MapTrans.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/08_natural_transformations/MapTrans.jl rename to src/categorical_algebra/cats/natural_transformations/MapTrans.jl diff --git a/src/04_categorical_algebra/01_cats/08_natural_transformations/OpTrans.jl b/src/categorical_algebra/cats/natural_transformations/OpTrans.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/08_natural_transformations/OpTrans.jl rename to src/categorical_algebra/cats/natural_transformations/OpTrans.jl diff --git a/src/04_categorical_algebra/01_cats/08_natural_transformations/Transformations.jl b/src/categorical_algebra/cats/natural_transformations/Transformations.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/08_natural_transformations/Transformations.jl rename to src/categorical_algebra/cats/natural_transformations/Transformations.jl diff --git a/src/04_categorical_algebra/01_cats/08_natural_transformations/TwoCat.jl b/src/categorical_algebra/cats/natural_transformations/TwoCat.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/08_natural_transformations/TwoCat.jl rename to src/categorical_algebra/cats/natural_transformations/TwoCat.jl diff --git a/src/04_categorical_algebra/01_cats/08_natural_transformations/module.jl b/src/categorical_algebra/cats/natural_transformations/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/08_natural_transformations/module.jl rename to src/categorical_algebra/cats/natural_transformations/module.jl diff --git a/src/04_categorical_algebra/01_cats/01_paths/Paths.jl b/src/categorical_algebra/cats/paths/Paths.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/01_paths/Paths.jl rename to src/categorical_algebra/cats/paths/Paths.jl diff --git a/src/04_categorical_algebra/01_cats/12_slice/LimitsColimits.jl b/src/categorical_algebra/cats/slice/LimitsColimits.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/12_slice/LimitsColimits.jl rename to src/categorical_algebra/cats/slice/LimitsColimits.jl diff --git a/src/04_categorical_algebra/01_cats/12_slice/SliceCategories.jl b/src/categorical_algebra/cats/slice/SliceCategories.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/12_slice/SliceCategories.jl rename to src/categorical_algebra/cats/slice/SliceCategories.jl diff --git a/src/04_categorical_algebra/01_cats/12_slice/module.jl b/src/categorical_algebra/cats/slice/module.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/12_slice/module.jl rename to src/categorical_algebra/cats/slice/module.jl diff --git a/src/04_categorical_algebra/01_cats/13_subobjects/Subobjects.jl b/src/categorical_algebra/cats/subobjects/Subobjects.jl similarity index 100% rename from src/04_categorical_algebra/01_cats/13_subobjects/Subobjects.jl rename to src/categorical_algebra/cats/subobjects/Subobjects.jl diff --git a/src/04_categorical_algebra/04_misc/FinRelations.jl b/src/categorical_algebra/misc/FinRelations.jl similarity index 100% rename from src/04_categorical_algebra/04_misc/FinRelations.jl rename to src/categorical_algebra/misc/FinRelations.jl diff --git a/src/04_categorical_algebra/04_misc/Matrices.jl b/src/categorical_algebra/misc/Matrices.jl similarity index 100% rename from src/04_categorical_algebra/04_misc/Matrices.jl rename to src/categorical_algebra/misc/Matrices.jl diff --git a/src/04_categorical_algebra/04_misc/Permutations.jl b/src/categorical_algebra/misc/Permutations.jl similarity index 100% rename from src/04_categorical_algebra/04_misc/Permutations.jl rename to src/categorical_algebra/misc/Permutations.jl diff --git a/src/04_categorical_algebra/04_misc/module.jl b/src/categorical_algebra/misc/module.jl similarity index 100% rename from src/04_categorical_algebra/04_misc/module.jl rename to src/categorical_algebra/misc/module.jl diff --git a/src/categorical_algebra/module.jl b/src/categorical_algebra/module.jl new file mode 100644 index 000000000..cc82cb39d --- /dev/null +++ b/src/categorical_algebra/module.jl @@ -0,0 +1,18 @@ +module CategoricalAlgebra + +using Reexport + +include("cats/module.jl") +@reexport using .Cats + +include("setcats/module.jl") # depends on Cats +@reexport using .SetCats + +include("pointwise/module.jl") # depends on Cats, SetCats +@reexport using .Pointwise + +include("misc/module.jl") # doesn't depend on the other three + +@reexport using .Misc + +end # module diff --git a/src/04_categorical_algebra/03_pointwise/01_acsettransformations/ACSetTransformations.jl b/src/categorical_algebra/pointwise/acsettransformations/ACSetTransformations.jl similarity index 94% rename from src/04_categorical_algebra/03_pointwise/01_acsettransformations/ACSetTransformations.jl rename to src/categorical_algebra/pointwise/acsettransformations/ACSetTransformations.jl index d674ae8dd..16e84d3bf 100644 --- a/src/04_categorical_algebra/03_pointwise/01_acsettransformations/ACSetTransformations.jl +++ b/src/categorical_algebra/pointwise/acsettransformations/ACSetTransformations.jl @@ -142,14 +142,9 @@ end # WARNING that this means :cat is a reserved name for schema entities. """Move components as first argument""" -ACSetTransformation(X::ACSet, Y::ACSet; cat=nothing, components...) = +function ACSetTransformation(X::ACSet, Y::ACSet; cat=nothing, components...) ACSetTransformation((; components...), X, Y; cat) - -# ACSetTransformation(components, X::StructACSet{S}, Y::StructACSet{S}) where {S} = -# _ACSetTransformation(Val{S},components,X,Y,Val{true}) - -# ACSetTransformation(components, X::DynamicACSet, Y::DynamicACSet) = -# runtime(_ACSetTransformation, X.schema, components, X,Y,false) +end function _ACSetTransformation(components, X::StructACSet{S}, Y::StructACSet{S} ) where S diff --git a/src/04_categorical_algebra/03_pointwise/06_catelements/CatElements.jl b/src/categorical_algebra/pointwise/catelements/CatElements.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/06_catelements/CatElements.jl rename to src/categorical_algebra/pointwise/catelements/CatElements.jl diff --git a/src/04_categorical_algebra/03_pointwise/08_chase/Chase.jl b/src/categorical_algebra/pointwise/chase/Chase.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/08_chase/Chase.jl rename to src/categorical_algebra/pointwise/chase/Chase.jl diff --git a/src/04_categorical_algebra/03_pointwise/02_csets/ACSetFunctors.jl b/src/categorical_algebra/pointwise/csets/ACSetFunctors.jl similarity index 90% rename from src/04_categorical_algebra/03_pointwise/02_csets/ACSetFunctors.jl rename to src/categorical_algebra/pointwise/csets/ACSetFunctors.jl index f3a0bffdd..512bcc4c3 100644 --- a/src/04_categorical_algebra/03_pointwise/02_csets/ACSetFunctors.jl +++ b/src/categorical_algebra/pointwise/csets/ACSetFunctors.jl @@ -60,20 +60,13 @@ FinDomFunctor(acs::ACSet; cat=nothing) = ########################################### -# Set-valued FinDomFunctors as ACSets. +""" Set-valued FinDomFunctors as ACSets. """ function (::Type{ACS})(F::FinDomFunctor) where ACS <: ACSet getvalue(F) isa ACSetFunctor && return getvalue(F).acset - X = if ACS isa UnionAll - pres = presentation(dom(F)) - ACS{(strip_attrvars(eltype(ob_map(F, c))) for c in generators(pres, :AttrType))...}() - else - ACS() - end + X = ACS() copy_parts!(X, F) return X end -strip_attrvars(T) = T -strip_attrvars(::Type{Union{AttrVar, T}}) where T = T """ Copy parts from a set-valued `FinDomFunctor` to an `ACSet`. """ diff --git a/src/04_categorical_algebra/03_pointwise/02_csets/CSets.jl b/src/categorical_algebra/pointwise/csets/CSets.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/02_csets/CSets.jl rename to src/categorical_algebra/pointwise/csets/CSets.jl diff --git a/src/04_categorical_algebra/03_pointwise/02_csets/CollageCats.jl b/src/categorical_algebra/pointwise/csets/CollageCats.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/02_csets/CollageCats.jl rename to src/categorical_algebra/pointwise/csets/CollageCats.jl diff --git a/src/04_categorical_algebra/03_pointwise/02_csets/Heteromorphisms.jl b/src/categorical_algebra/pointwise/csets/Heteromorphisms.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/02_csets/Heteromorphisms.jl rename to src/categorical_algebra/pointwise/csets/Heteromorphisms.jl diff --git a/src/04_categorical_algebra/03_pointwise/02_csets/module.jl b/src/categorical_algebra/pointwise/csets/module.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/02_csets/module.jl rename to src/categorical_algebra/pointwise/csets/module.jl diff --git a/src/04_categorical_algebra/03_pointwise/09_datamigrations/FunctorialDataMigrations.jl b/src/categorical_algebra/pointwise/datamigrations/FunctorialDataMigrations.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/09_datamigrations/FunctorialDataMigrations.jl rename to src/categorical_algebra/pointwise/datamigrations/FunctorialDataMigrations.jl diff --git a/src/04_categorical_algebra/03_pointwise/09_datamigrations/Yoneda.jl b/src/categorical_algebra/pointwise/datamigrations/Yoneda.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/09_datamigrations/Yoneda.jl rename to src/categorical_algebra/pointwise/datamigrations/Yoneda.jl diff --git a/src/04_categorical_algebra/03_pointwise/09_datamigrations/module.jl b/src/categorical_algebra/pointwise/datamigrations/module.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/09_datamigrations/module.jl rename to src/categorical_algebra/pointwise/datamigrations/module.jl diff --git a/src/04_categorical_algebra/03_pointwise/05_homsearch/HomSearch.jl b/src/categorical_algebra/pointwise/homsearch/HomSearch.jl similarity index 99% rename from src/04_categorical_algebra/03_pointwise/05_homsearch/HomSearch.jl rename to src/categorical_algebra/pointwise/homsearch/HomSearch.jl index 53a400ec3..d071f7e92 100644 --- a/src/04_categorical_algebra/03_pointwise/05_homsearch/HomSearch.jl +++ b/src/categorical_algebra/pointwise/homsearch/HomSearch.jl @@ -210,6 +210,7 @@ struct BacktrackingState{ predicates::Predicates image::Image # Negative of image for epic components or if finding an epimorphism unassigned::Unassign # "# of unassigned elems in domain of a component + cat::ACSetCategory end function backtracking_search(f, X::ACSet, Y::ACSet; @@ -299,7 +300,7 @@ function backtracking_search(f, X::ACSet, Y::ACSet; state = BacktrackingState(assignment, assignment_depth, inv_assignment, X, Y, loosefuns, pred_nt, - images, unassigned) + images, unassigned, cat) # Make any initial assignments, failing immediately if inconsistent. for (c, c_assignments) in pairs(initial) @@ -341,7 +342,7 @@ function backtracking_search(f, state::BacktrackingState, depth::Int; state.assignment, state.type_components, state.dom, state.codom)]) else m = Dict(k=>!isnothing(v) for (k,v) in pairs(state.inv_assignment)) - return f(postprocess_search_results(state.dom, state.codom, state.assignment, m)) + return f(postprocess_search_results(state.dom, state.codom, state.assignment, m; cat=state.cat)) end elseif mrv == 0 # An element has no allowable assignment, so we must backtrack. @@ -522,7 +523,7 @@ representables. This function takes a result assignment from backtracking search and returns an iterator of the implicit set of homomorphisms that it specifies. """ -function postprocess_search_results(dom, codom, assgn, monic) +function postprocess_search_results(dom, codom, assgn, monic; cat) S = acset_schema(dom) od = Dict{Symbol,Vector{Int}}(k=>(assgn[k]) for k in objects(S)) @@ -547,7 +548,7 @@ function postprocess_search_results(dom, codom, assgn, monic) k => vec end) comps = merge(NamedTuple(od),NamedTuple(ad)) - ACSetTransformation(comps, dom, codom) + ACSetTransformation(comps, dom, codom; cat) end end diff --git a/src/04_categorical_algebra/03_pointwise/05_homsearch/MCO.jl b/src/categorical_algebra/pointwise/homsearch/MCO.jl similarity index 95% rename from src/04_categorical_algebra/03_pointwise/05_homsearch/MCO.jl rename to src/categorical_algebra/pointwise/homsearch/MCO.jl index 4e6b5686d..ebbf7ca83 100644 --- a/src/04_categorical_algebra/03_pointwise/05_homsearch/MCO.jl +++ b/src/categorical_algebra/pointwise/homsearch/MCO.jl @@ -79,10 +79,10 @@ end """This would be much more efficient with canonical isomorph""" function is_seen(cat, S::SubobjectIteratorState, f::ACSetTransformation) - for h in S.seen - if any(σ -> force(compose[cat](σ,h); cat) == force(f; cat), - isomorphisms(dom(f),dom(h))) - return true + for h in S.seen + for σ in isomorphisms(dom(f),dom(h); cat) + σ = force(σ; cat) # TODO this should be done automatically in homsearch + force(compose[cat](σ,h); cat) == force(f; cat) && return true end end return false @@ -261,8 +261,8 @@ these are all returned. If there are attributes, we ignore these and use variables in the apex of the overlap. """ -function maximum_common_subobject(Xs::Vector{T}; abstract=true) where T <: ACSet - it = partial_overlaps(Xs; abstract) +function maximum_common_subobject(Xs::Vector{T}; abstract=true, kw...) where T <: ACSet + it = partial_overlaps(Xs; abstract, kw...) osize = -1 res = DefaultDict(()->[]) for overlap in it @@ -275,7 +275,7 @@ function maximum_common_subobject(Xs::Vector{T}; abstract=true) where T <: ACSet return res end -maximum_common_subobject(Xs::T...; abstract=true) where T <: ACSet = - maximum_common_subobject(collect(Xs); abstract) +maximum_common_subobject(Xs::ACSet...; abstract=true, kw...) = + maximum_common_subobject(collect(Xs); abstract, kw...) end # module \ No newline at end of file diff --git a/src/04_categorical_algebra/03_pointwise/05_homsearch/VMSearch.jl b/src/categorical_algebra/pointwise/homsearch/VMSearch.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/05_homsearch/VMSearch.jl rename to src/categorical_algebra/pointwise/homsearch/VMSearch.jl diff --git a/src/04_categorical_algebra/03_pointwise/05_homsearch/module.jl b/src/categorical_algebra/pointwise/homsearch/module.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/05_homsearch/module.jl rename to src/categorical_algebra/pointwise/homsearch/module.jl diff --git a/src/04_categorical_algebra/03_pointwise/04_limits_colimits/Colimits.jl b/src/categorical_algebra/pointwise/limits_colimits/Colimits.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/04_limits_colimits/Colimits.jl rename to src/categorical_algebra/pointwise/limits_colimits/Colimits.jl diff --git a/src/04_categorical_algebra/03_pointwise/04_limits_colimits/Limits.jl b/src/categorical_algebra/pointwise/limits_colimits/Limits.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/04_limits_colimits/Limits.jl rename to src/categorical_algebra/pointwise/limits_colimits/Limits.jl diff --git a/src/04_categorical_algebra/03_pointwise/04_limits_colimits/LimitsColimits.jl b/src/categorical_algebra/pointwise/limits_colimits/LimitsColimits.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/04_limits_colimits/LimitsColimits.jl rename to src/categorical_algebra/pointwise/limits_colimits/LimitsColimits.jl diff --git a/src/04_categorical_algebra/03_pointwise/04_limits_colimits/module.jl b/src/categorical_algebra/pointwise/limits_colimits/module.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/04_limits_colimits/module.jl rename to src/categorical_algebra/pointwise/limits_colimits/module.jl diff --git a/src/categorical_algebra/pointwise/module.jl b/src/categorical_algebra/pointwise/module.jl new file mode 100644 index 000000000..deb40b964 --- /dev/null +++ b/src/categorical_algebra/pointwise/module.jl @@ -0,0 +1,34 @@ +module Pointwise +using Reexport + +include("acsettransformations/ACSetTransformations.jl") +@reexport using .ACSetTransformations + +include("csets/module.jl") +@reexport using .CSets + +include("pointwisecats/module.jl") +@reexport using .PointwiseCats + +include("limits_colimits/module.jl") +@reexport using .LimitsColimits + +include("homsearch/module.jl") +@reexport using .HomSearch + +include("catelements/CatElements.jl") +@reexport using .CatElements + +include("subcsets/SubCSets.jl") +@reexport using .SubCSets + +include("chase/Chase.jl") +@reexport using .Chase + +include("datamigrations/module.jl") +@reexport using .FunctorialDataMigrations + +include("structured_cospans/StructuredCospans.jl") +@reexport using .StructuredCospans + +end # module diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/ACSetCats.jl b/src/categorical_algebra/pointwise/pointwisecats/ACSetCats.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/ACSetCats.jl rename to src/categorical_algebra/pointwise/pointwisecats/ACSetCats.jl diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/ACSetLooseCats.jl b/src/categorical_algebra/pointwise/pointwisecats/ACSetLooseCats.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/ACSetLooseCats.jl rename to src/categorical_algebra/pointwise/pointwisecats/ACSetLooseCats.jl diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/CParCats.jl b/src/categorical_algebra/pointwise/pointwisecats/CParCats.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/CParCats.jl rename to src/categorical_algebra/pointwise/pointwisecats/CParCats.jl diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/CSetCats.jl b/src/categorical_algebra/pointwise/pointwisecats/CSetCats.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/CSetCats.jl rename to src/categorical_algebra/pointwise/pointwisecats/CSetCats.jl diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/CatsOfACSet.jl b/src/categorical_algebra/pointwise/pointwisecats/CatsOfACSet.jl similarity index 94% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/CatsOfACSet.jl rename to src/categorical_algebra/pointwise/pointwisecats/CatsOfACSet.jl index 35b6a3692..6b9eed594 100644 --- a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/CatsOfACSet.jl +++ b/src/categorical_algebra/pointwise/pointwisecats/CatsOfACSet.jl @@ -30,6 +30,7 @@ using ...CSets function compose(f::ACSetTransformation, g::ACSetTransformation) S = acset_schema(model) + f, g = coerce(f; cat=model), coerce(g; cat=model) # we shouldn't have to do this 𝒞, 𝒟 = Category(entity_cat(model)), t->Category(attr_cat(model,t)) ecomps = Dict(o => compose(𝒞, f[o], g[o]) for o in ob(S)) acomps = Dict(o => compose(𝒟(o), f[o], g[o]) for o in attrtypes(S)) diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/InferCat.jl b/src/categorical_algebra/pointwise/pointwisecats/InferCat.jl similarity index 97% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/InferCat.jl rename to src/categorical_algebra/pointwise/pointwisecats/InferCat.jl index 80e268e5a..5557b8472 100644 --- a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/InferCat.jl +++ b/src/categorical_algebra/pointwise/pointwisecats/InferCat.jl @@ -33,12 +33,12 @@ function infer_acset_cat(X::ACSet)::ACSetCategory return ACSetCategory(cat(X)) end - -function hasvar(X::ACSet,x) +function hasvar(X::ACSet, x) s = acset_schema(X) (x∈ attrs(acset_schema(X),just_names=true) && hasvar(X,codom(s,x))) || x∈attrtypes(acset_schema(X)) && nparts(X,x)>0 end + hasvar(X::ACSet) = any(o->hasvar(X,o), attrtypes(acset_schema(X))) function ACSetTransformation(comps, dom::ACSet, codom::ACSet; diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/VarACSetCats.jl b/src/categorical_algebra/pointwise/pointwisecats/VarACSetCats.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/VarACSetCats.jl rename to src/categorical_algebra/pointwise/pointwisecats/VarACSetCats.jl diff --git a/src/04_categorical_algebra/03_pointwise/03_pointwisecats/module.jl b/src/categorical_algebra/pointwise/pointwisecats/module.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/03_pointwisecats/module.jl rename to src/categorical_algebra/pointwise/pointwisecats/module.jl diff --git a/src/04_categorical_algebra/03_pointwise/10_structured_cospans/StructuredCospans.jl b/src/categorical_algebra/pointwise/structured_cospans/StructuredCospans.jl similarity index 100% rename from src/04_categorical_algebra/03_pointwise/10_structured_cospans/StructuredCospans.jl rename to src/categorical_algebra/pointwise/structured_cospans/StructuredCospans.jl diff --git a/src/04_categorical_algebra/03_pointwise/07_subcsets/SubCSets.jl b/src/categorical_algebra/pointwise/subcsets/SubCSets.jl similarity index 88% rename from src/04_categorical_algebra/03_pointwise/07_subcsets/SubCSets.jl rename to src/categorical_algebra/pointwise/subcsets/SubCSets.jl index 386d52e95..c1dedbeb2 100644 --- a/src/04_categorical_algebra/03_pointwise/07_subcsets/SubCSets.jl +++ b/src/categorical_algebra/pointwise/subcsets/SubCSets.jl @@ -9,7 +9,7 @@ using ACSets, GATlab import .....Theories: ob, hom, top, bottom, meet, join using .....BasicSets, ...Cats, ...SetCats -import .....BasicSets: preimage +import .....BasicSets: preimage, left import ...Cats: components, implies, subtract, negate, non, force using ..Pointwise @@ -18,15 +18,31 @@ using Base.Meta: quot # Sub-C-sets ############ +""" assume a VarFunction is secretly a FinFunction """ +function left(f::FinDomFunction)::FinFunction + get_left(l::Left) = getvalue(l) + get_left(r::Right) = error( + "Tried to coerce VarFunction $f to FinFunction, got value $r") + lft = SetFunction(SetFunctionCallable(get_left, codom(f), + left(getvalue(codom(f))))) + force(compose[SetC()](f, lft)) +end + """ Sub-C-set of a C-set. """ const SubACSet{S} = Subobject{<:StructACSet{S}} -# Componentwise subobjects: coerce VarFunctions to FinFunctions -components(A::SubACSet{S}) where S = - NamedTuple(k => Subobject(k ∈ ob(S) ? vs : FinFunction(vs)) for (k,vs) in - pairs(components(hom(A))) -) +""" +Componentwise subobjects: note we must coerce VarFunctions (which only make +reference to AttrVars) into FinFunctions +""" +function components(A::SubACSet{S}) where S + 𝒞 = infer_acset_cat(ob(A)) + FF = getvalue(𝒞) isa CSetCat ? FinFunction : left + NamedTuple(sort(map(collect(pairs(components(hom(A))))) do (k,vs) + k => Subobject(k ∈ ob(S) ? vs : FF(vs)) + end; by=first)) +end force(A::SubACSet) = Subobject(force(hom(A))) @@ -41,7 +57,8 @@ force(A::SubACSet) = Subobject(force(hom(A))) S = acset_schema(X) cat = isnothing(cat) ? infer_acset_cat(X) : cat X_sets = NamedTuple(c => FinSet(get_ob(cat,X,c)) for c in types(S)) - @assert keys(components) ⊆ keys(X_sets) + keys(components) ⊆ keys(X_sets) || error( + "$(keys(components)) ⊈ $(keys(X_sets))") coerced_components = NamedTuple{keys(X_sets)}( coerce_subob_component(set, get(components, ob, 1:0)) for (ob, set) in pairs(X_sets)) @@ -65,7 +82,8 @@ end coerce_subob_component(X::FinSet, f) = Subobject(X, f) ob(A::SubACSetComponentwise) = A.ob -components(A::SubACSetComponentwise) = A.components +components(A::SubACSetComponentwise) = NamedTuple(sort(collect( + pairs(A.components)); by=first)) function hom(A::SubACSetComponentwise{T}) where T <: ACSet X = ob(A) diff --git a/src/04_categorical_algebra/02_setcats/CatsInterop.jl b/src/categorical_algebra/setcats/CatsInterop.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/CatsInterop.jl rename to src/categorical_algebra/setcats/CatsInterop.jl diff --git a/src/04_categorical_algebra/02_setcats/DiscreteCatLimits.jl b/src/categorical_algebra/setcats/DiscreteCatLimits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/DiscreteCatLimits.jl rename to src/categorical_algebra/setcats/DiscreteCatLimits.jl diff --git a/src/04_categorical_algebra/02_setcats/FinSetCat/Colimits.jl b/src/categorical_algebra/setcats/FinSetCat/Colimits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/FinSetCat/Colimits.jl rename to src/categorical_algebra/setcats/FinSetCat/Colimits.jl diff --git a/src/04_categorical_algebra/02_setcats/FinSetCat/FinSetCat.jl b/src/categorical_algebra/setcats/FinSetCat/FinSetCat.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/FinSetCat/FinSetCat.jl rename to src/categorical_algebra/setcats/FinSetCat/FinSetCat.jl diff --git a/src/04_categorical_algebra/02_setcats/FinSetCat/Limits.jl b/src/categorical_algebra/setcats/FinSetCat/Limits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/FinSetCat/Limits.jl rename to src/categorical_algebra/setcats/FinSetCat/Limits.jl diff --git a/src/04_categorical_algebra/02_setcats/FinSetCat/module.jl b/src/categorical_algebra/setcats/FinSetCat/module.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/FinSetCat/module.jl rename to src/categorical_algebra/setcats/FinSetCat/module.jl diff --git a/src/04_categorical_algebra/02_setcats/GraphCategories.jl b/src/categorical_algebra/setcats/GraphCategories.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/GraphCategories.jl rename to src/categorical_algebra/setcats/GraphCategories.jl diff --git a/src/04_categorical_algebra/02_setcats/SetCat/Colimits.jl b/src/categorical_algebra/setcats/SetCat/Colimits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SetCat/Colimits.jl rename to src/categorical_algebra/setcats/SetCat/Colimits.jl diff --git a/src/04_categorical_algebra/02_setcats/SetCat/Limits.jl b/src/categorical_algebra/setcats/SetCat/Limits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SetCat/Limits.jl rename to src/categorical_algebra/setcats/SetCat/Limits.jl diff --git a/src/04_categorical_algebra/02_setcats/SetCat/SetCat.jl b/src/categorical_algebra/setcats/SetCat/SetCat.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SetCat/SetCat.jl rename to src/categorical_algebra/setcats/SetCat/SetCat.jl diff --git a/src/04_categorical_algebra/02_setcats/SetCat/module.jl b/src/categorical_algebra/setcats/SetCat/module.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SetCat/module.jl rename to src/categorical_algebra/setcats/SetCat/module.jl diff --git a/src/04_categorical_algebra/02_setcats/SkelFinSetCat/Colimits.jl b/src/categorical_algebra/setcats/SkelFinSetCat/Colimits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SkelFinSetCat/Colimits.jl rename to src/categorical_algebra/setcats/SkelFinSetCat/Colimits.jl diff --git a/src/04_categorical_algebra/02_setcats/SkelFinSetCat/Limits.jl b/src/categorical_algebra/setcats/SkelFinSetCat/Limits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SkelFinSetCat/Limits.jl rename to src/categorical_algebra/setcats/SkelFinSetCat/Limits.jl diff --git a/src/04_categorical_algebra/02_setcats/SkelFinSetCat/SkelFinSetCat.jl b/src/categorical_algebra/setcats/SkelFinSetCat/SkelFinSetCat.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SkelFinSetCat/SkelFinSetCat.jl rename to src/categorical_algebra/setcats/SkelFinSetCat/SkelFinSetCat.jl diff --git a/src/04_categorical_algebra/02_setcats/SkelFinSetCat/module.jl b/src/categorical_algebra/setcats/SkelFinSetCat/module.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/SkelFinSetCat/module.jl rename to src/categorical_algebra/setcats/SkelFinSetCat/module.jl diff --git a/src/04_categorical_algebra/02_setcats/Subsets.jl b/src/categorical_algebra/setcats/Subsets.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/Subsets.jl rename to src/categorical_algebra/setcats/Subsets.jl diff --git a/src/04_categorical_algebra/02_setcats/VarFunctions/SkelVarFnCat.jl b/src/categorical_algebra/setcats/VarFunctions/SkelVarFnCat.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/VarFunctions/SkelVarFnCat.jl rename to src/categorical_algebra/setcats/VarFunctions/SkelVarFnCat.jl diff --git a/src/04_categorical_algebra/02_setcats/VarFunctions/VarFnLimits.jl b/src/categorical_algebra/setcats/VarFunctions/VarFnLimits.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/VarFunctions/VarFnLimits.jl rename to src/categorical_algebra/setcats/VarFunctions/VarFnLimits.jl diff --git a/src/04_categorical_algebra/02_setcats/VarFunctions/module.jl b/src/categorical_algebra/setcats/VarFunctions/module.jl similarity index 100% rename from src/04_categorical_algebra/02_setcats/VarFunctions/module.jl rename to src/categorical_algebra/setcats/VarFunctions/module.jl diff --git a/src/04_categorical_algebra/02_setcats/module.jl b/src/categorical_algebra/setcats/module.jl similarity index 77% rename from src/04_categorical_algebra/02_setcats/module.jl rename to src/categorical_algebra/setcats/module.jl index 19ef6991c..c625966c5 100644 --- a/src/04_categorical_algebra/02_setcats/module.jl +++ b/src/categorical_algebra/setcats/module.jl @@ -8,11 +8,6 @@ include("SkelFinSetCat/module.jl") include("FinSetCat/module.jl") @reexport using .FinSetCat -# This category doesn't make sense: no id morphisms on the non-finite sets. -# include("FinDomSetCat/module.jl") -# @reexport using .FinDomSetCat - - include("SetCat/module.jl") @reexport using .SetCat @@ -22,11 +17,11 @@ include("CatsInterop.jl") include("Subsets.jl") @reexport using .Subsets +include("VarFunctions/module.jl") +@reexport using .VarFunctions + include("GraphCategories.jl") # (not reexported) include("DiscreteCatLimits.jl") # nothing to reexport -include("VarFunctions/module.jl") -@reexport using .VarFunctions - end # module diff --git a/src/02_graphs/BasicGraphs.jl b/src/graphs/BasicGraphs.jl similarity index 100% rename from src/02_graphs/BasicGraphs.jl rename to src/graphs/BasicGraphs.jl diff --git a/src/02_graphs/BipartiteGraphs.jl b/src/graphs/BipartiteGraphs.jl similarity index 100% rename from src/02_graphs/BipartiteGraphs.jl rename to src/graphs/BipartiteGraphs.jl diff --git a/src/02_graphs/GraphAlgorithms.jl b/src/graphs/GraphAlgorithms.jl similarity index 100% rename from src/02_graphs/GraphAlgorithms.jl rename to src/graphs/GraphAlgorithms.jl diff --git a/src/02_graphs/GraphGenerators.jl b/src/graphs/GraphGenerators.jl similarity index 100% rename from src/02_graphs/GraphGenerators.jl rename to src/graphs/GraphGenerators.jl diff --git a/src/02_graphs/GraphSearching.jl b/src/graphs/GraphSearching.jl similarity index 100% rename from src/02_graphs/GraphSearching.jl rename to src/graphs/GraphSearching.jl diff --git a/src/02_graphs/Graphs.jl b/src/graphs/Graphs.jl similarity index 100% rename from src/02_graphs/Graphs.jl rename to src/graphs/Graphs.jl diff --git a/src/02_graphs/NamedGraphs.jl b/src/graphs/NamedGraphs.jl similarity index 100% rename from src/02_graphs/NamedGraphs.jl rename to src/graphs/NamedGraphs.jl diff --git a/src/02_graphs/PropertyGraphs.jl b/src/graphs/PropertyGraphs.jl similarity index 100% rename from src/02_graphs/PropertyGraphs.jl rename to src/graphs/PropertyGraphs.jl diff --git a/src/01_theories/Category.jl b/src/theories/Category.jl similarity index 100% rename from src/01_theories/Category.jl rename to src/theories/Category.jl diff --git a/src/01_theories/HigherCategory.jl b/src/theories/HigherCategory.jl similarity index 100% rename from src/01_theories/HigherCategory.jl rename to src/theories/HigherCategory.jl diff --git a/src/01_theories/IndexedCategory.jl b/src/theories/IndexedCategory.jl similarity index 100% rename from src/01_theories/IndexedCategory.jl rename to src/theories/IndexedCategory.jl diff --git a/src/01_theories/Limits.jl b/src/theories/Limits.jl similarity index 100% rename from src/01_theories/Limits.jl rename to src/theories/Limits.jl diff --git a/src/01_theories/Monoidal.jl b/src/theories/Monoidal.jl similarity index 100% rename from src/01_theories/Monoidal.jl rename to src/theories/Monoidal.jl diff --git a/src/01_theories/MonoidalAdditive.jl b/src/theories/MonoidalAdditive.jl similarity index 100% rename from src/01_theories/MonoidalAdditive.jl rename to src/theories/MonoidalAdditive.jl diff --git a/src/01_theories/MonoidalMultiple.jl b/src/theories/MonoidalMultiple.jl similarity index 100% rename from src/01_theories/MonoidalMultiple.jl rename to src/theories/MonoidalMultiple.jl diff --git a/src/01_theories/Preorders.jl b/src/theories/Preorders.jl similarity index 100% rename from src/01_theories/Preorders.jl rename to src/theories/Preorders.jl diff --git a/src/01_theories/Relations.jl b/src/theories/Relations.jl similarity index 100% rename from src/01_theories/Relations.jl rename to src/theories/Relations.jl diff --git a/src/01_theories/Schema.jl b/src/theories/Schema.jl similarity index 97% rename from src/01_theories/Schema.jl rename to src/theories/Schema.jl index 7487c8e6b..d2073c9fc 100644 --- a/src/01_theories/Schema.jl +++ b/src/theories/Schema.jl @@ -4,6 +4,7 @@ export ThSchema, FreeSchema, AttrType, Attr, SchemaExpr, AttrTypeExpr, AttrExpr, ######## # Why is ThSchema in Catlab rather than in GATlab? +# TODO make this an optional dependency of ACSets """ The GAT that parameterizes Attributed C-sets A schema is comprised of a category C, a discrete category D, and a profunctor diff --git a/src/01_theories/module.jl b/src/theories/module.jl similarity index 100% rename from src/01_theories/module.jl rename to src/theories/module.jl diff --git a/test/Project.toml b/test/Project.toml index 79180e3ea..849bf4961 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,7 +1,6 @@ [deps] ACSets = "227ef7b5-1206-438b-ac65-934d6da304b8" AlgebraicInterfaces = "23cfdc9f-0504-424a-be1f-4892b28e2f0c" -Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Catlab = "134e5e36-593f-5add-ad60-77f754baafbe" Compose = "a81c6b42-2e10-5240-aca2-a61377ecd94b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/test/aqua.jl b/test/aqua.jl deleted file mode 100644 index f01188e8f..000000000 --- a/test/aqua.jl +++ /dev/null @@ -1,3 +0,0 @@ -using Aqua, Catlab - -Aqua.test_all(Catlab, undefined_exports=false, project_extras=false, ambiguities=false) diff --git a/test/categorical_algebra/Pointwise/LabeledCSets/Limits.jl b/test/categorical_algebra/Pointwise/LabeledCSets/Limits.jl index 10378f3ff..0b572ed9b 100644 --- a/test/categorical_algebra/Pointwise/LabeledCSets/Limits.jl +++ b/test/categorical_algebra/Pointwise/LabeledCSets/Limits.jl @@ -1,5 +1,41 @@ module TestLabeledCSetLimits +using Catlab, Test + +const WG = WeightedGraph{Symbol} + +A = @acset WG begin + V=1;E=2;Weight=1;src=1;tgt=1;weight=[AttrVar(1),:X] +end +B = @acset WG begin V=1;E=2;Weight=1;src=1;tgt=1;weight=[:X, :Y] end + +𝒞 = infer_acset_cat(A) +CM = TypedCatWithCoproducts(𝒞) +C = @withmodel CM (⊕) begin + B ⊕ @acset WG begin V=1 end +end + + +AC = homomorphism(A,C; initial=(E=[1,1],)) +BC = CSetTransformation(B,C; V=[1],E=[1,2], Weight=[:X]) +@test all(is_natural,[AC,BC]) +p1, p2 = product(A,A; cset=true); +X = @acset WG begin V=1;E=2;Weight=1;src=1;tgt=1;weight=[:X, :X] end +@test nparts(apex(product(X,X;cset=true)),:Weight) == 1 + +# Pullback in Graph from (Reyes et al 2004, p. 53), again +g0, g1, g2 = WG.([2,3,2]) +add_edges!(g0, [1,1,2], [1,2,2]; weight=[:X,:Y,:Z]) +add_edges!(g1, [1,2,3], [2,3,3]; weight=[:Y,:Z,AttrVar(add_part!(g1,:Weight))]) +add_edges!(g2, [1,2,2], [1,2,2]; weight=[AttrVar(add_part!(g2,:Weight)), :Z,:Z]) +ϕ = homomorphism(g1, g0) |> CSetTransformation +ψ = homomorphism(g2, g0; initial=(V=[1,2],)) |> CSetTransformation +@test is_natural(ϕ) && is_natural(ψ) +lim = pullback(ϕ, ψ) +@test nv(ob(lim)) == 3 +@test sort!(collect(zip(src(ob(lim)), tgt(ob(lim))))) == + [(2,3), (2,3), (3,3), (3,3)] +@test is_natural(proj1(lim)) && is_natural(proj2(lim)) # Example: "Reflexive graphs" where reflexive edges have weight -1 A = @acset WeightedGraph{Float64} begin V=2; E=3; src=[1, 2, 1]; tgt=[1, 2, 2]; weight=[-1, -1, 5] diff --git a/test/categorical_algebra/Pointwise/VarACSetCats/MCO.jl b/test/categorical_algebra/Pointwise/VarACSetCats/MCO.jl index 471b297a9..e90e17916 100644 --- a/test/categorical_algebra/Pointwise/VarACSetCats/MCO.jl +++ b/test/categorical_algebra/Pointwise/VarACSetCats/MCO.jl @@ -6,9 +6,10 @@ using Catlab, Test #----------------- subG, subobjs = subobject_graph(path_graph(Graph, 3)) - G′ = path_graph(WeightedGraph{Bool}, 3) G′[:weight] = [false, AttrVar(add_part!(G′, :Weight))] + +𝒞 = infer_acset_cat(G′) subG′, subobjs′ = subobject_graph(G′) @test is_isomorphic(subG, subG′) @test nparts(dom(hom(first(subobjs′))), :Weight) == 1 @@ -34,7 +35,7 @@ end @acset_type VELabeledGraph(SchVELabeledGraph) <: AbstractGraph const LGraph = VELabeledGraph{Bool,Bool} -G = @acset LGraph begin +G = @acset LGraph begin V=3; E=2; src=[1,2]; tgt=[2,3]; vlabel=Bool[0,1,1]; elabel=Bool[0,1] end H = @acset LGraph begin @@ -44,10 +45,10 @@ end 𝒱 = ACSetCategory(VarACSetCat(LGraph())) os = partial_overlaps(G, H; cat=𝒱); # abstract=true @test count(apx->nparts(apx,:E)==2, apex.(os)) == 1 -os = partial_overlaps(G, H; abstract=[:VL]); +os = collect(partial_overlaps(G, H; abstract=[:VL], cat=𝒱)); @test count(apx->nparts(apx,:E)==2, apex.(os)) == 0 @test count(apx->nparts(apx,:E)==1, apex.(os)) == 4 -os = partial_overlaps(G, H; abstract=false); +os = partial_overlaps(G, H; abstract=false, cat=𝒱); @test count(apx->nparts(apx,:E)==2, apex.(os)) == 0 @test count(apx->nparts(apx,:E)==1, apex.(os)) == 1 @@ -71,7 +72,7 @@ apex2 = @acset WG begin V=3; E=2; Weight=2; src=[1,3]; tgt=[2,3]; weight=AttrVar.(1:2) end -results = collect(maximum_common_subobject(g1, g2)) +results = collect(maximum_common_subobject(g1, g2; cat=𝒞)) @test length(results) == 2 is_iso1 = map(result -> is_isomorphic(first(result), apex1), results) @test sum(is_iso1) == 1 @@ -90,4 +91,4 @@ results = first(is_iso1) ? results : reverse(results) exp = @acset WG begin V=3; E=1; src=1; tgt=2; weight=[false] end @test first(first(maximum_common_subobject(g1, g2; abstract=false))) == exp -end # module \ No newline at end of file +end # module diff --git a/test/categorical_algebra/Pointwise/VarACSetCats/MonoidalProducts.jl b/test/categorical_algebra/Pointwise/VarACSetCats/MonoidalProducts.jl deleted file mode 100644 index 6934a793d..000000000 --- a/test/categorical_algebra/Pointwise/VarACSetCats/MonoidalProducts.jl +++ /dev/null @@ -1,26 +0,0 @@ - - - -A = @acset WG{Symbol} begin V=1;E=2;Weight=1;src=1;tgt=1;weight=[AttrVar(1),:X] end -B = @acset WG{Symbol} begin V=1;E=2;Weight=1;src=1;tgt=1;weight=[:X, :Y] end -C = B ⊕ @acset WG{Symbol} begin V=1 end -AC = homomorphism(A,C; initial=(E=[1,1],)) -BC = CSetTransformation(B,C; V=[1],E=[1,2], Weight=[:X]) -@test all(is_natural,[AC,BC]) -p1, p2 = product(A,A; cset=true); -X = @acset WG{Symbol} begin V=1;E=2;Weight=1;src=1;tgt=1;weight=[:X, :X] end -@test nparts(apex(product(X,X;cset=true)),:Weight) == 1 - -# Pullback in Graph from (Reyes et al 2004, p. 53), again -g0, g1, g2 = WG{Symbol}.([2,3,2]) -add_edges!(g0, [1,1,2], [1,2,2]; weight=[:X,:Y,:Z]) -add_edges!(g1, [1,2,3], [2,3,3]; weight=[:Y,:Z,AttrVar(add_part!(g1,:Weight))]) -add_edges!(g2, [1,2,2], [1,2,2]; weight=[AttrVar(add_part!(g2,:Weight)), :Z,:Z]) -ϕ = homomorphism(g1, g0) |> CSetTransformation -ψ = homomorphism(g2, g0; initial=(V=[1,2],)) |> CSetTransformation -@test is_natural(ϕ) && is_natural(ψ) -lim = pullback(ϕ, ψ) -@test nv(ob(lim)) == 3 -@test sort!(collect(zip(src(ob(lim)), tgt(ob(lim))))) == - [(2,3), (2,3), (3,3), (3,3)] -@test is_natural(proj1(lim)) && is_natural(proj2(lim)) \ No newline at end of file diff --git a/test/categorical_algebra/Pointwise/VarACSetCats/Subobjects.jl b/test/categorical_algebra/Pointwise/VarACSetCats/Subobjects.jl index 3539124a1..fd1b16a0b 100644 --- a/test/categorical_algebra/Pointwise/VarACSetCats/Subobjects.jl +++ b/test/categorical_algebra/Pointwise/VarACSetCats/Subobjects.jl @@ -2,15 +2,32 @@ module TestVarACSetSubobjects using Catlab, Test +# SetAttr +######### + @present SchSetAttr(FreeSchema) begin X::Ob; D::AttrType; f::Attr(X,D) end @acset_type SetAttr(SchSetAttr) X = @acset SetAttr{Bool} begin X=2;D=1;f=[true, AttrVar(1)] end + +const 𝒞 = infer_acset_cat(X) + A = Subobject(X, X=[1]) B = Subobject(X, X=[2], D=[1]) -@test A ∧ B |> force == ⊥(X) |> force -@test A ∨ B |> force == ⊤(X) |> force + +@withmodel 𝒞 (∧, ∨, ⊤, ⊥, bottom) begin + @test A ∧ B |> force == ⊥(X) |> force + @test A ∨ B |> force == ⊤(X) |> force +end + + +# LabeledGraph +############### +@present SchVELabeledGraph <: SchGraph begin + Label::AttrType; vlabel::Attr(V,Label); elabel::Attr(E,Label) +end +@acset_type VELabeledGraph(SchVELabeledGraph,index=[:src,:tgt]) <: AbstractGraph const VES = VELabeledGraph{Symbol} @@ -26,33 +43,58 @@ X = @acset VES begin V=6; E=5; Label=5 vlabel=[:a,:b,:c,:d,:e,:f]; elabel=AttrVar.(1:5) end +const 𝒟 = infer_acset_cat(X) + + A′ = Subobject(X, V=1:4, E=1:3, Label=1:3) # component-wise representation B′ = Subobject(X, V=3:6, E=3:5, Label=3:5) A′′, B′′ = Subobject.(hom.([A′,B′])) # hom representation for (A,B) in [A′=>B′, A′′ =>B′′] - @test A ∧ B |> force == Subobject(X, V=3:4, E=3:3, Label=3:3) |> force - expected = @acset VES begin V=2; E=1; Label=1; - src=1; tgt=2; vlabel=[:c,:d]; elabel=[AttrVar(1)] - end - @test is_isomorphic(dom(hom(A ∧ B )), expected) - @test A ∨ B |> force == Subobject(X, V=1:6, E=1:5, Label=1:5) |> force - @test ⊤(X) |> force == A ∨ B |> force - @test ⊥(X) |> force == Subobject(X, V=1:0, E=1:0, Label=1:0) |> force - @test force(implies(A, B)) == force(¬(A) ∨ B) - @test ¬(A ∧ B) == ¬(A) ∨ ¬(B) - @test ¬(A ∧ B) != ¬(A) ∨ B - @test (A ∧ implies(A,B)) == B ∧ (A ∧ implies(A,B)) - @test (B ∧ implies(B,A)) == A ∧ (B ∧ implies(B,A)) - @test ¬(A ∨ (¬B)) == ¬(A) ∧ ¬(¬(B)) - @test ¬(A ∨ (¬B)) == ¬(A) ∧ B - @test A ∧ ¬(¬(A)) == ¬(¬(A)) - @test implies((A∧B), A) == A∨B - @test dom(hom(subtract(A,B))) == @acset VES begin V=3; E=2; Label=2 - src=[1,2]; tgt=3; vlabel=[:a,:b,:c]; elabel=AttrVar.(1:2) - end + @withmodel 𝒞 (∧, ∨,⊤, ⊥, ⟹, ¬, \, ~) begin #, subtract, implies, ~) begin + + # Conjunction + #------------ + A_and_B = Subobject(X, V=3:4, E=3:3, Label=3:3) |> force + @test A ∧ B |> force == A_and_B + + A_and_B_dom = @acset VES begin + V=2; E=1; Label=1; + src=1; tgt=2; vlabel=[:c,:d]; elabel=[AttrVar(1)] + end + @test is_isomorphic(dom(hom(A ∧ B )), A_and_B_dom) + + # Disjunction + #------------ + + @test A ∨ B |> force == Subobject(X, V=1:6, E=1:5, Label=1:5) |> force - @test nv(dom(hom(~A))) == 3 + # Top / bottom + #------------- + @test ⊤(X) |> force == A ∨ B |> force + @test ⊥(X) |> force == Subobject(X, V=1:0, E=1:0, Label=1:0) |> force + + # Implication and not + #-------------------- + @test force(A⟹B) == force(¬(A) ∨ B) + @test ¬(A ∧ B) == ¬(A) ∨ ¬(B) + @test ¬(A ∧ B) != ¬(A) ∨ B + @test (A ∧ (A⟹B)) == B ∧ (A ∧ (A⟹B)) + @test (B ∧ (B⟹A)) == A ∧ (B ∧ (B⟹A)) + @test ¬(A ∨ (¬B)) == ¬(A) ∧ ¬(¬(B)) + @test ¬(A ∨ (¬B)) == ¬(A) ∧ B + @test A ∧ ¬(¬(A)) == ¬(¬(A)) + @test ((A∧B)⟹ A) == A∨B + + AmB_dom = @acset VES begin + V=3; E=2; Label=2 + src=[1,2]; tgt=3; vlabel=[:a,:b,:c]; elabel=AttrVar.(1:2) + end + + @test dom(hom(A\B)) == AmB_dom + @test nv(dom(hom(~A))) == 3 + end end + end # module \ No newline at end of file diff --git a/test/categorical_algebra/Pointwise/VarACSetCats/runtests.jl b/test/categorical_algebra/Pointwise/VarACSetCats/runtests.jl index 9c6dff5be..170682f36 100644 --- a/test/categorical_algebra/Pointwise/VarACSetCats/runtests.jl +++ b/test/categorical_algebra/Pointwise/VarACSetCats/runtests.jl @@ -16,7 +16,9 @@ end include("DataMigrations.jl") end -# include("Subobjects.jl") -# include("MCO.jl") -# include("MonoidalProducts.jl") - +@testset "Subobjects" begin + include("Subobjects.jl") +end +@testset "MCO" begin + include("MCO.jl") +end