From 5a5331537c3fa89ac1a553e101997e945ce97bc0 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 12:22:37 +0100 Subject: skeletons --- src/act4e_solutions/intro.py | 6 ++ src/act4e_solutions/maps.py | 26 ++++++++ src/act4e_solutions/maps_representation.py | 17 ++++++ src/act4e_solutions/posets.py | 0 src/act4e_solutions/posets_bounds.py | 76 ++++++++++++++++++++++++ src/act4e_solutions/posets_construction.py | 18 ++++++ src/act4e_solutions/posets_interval.py | 33 ++++++++++ src/act4e_solutions/posets_map.py | 15 +++++ src/act4e_solutions/posets_monoidal.py | 12 ++++ src/act4e_solutions/posets_product.py | 10 ++++ src/act4e_solutions/posets_representation.py | 12 ++++ src/act4e_solutions/posets_sum.py | 18 ++++++ src/act4e_solutions/py.typed | 0 src/act4e_solutions/relations.py | 61 +++++++++++++++++++ src/act4e_solutions/relations_representation.py | 15 +++++ src/act4e_solutions/semigroups.py | 10 ++++ src/act4e_solutions/semigroups_representation.py | 30 ++++++++++ src/act4e_solutions/sets.py | 14 +++++ src/act4e_solutions/sets_power.py | 18 ++++++ src/act4e_solutions/sets_product.py | 18 ++++++ src/act4e_solutions/sets_properties.py | 30 ++++++++++ src/act4e_solutions/sets_representation.py | 13 ++++ src/act4e_solutions/sets_sum.py | 19 ++++++ src/act4e_solutions/sets_union_inter.py | 28 +++++++++ 24 files changed, 499 insertions(+) create mode 100644 src/act4e_solutions/intro.py create mode 100644 src/act4e_solutions/maps.py create mode 100644 src/act4e_solutions/maps_representation.py create mode 100644 src/act4e_solutions/posets.py create mode 100644 src/act4e_solutions/posets_bounds.py create mode 100644 src/act4e_solutions/posets_construction.py create mode 100644 src/act4e_solutions/posets_interval.py create mode 100644 src/act4e_solutions/posets_map.py create mode 100644 src/act4e_solutions/posets_monoidal.py create mode 100644 src/act4e_solutions/posets_product.py create mode 100644 src/act4e_solutions/posets_representation.py create mode 100644 src/act4e_solutions/posets_sum.py create mode 100644 src/act4e_solutions/py.typed create mode 100644 src/act4e_solutions/relations.py create mode 100644 src/act4e_solutions/relations_representation.py create mode 100644 src/act4e_solutions/semigroups.py create mode 100644 src/act4e_solutions/semigroups_representation.py create mode 100644 src/act4e_solutions/sets.py create mode 100644 src/act4e_solutions/sets_power.py create mode 100644 src/act4e_solutions/sets_product.py create mode 100644 src/act4e_solutions/sets_properties.py create mode 100644 src/act4e_solutions/sets_representation.py create mode 100644 src/act4e_solutions/sets_sum.py create mode 100644 src/act4e_solutions/sets_union_inter.py (limited to 'src/act4e_solutions') diff --git a/src/act4e_solutions/intro.py b/src/act4e_solutions/intro.py new file mode 100644 index 0000000..4d8207f --- /dev/null +++ b/src/act4e_solutions/intro.py @@ -0,0 +1,6 @@ +import act4e_interfaces as I + + +class MySimpleIntro(I.SimpleIntro): + def sum(self, a: int, b: int) -> int: + raise NotImplementedError() diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py new file mode 100644 index 0000000..cf4e98f --- /dev/null +++ b/src/act4e_solutions/maps.py @@ -0,0 +1,26 @@ +from typing import overload, TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +C = TypeVar("C") + + +class MyFiniteMapOperations(I.FiniteMapOperations): + @overload + def identity(self, s: I.FiniteSet[A]) -> I.FiniteMap[A, A]: + ... + + @overload + def identity(self, s: I.Setoid[A]) -> I.Mapping[A, A]: + ... + + def identity(self, s: I.Setoid[A]) -> I.Mapping[A, A]: + raise NotImplementedError() + + def compose(self, f: I.FiniteMap[A, B], g: I.FiniteMap[B, C]) -> I.FiniteMap[A, C]: + raise NotImplementedError() + + def as_relation(self, f: I.FiniteMap[A, B]) -> I.FiniteRelation[A, B]: + raise NotImplementedError() diff --git a/src/act4e_solutions/maps_representation.py b/src/act4e_solutions/maps_representation.py new file mode 100644 index 0000000..b77ef06 --- /dev/null +++ b/src/act4e_solutions/maps_representation.py @@ -0,0 +1,17 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + +__all__ = ["MyFiniteMapRepresentation"] + +A = TypeVar("A") +B = TypeVar("B") + + +class MyFiniteMapRepresentation(I.FiniteMapRepresentation): + + def load(self, h: I.IOHelper, s: I.FiniteMap_desc) -> I.FiniteMap[A, B]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMap[Any, Any]) -> I.FiniteMap_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets.py b/src/act4e_solutions/posets.py new file mode 100644 index 0000000..e69de29 diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py new file mode 100644 index 0000000..d582e67 --- /dev/null +++ b/src/act4e_solutions/posets_bounds.py @@ -0,0 +1,76 @@ +from typing import Any, List, Optional, overload, TypeVar + +import act4e_interfaces as I + +E = TypeVar("E") +X = TypeVar("X") + +__all__ = ["MyFinitePosetMeasurement"] + + +class MyFinitePosetMeasurement(I.FinitePosetMeasurement): + def height(self, fp: I.FinitePoset[Any]) -> int: + raise NotImplementedError() + + def width(self, fp: I.FinitePoset[Any]) -> int: + raise NotImplementedError() + + +class MyFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): + @overload + def opposite(self, p: I.FinitePoset[X]) -> I.FinitePoset[X]: + ... + + @overload + def opposite(self, p: I.Poset[X]) -> I.Poset[X]: + ... + + def opposite(self, m: I.Poset[X]) -> I.Poset[X]: + raise NotImplementedError() + + +class MyFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): + def is_chain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + def is_antichain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + +class MyFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): + + def is_lower_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + def is_upper_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + +class MyFinitePosetClosures(I.FinitePosetClosures): + def upper_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: + raise NotImplementedError() + + def lower_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: + raise NotImplementedError() + + +class MyFinitePosetInfSup(I.FinitePosetInfSup): + def lower_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: + raise NotImplementedError() + + def upper_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: + raise NotImplementedError() + + def infimum(self, fp: I.FinitePoset[E], s: List[E]) -> Optional[E]: + raise NotImplementedError() + + def supremum(self, fp: I.FinitePoset[E], s: List[E]) -> Optional[E]: + raise NotImplementedError() + + +class MyFinitePosetMinMax(I.FinitePosetMinMax): + def minimal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: + raise NotImplementedError() + + def maximal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_construction.py b/src/act4e_solutions/posets_construction.py new file mode 100644 index 0000000..f7fb2ae --- /dev/null +++ b/src/act4e_solutions/posets_construction.py @@ -0,0 +1,18 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyPosetConstructionPower(I.PosetConstructionPower): + @overload + def powerposet(self, s: I.FiniteSet[X]) -> I.FinitePosetOfFiniteSubsets[X, Any]: + ... + + @overload + def powerposet(self, s: I.Setoid[X]) -> I.PosetOfFiniteSubsets[X, Any]: + ... + + def powerposet(self, s: I.Setoid[X]) -> I.PosetOfFiniteSubsets[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_interval.py b/src/act4e_solutions/posets_interval.py new file mode 100644 index 0000000..0553811 --- /dev/null +++ b/src/act4e_solutions/posets_interval.py @@ -0,0 +1,33 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +C = TypeVar("C") +E = TypeVar("E") +X = TypeVar("X") + + +class MyFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): + @overload + def twisted(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: + ... + + @overload + def twisted(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + ... + + def twisted(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + raise NotImplementedError() + + +class MyFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): + @overload + def arrow(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: + ... + + @overload + def arrow(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + ... + + def arrow(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_map.py b/src/act4e_solutions/posets_map.py new file mode 100644 index 0000000..d2671bb --- /dev/null +++ b/src/act4e_solutions/posets_map.py @@ -0,0 +1,15 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +X = TypeVar("X") + + +class MyFiniteMonotoneMapProperties(I.FiniteMonotoneMapProperties): + def is_monotone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError() + + def is_antitone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_monoidal.py b/src/act4e_solutions/posets_monoidal.py new file mode 100644 index 0000000..1c18ce6 --- /dev/null +++ b/src/act4e_solutions/posets_monoidal.py @@ -0,0 +1,12 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +X = TypeVar("X") + + +class MyMonoidalPosetOperations(I.MonoidalPosetOperations): + def is_monoidal_poset(self, fp: I.FinitePoset[X], fm: I.FiniteMonoid[X]) -> bool: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_product.py b/src/act4e_solutions/posets_product.py new file mode 100644 index 0000000..035eabe --- /dev/null +++ b/src/act4e_solutions/posets_product.py @@ -0,0 +1,10 @@ +from typing import Any, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyFinitePosetConstructionProduct(I.FinitePosetConstructionProduct): + def product(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetProduct[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_representation.py b/src/act4e_solutions/posets_representation.py new file mode 100644 index 0000000..9bdca1f --- /dev/null +++ b/src/act4e_solutions/posets_representation.py @@ -0,0 +1,12 @@ +from typing import Any + +import act4e_interfaces as I + + +class MyFinitePosetRepresentation(I.FinitePosetRepresentation): + + def load(self, h: I.IOHelper, s: I.FinitePoset_desc) -> I.FinitePoset[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, p: I.FinitePoset[Any]) -> I.FinitePoset_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_sum.py b/src/act4e_solutions/posets_sum.py new file mode 100644 index 0000000..a91b0a0 --- /dev/null +++ b/src/act4e_solutions/posets_sum.py @@ -0,0 +1,18 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyFinitePosetConstructionSum(I.FinitePosetConstructionSum): + @overload + def disjoint_union(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetDisjointUnion[X, Any]: + ... + + @overload + def disjoint_union(self, ps: Sequence[I.Poset[X]]) -> I.PosetDisjointUnion[X, Any]: + ... + + def disjoint_union(self, ps: Sequence[I.Poset[X]]) -> I.PosetDisjointUnion[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/py.typed b/src/act4e_solutions/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/act4e_solutions/relations.py b/src/act4e_solutions/relations.py new file mode 100644 index 0000000..47a7c3e --- /dev/null +++ b/src/act4e_solutions/relations.py @@ -0,0 +1,61 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I +from act4e_interfaces import FiniteRelation + +E1 = TypeVar("E1") +E2 = TypeVar("E2") +E3 = TypeVar("E3") +E = TypeVar("E") + +A = TypeVar("A") +B = TypeVar("B") + + +class MyFiniteRelationProperties(I.FiniteRelationProperties): + def is_surjective(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_defined_everywhere(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_injective(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_single_valued(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + +class MyFiniteRelationOperations(I.FiniteRelationOperations): + def transpose(self, fr: I.FiniteRelation[A, B]) -> I.FiniteRelation[B, A]: + raise NotImplementedError() + + +class MyFiniteEndorelationProperties(I.FiniteEndorelationProperties): + def is_reflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_irreflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_transitive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_symmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_antisymmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_asymmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + +class MyFiniteEndorelationOperations(I.FiniteEndorelationOperations): + def transitive_closure(self, fr: I.FiniteRelation[E, E]) -> I.FiniteRelation[E, E]: + raise NotImplementedError() + + +class MyFiniteRelationCompose(I.FiniteRelationCompose): + def compose(self, fr1: FiniteRelation[E1, E2], fr2: FiniteRelation[E2, E3]) -> I.FiniteRelation[E1, E3]: + raise NotImplementedError() diff --git a/src/act4e_solutions/relations_representation.py b/src/act4e_solutions/relations_representation.py new file mode 100644 index 0000000..e150534 --- /dev/null +++ b/src/act4e_solutions/relations_representation.py @@ -0,0 +1,15 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") + + +class MyFiniteRelationRepresentation(I.FiniteRelationRepresentation): + + def load(self, h: I.IOHelper, data: I.FiniteRelation_desc) -> I.FiniteRelation[A, B]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, f: I.FiniteRelation[A, B]) -> I.FiniteRelation_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups.py b/src/act4e_solutions/semigroups.py new file mode 100644 index 0000000..31ecd58 --- /dev/null +++ b/src/act4e_solutions/semigroups.py @@ -0,0 +1,10 @@ +from typing import List, TypeVar + +import act4e_interfaces as I + +C = TypeVar("C") + + +class MyFiniteSemigroupConstruct(I.FiniteSemigroupConstruct): + def free(self, fs: I.FiniteSet[C]) -> I.FreeSemigroup[C, List[C]]: + raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups_representation.py b/src/act4e_solutions/semigroups_representation.py new file mode 100644 index 0000000..5d90823 --- /dev/null +++ b/src/act4e_solutions/semigroups_representation.py @@ -0,0 +1,30 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): + + def load(self, h: I.IOHelper, s: I.FiniteSemigroup_desc) -> I.FiniteSemigroup[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteSemigroup[Any]) -> I.FiniteSemigroup_desc: + raise NotImplementedError() + + +class MyFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteMonoid_desc) -> I.FiniteMonoid[X]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMonoid[Any]) -> I.FiniteMonoid_desc: + raise NotImplementedError() + + +class MyFiniteGroupRepresentation(I.FiniteGroupRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteGroup_desc) -> I.FiniteGroup[X]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteGroup[Any]) -> I.FiniteGroup_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets.py b/src/act4e_solutions/sets.py new file mode 100644 index 0000000..7cb4252 --- /dev/null +++ b/src/act4e_solutions/sets.py @@ -0,0 +1,14 @@ +from typing import Callable, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyEnumerableSetsOperations(I.EnumerableSetsOperations): + def make_set_sequence(self, f: Callable[[int], X]) -> I.EnumerableSet[X]: + raise NotImplementedError() + + def union_esets(self, a: I.EnumerableSet[X], b: I.EnumerableSet[X]) -> I.EnumerableSet[X]: + """Creates the union of two EnumerableSet.""" + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_power.py b/src/act4e_solutions/sets_power.py new file mode 100644 index 0000000..1f3c103 --- /dev/null +++ b/src/act4e_solutions/sets_power.py @@ -0,0 +1,18 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyMakePowerSet(I.MakePowerSet): + @overload + def powerset(self, s: I.FiniteSet[X]) -> I.FiniteSetOfFiniteSubsets[X, Any]: + ... + + @overload + def powerset(self, s: I.Setoid[X]) -> I.SetOfFiniteSubsets[X, Any]: + ... + + def powerset(self, s: I.Setoid[X]) -> I.SetOfFiniteSubsets[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py new file mode 100644 index 0000000..19661ca --- /dev/null +++ b/src/act4e_solutions/sets_product.py @@ -0,0 +1,18 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyMakeSetProduct(I.MakeSetProduct): + @overload + def product(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetProduct[X, Any]: + ... + + @overload + def product(self, components: Sequence[I.Setoid[X]]) -> I.SetProduct[X, Any]: + ... + + def product(self, components: Sequence[I.Setoid[X]]) -> I.SetProduct[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py new file mode 100644 index 0000000..ef9f291 --- /dev/null +++ b/src/act4e_solutions/sets_properties.py @@ -0,0 +1,30 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +__all__ = ["MyMakeSetUnion", "MyMakeSetIntersection", "MyFiniteSetProperties"] + +X = TypeVar("X") + + +class MyFiniteSetProperties(I.FiniteSetProperties): + def is_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: + raise NotImplementedError() + + +class MyMakeSetUnion(I.MakeSetUnion): + @overload + def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: + ... + + @overload + def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: + ... + + def union(self, components: Sequence[I.Setoid[X]]) -> I.SetUnion[X, Any]: + raise NotImplementedError() + + +class MyMakeSetIntersection(I.MakeSetIntersection): + def intersection(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSet[X]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_representation.py b/src/act4e_solutions/sets_representation.py new file mode 100644 index 0000000..d8c56d7 --- /dev/null +++ b/src/act4e_solutions/sets_representation.py @@ -0,0 +1,13 @@ +from typing import Any + +import act4e_interfaces as I + +__all__ = ["MyFiniteSetRepresentation"] + + +class MyFiniteSetRepresentation(I.FiniteSetRepresentation): + def load(self, h: I.IOHelper, data: I.FiniteSet_desc) -> I.FiniteSet[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, f: I.FiniteSet[Any]) -> I.FiniteSet_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_sum.py b/src/act4e_solutions/sets_sum.py new file mode 100644 index 0000000..54e0e95 --- /dev/null +++ b/src/act4e_solutions/sets_sum.py @@ -0,0 +1,19 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + + +X = TypeVar("X") + + +class MyMakeSetDisjointUnion(I.MakeSetDisjointUnion): + @overload + def disjoint_union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetDisjointUnion[X, Any]: + ... + + @overload + def disjoint_union(self, components: Sequence[I.Setoid[X]]) -> I.SetDisjointUnion[X, Any]: + ... + + def disjoint_union(self, components: Sequence[I.Setoid[X]]) -> I.SetDisjointUnion[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_union_inter.py b/src/act4e_solutions/sets_union_inter.py new file mode 100644 index 0000000..72f9e64 --- /dev/null +++ b/src/act4e_solutions/sets_union_inter.py @@ -0,0 +1,28 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyMakeSetUnion(I.MakeSetUnion): + @overload + def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: + ... + + @overload + def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: + ... + + def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: + raise NotImplementedError() + + +class MySetoidOperations(I.SetoidOperations): + @classmethod + def union_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: + raise NotImplementedError() + + @classmethod + def intersection_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: + raise NotImplementedError() -- cgit v1.2.1 From cc712ed5fdf07e24af3ac0a133f483c506af55a9 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 12:24:14 +0100 Subject: skeletons --- src/act4e_solutions/intro.py | 2 +- src/act4e_solutions/maps.py | 2 +- src/act4e_solutions/maps_representation.py | 5 ++--- src/act4e_solutions/posets_bounds.py | 19 ++++++++----------- src/act4e_solutions/posets_construction.py | 2 +- src/act4e_solutions/posets_interval.py | 4 ++-- src/act4e_solutions/posets_map.py | 2 +- src/act4e_solutions/posets_monoidal.py | 2 +- src/act4e_solutions/posets_product.py | 2 +- src/act4e_solutions/posets_representation.py | 2 +- src/act4e_solutions/posets_sum.py | 2 +- src/act4e_solutions/relations.py | 10 +++++----- src/act4e_solutions/relations_representation.py | 2 +- src/act4e_solutions/semigroups.py | 2 +- src/act4e_solutions/semigroups_representation.py | 6 +++--- src/act4e_solutions/sets.py | 2 +- src/act4e_solutions/sets_power.py | 2 +- src/act4e_solutions/sets_product.py | 2 +- src/act4e_solutions/sets_properties.py | 10 ++++------ src/act4e_solutions/sets_representation.py | 6 ++---- src/act4e_solutions/sets_sum.py | 2 +- src/act4e_solutions/sets_union_inter.py | 4 ++-- 22 files changed, 42 insertions(+), 50 deletions(-) (limited to 'src/act4e_solutions') diff --git a/src/act4e_solutions/intro.py b/src/act4e_solutions/intro.py index 4d8207f..2a4856d 100644 --- a/src/act4e_solutions/intro.py +++ b/src/act4e_solutions/intro.py @@ -1,6 +1,6 @@ import act4e_interfaces as I -class MySimpleIntro(I.SimpleIntro): +class SolSimpleIntro(I.SimpleIntro): def sum(self, a: int, b: int) -> int: raise NotImplementedError() diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py index cf4e98f..4984eef 100644 --- a/src/act4e_solutions/maps.py +++ b/src/act4e_solutions/maps.py @@ -7,7 +7,7 @@ B = TypeVar("B") C = TypeVar("C") -class MyFiniteMapOperations(I.FiniteMapOperations): +class SolFiniteMapOperations(I.FiniteMapOperations): @overload def identity(self, s: I.FiniteSet[A]) -> I.FiniteMap[A, A]: ... diff --git a/src/act4e_solutions/maps_representation.py b/src/act4e_solutions/maps_representation.py index b77ef06..45c816e 100644 --- a/src/act4e_solutions/maps_representation.py +++ b/src/act4e_solutions/maps_representation.py @@ -1,14 +1,13 @@ from typing import Any, TypeVar import act4e_interfaces as I - -__all__ = ["MyFiniteMapRepresentation"] + A = TypeVar("A") B = TypeVar("B") -class MyFiniteMapRepresentation(I.FiniteMapRepresentation): +class SolFiniteMapRepresentation(I.FiniteMapRepresentation): def load(self, h: I.IOHelper, s: I.FiniteMap_desc) -> I.FiniteMap[A, B]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py index d582e67..73adc98 100644 --- a/src/act4e_solutions/posets_bounds.py +++ b/src/act4e_solutions/posets_bounds.py @@ -3,12 +3,9 @@ from typing import Any, List, Optional, overload, TypeVar import act4e_interfaces as I E = TypeVar("E") -X = TypeVar("X") +X = TypeVar("X") -__all__ = ["MyFinitePosetMeasurement"] - - -class MyFinitePosetMeasurement(I.FinitePosetMeasurement): +class SolFinitePosetMeasurement(I.FinitePosetMeasurement): def height(self, fp: I.FinitePoset[Any]) -> int: raise NotImplementedError() @@ -16,7 +13,7 @@ class MyFinitePosetMeasurement(I.FinitePosetMeasurement): raise NotImplementedError() -class MyFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): +class SolFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): @overload def opposite(self, p: I.FinitePoset[X]) -> I.FinitePoset[X]: ... @@ -29,7 +26,7 @@ class MyFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): raise NotImplementedError() -class MyFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): +class SolFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): def is_chain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: raise NotImplementedError() @@ -37,7 +34,7 @@ class MyFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): raise NotImplementedError() -class MyFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): +class SolFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): def is_lower_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: raise NotImplementedError() @@ -46,7 +43,7 @@ class MyFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): raise NotImplementedError() -class MyFinitePosetClosures(I.FinitePosetClosures): +class SolFinitePosetClosures(I.FinitePosetClosures): def upper_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: raise NotImplementedError() @@ -54,7 +51,7 @@ class MyFinitePosetClosures(I.FinitePosetClosures): raise NotImplementedError() -class MyFinitePosetInfSup(I.FinitePosetInfSup): +class SolFinitePosetInfSup(I.FinitePosetInfSup): def lower_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: raise NotImplementedError() @@ -68,7 +65,7 @@ class MyFinitePosetInfSup(I.FinitePosetInfSup): raise NotImplementedError() -class MyFinitePosetMinMax(I.FinitePosetMinMax): +class SolFinitePosetMinMax(I.FinitePosetMinMax): def minimal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_construction.py b/src/act4e_solutions/posets_construction.py index f7fb2ae..065f931 100644 --- a/src/act4e_solutions/posets_construction.py +++ b/src/act4e_solutions/posets_construction.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyPosetConstructionPower(I.PosetConstructionPower): +class SolPosetConstructionPower(I.PosetConstructionPower): @overload def powerposet(self, s: I.FiniteSet[X]) -> I.FinitePosetOfFiniteSubsets[X, Any]: ... diff --git a/src/act4e_solutions/posets_interval.py b/src/act4e_solutions/posets_interval.py index 0553811..bd164eb 100644 --- a/src/act4e_solutions/posets_interval.py +++ b/src/act4e_solutions/posets_interval.py @@ -7,7 +7,7 @@ E = TypeVar("E") X = TypeVar("X") -class MyFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): +class SolFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): @overload def twisted(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: ... @@ -20,7 +20,7 @@ class MyFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): raise NotImplementedError() -class MyFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): +class SolFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): @overload def arrow(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: ... diff --git a/src/act4e_solutions/posets_map.py b/src/act4e_solutions/posets_map.py index d2671bb..a91d4d8 100644 --- a/src/act4e_solutions/posets_map.py +++ b/src/act4e_solutions/posets_map.py @@ -7,7 +7,7 @@ B = TypeVar("B") X = TypeVar("X") -class MyFiniteMonotoneMapProperties(I.FiniteMonotoneMapProperties): +class SolFiniteMonotoneMapProperties(I.FiniteMonotoneMapProperties): def is_monotone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_monoidal.py b/src/act4e_solutions/posets_monoidal.py index 1c18ce6..96afedc 100644 --- a/src/act4e_solutions/posets_monoidal.py +++ b/src/act4e_solutions/posets_monoidal.py @@ -7,6 +7,6 @@ B = TypeVar("B") X = TypeVar("X") -class MyMonoidalPosetOperations(I.MonoidalPosetOperations): +class SolMonoidalPosetOperations(I.MonoidalPosetOperations): def is_monoidal_poset(self, fp: I.FinitePoset[X], fm: I.FiniteMonoid[X]) -> bool: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_product.py b/src/act4e_solutions/posets_product.py index 035eabe..bf67efd 100644 --- a/src/act4e_solutions/posets_product.py +++ b/src/act4e_solutions/posets_product.py @@ -5,6 +5,6 @@ import act4e_interfaces as I X = TypeVar("X") -class MyFinitePosetConstructionProduct(I.FinitePosetConstructionProduct): +class SolFinitePosetConstructionProduct(I.FinitePosetConstructionProduct): def product(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetProduct[X, Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_representation.py b/src/act4e_solutions/posets_representation.py index 9bdca1f..d7b2991 100644 --- a/src/act4e_solutions/posets_representation.py +++ b/src/act4e_solutions/posets_representation.py @@ -3,7 +3,7 @@ from typing import Any import act4e_interfaces as I -class MyFinitePosetRepresentation(I.FinitePosetRepresentation): +class SolFinitePosetRepresentation(I.FinitePosetRepresentation): def load(self, h: I.IOHelper, s: I.FinitePoset_desc) -> I.FinitePoset[Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_sum.py b/src/act4e_solutions/posets_sum.py index a91b0a0..3081c7f 100644 --- a/src/act4e_solutions/posets_sum.py +++ b/src/act4e_solutions/posets_sum.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyFinitePosetConstructionSum(I.FinitePosetConstructionSum): +class SolFinitePosetConstructionSum(I.FinitePosetConstructionSum): @overload def disjoint_union(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetDisjointUnion[X, Any]: ... diff --git a/src/act4e_solutions/relations.py b/src/act4e_solutions/relations.py index 47a7c3e..048b500 100644 --- a/src/act4e_solutions/relations.py +++ b/src/act4e_solutions/relations.py @@ -12,7 +12,7 @@ A = TypeVar("A") B = TypeVar("B") -class MyFiniteRelationProperties(I.FiniteRelationProperties): +class SolFiniteRelationProperties(I.FiniteRelationProperties): def is_surjective(self, fr: I.FiniteRelation[Any, Any]) -> bool: raise NotImplementedError() @@ -26,12 +26,12 @@ class MyFiniteRelationProperties(I.FiniteRelationProperties): raise NotImplementedError() -class MyFiniteRelationOperations(I.FiniteRelationOperations): +class SolFiniteRelationOperations(I.FiniteRelationOperations): def transpose(self, fr: I.FiniteRelation[A, B]) -> I.FiniteRelation[B, A]: raise NotImplementedError() -class MyFiniteEndorelationProperties(I.FiniteEndorelationProperties): +class SolFiniteEndorelationProperties(I.FiniteEndorelationProperties): def is_reflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: raise NotImplementedError() @@ -51,11 +51,11 @@ class MyFiniteEndorelationProperties(I.FiniteEndorelationProperties): raise NotImplementedError() -class MyFiniteEndorelationOperations(I.FiniteEndorelationOperations): +class SolFiniteEndorelationOperations(I.FiniteEndorelationOperations): def transitive_closure(self, fr: I.FiniteRelation[E, E]) -> I.FiniteRelation[E, E]: raise NotImplementedError() -class MyFiniteRelationCompose(I.FiniteRelationCompose): +class SolFiniteRelationCompose(I.FiniteRelationCompose): def compose(self, fr1: FiniteRelation[E1, E2], fr2: FiniteRelation[E2, E3]) -> I.FiniteRelation[E1, E3]: raise NotImplementedError() diff --git a/src/act4e_solutions/relations_representation.py b/src/act4e_solutions/relations_representation.py index e150534..8dbde1c 100644 --- a/src/act4e_solutions/relations_representation.py +++ b/src/act4e_solutions/relations_representation.py @@ -6,7 +6,7 @@ A = TypeVar("A") B = TypeVar("B") -class MyFiniteRelationRepresentation(I.FiniteRelationRepresentation): +class SolFiniteRelationRepresentation(I.FiniteRelationRepresentation): def load(self, h: I.IOHelper, data: I.FiniteRelation_desc) -> I.FiniteRelation[A, B]: raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups.py b/src/act4e_solutions/semigroups.py index 31ecd58..1b02766 100644 --- a/src/act4e_solutions/semigroups.py +++ b/src/act4e_solutions/semigroups.py @@ -5,6 +5,6 @@ import act4e_interfaces as I C = TypeVar("C") -class MyFiniteSemigroupConstruct(I.FiniteSemigroupConstruct): +class SolFiniteSemigroupConstruct(I.FiniteSemigroupConstruct): def free(self, fs: I.FiniteSet[C]) -> I.FreeSemigroup[C, List[C]]: raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups_representation.py b/src/act4e_solutions/semigroups_representation.py index 5d90823..23e2ba1 100644 --- a/src/act4e_solutions/semigroups_representation.py +++ b/src/act4e_solutions/semigroups_representation.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): +class SolFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): def load(self, h: I.IOHelper, s: I.FiniteSemigroup_desc) -> I.FiniteSemigroup[Any]: raise NotImplementedError() @@ -14,7 +14,7 @@ class MyFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): raise NotImplementedError() -class MyFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): +class SolFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): def load(self, h: I.IOHelper, s: I.FiniteMonoid_desc) -> I.FiniteMonoid[X]: raise NotImplementedError() @@ -22,7 +22,7 @@ class MyFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): raise NotImplementedError() -class MyFiniteGroupRepresentation(I.FiniteGroupRepresentation): +class SolFiniteGroupRepresentation(I.FiniteGroupRepresentation): def load(self, h: I.IOHelper, s: I.FiniteGroup_desc) -> I.FiniteGroup[X]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets.py b/src/act4e_solutions/sets.py index 7cb4252..1dc635f 100644 --- a/src/act4e_solutions/sets.py +++ b/src/act4e_solutions/sets.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyEnumerableSetsOperations(I.EnumerableSetsOperations): +class SolEnumerableSetsOperations(I.EnumerableSetsOperations): def make_set_sequence(self, f: Callable[[int], X]) -> I.EnumerableSet[X]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_power.py b/src/act4e_solutions/sets_power.py index 1f3c103..2e9c970 100644 --- a/src/act4e_solutions/sets_power.py +++ b/src/act4e_solutions/sets_power.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakePowerSet(I.MakePowerSet): +class SolMakePowerSet(I.MakePowerSet): @overload def powerset(self, s: I.FiniteSet[X]) -> I.FiniteSetOfFiniteSubsets[X, Any]: ... diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py index 19661ca..d3e5558 100644 --- a/src/act4e_solutions/sets_product.py +++ b/src/act4e_solutions/sets_product.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakeSetProduct(I.MakeSetProduct): +class SolMakeSetProduct(I.MakeSetProduct): @overload def product(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetProduct[X, Any]: ... diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py index ef9f291..1a2ab88 100644 --- a/src/act4e_solutions/sets_properties.py +++ b/src/act4e_solutions/sets_properties.py @@ -1,18 +1,16 @@ from typing import Any, overload, Sequence, TypeVar import act4e_interfaces as I - -__all__ = ["MyMakeSetUnion", "MyMakeSetIntersection", "MyFiniteSetProperties"] - + X = TypeVar("X") -class MyFiniteSetProperties(I.FiniteSetProperties): +class SolFiniteSetProperties(I.FiniteSetProperties): def is_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: raise NotImplementedError() -class MyMakeSetUnion(I.MakeSetUnion): +class SolMakeSetUnion(I.MakeSetUnion): @overload def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: ... @@ -25,6 +23,6 @@ class MyMakeSetUnion(I.MakeSetUnion): raise NotImplementedError() -class MyMakeSetIntersection(I.MakeSetIntersection): +class SolMakeSetIntersection(I.MakeSetIntersection): def intersection(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSet[X]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_representation.py b/src/act4e_solutions/sets_representation.py index d8c56d7..10d89c9 100644 --- a/src/act4e_solutions/sets_representation.py +++ b/src/act4e_solutions/sets_representation.py @@ -1,11 +1,9 @@ from typing import Any import act4e_interfaces as I + -__all__ = ["MyFiniteSetRepresentation"] - - -class MyFiniteSetRepresentation(I.FiniteSetRepresentation): +class SolFiniteSetRepresentation(I.FiniteSetRepresentation): def load(self, h: I.IOHelper, data: I.FiniteSet_desc) -> I.FiniteSet[Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_sum.py b/src/act4e_solutions/sets_sum.py index 54e0e95..ee82985 100644 --- a/src/act4e_solutions/sets_sum.py +++ b/src/act4e_solutions/sets_sum.py @@ -6,7 +6,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakeSetDisjointUnion(I.MakeSetDisjointUnion): +class SolMakeSetDisjointUnion(I.MakeSetDisjointUnion): @overload def disjoint_union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetDisjointUnion[X, Any]: ... diff --git a/src/act4e_solutions/sets_union_inter.py b/src/act4e_solutions/sets_union_inter.py index 72f9e64..3a4c419 100644 --- a/src/act4e_solutions/sets_union_inter.py +++ b/src/act4e_solutions/sets_union_inter.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakeSetUnion(I.MakeSetUnion): +class SolMakeSetUnion(I.MakeSetUnion): @overload def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: ... @@ -18,7 +18,7 @@ class MyMakeSetUnion(I.MakeSetUnion): raise NotImplementedError() -class MySetoidOperations(I.SetoidOperations): +class SolSetoidOperations(I.SetoidOperations): @classmethod def union_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: raise NotImplementedError() -- cgit v1.2.1