From f522450580f1c6ca937cb3c455babdd597170faf Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 1 Nov 2023 10:18:52 +0100 Subject: misc --- src/act4e_solutions/posets_bounds.py | 6 ++-- src/act4e_solutions/semicategory_representation.py | 41 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/act4e_solutions/semicategory_representation.py (limited to 'src/act4e_solutions') diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py index e1f9d26..0d50baf 100644 --- a/src/act4e_solutions/posets_bounds.py +++ b/src/act4e_solutions/posets_bounds.py @@ -1,4 +1,4 @@ -from typing import Any, List, Optional, overload, TypeVar +from typing import Any, List, Optional, overload, TypeVar, Collection import act4e_interfaces as I @@ -19,10 +19,10 @@ class SolFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): class SolFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): - def is_chain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + def is_chain(self, fp: I.FinitePoset[X], s: Collection[X]) -> bool: raise NotImplementedError() - def is_antichain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + def is_antichain(self, fp: I.FinitePoset[X], s: Collection[X]) -> bool: raise NotImplementedError() diff --git a/src/act4e_solutions/semicategory_representation.py b/src/act4e_solutions/semicategory_representation.py new file mode 100644 index 0000000..860a451 --- /dev/null +++ b/src/act4e_solutions/semicategory_representation.py @@ -0,0 +1,41 @@ +from typing import Callable, Generic, Optional, TypeVar + +import act4e_interfaces as I +from act4e_interfaces import EnumerableSet + +OD = TypeVar("OD") +MD = TypeVar("MD") + + +class SolSemiCategoryRepresentation(I.SemiCategoryRepresentation): + def load( + self, + h: I.IOHelper, + data: I.FiniteSemiCategory_desc, + ObData: I.Setoid[OD], + MorData: I.Setoid[MD], + compose: Callable[[OD, OD, OD, MD, MD], MD], + ) -> I.SemiCategory[I.RichObject[OD], I.RichMorphism[MD]]: + raise NotImplementedError() + + +class SolSemiCategory(Generic[OD, MD], I.SemiCategory[I.RichObject[OD], I.RichMorphism[MD]]): + """ Skeleton for a class implementing SemiCategory.""" + + def __init__( + self, + add, more, parameters, here + ): + raise NotImplementedError + + def objects(self, uptolevel: Optional[int] = None) -> EnumerableSet[OD]: + raise NotImplementedError + + def hom(self, ob1: OD, ob2: OD, uptolevel: Optional[int] = None) -> EnumerableSet[MD]: + raise NotImplementedError + + def compose(self, ob1: OD, ob2: OD, ob3: OD, m1: MD, m2: MD) -> MD: + raise NotImplementedError + + def identity(self, ob: OD) -> MD: + raise NotImplementedError -- cgit v1.2.1