From 7595acf9858008a386e42e2394968a27eb7700ef Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Wed, 4 Oct 2023 18:32:09 +0200 Subject: Pass TestFiniteSetProperties --- src/act4e_solutions/sets_properties.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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): -- cgit v1.2.1