diff options
author | Nao Pross <np@0hm.ch> | 2023-10-04 18:32:09 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2023-10-04 18:34:28 +0200 |
commit | 7595acf9858008a386e42e2394968a27eb7700ef (patch) | |
tree | 22d07dd417e9ab6c4edb9942178c27da8db1e560 /src | |
parent | Pass TestFiniteSetRepresentation (diff) | |
download | act4e-7595acf9858008a386e42e2394968a27eb7700ef.tar.gz act4e-7595acf9858008a386e42e2394968a27eb7700ef.zip |
Pass TestFiniteSetProperties
Diffstat (limited to '')
-rw-r--r-- | src/act4e_solutions/sets_properties.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py index 5390d23..2044abd 100644 --- a/src/act4e_solutions/sets_properties.py +++ b/src/act4e_solutions/sets_properties.py @@ -7,7 +7,13 @@ X = TypeVar("X") class SolFiniteSetProperties(I.FiniteSetProperties): def is_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: - raise NotImplementedError() + return all([b.contains(e) for e in a.elements()]) + + def equal(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: + return self.is_Subset(a, b) and self.is_subset(b, a) + + def is_strict_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: + return self.is_subset(a, b) and not self.is_subset(b, a) class SolFiniteMakeSetUnion(I.FiniteMakeSetUnion): |